/* ------------------------------------------------------------ tokens */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --text: #121521;
  --text-2: #4a5160;
  --muted: #6c7383;
  --border: #e3e6eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --on-primary: #ffffff;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --warning: #b54708;
  --warning-soft: #fef3e2;
  --success: #067647;
  --success-soft: #e6f6ee;
  --info: #175cd3;
  --info-soft: #e9f1fe;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06);
  --shadow: 0 1px 3px rgb(16 24 40 / 0.06), 0 4px 12px rgb(16 24 40 / 0.05);
  --shadow-lg: 0 12px 40px rgb(16 24 40 / 0.18);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-w: 232px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --surface: #161922;
    --surface-2: #1d212c;
    --surface-3: #272c39;
    --text: #e8eaf0;
    --text-2: #b7bdcb;
    --muted: #8a92a3;
    --border: #262b37;
    --primary: #8b8cf8;
    --primary-hover: #a5a6fb;
    --primary-soft: #23244a;
    --on-primary: #0d0f14;
    --danger: #f97066;
    --danger-soft: #3a1714;
    --warning: #fdb022;
    --warning-soft: #36260a;
    --success: #47cd89;
    --success-soft: #0f2c1e;
    --info: #84adff;
    --info-soft: #14243f;
    --shadow-sm: none;
    --shadow: 0 0 0 1px var(--border);
    --shadow-lg: 0 16px 48px rgb(0 0 0 / 0.55);
  }
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 2rem; text-align: center; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }

/* ------------------------------------------------------------ boot / spinner */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 64px 0; }

/* ------------------------------------------------------------ auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 360px; padding: 32px 28px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  display: grid; gap: 16px;
}
.auth-card h1 { text-align: center; font-size: 22px; }
.auth-card > .muted { text-align: center; margin-top: -8px; }
.auth-logo { display: flex; justify-content: center; }
.auth-logo img { border-radius: 14px; }

/* ------------------------------------------------------------ layout */
.shell { min-height: 100dvh; }
.main { min-width: 0; }
.view { padding: 8px 16px calc(var(--tabbar-h) + var(--safe-b) + 88px); max-width: 1040px; margin: 0 auto; outline: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-start:empty + h1 { grid-column: 1 / 3; padding-left: 4px; }
.topbar-start:empty { display: none; }
.topbar-actions { display: flex; gap: 8px; }

.nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
}
.nav-brand { display: none; }
.nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none !important;
}
.nav-link .icon { width: 23px; height: 23px; }
.nav-link.active { color: var(--primary); }

.fab {
  position: fixed; z-index: 25; right: 18px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; box-shadow: 0 6px 20px rgb(79 70 229 / 0.35); cursor: pointer;
}
.fab .icon { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: scale(0.96); }

@media (min-width: 860px) {
  .nav {
    top: 0; right: auto; bottom: 0; width: var(--nav-w); height: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 18px 12px;
    border-top: 0; border-right: 1px solid var(--border); background: var(--surface);
  }
  .nav-brand {
    display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px;
    font-weight: 750; font-size: 18px; color: var(--text); text-decoration: none !important;
  }
  .nav-brand img { border-radius: 8px; }
  .nav-link {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 550; color: var(--text-2);
  }
  .nav-link .icon { width: 20px; height: 20px; }
  .nav-link:hover { background: var(--surface-2); }
  .nav-link.active { background: var(--primary-soft); color: var(--primary); }
  .main { margin-left: var(--nav-w); }
  .topbar { padding: 22px 32px 14px; grid-template-columns: 44px 1fr auto; }
  .topbar h1 { font-size: 26px; }
  .view { padding: 4px 32px 48px; }
  .fab { display: none; }
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; white-space: nowrap; cursor: pointer;
  text-decoration: none !important; transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(0.95); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted); border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn-primary.busy::after { border-color: var(--on-primary); border-top-color: transparent; }

