/* magpie portal: warm paper, serif headings, one terracotta accent */
:root {
  color-scheme: light;
  --bg: #faf9f5;
  --card: #ffffff;
  --sunk: #f4f2ec;
  --border: #e8e6dc;
  --hair: #efede6;
  --ink: #141413;
  --ink-2: #5e5d59;
  --ink-3: #87867f;
  --accent: #d97757;
  --accent-hover: #c6613f;
  --accent-ink: #ffffff;
  --accent-wash: rgba(217, 119, 87, 0.12);
  --good: #3f7a3f;
  --good-wash: rgba(90, 140, 90, 0.14);
  --bad: #b5443a;
  --bad-wash: rgba(191, 77, 67, 0.12);
  --warn-wash: rgba(201, 133, 0, 0.14);
  /* charts (validated: dataviz validate_palette.js) */
  --bar: #d97757;
  --grid: #ece9e1;
  --axis: #c9c6bb;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.06);
  --shadow-pop: 0 8px 28px rgba(20, 20, 19, 0.12);
  --serif: "Iowan Old Style", "Source Serif 4", "Source Serif Pro", Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --r: 14px;
  --r-sm: 9px;
  /* motion: ease-out, mostly opacity and transform; with reduced motion only the fades stay */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 150ms;
  --t: 220ms;
  --t-page: 560ms;
  --stagger: 55ms;
  --rise: 14px;
  --rise-sm: 8px;
  --pop: 0.96;
  --lift: -2px;
  --shadow-hover: 0 10px 28px -12px rgba(20, 20, 19, 0.22), 0 2px 6px rgba(20, 20, 19, 0.05);
  --accent-glow: 0 6px 16px -6px rgba(217, 119, 87, 0.55);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #262624; --card: #30302e; --sunk: #2b2b29; --border: #3e3e3a; --hair: #383835;
    --ink: #f0eee6; --ink-2: #c2c0b6; --ink-3: #8f8d85;
    --accent: #d97757; --accent-hover: #e08a6c; --accent-wash: rgba(217, 119, 87, 0.18);
    --good: #7fb87f; --good-wash: rgba(127, 184, 127, 0.14);
    --bad: #e07a70; --bad-wash: rgba(224, 122, 112, 0.14); --warn-wash: rgba(230, 170, 60, 0.16);
    --bar: #d4704f; --grid: #3a3a37; --axis: #4a4a46;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 12px 30px -12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #262624; --card: #30302e; --sunk: #2b2b29; --border: #3e3e3a; --hair: #383835;
  --ink: #f0eee6; --ink-2: #c2c0b6; --ink-3: #8f8d85;
  --accent: #d97757; --accent-hover: #e08a6c; --accent-wash: rgba(217, 119, 87, 0.18);
  --good: #7fb87f; --good-wash: rgba(127, 184, 127, 0.14);
  --bad: #e07a70; --bad-wash: rgba(224, 122, 112, 0.14); --warn-wash: rgba(230, 170, 60, 0.16);
  --bar: #d4704f; --grid: #3a3a37; --axis: #4a4a46;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 12px 30px -12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* the scrollbar's room is kept, so a short page and a long one line up the same */
html { scrollbar-gutter: stable; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 22px 14px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--serif); font-size: 19px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font: 600 14px var(--sans); }
.nav-group { font-size: 12px; color: var(--ink-3); padding: 16px 10px 6px; }
.side { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 9px; border-radius: var(--r-sm);
  border: 1px solid transparent; text-decoration: none; color: var(--ink-2);
  transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out, border-color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
/* the current page's mark: a short accent bar that grows in */
.nav a::before {
  content: ""; position: absolute; left: -1px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
  background: var(--accent); transform: scaleY(0); opacity: 0; transform-origin: 50% 50%;
  transition: transform var(--t) var(--ease-out), opacity var(--t-fast) ease-out;
}
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); border-color: var(--border); }
.nav a[aria-current="page"]::before { transform: scaleY(1); opacity: 1; }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t) var(--ease-out); }
.nav a:hover svg { transform: translateX(2px); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.side-foot { margin-top: auto; padding: 14px 10px 0; display: grid; gap: 10px; font-size: 13px; }
.side-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.side-tools { display: flex; gap: 6px; flex-wrap: wrap; }

.main { padding: 30px 44px 64px; min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; display: grid; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0;
  transition: box-shadow var(--t) var(--ease-out), border-color var(--t) ease-out, transform var(--t) var(--ease-out);
}
/* cards one reads at a glance or picks from rise a little under the pointer */
.card.tile:hover, .plan:hover, .post-item:hover, .group-card:hover, .sub-card:hover, .coupon:not(.used):not(.expired):hover {
  transform: translateY(var(--lift)); box-shadow: var(--shadow-hover);
}
.card.tile:hover { border-color: var(--axis); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .sub { font-size: 13px; color: var(--ink-2); }
.grid { display: grid; gap: 18px; }
.grid.tiles { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.grid.two { grid-template-columns: 1fr 1fr; }

/* stat tiles */
.tile-label { font-size: 13px; color: var(--ink-2); }
.tile-value { font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.hero .tile-value { font-size: 48px; line-height: 1.05; font-weight: 600; }
.hero.low .tile-value { color: var(--bad); }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--card);
  padding: 7px 14px; cursor: pointer; line-height: 1.3; white-space: nowrap; text-decoration: none;
  transition: background-color var(--t-fast) ease-out, border-color var(--t-fast) ease-out, color var(--t-fast) ease-out, opacity var(--t-fast) ease-out,
    box-shadow var(--t) var(--ease-out), transform var(--t) var(--ease-out);
}
.btn:hover { background: var(--sunk); }
.btn:active:not(:disabled) { transform: scale(0.97); transition-duration: 80ms; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--accent-glow); }
.btn.primary:active:not(:disabled) { transform: translateY(0) scale(0.97); box-shadow: none; }
/* a copy button says it worked */
.btn.copied { background: var(--good-wash); border-color: transparent; color: var(--good); animation: pop 260ms var(--ease-back); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-wash); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }
.btn:focus-visible, .input:focus-visible, .nav a:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a field beside a taller one keeps its own height (no stretched input) */
.field { display: grid; gap: 6px; align-content: start; }
.field > .seg, .form > .seg { justify-self: start; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card);
  padding: 9px 12px; outline: none;
  transition: border-color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
