/* GanaRuta — mobile-first */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --danger: #d03b3b;
  --good: #006300;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --danger: #e66767;
    --good: #0ca30c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.hidden { display: none !important; }

/* ---------- auth ---------- */
.auth-box {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 16px;
  text-align: center;
}
.auth-brand { font-size: 26px; font-weight: 700; }
.auth-tag { color: var(--ink-2); font-size: 14px; margin: 6px 0 20px; }
.auth-box .card { text-align: left; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--grid); }
.auth-tab {
  flex: 1; background: none; border: none; font: inherit; font-weight: 600;
  color: var(--muted); padding: 10px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-box .primary { width: 100%; }
.lang-btn { margin-top: 18px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* ---------- shell ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px;
  max-width: 640px; margin: 0 auto;
}
.brand { font-weight: 700; font-size: 17px; }
.trial-banner {
  max-width: 640px; margin: 6px auto 0; padding: 8px 16px;
  font-size: 13px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  text-align: center;
}
main {
  max-width: 640px; margin: 0 auto;
  padding: 0 12px calc(84px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.tabview { display: flex; flex-direction: column; gap: 12px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--grid);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  background: none; border: none; font: inherit; font-size: 11px;
  color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 8px; border-radius: 10px; min-width: 56px;
}
.tab span:first-child { font-size: 20px; }
.tab.active { color: var(--accent); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-head h3 { margin: 0; }

.month-nav { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 0; }
.month-nav h2 { margin: 0; font-size: 17px; }

.hero { text-align: center; }
.hero-label { color: var(--ink-2); font-size: 13px; }
.hero-value { font-size: 40px; font-weight: 700; letter-spacing: -0.5px; margin: 2px 0; }
.hero-value.negative { color: var(--danger); }
.hero-sub { color: var(--muted); font-size: 13px; }

.split { display: flex; gap: 12px; }
.split .mini { flex: 1; text-align: center; padding: 12px; }
.mini-label { font-size: 12px; color: var(--ink-2); }
.mini-value { font-size: 22px; font-weight: 700; }
.mini-value.good { color: var(--good); }
.mini-sub { font-size: 12px; color: var(--muted); }

.invest-bar {
  height: 14px; border-radius: 999px; background: var(--grid);
  overflow: hidden; margin: 4px 0 8px;
}
.invest-fill {
  height: 100%; background: var(--accent); border-radius: 999px 0 0 999px;
  min-width: 3px; transition: width 0.4s ease;
}
.invest-text { font-size: 14px; color: var(--ink-2); text-align: center; }

.best-list { display: flex; flex-direction: column; gap: 8px; }
.best-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.best-row .k { color: var(--ink-2); }
.best-row .v { font-weight: 600; text-align: right; }

/* ---------- forms ---------- */
.field { margin-bottom: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }
label, .chip-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--grid); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--grid); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer;
}
.chip[aria-checked="true"], .chip.active {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 600;
}

.form-actions { display: flex; gap: 8px; margin-top: 4px; }
button.primary {
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 10px; padding: 12px 18px;
  font: inherit; font-weight: 600; cursor: pointer; flex: 1;
}
button.ghost, .btn-link {
  background: transparent; color: var(--accent);
  border: 1px solid var(--grid); border-radius: 10px;
  padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.form-error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.fuel-fields {
  border: 1px dashed var(--grid);
  border-radius: 10px;
  padding: 12px 12px 8px;
  margin-bottom: 12px;
}
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin: 2px 0 4px; }
.check-row input { width: auto; }
.photo-row { display: flex; align-items: center; gap: 8px; }
.photo-state { font-size: 13px; color: var(--ink-2); }
.photo-state a { color: var(--accent); }

/* ---------- bars ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 74px; gap: 8px; align-items: center; }
.bar-name { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-left: 2px solid var(--grid); }
.bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-value { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.chart-note { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }

/* ---------- lists ---------- */
.day-group { margin-bottom: 4px; }
.day-head {
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 0 4px; border-bottom: 1px solid var(--grid);
}
.exp-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.exp-main { flex: 1; min-width: 0; }
.exp-cat { font-weight: 600; font-size: 15px; }
.exp-meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.exp-amount .rate { display: block; font-weight: 400; font-size: 12px; color: var(--muted); text-align: right; }
.icon-btn {
  background: transparent; border: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 6px; border-radius: 8px;
}
.icon-btn:hover { background: var(--grid); color: var(--ink); }

/* ---------- guide ---------- */
.guide-sec { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.guide-sec:last-child { border-bottom: none; }
.guide-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.guide-sec h4 { margin: 0 0 6px; font-size: 15px; }
.guide-sec p { margin: 0; font-size: 14px; color: var(--ink-2); white-space: pre-line; }

/* ---------- paywall ---------- */
.paywall-text { font-size: 14px; color: var(--ink-2); }
.pay-methods { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
.pay-chip {
  border: 1px solid var(--grid); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; color: var(--ink-2);
}

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; z-index: 50; overflow-y: auto;
}
.modal-box { width: 100%; max-width: 480px; }
.settings-user { margin-bottom: 14px; }
.set-name { font-weight: 700; }
.set-email { color: var(--ink-2); font-size: 14px; }
.set-status { font-size: 13px; color: var(--muted); margin-top: 4px; }
.sep { border: none; border-top: 1px solid var(--grid); margin: 16px 0; }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.admin-user .au-main { min-width: 0; }
.admin-user .au-email { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.admin-user select { width: auto; padding: 6px 8px; font-size: 13px; }

@media (max-width: 420px) {
  .bar-row { grid-template-columns: 96px 1fr 66px; }
  .hero-value { font-size: 34px; }
}