/* ------------------------------------------------------------ cards / stats */
.stack { display: grid; gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; }
.card-head h2 { font-size: 15.5px; font-weight: 700; }
.card-head .count { color: var(--muted); font-weight: 600; margin-left: 6px; }
.card-body { padding: 14px 18px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.danger { background: var(--danger-soft); box-shadow: none; }
.stat.danger .stat-value, .stat.danger .stat-label { color: var(--danger); }
@media (min-width: 720px) { .stat-value { font-size: 26px; } }

/* ------------------------------------------------------------ lists */
.list { list-style: none; margin: 0; padding: 4px 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; min-height: 64px;
  color: inherit; text-decoration: none !important; position: relative;
}
.list > li + li .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 1px solid var(--border); }
a.row:hover, button.row:hover { background: var(--surface-2); }
button.row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 620; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; align-items: center; gap: 12px; flex: none; }
.row-amount { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.row-amount .small { display: block; font-weight: 500; color: var(--muted); }
.row-chevron { color: var(--muted); }
.row.projected .row-title, .row.projected .row-amount { color: var(--text-2); font-weight: 550; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--surface-3); }
.dot.overdue { background: var(--danger); }
.dot.due_today, .dot.due_soon { background: var(--warning); }
.dot.upcoming { background: var(--info); }
.dot.paid { background: var(--success); }

.date-chip {
  flex: none; width: 46px; height: 48px; border-radius: 11px; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.date-chip .m { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.date-chip .d { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.date-chip.overdue { background: var(--danger-soft); }
.date-chip.overdue .m, .date-chip.overdue .d { color: var(--danger); }
.date-chip.due_today, .date-chip.due_soon { background: var(--warning-soft); }
.date-chip.due_today .m, .date-chip.due_today .d, .date-chip.due_soon .m, .date-chip.due_soon .d { color: var(--warning); }

.group-head {
  display: flex; justify-content: space-between; padding: 14px 18px 4px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}

/* ------------------------------------------------------------ badges / pills */
.badge {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-2);
}
.badge .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.badge.autopay { background: var(--success-soft); color: var(--success); }
.badge.archived { background: var(--surface-3); }
.status-text.overdue { color: var(--danger); font-weight: 600; }
.status-text.due_today, .status-text.due_soon { color: var(--warning); font-weight: 600; }
.status-text.paid { color: var(--success); font-weight: 600; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650;
  padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2);
}
.pill.overdue { background: var(--danger-soft); color: var(--danger); }
.pill.due_today, .pill.due_soon { background: var(--warning-soft); color: var(--warning); }
.pill.upcoming { background: var(--info-soft); color: var(--info); }
.pill.paid { background: var(--success-soft); color: var(--success); }

/* ------------------------------------------------------------ empty state */
.empty { padding: 28px 18px 30px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.empty > .icon { width: 36px; height: 36px; color: var(--success); stroke-width: 1.6; margin-bottom: 4px; }
.empty.neutral > .icon { color: var(--muted); }
.empty h3 { font-size: 15.5px; }
.empty p { color: var(--muted); max-width: 320px; }
.empty .btn { margin-top: 10px; }

/* ------------------------------------------------------------ toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 220px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search input[type="search"] { padding-left: 38px; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.summary-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 10px; color: var(--muted); font-size: 14px; }
.summary-line strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ forms */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .form-row.collapse { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--danger); font-weight: 550; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="url"],
input[type="email"], input[type="number"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none; appearance: none;
}
input[type="date"] { min-width: 0; display: block; }
input::-webkit-date-and-time-value { text-align: left; }
@media (min-width: 860px) {
  input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="url"],
  input[type="email"], input[type="number"], select, textarea { font-size: 15px; }
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-prefix input { padding-left: calc(12px + var(--prefix-w, 1ch) + 6px); }
.form-error {
  background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 550;
}
.form-note { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--text-2); }
.status-note { display: grid; gap: 10px; }
.status-note.small { font-size: 13.5px; }
.note-warn { background: var(--warning-soft); color: var(--text); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
details.advanced > summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 14px; width: fit-content; }
details.advanced .token-secret { background: var(--surface); }
.note-warn .token-secret { background: var(--surface); }

/* toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch .label-text { display: grid; }
.switch .label-text strong { font-weight: 600; font-size: 14.5px; }
.switch .label-text span { font-size: 12.5px; color: var(--muted); }
.switch input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer;
  transition: background 0.15s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.15s;
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ------------------------------------------------------------ dialog / sheet */
dialog {
  border: 0; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: min(88dvh, 820px);
  border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; animation: pop 0.16s ease-out; }
dialog::backdrop { background: rgb(10 12 20 / 0.45); animation: fade 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }
.dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 14px 8px 20px; }
.dialog-head h2 { font-size: 18px; font-weight: 700; }
.dialog-body { padding: 8px 20px 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.dialog-foot {
  display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px calc(14px + var(--safe-b));
  border-top: 1px solid var(--border); background: var(--surface);
}
.dialog-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 94dvh;
  }
  dialog[open] { animation: sheet 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); }
  @keyframes sheet { from { transform: translateY(100%); } }
  .dialog-head::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 4px; background: var(--surface-3);
  }
  .dialog-foot .btn { flex: 1; }
  .dialog-foot .spacer { display: none; }
}

/* ------------------------------------------------------------ bill detail */
.hero { padding: 20px 18px; display: grid; gap: 14px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-amount { font-size: 34px; font-weight: 780; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-amount .approx { color: var(--muted); font-weight: 600; margin-right: 2px; }
.hero-due { color: var(--text-2); margin-top: 4px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { flex: 1 1 auto; }
@media (min-width: 560px) { .hero-actions .btn { flex: 0 0 auto; } }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; padding: 16px 18px 18px; }
.details dt { color: var(--muted); font-size: 14px; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.details dd.notes { white-space: pre-wrap; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.mini-stats > div { padding: 12px 18px; }
.mini-stats > div + div { border-left: 1px solid var(--border); }
.mini-stats .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-stats .l { font-size: 12.5px; color: var(--muted); }

.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 18px; }

.two-col { display: grid; gap: 18px; }
@media (min-width: 980px) { .two-col { grid-template-columns: 1.15fr 1fr; align-items: start; } }

/* ------------------------------------------------------------ settings */
.settings-section .card-body { display: grid; gap: 16px; }
.token-secret {
  display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 10px 12px;
  font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere;
}
.token-secret code { flex: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.code {
  margin: 0; padding: 12px; background: var(--surface-2); border-radius: 10px; font-family: var(--mono); font-size: 12.5px;
  overflow-x: auto; white-space: pre;
}

/* ------------------------------------------------------------ toasts */
.toasts {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 86px); /* clears the + button */
  display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none;
}
@media (min-width: 860px) { .toasts { bottom: 24px; left: calc(50% + var(--nav-w) / 2); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: #1c1f2a; color: #f1f2f6; border-radius: 12px; padding: 12px 14px 12px 16px;
  box-shadow: var(--shadow-lg); font-size: 14.5px; animation: pop 0.18s ease-out;
}
@media (prefers-color-scheme: dark) { .toast { background: #2a2f3d; } }
.toast .msg { flex: 1; }
.toast.error { background: var(--danger); color: #fff; }
.toast button {
  border: 0; background: transparent; color: #a5b4fc; font-weight: 700; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.toast.error button { color: #fff; text-decoration: underline; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }

/* ------------------------------------------------------------ misc */
@media (max-width: 859px) { .desktop-only { display: none !important; } }
.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }
.foot-note { color: var(--muted); font-size: 13.5px; text-align: center; padding: 6px 0 0; }
.error-state { padding: 40px 18px; text-align: center; display: grid; gap: 12px; justify-items: center; }