textarea.input { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.form { display: grid; gap: 14px; }
/* an empty error holder takes no gap of its own; paragraphs keep to the form's spacing */
.form > div:empty { display: none; }
.form > p { margin: 0; }
/* an input with a label beside a button: the button lines up with the input */
.row:has(> .grow > .field) { align-items: flex-end; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.seg { display: inline-flex; background: var(--sunk); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; }
.seg button {
  border: 0; background: transparent; padding: 4px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: auto; min-width: 140px; padding: 6px 10px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; transition: background-color 120ms ease-out; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--sunk); }
tr.clickable { cursor: pointer; }
.empty { padding: 34px 10px; text-align: center; color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--good-wash); color: var(--good); }
.badge.err { background: var(--bad-wash); color: var(--bad); }
.badge.warn { background: var(--warn-wash); color: var(--ink); }
.badge.plain::before { display: none; }
.amount-pos { color: var(--good); }
.err-text { color: var(--ink-2); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the secret shown once */
.secret { display: flex; gap: 8px; align-items: center; background: var(--sunk); border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.secret code { flex: 1; overflow-wrap: anywhere; }
.callout { border-radius: var(--r-sm); padding: 10px 14px; font-size: 14px; background: var(--accent-wash); }
.callout.err { background: var(--bad-wash); color: var(--bad); }

pre.snippet { margin: 0; background: var(--sunk); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; font: 13px/1.6 var(--mono); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: min(420px, 100%); display: grid; gap: 22px; }
.auth-box .brand { padding: 0; justify-content: center; font-size: 22px; }
.auth-box h1 { text-align: center; font-size: 34px; }
.auth-box .lead { text-align: center; color: var(--ink-2); margin: -10px 0 0; }
.auth-alt { text-align: center; font-size: 14px; color: var(--ink-2); }

/* dialog */
dialog { border: 1px solid var(--border); border-radius: var(--r); background: var(--card); color: var(--ink); padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(20, 20, 19, 0.35); backdrop-filter: blur(2px); }
dialog[open] { animation: dialog-in 300ms var(--ease-out); }
dialog[open]::backdrop { animation: fade-in 260ms ease-out; }
dialog.closing { animation: dialog-out var(--t-fast) ease-in forwards; }
dialog.closing::backdrop { animation: fade-out var(--t-fast) ease-in forwards; }
/* what a dialog holds comes in just after its frame */
dialog[open] > * { animation: rise-in-sm 360ms var(--ease-out) backwards; }
dialog[open] > :nth-child(2) { animation-delay: 40ms; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -6px 16px 0; }
.dialog-head h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* a toast may be a popover (top layer), so the popover defaults are undone here */
.toast {
  position: fixed; inset: auto auto 24px 50%; translate: -50% 0; margin: 0; border: 0; overflow: visible;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 20px; font-size: 14px; box-shadow: var(--shadow-pop); z-index: 50;
  animation: toast-in 380ms var(--ease-back);
}
.toast.out { opacity: 0; transform: translateY(6px) scale(0.96); transition: opacity var(--t-fast) ease-in, transform var(--t-fast) ease-in; }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--bar); }
.chart .hit { fill: transparent; cursor: default; }
.chart .band-on { fill: var(--sunk); opacity: 0; transition: opacity 120ms ease-out; }
.chart .band-on.on { opacity: 1; }
.tip {
  position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--shadow-pop); padding: 8px 11px; font-size: 13px; white-space: nowrap; z-index: 5;
}
.tip b { display: block; font-weight: 600; }
.meter { height: 6px; border-radius: 99px; background: var(--sunk); min-width: 60px; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--bar); }
/* a chart's columns grow up from the base the first time it shows */
.chart svg.grow .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-grow 640ms var(--ease-out) backwards; }

/* ---------- motion ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(var(--rise)); } }
@keyframes rise-in-sm { from { opacity: 0; transform: translateY(var(--rise-sm)); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(var(--rise)) scale(var(--pop)); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(var(--rise-sm)) scale(var(--pop)); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(var(--rise)) scale(0.9); } }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { opacity: 0.5; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes bar-grow { from { transform: scaleY(0); } }
@keyframes meter-fill { from { width: 0; } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } 75% { transform: rotate(2deg); } }
@keyframes progress-run { from { transform: scaleX(0); } 30% { transform: scaleX(0.45); } to { transform: scaleX(0.9); } }

/* a page swaps in whole, after its data, its parts rising one after another;
   the old one dims while a slow one loads */
