/* browsertodo dashboard. Same ink, paper and margin-red as the marketing site,
   set as a calm, dense app. The one loud element is the legal pad: the sign-in
   sheet and the credit card on Overview. The sidebar ends in the pad's double red
   margin rule. */

:root {
  --bg: #e9edf2;
  --surface: #fdfdfb;
  --surface-2: #f3f5f8;
  --ink: #1b2a4a;
  --ink-2: #4a5873;
  --ink-3: #5c6882;
  --line: #d7dee8;
  --line-strong: #b5c3d6;
  --margin: #d8443c;
  --paper: #fbefa4;
  --paper-rule: rgba(92, 131, 184, 0.28);
  --paper-ink: #1b2a4a;
  --paper-binding: #b83a33;
  --highlight: #fbefa4;
  --highlight-ink: #1b2a4a;
  --focus: #d8443c;

  --series-1: #2f5c9e;
  --series-2: #b67a0c;
  --track: #dde5f0;

  --accent: #2f5c9e;   --accent-soft: #e2eaf6;
  --ok: #1c7a45;       --ok-soft: #e1f2e7;
  --warn: #8a5600;     --warn-soft: #faefcf;
  --bad: #b3261e;      --bad-soft: #fbe6e3;
  --muted-soft: #eaeef3;

  --shadow: 0 1px 0 rgba(27, 42, 74, 0.05), 0 8px 24px -16px rgba(27, 42, 74, 0.35);
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111827;
    --surface: #182238;
    --surface-2: #1e2a43;
    --ink: #e8ecf4;
    --ink-2: #b6c0d3;
    --ink-3: #95a2ba;
    --line: #29354f;
    --line-strong: #3b4a69;
    --margin: #e8675f;
    --paper: #2c2a1c;
    --paper-rule: rgba(156, 183, 216, 0.13);
    --paper-ink: #f3ecc4;
    --highlight: rgba(251, 239, 164, 0.14);
    --highlight-ink: #f7eaa6;
    --focus: #f08a82;
    --series-1: #5b8fe0;
    --series-2: #b3831d;
    --track: #26324d;
    --accent: #8db4f0;   --accent-soft: #1f3050;
    --ok: #6fd39a;       --ok-soft: #173427;
    --warn: #f0c35a;     --warn-soft: #3a2f13;
    --bad: #f28b82;      --bad-soft: #3d1f1f;
    --muted-soft: #222d45;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 10px 28px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111827;
  --surface: #182238;
  --surface-2: #1e2a43;
  --ink: #e8ecf4;
  --ink-2: #b6c0d3;
  --ink-3: #95a2ba;
  --line: #29354f;
  --line-strong: #3b4a69;
  --margin: #e8675f;
  --paper: #2c2a1c;
  --paper-rule: rgba(156, 183, 216, 0.13);
  --paper-ink: #f3ecc4;
  --highlight: rgba(251, 239, 164, 0.14);
  --highlight-ink: #f7eaa6;
  --focus: #f08a82;
  --series-1: #5b8fe0;
  --series-2: #b3831d;
  --track: #26324d;
  --accent: #8db4f0;   --accent-soft: #1f3050;
  --ok: #6fd39a;       --ok-soft: #173427;
  --warn: #f0c35a;     --warn-soft: #3a2f13;
  --bad: #f28b82;      --bad-soft: #3d1f1f;
  --muted-soft: #222d45;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 10px 28px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.fine { font-size: 13px; color: var(--ink-3); max-width: 44rem; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus, .page-title:focus { outline: none; }

.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--ink); color: var(--surface); padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 8px; }

