/* My Own Ledger 3.0 - design system
   One stylesheet, no build step, light and dark. */

:root {
  color-scheme: light;

  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef0f4;
  --bg-hover: #f1f3f7;

  --text: #10151c;
  --text-soft: #58627a;
  --text-faint: #8a93a6;
  --text-invert: #ffffff;

  --line: #e2e6ee;
  --line-strong: #cdd4e0;

  --brand: #0e7c6b;
  --brand-soft: #e6f4f1;
  --brand-strong: #0a5f52;
  --brand-text: #0a5f52;

  --good: #12805c;
  --good-soft: #e3f5ee;
  --bad: #c3324a;
  --bad-soft: #fdeaee;
  --warn: #a86209;
  --warn-soft: #fdf1e0;
  --info: #2b5fd0;
  --info-soft: #e8effc;

  --c1: #0e7c6b; --c2: #2b5fd0; --c3: #7c4dc4; --c4: #b8791b;
  --c5: #c3324a; --c6: #12805c; --c7: #4b5a72; --c8: #a3439b;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 21, 28, .06), 0 1px 3px rgba(16, 21, 28, .04);
  --shadow: 0 2px 6px rgba(16, 21, 28, .06), 0 8px 24px rgba(16, 21, 28, .06);
  --shadow-lg: 0 12px 40px rgba(16, 21, 28, .14);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 244px;
  --header-h: 60px;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d1117;
  --bg-elevated: #161b23;
  --bg-sunken: #10151c;
  --bg-hover: #1d242e;

  --text: #e9edf3;
  --text-soft: #a3adbe;
  --text-faint: #737e91;
  --text-invert: #0d1117;

  --line: #252c37;
  --line-strong: #333c4a;

  --brand: #2fb39c;
  --brand-soft: #10312c;
  --brand-strong: #45c9b2;
  --brand-text: #45c9b2;

  --good: #35c48d;
  --good-soft: #0f2d24;
  --bad: #f0728c;
  --bad-soft: #33161e;
  --warn: #e0a44a;
  --warn-soft: #33260f;
  --info: #6f9bf5;
  --info-soft: #131f37;

  --c1: #2fb39c; --c2: #6f9bf5; --c3: #a98ae8; --c4: #e0a44a;
  --c5: #f0728c; --c6: #35c48d; --c7: #8e9bb0; --c8: #d47cc9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
}

/* Fallback for people with JavaScript switched off: follow the device
   setting unless an explicit light choice has been made. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0d1117;
    --bg-elevated: #161b23;
    --bg-sunken: #10151c;
    --bg-hover: #1d242e;

    --text: #e9edf3;
    --text-soft: #a3adbe;
    --text-faint: #737e91;
    --text-invert: #0d1117;

    --line: #252c37;
    --line-strong: #333c4a;

    --brand: #2fb39c;
    --brand-soft: #10312c;
    --brand-strong: #45c9b2;
    --brand-text: #45c9b2;

    --good: #35c48d;
    --good-soft: #0f2d24;
    --bad: #f0728c;
    --bad-soft: #33161e;
    --warn: #e0a44a;
    --warn-soft: #33260f;
    --info: #6f9bf5;
    --info-soft: #131f37;

    --c1: #2fb39c; --c2: #6f9bf5; --c3: #a98ae8; --c4: #e0a44a;
    --c5: #f0728c; --c6: #35c48d; --c7: #8e9bb0; --c8: #d47cc9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .92rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: .82rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Layout ------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  font-weight: 700; font-size: 1.02rem; letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), var(--c3));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .84rem;
  flex: 0 0 auto;
}

.nav { padding: 4px 10px 16px; flex: 1; }
.nav-group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-faint); font-weight: 700;
  padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-soft); font-size: .895rem; font-weight: 500;
  margin-bottom: 1px;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 620; }
.nav a .ic { flex: 0 0 auto; opacity: .85; }
.nav a.active .ic { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: .66rem; font-weight: 700;
  background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 99px;
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 1.06rem; margin: 0; font-weight: 640; }
.topbar-spacer { flex: 1; }

.content { padding: 22px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; }

.page-head {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { color: var(--text-soft); margin: 2px 0 0; font-size: .9rem; }

/* Cards ---------------------------------------------------------------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: .98rem; }
.card-head .grow { flex: 1; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-sunken); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
/* Grid and flex children default to min-width:auto, which lets long content
   push a column wider than the screen. This keeps everything inside. */
.grid > *, .flex-col > * { min-width: 0; }
.card { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Cards size to their own content rather than stretching to match the
   tallest one in the row, which otherwise leaves large empty panels. */
.grid-sidebar { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }

/* Stat tiles ----------------------------------------------------------- */

.stat {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 680; margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
}
.stat-value {
  font-size: 1.55rem; font-weight: 680; letter-spacing: -.024em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-meta { font-size: .8rem; color: var(--text-soft); margin-top: 4px; }
.stat.accent-good .stat-value { color: var(--good); }
.stat.accent-bad .stat-value { color: var(--bad); }
.stat.accent-brand .stat-value { color: var(--brand-text); }

.delta { font-size: .78rem; font-weight: 620; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-faint); }

/* Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated); color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 580;
  cursor: pointer; text-decoration: none;
  transition: background .13s ease, border-color .13s ease, transform .06s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
html[data-theme="dark"] .btn-primary { color: #06231e; }

.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 7px; }
.btn-lg { padding: 11px 22px; font-size: .95rem; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* Forms ---------------------------------------------------------------- */

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }

label, .label {
  display: block; font-size: .82rem; font-weight: 620;
  margin-bottom: 5px; color: var(--text);
}
.hint { font-size: .78rem; color: var(--text-faint); margin-top: 4px; line-height: 1.45; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--bg-elevated); color: var(--text);
  font: inherit; font-size: .9rem;
  transition: border-color .13s ease, box-shadow .13s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a93a6' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
input[type="date"] { min-height: 38px; }

.input-money { position: relative; }
.input-money .cur {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-size: .9rem; pointer-events: none; font-weight: 600;
}
.input-money input { padding-left: 34px; font-variant-numeric: tabular-nums; }

.check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: .875rem; font-weight: 500; cursor: pointer; margin-bottom: 0;
}
.check input { width: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--brand); cursor: pointer; }
.check span { flex: 1; }
.check .hint { margin-top: 2px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
legend { font-size: .8rem; font-weight: 700; padding: 0 7px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .05em; }

.segmented {
  display: inline-flex; background: var(--bg-sunken); padding: 3px;
  border-radius: 10px; border: 1px solid var(--line); gap: 2px;
}
.segmented label {
  margin: 0; padding: 6px 14px; border-radius: 7px; cursor: pointer;
  font-size: .85rem; font-weight: 580; color: var(--text-soft);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span,
.segmented label:has(input:checked) { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label:has(input:checked) { color: var(--brand-text); }

/* Color swatches */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  display: block; width: 30px; height: 30px; border-radius: 8px;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatch input:checked + span { border-color: var(--text); }
.sw-teal { background: #0e7c6b; } .sw-blue { background: #2b5fd0; }
.sw-violet { background: #7c4dc4; } .sw-amber { background: #b8791b; }
.sw-rose { background: #c3324a; } .sw-emerald { background: #12805c; }
.sw-slate { background: #4b5a72; }

/* Tables ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data { width: 100%; border-collapse: collapse; font-size: .885rem; }
table.data th {
  text-align: left; padding: 9px 14px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .055em;
  color: var(--text-faint); font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--bg-elevated);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .shrink { width: 1%; white-space: nowrap; }

.money-in { color: var(--good); font-weight: 620; }
.money-out { color: var(--bad); font-weight: 620; }
.money-neutral { color: var(--text-soft); font-weight: 580; }
.num { font-variant-numeric: tabular-nums; }

/* Pills and badges ------------------------------------------------------ */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: .74rem; font-weight: 640; white-space: nowrap;
  background: var(--bg-sunken); color: var(--text-soft);
}
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-brand { background: var(--brand-soft); color: var(--brand-text); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 750; color: #fff;
  background: var(--c7);
}
.avatar.teal { background: var(--c1); } .avatar.blue { background: var(--c2); }
.avatar.violet { background: var(--c3); } .avatar.amber { background: var(--c4); }
.avatar.rose { background: var(--c5); } .avatar.emerald { background: var(--c6); }
.avatar.slate { background: var(--c7); }
.avatar-sm { width: 28px; height: 28px; border-radius: 8px; font-size: .66rem; }

/* Progress -------------------------------------------------------------- */

.bar { height: 8px; background: var(--bg-sunken); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .4s ease; }
.bar.good > i { background: var(--good); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.bar-lg { height: 11px; }

.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .track { stroke: var(--bg-sunken); }
.ring .fill { stroke: var(--brand); transition: stroke-dasharray .5s ease; }

/* Flash messages --------------------------------------------------------- */

.flashes { position: fixed; top: 14px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: min(420px, calc(100vw - 28px)); }
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 11px;
  background: var(--bg-elevated); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); font-size: .875rem;
  animation: flashIn .24s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } }
.flash-success { border-left: 3px solid var(--good); }
.flash-error { border-left: 3px solid var(--bad); }
.flash-info { border-left: 3px solid var(--info); }
.flash .close { margin-left: auto; background: none; border: 0; color: var(--text-faint); cursor: pointer; padding: 0 2px; font-size: 1.1rem; line-height: 1; }

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--info-soft); color: var(--text);
  font-size: .875rem; margin-bottom: 18px; line-height: 1.55;
}
.notice-warn { background: var(--warn-soft); }
.notice-bad { background: var(--bad-soft); }
.notice-good { background: var(--good-soft); }
.notice .ic { flex: 0 0 auto; margin-top: 1px; }
.notice strong { display: block; margin-bottom: 2px; }

/* Empty states ----------------------------------------------------------- */

.empty { text-align: center; padding: 46px 20px; }
.empty .ic { color: var(--text-faint); margin-bottom: 12px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-soft); max-width: 380px; margin: 0 auto 18px; font-size: .9rem; }

/* Lists ------------------------------------------------------------------ */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--line);
  color: inherit;
}
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--bg-hover); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t1 { font-weight: 570; font-size: .9rem; }
.list-item .t2 { font-size: .79rem; color: var(--text-faint); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Charts ------------------------------------------------------------------ */

.chart { width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .8rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); }
.chart-legend b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 620; }