.shell, .auth { animation: fade-in 320ms ease-out; }
.auth-box > * { animation: rise-in var(--t-page) var(--ease-out) backwards; }
.auth-box > :nth-child(2) { animation-delay: 50ms; }
.auth-box > :nth-child(3) { animation-delay: 100ms; }
.auth-box > :nth-child(n+4) { animation-delay: 150ms; }
.page.enter > * { animation: rise-in var(--t-page) var(--ease-out) backwards; }
.page.enter > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.page.enter > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.page.enter > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.page.enter > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
.page.enter > :nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
.page.enter > :nth-child(n+7) { animation-delay: calc(var(--stagger) * 6); }
/* tiles and cards side by side take turns too */
.page.enter > .grid > * { animation: rise-in var(--t-page) var(--ease-out) backwards; }
.page.enter > .grid > :nth-child(2) { animation-delay: 60ms; }
.page.enter > .grid > :nth-child(3) { animation-delay: 120ms; }
.page.enter > .grid > :nth-child(4) { animation-delay: 180ms; }
.page.enter > .grid > :nth-child(n+5) { animation-delay: 240ms; }
/* the first rows of a table fade in down the page */
.page.enter tbody tr { animation: fade-in 420ms ease-out backwards; animation-delay: 300ms; }
.page.enter tbody tr:nth-child(1) { animation-delay: 120ms; }
.page.enter tbody tr:nth-child(2) { animation-delay: 150ms; }
.page.enter tbody tr:nth-child(3) { animation-delay: 180ms; }
.page.enter tbody tr:nth-child(4) { animation-delay: 210ms; }
.page.enter tbody tr:nth-child(5) { animation-delay: 240ms; }
.page.enter tbody tr:nth-child(6) { animation-delay: 270ms; }
.page.enter .meter > i { animation: meter-fill 900ms var(--ease-out) 200ms backwards; }
.page > .arrive { animation: rise-in var(--t-page) var(--ease-out) backwards; }
.main > .page { transition: opacity var(--t) ease-out; }
.main.busy > .page { opacity: 0.55; }
.callout { animation: rise-in-sm var(--t) var(--ease-out); }
/* the bell rings once when there is something new */
.bell.has svg { animation: ring 900ms ease-in-out 400ms; transform-origin: 50% 10%; }
.bell.has::after { animation: pop 320ms var(--ease-back); }
/* a finished onboarding step ticks itself off */
.onboard li.done .step-n { animation: pop 420ms var(--ease-back) 300ms backwards; }
/* the featured plan wears a slow sweep of light along its edge */
@property --beam { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes beam { to { --beam: 360deg; } }
.plan.featured::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--beam), transparent 0 72%, var(--accent) 88%, transparent 100%); padding: 2px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: beam 4.5s linear infinite;
}
.plan-badge { animation: pop 420ms var(--ease-back) 350ms backwards; }

/* the loading bar: shows only when a load is slow */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; pointer-events: none;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
}
.progress.on { opacity: 1; animation: progress-run 2.4s cubic-bezier(0.1, 0.6, 0.3, 1) forwards; }
.progress.done { transform: scaleX(1); opacity: 0; transition: opacity 220ms ease-out 60ms; }

/* placeholder for a page still loading */
.skeleton { max-width: 1120px; margin: 22px auto 0; display: grid; gap: 22px; animation: fade-in var(--t) ease-out; }
.page:empty + .skeleton { margin-top: 0; }
.skeleton .card { display: grid; gap: 14px; }
.skeleton i {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--hair) 0%, var(--sunk) 45%, var(--hair) 90%) 0 0 / 200% 100% var(--hair);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton i:nth-child(1) { width: 32%; height: 16px; }
.skeleton i:nth-child(2) { width: 88%; }
.skeleton i:nth-child(3) { width: 64%; }

/* the theme switch: a cross-fade where the browser has view transitions; transitions held meanwhile */
html.theming *, html.theming *::before, html.theming *::after { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 200ms; animation-timing-function: ease-out; }

/* reduced motion: nothing moves, slides, grows or loops; short fades stay, so a page
   still eases in rather than snapping (fades don't trouble those who ask for less motion) */
@media (prefers-reduced-motion: reduce) {
  :root { --rise: 0px; --rise-sm: 0px; --pop: 1; --lift: 0px; --stagger: 0ms; --t-page: 200ms; }
  *, *::before, *::after { scroll-behavior: auto !important; }
  .btn:active:not(:disabled), .btn.primary:hover:not(:disabled), .nav a:hover svg { transform: none; }
  .btn.copied, .bell.has svg, .bell.has::after, .onboard li.done .step-n, .plan-badge, .toast,
  .chart svg.grow .bar, .page.enter .meter > i, .tabs button[aria-selected="true"]::after { animation: none; }
  .page.enter > *, .page.enter > .grid > *, .page.enter tbody tr, .auth-box > * { animation-delay: 0s !important; }
  .plan.featured::before { animation: none; display: none; }
  .is-live .live-dot, .badge.live::before, .skeleton i { animation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: 120ms !important; }
}

@media (max-width: 1080px) {
  .grid.tiles { grid-template-columns: 1fr 1fr; }
  .main { padding: 32px 28px 56px; }
}
@media (max-width: 760px) {
  .grid.tiles, .grid.two { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
  .hero .tile-value { font-size: 40px; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
}

/* ---------- the reseller's pages ---------- */
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog { max-height: calc(100vh - 40px); overflow-y: auto; }
.brand-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2); transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.icon-btn:focus-visible, .search-btn:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg, .search-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bell.has::after { content: attr(data-count); position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 600 10px/16px var(--sans); text-align: center; }
.search-btn { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); color: var(--ink-3); cursor: pointer; font-size: 13px; transition: border-color var(--t-fast) ease-out, color var(--t-fast) ease-out; }
.search-btn:hover { border-color: var(--axis); color: var(--ink-2); }
.search-btn span { flex: 1; text-align: left; }
kbd { display: inline-block; font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--sunk); color: var(--ink-2); margin-left: 4px; white-space: nowrap; }
.nav .nav-group:first-child { padding-top: 6px; }