/* ---------------------------------------------------------------- shell */

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 18px 16px 16px;
  /* the legal pad's double red margin rule */
  box-shadow: inset -1px 0 0 var(--margin), inset -4px 0 0 var(--bg), inset -5px 0 0 var(--margin);
}
.side-top { display: flex; flex-direction: column; gap: 14px; }
.side-top-end { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; padding: 0 8px; }
.side-plan { color: var(--ink-2); }
.side-credit { color: var(--ink); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.side-credit:hover { text-decoration: underline; }
.side-credit.is-empty { color: var(--bad); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  padding: 0 8px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-link[aria-current="page"] { background: var(--highlight); color: var(--highlight-ink); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.who-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.3; }
.who-text strong, .who-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { color: var(--ink-3); }
.side-foot .btn { align-self: flex-start; margin-left: -10px; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; background: var(--ink); color: var(--surface); font-weight: 700; font-size: 13px;
}
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

.content { padding: 32px 40px 64px; min-width: 0; }
.page { max-width: 68rem; display: flex; flex-direction: column; gap: 20px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.page-title { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; font-variation-settings: "opsz" 72; }
.page-lede { color: var(--ink-2); margin-top: 6px; max-width: 42rem; }
.page-actions { display: flex; gap: 8px; }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-top: 8px; }

.boot { min-height: 60vh; display: grid; place-items: center; padding: 24px; }
.boot .notice { max-width: 32rem; }

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.panel-title { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.usage-body, .todo-body { display: flex; flex-direction: column; gap: 20px; }
.panel-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.panel-danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

/* The legal-pad sheet: ruled paper, red margin, glued top edge. */
.pad-panel {
  --gap-color: var(--paper);
  position: relative;
  border: 0;
  color: var(--paper-ink);
  padding: 30px 22px 20px 44px;
  background:
    linear-gradient(to right, transparent 28px, var(--margin) 28px, var(--margin) 29px, transparent 29px, transparent 31px, var(--margin) 31px, var(--margin) 32px, transparent 32px),
    repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) 27px, var(--paper-rule) 27px, var(--paper-rule) 28px);
  background-color: var(--paper);
  background-position: 0 0, 0 18px;
  box-shadow: var(--shadow);
  border-radius: 4px 4px var(--radius) var(--radius);
}
.pad-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 10px;
  background: var(--paper-binding);
  border-radius: 4px 4px 0 0;
}
.pad-panel .panel-title, .pad-panel .fine { color: var(--paper-ink); }
.pad-panel .fine { opacity: 0.8; }
.pad-panel .muted { color: color-mix(in srgb, var(--paper-ink) 75%, transparent); }

.hero-figure { font-size: 52px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; font-variation-settings: "opsz" 96; }

.plan-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-name { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }

.facts { margin: 0; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------------------------------------------------------------- credit meter */

.credit { display: flex; flex-direction: column; gap: 10px; --gap-color: var(--surface); }
.pad-panel .credit { --gap-color: var(--paper); }
.panel .credit { max-width: 40rem; }
.meter { display: flex; height: 12px; border-radius: 6px; background: var(--track); overflow: hidden; }
.pad-panel .meter { background: color-mix(in srgb, var(--paper-ink) 12%, var(--paper)); }
.meter span { display: block; height: 100%; }
.meter-sub { background: var(--series-1); }
.meter-top { background: var(--series-2); }
.meter-sub + .meter-top { border-left: 2px solid var(--gap-color); }
.meter-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.meter-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.meter-legend .muted { font-size: 13px; text-align: right; }
.key { width: 12px; height: 12px; border-radius: 3px; }
.key-sub { background: var(--series-1); }
.key-top { background: var(--series-2); }

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

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); min-width: 0;
}
.panel .tile { background: var(--surface-2); border-color: transparent; }
.tile-label { font-size: 13px; color: var(--ink-2); }
.tile-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.tile-sub { font-size: 12.5px; color: var(--ink-3); }

.quick { list-style: none; margin: 0; padding: 0; display: grid; }
.quick li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quick li:last-child { border-bottom: 0; }
.quick a { font-weight: 600; color: var(--ink); text-decoration-color: var(--line-strong); }
.quick a:hover { text-decoration-color: var(--margin); }
.quick span { font-size: 13px; color: var(--ink-3); }