/* Auth pages --------------------------------------------------------------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 18px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card { padding: 26px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; font-weight: 720; font-size: 1.1rem; }
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head p { color: var(--text-soft); font-size: .88rem; margin: 4px 0 0; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .875rem; color: var(--text-soft); }

.code-input {
  font-family: var(--mono); font-size: 1.5rem; letter-spacing: .35em;
  text-align: center; padding: 12px; font-weight: 600;
}

.recovery-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  font-family: var(--mono); font-size: .86rem;
  background: var(--bg-sunken); padding: 14px; border-radius: var(--radius);
  margin: 14px 0;
}
.recovery-grid span { padding: 3px 6px; }

.qr-box {
  display: inline-block; padding: 12px; background: #fff;
  border-radius: var(--radius); border: 1px solid var(--line);
}
.secret-text {
  font-family: var(--mono); font-size: .84rem; word-break: break-all;
  background: var(--bg-sunken); padding: 9px 11px; border-radius: 8px;
  display: inline-block; letter-spacing: .04em;
}

/* Public pages -------------------------------------------------------------- */

.public-nav {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; max-width: 1120px; margin: 0 auto;
}
.hero { text-align: center; padding: 60px 20px 40px; max-width: 720px; margin: 0 auto; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); letter-spacing: -.03em; margin-bottom: 14px; }
.hero p { font-size: 1.06rem; color: var(--text-soft); max-width: 560px; margin: 0 auto 26px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; max-width: 1000px; margin: 0 auto; padding: 20px; }
.feature { padding: 20px; }
.feature .ic { color: var(--brand); margin-bottom: 10px; }
.feature h3 { font-size: .98rem; margin-bottom: 5px; }
.feature p { font-size: .86rem; color: var(--text-soft); margin: 0; }

.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; max-width: 760px; margin: 0 auto; }
.price-card { padding: 24px; position: relative; }
.price-card.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.price-tag { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; }
.price-tag small { font-size: .88rem; font-weight: 500; color: var(--text-soft); }
.perks { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 9px; }
.perks li { display: flex; gap: 9px; align-items: flex-start; font-size: .88rem; }
.perks .ic { color: var(--good); flex: 0 0 auto; margin-top: 2px; }

/* Utilities -------------------------------------------------------------------- */

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.bold { font-weight: 650; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 5px; } .gap-2 { gap: 9px; } .gap-3 { gap: 14px; } .gap-4 { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 26px; }

.hide { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Mobile bottom bar ------------------------------------------------------------- */

.mobile-bar { display: none; }
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* Responsive --------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-sidebar { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  :root { --header-h: 56px; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 120;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(6, 10, 16, .5);
  }
  .menu-toggle { display: inline-flex; }

  .content { padding: 16px 14px 84px; }

  /* Compact stat tiles still fit two to a row on a phone, which keeps the
     page short enough to scan without endless scrolling. */
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .recovery-grid { grid-template-columns: 1fr; }

  .stat-value { font-size: 1.34rem; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: .98rem; }

  .mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-elevated); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .mobile-bar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: .64rem; font-weight: 600; color: var(--text-faint);
    padding: 5px 8px; border-radius: 9px; flex: 1; text-align: center;
  }
  .mobile-bar a.active { color: var(--brand-text); }
  .mobile-bar a:hover { text-decoration: none; }
  .mobile-bar .fab {
    background: var(--brand); color: #fff; border-radius: 50%;
    width: 44px; height: 44px; margin-top: -14px;
    display: grid; place-items: center; flex: 0 0 auto;
    box-shadow: var(--shadow);
  }

  table.data th, table.data td { padding: 9px 10px; }
  .card-pad, .card-body, .card-head { padding: 14px; }
  .btn { padding: 9px 14px; }
}

@media (max-width: 420px) {
  .hide-xs { display: none !important; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 1.22rem; }
}

@media print {
  .sidebar, .topbar, .mobile-bar, .flashes, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Second currency ---------------------------------------------------------
   The smaller figure printed under an amount when someone has chosen to see
   a second currency. Deliberately quiet, so the real amount stays the one
   the eye lands on. */
.fx-alt {
  display: block;
  font-size: .73rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-top: 1px;
}
.fx-alt + .fx-alt { margin-top: 0; }
.stat .fx-alt:first-of-type { margin-top: 3px; }
td.num .fx-alt { text-align: right; }
.num .fx-alt { text-align: right; }
@media print { .fx-alt { color: #555; } }