.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.plans { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.groups { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid.coupons { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.row.between { justify-content: space-between; }
.row.tight { gap: 6px; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.bad { color: var(--bad); }
.pre, .post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-body { line-height: 1.7; }
.tile .tile-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.live .tile-value { color: var(--accent); }
.empty.sm { padding: 14px 10px; }
.filters .seg, .seg.wrap { flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--sunk); border: 1px solid var(--hair); color: var(--ink-2); white-space: nowrap; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* the key wizard */
.wizard { gap: 18px; }
.step { display: grid; gap: 10px; padding-top: 4px; }
.step + .step { border-top: 1px solid var(--hair); padding-top: 16px; }
.step-title { font-weight: 600; font-size: 14px; }
details.step > summary { cursor: pointer; list-style: none; }
details.step > summary::-webkit-details-marker { display: none; }
details.step > summary::before { content: "▸ "; color: var(--ink-3); }
details.step[open] > summary::before { content: "▾ "; }
details.step[open] > summary { margin-bottom: 4px; }
.group-pick { display: grid; gap: 6px; }
.group-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); transition: border-color var(--t-fast) ease-out, background-color var(--t-fast) ease-out; }
.group-row.on { border-color: var(--accent); background: var(--accent-wash); }
.model-pick { max-height: 320px; overflow-y: auto; display: grid; gap: 6px; padding: 2px; }
.vendor-head { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.check.model { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); transition: border-color var(--t-fast) ease-out, background-color var(--t-fast) ease-out; }
.check.model.on { border-color: var(--accent); background: var(--accent-wash); }
.check.model code { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-name { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* meters, plans, subscriptions */
.meter-row { display: grid; gap: 4px; font-size: 13px; }
.meter.hot > i { background: var(--bad); }
.meter > i { transition: width 400ms var(--ease); }
.sub-card { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--sunk); }
.plan { display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan.featured { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, var(--border)), var(--shadow); }
.plan-badge { position: absolute; top: -11px; right: 18px; background: var(--accent); color: var(--accent-ink); font-size: 12px; padding: 2px 10px; border-radius: 99px; }
.plan-price span:first-child { font-size: 32px; font-weight: 600; letter-spacing: -0.01em; }
.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); flex: 1; align-content: start; }
.facts li::before { content: "✓"; color: var(--good); margin-right: 8px; }
.btn.block { width: 100%; }
.sum { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunk); font-size: 14px; }
.sum .total { border-top: 1px solid var(--border); padding-top: 6px; }
.plan-amt { color: var(--ink-2); }