/* ---------------------------------------------------------------- buttons, fields */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 14px/1.2 var(--font);
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 88%, var(--surface)); border-color: transparent; }
.btn-primary:disabled { background: transparent; color: var(--ink-3); border-color: var(--line-strong); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #1a0c0c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #1a0c0c; } }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 88%, var(--ink)); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn-sm { font-size: 13px; padding: 5px 10px; min-height: 30px; border-radius: 7px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
input[type="file"] { font: inherit; font-size: 13px; color: var(--ink-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: 600 13px var(--font); color: var(--ink); background: var(--surface); cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 10px; margin-right: 10px;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--ink); }
::placeholder { color: var(--ink-3); opacity: 0.8; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.panel form.stack { max-width: 48rem; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label > span { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.field small { color: var(--ink-3); font-size: 12.5px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.counter { font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.form-error { color: var(--bad); font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.file-list { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); display: grid; gap: 2px; }
.file-list li { display: flex; gap: 10px; align-items: baseline; }

.choice-group { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-group legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.choice input { margin-top: 3px; }
.choice > span { display: flex; flex-direction: column; font-size: 14px; }
.choice .muted { font-size: 13px; }

.segmented { border: 0; margin: 0; padding: 3px; display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 9px; align-self: flex-start; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.toggle-row label { display: flex; flex-direction: column; }
.toggle-end { flex: none; }
.toggle-end .loading { padding: 0; }
.switch { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; flex: none; cursor: pointer; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform 0.15s; }
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- chips, badges, notices */

.chip {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
}
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-muted { background: var(--muted-soft); color: var(--ink-2); }
.chip[data-tip] { cursor: help; }
.chip[data-tip]:hover::after, .chip[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 6px);
  width: max-content;
  max-width: 260px;
  white-space: normal;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; background: var(--muted-soft); color: var(--ink-2); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.plan-line .badge { margin-left: 0; }

.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.notice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 18rem; }
.notice-text p { color: var(--ink-2); font-size: 14px; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice-warn { border-color: var(--warn); background: var(--warn-soft); }
.notice-bad { border-color: var(--bad); background: var(--bad-soft); }
.notice-ok { border-color: var(--ok); background: var(--ok-soft); }

.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 12px 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 0; }
.empty p { color: var(--ink-2); max-width: 36rem; }
/* The TODO list on a plan without it: one calm, centred way to a plan. */
.empty.locked { align-items: center; text-align: center; padding: 28px 0; }
.empty.locked strong { font-size: 1.1rem; }

/* ---------------------------------------------------------------- lists and tables */

.rows { list-style: none; margin: 0; padding: 0; }
p + .rows { margin-top: 10px; }
.panel > p.muted + .rows { margin-top: 4px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 2px; }
.row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-meta { font-size: 13px; color: var(--ink-3); }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.row.is-off .row-main strong { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--margin); }

.tasks .row { grid-template-columns: 96px minmax(0, 1fr) auto; }
.task-chip { padding-top: 1px; }
.task-text { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.reason { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.reason-bad { color: var(--bad); }
.reason-warn { color: var(--warn); }
.result-link { margin-left: 8px; font-weight: 600; }
.more { display: flex; justify-content: center; }
.quote { padding: 8px 12px; border-left: 3px solid var(--line-strong); color: var(--ink-2); overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data thead th { font-weight: 600; color: var(--ink-2); font-size: 13px; border-bottom-color: var(--line-strong); }
table.data tbody th { font-weight: 500; }
table.data tfoot th, table.data tfoot td { font-weight: 700; border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data .row-note { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }

.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { font-weight: 600; color: var(--ink-2); }
.filters select { width: auto; min-width: 12rem; }
.filters .btn { margin-left: auto; }

/* ---------------------------------------------------------------- charts */

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.chart { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chart-title { font-weight: 600; }
.chart-summary { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; }
.chart-frame { width: 100%; min-height: 190px; }
.chart-svg { display: block; overflow: visible; font-family: var(--font); }
.chart-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.chart-svg .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .peak { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-grid line.baseline { stroke: var(--line-strong); }
.chart-svg .bar { fill: var(--series-1); }
.chart-svg .bar.active { fill: color-mix(in srgb, var(--series-1) 72%, var(--surface)); }
.chart-svg .hit { fill: transparent; }
.chart-cross { stroke: var(--ink-3); stroke-width: 1; pointer-events: none; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  display: flex; flex-direction: column;
  padding: 6px 10px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: 12.5px; white-space: nowrap;
}
.chart-tip strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-tip span { color: var(--ink-2); }
.chart-table summary { cursor: pointer; font-size: 13px; color: var(--ink-2); width: max-content; }
.chart-table table { margin-top: 8px; }
.chart-table .table-scroll { max-height: 16rem; overflow-y: auto; }

/* ---------------------------------------------------------------- billing */

.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.plan-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.plan-card h3 { font-size: 16px; font-weight: 700; }
.plan-price { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.plan-price span { font-size: 14px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.plan-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.plan-points li { padding-left: 16px; position: relative; }
.plan-points li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 6px; height: 2px; background: var(--line-strong); }
.plan-action { margin-top: auto; padding-top: 4px; min-height: 38px; display: flex; align-items: center; }
.plan-action .btn { width: 100%; }
.plan-card.is-current { border: 2px solid var(--ink); padding: 17px; }
.current-mark { font-weight: 700; padding: 2px 10px; border-radius: 6px; background: var(--highlight); color: var(--highlight-ink); }
.topups { display: flex; gap: 10px; flex-wrap: wrap; }
.topups .btn { flex: 1 1 0; min-width: 6rem; max-width: 10rem; }

/* ---------------------------------------------------------------- keys */

.reveal { border-color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.reveal-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reveal-key {
  flex: 1 1 18rem; min-width: 0;
  padding: 9px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong);
  font-size: 14px; overflow-wrap: anywhere; user-select: all;
}
.snippet {
  margin: 0; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line);
  overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: var(--ink);
}

/* ---------------------------------------------------------------- account */

.profile { display: flex; gap: 16px; align-items: center; }
.profile-name { font-size: 18px; font-weight: 700; }

/* ---------------------------------------------------------------- dialogs, toasts */

.dialog {
  border: 0; padding: 0; border-radius: 12px;
  width: min(30rem, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(10, 18, 36, 0.55);
}
.dialog-wide { width: min(40rem, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(14, 22, 40, 0.5); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-text { color: var(--ink-2); display: flex; flex-direction: column; gap: 8px; }
.dialog-text ul { margin: 0; padding-left: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 0 22px; }
.dialog-head h2 { font-size: 19px; font-weight: 700; }
.dialog-wide > form { padding: 14px 22px 22px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(24rem, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 12px 12px 12px 16px; border-radius: 9px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow);
  border-left: 4px solid var(--ok);
}
.toast p { opacity: 0.85; font-size: 13.5px; }
.toast a { color: inherit; font-weight: 600; font-size: 13.5px; }
.toast-bad { border-left-color: var(--margin); }
.toast-info { border-left-color: var(--series-1); }
.toast-close { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: 0.7; padding: 0 4px; }

/* ---------------------------------------------------------------- sign-in */

.signin { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.signin-sheet {
  position: relative;
  width: min(30rem, 100%);
  display: flex; flex-direction: column; gap: 16px;
  padding: 44px 32px 30px 64px;
  color: var(--paper-ink);
  background:
    linear-gradient(to right, transparent 40px, var(--margin) 40px, var(--margin) 41px, transparent 41px, transparent 44px, var(--margin) 44px, var(--margin) 45px, transparent 45px),
    repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) 29px, var(--paper-rule) 29px, var(--paper-rule) 30px);
  background-color: var(--paper);
  background-position: 0 0, 0 14px;
  border-radius: 4px 4px 10px 10px;
  box-shadow: 0 1px 0 rgba(27, 42, 74, 0.08), 0 22px 48px -22px rgba(27, 42, 74, 0.5);
}
.signin-sheet::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 14px; background: var(--paper-binding); border-radius: 4px 4px 0 0; }
.signin-sheet .brand { padding: 0; color: var(--paper-ink); }
.signin-sheet h1 { font-size: 32px; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; font-variation-settings: "opsz" 96; }
.signin-lede { font-size: 16px; color: color-mix(in srgb, var(--paper-ink) 80%, transparent); }
.signin-foot { font-size: 14px; color: color-mix(in srgb, var(--paper-ink) 80%, transparent); }
.signin-foot a { color: var(--paper-ink); font-weight: 600; }
.gsi-slot { min-height: 44px; display: flex; align-items: center; }
.signin .notice { background: color-mix(in srgb, var(--surface) 70%, transparent); }

/* ---------------------------------------------------------------- responsive */

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

@media (max-width: 900px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky;
    z-index: 10;
    height: auto;
    gap: 8px;
    padding: 12px 16px 0;
    background: var(--bg);
    box-shadow: inset 0 -1px 0 var(--margin), inset 0 -4px 0 var(--bg), inset 0 -5px 0 var(--margin);
  }
  .side-top { flex-direction: row; align-items: center; justify-content: space-between; }
  .brand { padding: 0; }
  .side-top-end { padding: 0; gap: 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 2px; margin: 0 -16px; padding: 0 16px 10px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { white-space: nowrap; padding: 6px 10px; }
  .side-foot { display: none; }
  .content { padding: 20px 16px 48px; }
  .page { gap: 16px; }
  .page-title { font-size: 26px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .panel { padding: 16px; }
  .pad-panel { padding: 26px 16px 16px 40px; }
  .hero-figure { font-size: 44px; }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .tiles-4, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 22px; }
  .field-row, .choice-group { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-actions { justify-content: flex-start; }
  .tasks .row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .meter-legend li { grid-template-columns: 12px minmax(0, 1fr); }
  .meter-legend .muted { grid-column: 2; text-align: left; margin-top: -4px; }
  .filters select { flex: 1; min-width: 0; }
  .filters .btn { margin-left: 0; }
  .page-head { align-items: flex-start; }
  .signin-sheet { padding: 40px 18px 24px 52px; background-position: 0 0, 0 10px; }
  .signin-sheet { background:
    linear-gradient(to right, transparent 32px, var(--margin) 32px, var(--margin) 33px, transparent 33px, transparent 36px, var(--margin) 36px, var(--margin) 37px, transparent 37px),
    repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) 29px, var(--paper-rule) 29px, var(--paper-rule) 30px); background-color: var(--paper); }
  .signin-sheet h1 { font-size: 28px; }
  .toggle-row { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .switch::after { transition: none; }
}

@media (forced-colors: active) {
  .meter span, .chart-svg .bar, .key { forced-color-adjust: none; }
  .nav-link[aria-current="page"] { outline: 2px solid CanvasText; }
}

