:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --danger: #b00020;
  --highlight: #eef6ff;
  --text: #111827;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.muted { color: var(--muted); margin-left: 8px; }
.error { color: var(--danger); }

button, input, select {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px; /* important mobile */
  background: #fff;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: #111827;
  color: white;
}

button.secondary {
  width: auto;
  padding: 10px 12px;
  font-size: 14px;
  background: white;
  color: #111827;
}

.card {
  background: var(--card);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

main.layout {
  display: grid;
  grid-template-columns: 1fr; /* mobile-first */
  gap: 12px;
  padding: 12px;
}

.loginCard {
  max-width: 420px;
  margin: 60px auto;
}

.recoGrid {
  display: grid;
  grid-template-columns: 1fr; /* mobile-first */
  gap: 10px;
  margin-top: 10px;
}

.recoBox {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--card);
}

.recoLabel {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.recoValue {
  font-size: 30px;
  font-weight: 800;
}

.subttl {
  margin-top: 16px;
  margin-bottom: 10px;
  font-size: 14px;
}

/* Cards history (mobile-friendly) */
.historyCards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

.hCard {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.hCard.latest {
  background: var(--highlight);
  border-color: #cfe3ff;
}

.hRow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.hWhen {
  font-size: 12px;
  color: var(--muted);
}

.hPrice {
  font-size: 22px;
  font-weight: 800;
}

.hMinMax {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hKpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.hKpi .k {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.hKpi .v {
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 480px) {
  #userEmail { display: none; }
}

/* desktop enhancement */
@media (min-width: 900px) {
  main.layout {
    grid-template-columns: 320px 1fr;
    gap: 16px;
    padding: 16px;
  }

  .recoGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .historyCards {
    grid-template-columns: repeat(2, 1fr);
  }
}