/* coupons, codes */
.coupon { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); border: 1px dashed var(--accent); background: var(--accent-wash); }
.coupon.used, .coupon.expired { border-color: var(--border); background: var(--sunk); opacity: 0.75; }
.coupon-value { font: 600 22px var(--sans); color: var(--accent); min-width: 64px; text-align: center; }
.code-in { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
textarea.input.plain { font-family: var(--sans); font-size: 14px; }
textarea.input.tall { min-height: 200px; }
textarea.codes-out { min-height: 220px; }
.steps-text { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }

/* the dashboard */
.onboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onboard li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.onboard li > div { flex: 1; }
.onboard li.done { background: var(--good-wash); border-color: transparent; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); font-weight: 600; flex: none; }
.onboard li.done .step-n { background: var(--good); color: #fff; }
.callout.link { display: block; text-decoration: none; transition: background-color var(--t-fast) ease-out; }
.callout.link:hover { background: rgba(217, 119, 87, 0.2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.list li:last-child { border-bottom: 0; }
.list a { display: flex; gap: 8px; align-items: center; text-decoration: none; min-width: 0; }
.list a:hover span:last-child, .list a:hover strong { text-decoration: underline; }
.notices li.unread strong::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.notices a { display: block; }
details.faq { border-bottom: 1px solid var(--hair); padding: 10px 0; }
details.faq:last-child { border-bottom: 0; }
details.faq summary { cursor: pointer; font-weight: 500; }
details.faq .post-body { margin-top: 8px; color: var(--ink-2); }
.post-list { display: grid; gap: 12px; }
.post-item { display: grid; gap: 8px; text-decoration: none; }
.post-item:hover { border-color: var(--axis); }
.post-item p { margin: 0; }
.back { justify-self: start; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { position: relative; border: 0; background: transparent; padding: 8px 14px 10px; cursor: pointer; color: var(--ink-2); white-space: nowrap; transition: color var(--t-fast) ease-out; }
.tabs button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform var(--t) var(--ease-out); }
.tabs button:hover { color: var(--ink); }
.tabs button:hover::after { transform: scaleX(0.35); opacity: 0.5; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { transform: scaleX(1); opacity: 1; animation: grow-x 420ms var(--ease-out) 120ms backwards; }

/* groups as cards */
.group-card { display: grid; gap: 8px; align-content: start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.group-card.locked { background: var(--sunk); }

/* live */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; }
.is-live .live-dot { background: var(--good); animation: live-ring 1.6s ease-out infinite; }
@keyframes live-ring { 0% { box-shadow: 0 0 0 0 rgba(90, 160, 90, 0.5); } 100% { box-shadow: 0 0 0 8px rgba(90, 160, 90, 0); } }
.badge.live { background: var(--good-wash); color: var(--good); }
.badge.live::before { animation: pulse 1.2s ease-in-out infinite; }

/* the palette */
.palette { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; }
.palette li.on a, .palette li a:hover { background: var(--accent-wash); }

/* sign-in elsewhere */
.oauth { display: grid; gap: 10px; }
.oauth .or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; }
.oauth .or::before, .oauth .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

@media (max-width: 1080px) {
  .grid.tiles.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid.three, .grid.tiles.five { grid-template-columns: 1fr 1fr; }
  .search-btn { flex: none; }
  .search-btn span, .search-btn kbd { display: none; }
  .check-grid { grid-template-columns: 1fr; }
  .group-row { flex-wrap: wrap; }
}
.step > p { margin: 0; }

/* ---------- motion for the small surfaces ---------- */
.sub-card, .coupon, .group-card { transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), border-color var(--t-fast) ease-out; }
.group-row:hover, .check.model:hover { border-color: var(--axis); }
.group-row.on:hover, .check.model.on:hover { border-color: var(--accent); }
.palette li a { transition: background-color var(--t-fast) ease-out; }
details.faq .post-body, details.step[open] > :not(summary) { animation: rise-in-sm 280ms var(--ease-out); }
details.step > summary::before { display: inline-block; transition: transform var(--t) var(--ease-out); }
.brand-mark { transition: transform 400ms var(--ease-back); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.icon-btn:active, .search-btn:active { transform: scale(0.95); }
.icon-btn, .search-btn { transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out, border-color var(--t-fast) ease-out, transform 120ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  details.faq .post-body, details.step[open] > :not(summary) { animation: none; }
  .brand:hover .brand-mark, .icon-btn:active, .search-btn:active { transform: none; }
}
.sum-rows { display: grid; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  .plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
}

/* ==================== EasyCode: shell, icons, drawer, home, mascot ==================== */
:root { --term-bg: #1f1e1c; --tok-in: #d97757; --tok-out: #6a9bcc; --tok-cw: #c9a227; --tok-cr: #5f9e62; --warn: #c98500; }

/* icons anywhere: a line icon in the text's colour */
svg.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.ic.ic-xs { width: 13px; height: 13px; }
.btn svg.ic { width: 16px; height: 16px; margin: 0 -1px; }
.btn.sm svg.ic { width: 14px; height: 14px; }
.btn.lg { padding: 11px 20px; font-size: 15.5px; border-radius: 11px; gap: 8px; }
.btn.lg svg.ic { width: 18px; height: 18px; }
.btn.primary svg.ic { transition: transform var(--t) var(--ease-out); }
.btn.primary:hover svg.ic:last-child { transform: translateX(2px); }
.chip-icon { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-wash); color: var(--accent); }
.chip-icon svg.ic { width: 19px; height: 19px; }
.chip-icon.sm { width: 28px; height: 28px; border-radius: 8px; }
.chip-icon.sm svg.ic { width: 15px; height: 15px; }
.chip-icon.ok { background: var(--good-wash); color: var(--good); }
.chip-icon.err { background: var(--bad-wash); color: var(--bad); }
h2.with-icon { display: flex; align-items: center; gap: 10px; }
.icon-btn.danger:hover { background: var(--bad-wash); color: var(--bad); }
.actions { gap: 2px; }
.actions .btn.sm { margin-right: 4px; }
.empty { display: grid; justify-items: center; gap: 10px; }
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--sunk); color: var(--ink-3); }
.empty-icon svg.ic { width: 21px; height: 21px; }
.empty.sm .empty-icon { display: none; }
.hint { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.nowrap { white-space: nowrap; }
.ellipsis { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.callout { display: flex; align-items: flex-start; gap: 10px; }
.callout > svg.ic { margin-top: 2px; }
.callout.link { display: flex; align-items: center; }
.callout.link svg.ic:last-child { transition: transform var(--t) var(--ease-out); }
.callout.link:hover svg.ic:last-child { transform: translateX(3px); }

/* the logo */
.logo { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-family: var(--sans); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.logo .brand-name { font-size: 1.05em; }
.logo .brand-name b { color: var(--accent); font-weight: 800; }
.logo-mark { flex: none; display: block; border-radius: 9px; box-shadow: 0 4px 12px -4px rgba(196, 87, 58, 0.55); transition: transform 420ms var(--ease-back); }
a:hover > .logo .logo-mark, .brand:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.logo-spark { transform-box: fill-box; transform-origin: center; }
a:hover > .logo .logo-spark, .brand:hover .logo-spark { animation: spark 700ms var(--ease-back); }
.home .logo-cursor, .auth .logo-cursor { animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes spark { 0% { transform: scale(1) rotate(0); } 50% { transform: scale(1.4) rotate(45deg); } 100% { transform: scale(1) rotate(90deg); } }
.brand { text-decoration: none; padding: 2px 8px 18px; }

/* the shell: the side, the top bar, main */
.body { min-width: 0; display: flex; flex-direction: column; }
.side { padding: 18px 14px 14px; background: var(--bg); gap: 2px; }
.side .nav { display: grid; gap: 2px; }
.side-wallet {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--card); text-decoration: none; box-shadow: var(--shadow);
  transition: border-color var(--t-fast) ease-out, box-shadow var(--t) var(--ease-out), transform var(--t) var(--ease-out);
}
.side .nav + .side-wallet { margin-top: auto; position: sticky; bottom: 0; }

.side-wallet:hover { border-color: var(--axis); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.side-wallet .grow { display: grid; line-height: 1.3; }
.side-wallet .grow .faint { font-size: 12px; }
.side-wallet strong { font-size: 16px; }
.side-wallet.low strong { color: var(--bad); }
.side-wallet-go { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 28px 0 44px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; white-space: nowrap; }
.crumb .crumb-sep { width: 14px; height: 14px; color: var(--ink-3); }
.crumb-here { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar .search-btn { margin: 0; width: 240px; padding: 6px 8px 6px 10px; }
.top-tools { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.lang-btn { width: auto; padding: 0 8px; gap: 4px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; }
.nav-toggle { display: none; }
.menu-wrap { position: relative; margin-left: 6px; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; flex: none;
  background: linear-gradient(135deg, #e8946f, #c4573a); color: #fff; font: 700 14px var(--sans);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--border); transition: box-shadow var(--t-fast) ease-out, transform 120ms ease-out;
}
button.avatar:hover, button.avatar[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
button.avatar:active { transform: scale(0.95); }
button.avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; box-shadow: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 260px; z-index: 40; padding: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop);
  transform-origin: 100% 0; animation: menu-in 220ms var(--ease-out);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.menu-head strong, .menu-head .faint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head .faint { font-size: 12px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); text-decoration: none; text-align: left; cursor: pointer; font-size: 14px;
  transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--sunk); color: var(--ink); outline: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover { background: var(--bad-wash); }
.menu-sep { height: 1px; background: var(--hair); margin: 4px 0; }
.scrim { display: none; }

/* the floating tip (a popover: its defaults undone) */
.tipfloat {
  position: fixed; inset: auto; margin: 0; border: 0; overflow: visible; z-index: 100; pointer-events: none;
  padding: 5px 9px; border-radius: 7px; background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1.35; white-space: nowrap;
  box-shadow: var(--shadow-pop); animation: tip-in 140ms var(--ease-out);
}
@keyframes tip-in { from { opacity: 0; transform: translateY(3px); } }
.tipfloat.below { animation-name: tip-in-below; }
@keyframes tip-in-below { from { opacity: 0; transform: translateY(-3px); } }

/* the request log */
.dot-col { width: 10px; padding-right: 0 !important; }
.status-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status-dot.ok { background: var(--good); box-shadow: 0 0 0 3px var(--good-wash); }
.status-dot.err { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-wash); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-wash); }
.model-cell { display: grid; gap: 3px; min-width: 0; }
.model-cell code { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.model-cell .row { font-size: 12px; flex-wrap: nowrap; white-space: nowrap; }
.go-col { width: 22px; padding-left: 0 !important; }
.row-go { color: var(--ink-3); opacity: 0.35; transition: opacity var(--t-fast) ease-out, transform var(--t) var(--ease-out); }
tr.clickable:hover .row-go, tr.clickable:focus-visible .row-go { opacity: 1; transform: translateX(2px); color: var(--accent); }
tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.clickable:focus-visible td { background: var(--sunk); }
.pending-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; animation: pulse 1.4s ease-in-out infinite; }

/* tiles with icons; the spend sum */
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile.hero { background: linear-gradient(140deg, var(--accent-wash), transparent 70%), var(--card); }
.tile.hero .chip-icon { background: var(--accent); color: #fff; }
.sum-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.sum-fig { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--sunk); min-width: 0; }
.sum-fig > span { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.sum-fig strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the drawer: a dialog that slides in from the right */
dialog.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border-radius: 18px 0 0 18px;
  border-right: 0; padding: 20px 24px 28px; overflow-y: auto;
}
dialog.drawer[open] { animation: drawer-in 380ms var(--ease-out); }
dialog.drawer.closing { animation: drawer-out var(--t-fast) ease-in forwards; }
dialog.drawer[open] > * { animation: none; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes drawer-out { to { transform: translateX(40px); opacity: 0; } }
.req { display: grid; gap: 18px; }
.req > * { animation: rise-in-sm 420ms var(--ease-out) backwards; }
.req > :nth-child(2) { animation-delay: 40ms; }
.req > :nth-child(3) { animation-delay: 80ms; }
.req > :nth-child(4) { animation-delay: 120ms; }
.req > :nth-child(n+5) { animation-delay: 160ms; }
.req-head { display: flex; align-items: center; gap: 12px; }
.req-model { display: block; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-head .row { font-size: 12.5px; margin-top: 2px; }
.req-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.req-figs > div { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunk); border: 1px solid var(--hair); min-width: 0; }
.req-figs span { font-size: 12px; }
.req-figs strong { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-id { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--r-sm); border: 1px dashed var(--border); font-size: 12px; }
.req-id code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.err-full { margin-top: 4px; font: 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); opacity: 0.85; }
.d-sect h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 600 13px var(--sans); color: var(--ink-2); letter-spacing: 0.02em; }
.d-sect h3 svg.ic { color: var(--accent); width: 15px; height: 15px; }
.d-sect dl { margin: 0; display: grid; padding: 2px 14px; border: 1px solid var(--hair); border-radius: var(--r-sm); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv dt { display: flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; }
.kv dt svg.ic { width: 14px; height: 14px; color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.tok-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; margin: 2px 0 10px; }
.tok-bar i { display: block; min-width: 3px; flex-basis: 0; transform-origin: 0 50%; animation: grow-x 700ms var(--ease-out) 200ms backwards; }
.tok-bar .in, .sw.in { background: var(--tok-in); }
.tok-bar .out, .sw.out { background: var(--tok-out); }
.tok-bar .cw, .sw.cw { background: var(--tok-cw); }
.tok-bar .cr, .sw.cr { background: var(--tok-cr); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.rs { background: transparent; border: 2px solid var(--tok-out); }

/* sign in */
.auth { position: relative; background: radial-gradient(900px 420px at 50% -10%, var(--accent-wash), transparent 70%), var(--bg); }
.auth-back { position: absolute; top: 20px; left: 22px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); transition: background-color var(--t-fast) ease-out, color var(--t-fast) ease-out; }
.auth-back:hover { background: var(--sunk); color: var(--ink); }
.auth-back svg.ic { transition: transform var(--t) var(--ease-out); }
.auth-back:hover svg.ic { transform: translateX(-2px); }
.auth-box .brand { padding: 0; justify-self: center; font-size: 24px; }
.auth-form { position: relative; margin-top: 30px; padding: 30px 26px 24px; }
.auth-form > .mascot.peek { position: absolute; top: -58px; right: 24px; }

/* ---------- 小易, the mascot ---------- */
.mascot { display: block; overflow: visible; }
.mascot g, .m-shadow { transform-box: fill-box; }
.mascot > g { animation: m-bob 2.6s ease-in-out infinite; }
.m-shadow { transform-origin: center; animation: m-shadow 2.6s ease-in-out infinite; }
.mascot > .m-eyes { transform-origin: center; animation: m-bob 2.6s ease-in-out infinite, m-blink 4.8s ease-in-out infinite; }
.mascot > .m-leaf { transform-origin: 50% 100%; animation: m-bob 2.6s ease-in-out infinite, m-sway 3.4s ease-in-out infinite; }
.mascot.wave > .m-arm-r { transform-origin: 0 0; animation: m-bob 2.6s ease-in-out infinite, m-wave 3.6s ease-in-out infinite; }
.mascot.hop { animation: m-hop 2.8s var(--ease-out) infinite; }
.mascot:hover > .m-leaf { animation-duration: 2.6s, 0.6s; }
@keyframes m-bob { 50% { translate: 0 -0.5px; } }
@keyframes m-shadow { 50% { scale: 0.84 1; opacity: 0.75; } }
@keyframes m-blink { 0%, 90%, 100% { scale: 1 1; } 94% { scale: 1 0.12; } }
@keyframes m-sway { 0%, 100% { rotate: -7deg; } 50% { rotate: 9deg; } }
@keyframes m-wave { 0%, 58%, 100% { rotate: 0deg; } 8% { rotate: -150deg; } 18% { rotate: -120deg; } 28% { rotate: -160deg; } 38% { rotate: -125deg; } 48% { rotate: -150deg; } }
@keyframes m-hop { 0%, 50%, 100% { translate: 0 0; scale: 1 1; } 58% { scale: 1.06 0.92; } 70% { translate: 0 -16%; scale: 0.96 1.05; } 82% { translate: 0 0; scale: 1.05 0.94; } 90% { scale: 1 1; } }
.mascot-wrap { position: relative; display: inline-grid; justify-items: center; gap: 8px; }
.bubble {
  position: relative; padding: 7px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 600; white-space: nowrap;
  animation: bubble-in 600ms var(--ease-back) 1.2s backwards;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: inherit; border: inherit; border-width: 0 1px 1px 0; translate: -50% 0; rotate: 45deg; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.8); } }

/* ---------- the home page ---------- */
.home { min-height: 100vh; background: radial-gradient(1100px 520px at 88% -8%, var(--accent-wash), transparent 62%), radial-gradient(800px 400px at -10% 30%, rgba(106, 155, 204, 0.08), transparent 60%), var(--bg); animation: fade-in 320ms ease-out; overflow-x: hidden; }
.home-nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px;
  padding: 14px max(24px, calc((100vw - 1160px) / 2));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hair);
}
.home-brand { text-decoration: none; font-size: 19px; }
.home-links { display: flex; gap: 22px; margin-right: auto; font-size: 14.5px; }
.home-links a { color: var(--ink-2); text-decoration: none; transition: color var(--t-fast) ease-out; }
.home-links a:hover { color: var(--ink); }
.home-hero { max-width: 1160px; margin: 0 auto; padding: 76px 24px 72px; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.hero-copy > * { animation: rise-in 700ms var(--ease-out) backwards; }
.hero-copy > :nth-child(2) { animation-delay: 70ms; }
.hero-copy > :nth-child(3) { animation-delay: 140ms; }
.hero-copy > :nth-child(4) { animation-delay: 210ms; }
.hero-copy > :nth-child(5) { animation-delay: 280ms; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--accent-wash); color: var(--accent); font-size: 13px; font-weight: 600; }
.home-hero h1 { font-size: clamp(42px, 5.8vw, 66px); line-height: 1.04; letter-spacing: -0.025em; margin: 20px 0; font-weight: 600; }
.home-hero h1 em { font-style: normal; background: linear-gradient(95deg, #e8946f, #c4573a 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero .lead { font-size: 18px; line-height: 1.6; color: var(--ink-2); max-width: 34em; margin: 0 0 30px; }
.trust { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-wrap: wrap; gap: 10px 24px; color: var(--ink-2); font-size: 14px; }
.trust li { display: flex; align-items: center; gap: 7px; }
.trust svg.ic { color: var(--accent); }
.hero-art { position: relative; padding-bottom: 40px; animation: rise-in 900ms var(--ease-out) 200ms backwards; }
.term {
  background: var(--term-bg); color: #e9e6dc; border-radius: 16px; overflow: hidden; min-height: 268px;
  border: 1px solid rgba(255, 255, 255, 0.07); box-shadow: 0 30px 60px -28px rgba(20, 20, 19, 0.5), 0 8px 20px -10px rgba(20, 20, 19, 0.25);
  font: 13.5px/1.75 var(--mono); rotate: -1.2deg; transition: rotate 600ms var(--ease-out);
}
.hero-art:hover .term { rotate: 0deg; }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; color: #8f8d85; font-size: 12px; }
.term-body { padding: 16px 20px 24px; }
.term-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line.prompt .term-pre { color: #7fb87f; }
.term-line.user .term-pre { color: #e8946f; }
.term-line.dim { color: #8f8d85; }
.term-line.out { color: #b9c6ee; }
.term-line.ok { color: #7fb87f; }
.term-caret { display: inline-block; width: 8px; height: 1.15em; margin-left: 2px; vertical-align: -3px; background: #e9e6dc; animation: caret 1s steps(1) infinite; }
.hero-mascot { position: absolute; right: -14px; bottom: -18px; }
.home-section { max-width: 1160px; margin: 0 auto; padding: 56px 24px; }
.home-section h2 { font-size: clamp(26px, 3.4vw, 36px); text-align: center; margin: 0 0 34px; font-weight: 600; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature {
  padding: 24px; border-radius: var(--r); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), border-color var(--t-fast) ease-out;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--axis); }
.feature:hover .chip-icon { animation: pop 420ms var(--ease-back); }
.feature h3 { margin: 16px 0 6px; font: 600 16.5px var(--sans); }
.feature p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.how { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.how li { display: grid; gap: 12px; align-content: start; padding: 22px; border-radius: var(--r); border: 1px dashed var(--border); background: color-mix(in srgb, var(--card) 60%, transparent); }
.how p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.step-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; box-shadow: var(--accent-glow); }
.cta-band {
  max-width: 1112px; margin: 24px auto 72px; display: flex; align-items: center; gap: 28px; padding: 30px 38px; border-radius: 22px;
  background: linear-gradient(120deg, var(--accent-wash), transparent 75%), var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.cta-band > div { flex: 1; min-width: 0; }
.cta-band h2 { margin: 0; font-size: 26px; font-weight: 600; }
.cta-band p { margin: 6px 0 0; color: var(--ink-2); }
.home-foot { max-width: 1160px; margin: 0 auto; padding: 22px 24px 30px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--hair); font-size: 13px; }
.home-foot .logo { font-size: 15px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1080px) {
  .topbar { padding: 0 20px 0 28px; }
  .topbar .search-btn { width: auto; }
  .topbar .search-btn kbd { display: none; }
}
@media (max-width: 960px) {
  .home-hero { grid-template-columns: 1fr; padding-top: 48px; gap: 40px; }
  .features { grid-template-columns: 1fr 1fr; }
  .how { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, 84vw); height: 100vh; border-right: 1px solid var(--border);
    transform: translateX(-102%); visibility: hidden;
    transition: transform 320ms var(--ease-out), box-shadow 320ms ease-out, visibility 0s linear 320ms;
  }
  .shell.nav-open .side { transform: none; visibility: visible; box-shadow: var(--shadow-pop); transition: transform 320ms var(--ease-out), box-shadow 320ms ease-out, visibility 0s; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(20, 20, 19, 0.35); animation: fade-in 220ms ease-out; }
  .nav-toggle { display: inline-grid; margin-left: -6px; }
  .topbar { padding: 0 14px; height: 56px; }
  .crumb > .faint, .crumb .crumb-sep { display: none; }
  .main { padding: 22px 16px 48px; }
}
@media (max-width: 600px) {
  .top-tools .icon-btn:first-child, .lang-btn span { display: none; }
  .search-btn span { display: none; }
  .home-links { display: none; }
  .home-nav { gap: 12px; padding: 12px 16px; }
  .home-nav .row .btn.ghost { display: none; }
  .home-nav .home-brand { margin-right: auto; }
  .home-hero { padding: 36px 16px 48px; }
  .home-hero .lead { font-size: 16px; }
  .hero-mascot { right: -4px; bottom: -26px; }
  .hero-mascot .mascot { width: 96px; height: 96px; }
  .features, .how { grid-template-columns: 1fr; }
  .home-section { padding: 40px 16px; }
  .cta-band { flex-direction: column; text-align: center; margin: 16px 16px 48px; padding: 26px 20px; }
  .home-foot { justify-content: center; text-align: center; }
  .sum-figs, .req-figs { gap: 6px; }
  .sum-fig, .req-figs > div { padding: 8px 10px; }
  .sum-fig strong, .req-figs strong { font-size: 15px; }
  dialog.drawer { border-radius: 0; padding: 16px 18px 24px; }
  .auth-back { top: 12px; left: 10px; }
  .menu { width: min(260px, calc(100vw - 24px)); }
}

/* reduced motion: the mascot stands still, the drawer and menu fade */
@media (prefers-reduced-motion: reduce) {
  .mascot, .mascot g, .m-shadow, .bubble, .term-caret, .logo-cursor, .logo-spark, .pending-dot, .feature:hover .chip-icon { animation: none !important; }
  .hero-copy > *, .hero-art, .req > * { animation: fade-in 200ms ease-out backwards !important; }
  dialog.drawer[open] { animation: fade-in 200ms ease-out; }
  dialog.drawer.closing { animation: fade-out 120ms ease-in forwards; }
  .menu { animation: fade-in 120ms ease-out; }
  .tok-bar i { animation: none; }
  .term, .hero-art:hover .term { rotate: none; }
  .logo-mark, .feature, .side-wallet, .side { transition: none; }
  a:hover > .logo .logo-mark, .brand:hover .logo-mark, .feature:hover, .side-wallet:hover { transform: none; }
}
.err-type { display: block; margin-top: 2px; font-size: 11.5px; opacity: 0.75; }
