/* ---------------------------------------------------------------
   Atmos1 accounts site: the customer pages ("Your account") and the
   admin area share this one stylesheet.

   The brand is the landing page's (landing.css, brand/README.md):
   Lexend, Atmos1 green #2E7D6B, ink #26251F, off-white #FCFBF9, and
   the five-bar waveform as the signature. DyslexicAid navy #194A7A
   marks the maker, and in charts it is the colour for reading.

   body.site-account  calm, roomy, centred: the audience finds reading hard.
   body.site-admin    an ink sidebar, an amber Admin badge and a cooler
                      ground, so nobody mistakes where they are.

   The Content-Security-Policy refuses inline styles, so bars and charts
   are SVG with geometry attributes (templates/partials/ui.php) and icons
   are an inline sprite (templates/partials/icons.php). Light only, as
   on the landing page.
   --------------------------------------------------------------- */

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/lexend-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/lexend-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --surface: #fcfbf9;
  --raised: #ffffff;
  --ink: #26251f;
  --ink-muted: #6b6a63;
  --ink-faint: #8f8d85;
  --border: rgba(38, 37, 31, 0.12);
  --border-strong: rgba(38, 37, 31, 0.24);
  --wash: #f6f4f0;

  --accent: #2e7d6b;
  --accent-strong: #236556;
  --on-accent: #ffffff;
  --accent-tint: rgba(46, 125, 107, 0.12);
  --accent-wash: #eef5f2;

  --read: #194a7a;
  --read-tint: rgba(25, 74, 122, 0.12);

  --warn: #8a5a10;
  --warn-tint: rgba(138, 90, 16, 0.13);
  --warn-wash: #fbf4e7;
  --bad: #b3261e;
  --bad-tint: rgba(179, 38, 30, 0.11);
  --bad-wash: #fcefed;

  --side: #26251f;
  --side-ink: rgba(252, 251, 249, 0.74);
  --side-ink-strong: #fcfbf9;
  --amber: #e9b44c;

  --font: "Lexend", -apple-system, system-ui, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(38, 37, 31, 0.04), 0 8px 24px rgba(38, 37, 31, 0.05);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.55;
  letter-spacing: 0.012em;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; z-index: 10; background: var(--raised); color: var(--ink); padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); }
.skip-link:focus { left: 0.5rem; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }
:focus { outline: none; }
:focus-visible { outline: 3px solid rgba(46, 125, 107, 0.55); outline-offset: 2px; border-radius: var(--radius-sm); }

h1, h2, h3 { font-weight: 600; line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; margin-bottom: 0.6rem; letter-spacing: 0; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.1rem; }
.muted { color: var(--ink-muted); }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: 0; }
code { background: var(--wash); border-radius: 5px; padding: 0.05em 0.35em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- Waveform: the brand's signature ---------------- */
.waveform { display: inline-flex; align-items: flex-end; gap: 3px; height: 24px; flex: none; }
.waveform span { display: block; width: 4px; border-radius: var(--radius-pill); background: var(--accent); transform-origin: bottom; animation: bar-rise 620ms var(--ease) both; }
.waveform span:nth-child(1) { height: 10px; animation-delay: 0ms; }
.waveform span:nth-child(2) { height: 17px; animation-delay: 70ms; }
.waveform span:nth-child(3) { height: 24px; animation-delay: 140ms; }
.waveform span:nth-child(4) { height: 15px; animation-delay: 210ms; }
.waveform span:nth-child(5) { height: 8px; animation-delay: 280ms; }
@keyframes bar-rise { from { transform: scaleY(0.16); opacity: 0.4; } to { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .waveform span { animation: none; } }

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand:hover { color: inherit; }
.brand-name { font-weight: 600; font-size: 1.15rem; letter-spacing: 0.01em; }

/* ================= Customer site ================= */
.site-account { font-size: 1.05rem; }
.topbar { background: var(--raised); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 48rem; margin: 0 auto; padding: 0.95rem 1.25rem; display: flex; align-items: center; gap: 0.75rem 1.25rem; flex-wrap: wrap; }
.brand-stack { display: flex; flex-direction: column; line-height: 1.15; }
.brand-maker { font-size: 0.78rem; color: var(--read); font-weight: 500; }
.brand-maker b { font-weight: 800; }
.place { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem; border-radius: var(--radius-pill); background: var(--accent-tint); color: var(--accent-strong); font-size: 0.85rem; font-weight: 600; }
.top-nav { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.top-nav .nav-link { display: inline-flex; align-items: center; gap: 0.45rem; font: inherit; font-size: 0.95rem; font-weight: 500; color: var(--ink); background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 0.4rem 0.95rem; cursor: pointer; text-decoration: none; }
.top-nav .nav-link:hover { background: var(--wash); color: var(--ink); }
.site-account .page { max-width: 48rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

/* Sign in, forgotten password, device approval: one focused card. */
.card.auth { max-width: 32rem; margin: 1.5rem auto 1.25rem; padding: 2rem; }
.auth-badge { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--accent-tint); color: var(--accent); margin-bottom: 1rem; }
.auth-badge .icon { width: 1.5rem; height: 1.5rem; }
.auth-badge.warn { background: var(--warn-tint); color: var(--warn); }
.auth-badge.bad { background: var(--bad-tint); color: var(--bad); }
.auth-foot { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.auth-foot p { margin: 0; }

/* Account page */
.account-hero { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.account-hero .who { flex: 1 1 16rem; min-width: 0; }
.account-hero h1 { margin: 0; }
.account-hero .email { margin: 0.1rem 0 0; color: var(--ink-muted); overflow-wrap: anywhere; }
.plan-line { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; }
.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem; margin: 0.5rem 0 1rem; }
.usage-tile { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.1rem; background: var(--surface); }
.usage-tile .what { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; margin-bottom: 0.4rem; }
.usage-tile .what .icon { color: var(--accent); }
.usage-tile.reading .what .icon { color: var(--read); }
.usage-tile .figure { margin: 0 0 0.6rem; }
.usage-tile .left { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--ink-muted); }
.usage-tile.unlimited .figure { margin: 0; color: var(--ink-muted); }
svg.meter { display: block; width: 100%; height: 14px; }
.meter .track { fill: rgba(38, 37, 31, 0.08); }
.meter .fill { fill: var(--accent); }
.usage-tile.reading .meter .fill { fill: var(--read); }
.meter .fill.warn, .usage-tile.reading .meter .fill.warn { fill: var(--warn); }
.meter .fill.full, .usage-tile.reading .meter .fill.full { fill: var(--bad); }

.device-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.device-list li { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 0; border-top: 1px solid var(--border); }
.device-list li:first-child { border-top: 0; }
.device-list .device-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-md); background: var(--wash); color: var(--ink-muted); flex: none; }
.device-list .device-main { flex: 1; min-width: 0; }
.device-list .device-name { font-weight: 600; margin: 0; }
.device-list .device-meta { margin: 0; font-size: 0.88rem; color: var(--ink-muted); }

/* ================= Admin site ================= */
.site-admin { background: #f1f0ec; font-size: 0.95rem; }
.admin-shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.site-admin:not(.is-bare) .admin-shell { background: linear-gradient(to right, var(--side) 15rem, transparent 15rem); }
.sidebar { background: var(--side); color: var(--side-ink); padding: 1.25rem 0.85rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: var(--side-ink-strong); padding: 0.2rem 0.55rem 1.1rem; }
.sidebar .waveform span { background: #5fb39f; }
.admin-badge { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; color: var(--side); background: var(--amber); border-radius: var(--radius-pill); padding: 0.12rem 0.55rem; }
.nav-group { margin-top: 0.9rem; }
.nav-group-name { font-size: 0.75rem; color: rgba(252, 251, 249, 0.45); margin: 0 0 0.25rem; padding: 0 0.6rem; }
.side-nav .inline { display: block; }
.side-nav .nav-link { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.5rem 0.6rem; border-radius: var(--radius-sm); color: var(--side-ink); text-decoration: none; font: inherit; font-size: 0.93rem; background: none; border: 0; cursor: pointer; text-align: left; position: relative; }
.side-nav .nav-link:hover { background: rgba(252, 251, 249, 0.07); color: var(--side-ink-strong); }
.side-nav .nav-link.is-current { background: rgba(95, 179, 159, 0.18); color: var(--side-ink-strong); font-weight: 600; }
.side-nav .nav-link.is-current::before { content: ""; position: absolute; left: -0.85rem; top: 0.45rem; bottom: 0.45rem; width: 3px; border-radius: 0 3px 3px 0; background: #5fb39f; }
.side-nav .nav-link.is-current .icon { color: #7fd0bb; }
.side-nav :focus-visible { outline-color: #7fd0bb; }
.admin-body { display: flex; flex-direction: column; min-width: 0; }
.site-admin .page { width: 100%; max-width: 78rem; padding: 1.75rem 2rem 3rem; flex: 1; }
.site-admin .footer { text-align: left; padding: 1rem 2rem 1.5rem; }

/* Admin sign-in and two-factor hold: no menu, the ink ground says "admin". */
.site-admin.is-bare { background: var(--side); }
.site-admin.is-bare .admin-shell { grid-template-columns: 1fr; justify-items: center; align-content: start; padding: 3rem 1rem 1rem; }
.site-admin.is-bare .sidebar { position: static; height: auto; background: none; padding: 0 0 1.25rem; overflow: visible; }
.site-admin.is-bare .sidebar .brand { padding: 0; }
.site-admin.is-bare .admin-body { width: 100%; max-width: 34rem; }
.site-admin.is-bare .page { padding: 0; }
.site-admin.is-bare .footer { color: var(--side-ink); text-align: center; }
.site-admin.is-bare .footer a { color: var(--side-ink-strong); }
.site-admin.is-bare .card { padding: 2rem; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .site-admin:not(.is-bare) .admin-shell { background: none; }
  .sidebar { position: static; height: auto; padding: 0.9rem 0.75rem 0.6rem; }
  .sidebar .brand { padding: 0 0.4rem 0.6rem; }
  .side-nav { display: flex; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.3rem; }
  .nav-group { display: flex; gap: 0.25rem; margin: 0; flex: none; }
  .nav-group + .nav-group { border-left: 1px solid rgba(252, 251, 249, 0.15); padding-left: 0.25rem; }
  .nav-group-name { display: none; }
  .side-nav .nav-link { white-space: nowrap; width: auto; }
  .side-nav .nav-link.is-current::before { display: none; }
  .site-admin .page { padding: 1.25rem 1rem 2.5rem; }
  .site-admin .footer { padding: 1rem; }
}

/* ---------------- Page heads ---------------- */
.page-head { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 0.25rem 0 0; color: var(--ink-muted); }
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; margin-bottom: 0.75rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.section-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.05rem; margin: 2rem 0 0.8rem; }
.section-title .icon { color: var(--ink-muted); }

/* ---------------- Cards ---------------- */
.card { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.site-admin .card { border-radius: var(--radius-md); padding: 1.25rem 1.35rem; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 0.75rem; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.card-head h2 .icon { color: var(--ink-muted); }
.card-head .hint { margin: 0; font-size: 0.85rem; color: var(--ink-muted); }
.card.danger-zone { border-color: rgba(179, 38, 30, 0.3); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 1.25rem 0; }
.row-2 > .card { margin-bottom: 0; }
@media (max-width: 760px) { .row-2 { grid-template-columns: 1fr; } }

/* ---------------- Forms and buttons ---------------- */
label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; padding: 0.65rem 0.8rem; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--raised); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
textarea { min-height: 6rem; resize: vertical; }
input[type="file"] { font: inherit; }
.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; font: inherit; font-weight: 600; line-height: 1.3;
  padding: 0.65rem 1.15rem; border-radius: 10px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--on-accent);
  text-decoration: none; cursor: pointer; transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.button.secondary { background: var(--raised); color: var(--ink); border-color: var(--border-strong); }
.button.secondary:hover { background: var(--wash); color: var(--ink); }
.button.danger { background: var(--raised); color: var(--bad); border-color: rgba(179, 38, 30, 0.45); }
.button.danger:hover { background: var(--bad-wash); color: var(--bad); }
.button.small, .site-admin td .button { padding: 0.35rem 0.75rem; font-size: 0.88rem; }
.button:disabled { opacity: 0.55; cursor: progress; }
.button + .button { margin-left: 0; }
.actions { margin-top: 1.25rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.inline { display: inline; }
form.stack .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.9rem; align-items: end; }
@media (max-width: 560px) { form.stack .row { grid-template-columns: 1fr; } }
fieldset.choices { border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 1rem 0.8rem; margin: 1rem 0 0; }
fieldset.choices legend { font-weight: 600; padding: 0 0.3rem; }
label.choice { font-weight: 400; display: flex; gap: 0.6rem; align-items: baseline; margin: 0.55rem 0 0; cursor: pointer; }
label.choice input { accent-color: var(--accent); }

/* ---------------- Notices: icon by kind, drawn in CSS ---------------- */
.notice { position: relative; border-radius: var(--radius-md); padding: 0.8rem 1rem 0.8rem 2.75rem; margin: 0 0 1rem; border: 1px solid var(--border); background: var(--wash); }
.notice::before { content: ""; position: absolute; left: 1rem; top: 0.95rem; width: 1.15rem; height: 1.15rem; background: currentColor; -webkit-mask: var(--notice-icon) center / contain no-repeat; mask: var(--notice-icon) center / contain no-repeat; }
.notice { --notice-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.8v.1'/%3E%3C/svg%3E"); }
.notice.error { border-color: rgba(179, 38, 30, 0.3); background: var(--bad-wash); color: var(--bad); --notice-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 21.5 20h-19z'/%3E%3Cpath d='M12 10v4.5M12 17.2v.1'/%3E%3C/svg%3E"); }
.notice.ok { border-color: rgba(46, 125, 107, 0.3); background: var(--accent-wash); color: var(--accent-strong); --notice-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='m8 12.3 2.8 2.7L16 9.5'/%3E%3C/svg%3E"); }
.notice.ok a { color: inherit; font-weight: 600; }
.notice > :last-child { margin-bottom: 0; }
.busy-status { margin: 0.8rem 0 0; font-weight: 600; }
.busy-status:empty { display: none; }
/* Make live progress (release-confirm.php, releases.js). */
.progress-panel { margin: 1.2rem 0 0; padding: 1rem 1.1rem; border: 1px solid var(--border, var(--line)); border-radius: 10px; background: var(--surface, #fbf9f5); }
.progress-panel progress { width: 100%; height: 1.2rem; accent-color: var(--accent); }
.progress-title { margin: 0 0 0.6rem; font-weight: 600; }
.progress-figures { margin: 0.5rem 0; font-variant-numeric: tabular-nums; }
.progress-panel.failed { border-color: var(--bad); }

/* ---------------- Pills and chips ---------------- */
.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.65rem; border-radius: var(--radius-pill); font-size: 0.82rem; font-weight: 600; background: rgba(38, 37, 31, 0.07); color: var(--ink-muted); white-space: nowrap; }
.pill .icon { width: 0.95em; height: 0.95em; }
.pill.paid, .pill.ok, .pill-plan-paid { background: var(--accent-tint); color: var(--accent-strong); }
.pill-plan-tester { background: var(--read-tint); color: var(--read); }
.pill.disabled, .pill.bad { background: var(--bad-tint); color: var(--bad); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.chip { display: inline-block; font-size: 0.8rem; padding: 0.05rem 0.5rem; margin: 0.15rem 0.3rem 0 0; border-radius: 6px; background: var(--wash); border: 1px solid var(--border); color: var(--ink-muted); overflow-wrap: anywhere; }
.status { display: inline-flex; align-items: center; gap: 0.45rem; }
.status::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); }
.status.off::before { background: var(--bad); }
.status.idle::before { background: var(--ink-faint); }
.avatar { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent-tint); color: var(--accent-strong); font-weight: 700; font-size: 0.9rem; flex: none; }
.avatar.large { width: 3.5rem; height: 3.5rem; font-size: 1.4rem; }
.avatar.tester { background: var(--read-tint); color: var(--read); }
.avatar.free { background: rgba(38, 37, 31, 0.07); color: var(--ink-muted); }

/* ---------------- Stat tiles ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.9rem; margin-bottom: 1rem; }
.stat { position: relative; background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.1rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat > .icon { width: 1.3rem; height: 1.3rem; color: var(--accent); margin-bottom: 0.55rem; }
.stat .n { font-size: 1.85rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; display: block; }
.stat .l { color: var(--ink-muted); font-size: 0.88rem; margin-top: 0.15rem; }
.stat .sub { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.35rem; }
.stat.is-read > .icon { color: var(--read); }
.stat.is-warn { border-color: rgba(138, 90, 16, 0.35); background: var(--warn-wash); }
.stat.is-warn > .icon, .stat.is-warn .n { color: var(--warn); }
.stat.is-bad { border-color: rgba(179, 38, 30, 0.3); background: var(--bad-wash); }
.stat.is-bad > .icon, .stat.is-bad .n { color: var(--bad); }
.stat.is-quiet > .icon { color: var(--ink-faint); }
.stat a { color: inherit; }

/* ---------------- Needs a look ---------------- */
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.signal { display: flex; gap: 0.75rem; align-items: center; padding: 0.7rem 0.9rem; border-radius: var(--radius-md); background: var(--wash); }
.signal > .icon { width: 1.25rem; height: 1.25rem; }
.signal p { margin: 0; flex: 1; }
.signal a.go { font-weight: 600; white-space: nowrap; }
.signal.bad { background: var(--bad-wash); color: var(--bad); }
.signal.warn { background: var(--warn-wash); color: var(--warn); }
.signal.good { background: var(--accent-wash); color: var(--accent-strong); }
.signal.bad a, .signal.warn a, .signal.good a { color: inherit; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 0.25rem 0 0.75rem; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--ink-muted); font-weight: 500; font-size: 0.82rem; border-bottom-color: var(--border-strong); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.site-admin tbody tr:hover td { background: rgba(46, 125, 107, 0.035); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.bar-cell { width: 40%; min-width: 6rem; }
td.actions { white-space: nowrap; margin: 0; }
td.actions .button { margin: 0.1rem 0.2rem 0.1rem 0; }
tr.revoked td { color: var(--ink-faint); }
td .sub { display: block; font-size: 0.8rem; color: var(--ink-muted); }
.who-cell { display: flex; align-items: center; gap: 0.65rem; min-width: 14rem; }
.who-cell a { font-weight: 500; overflow-wrap: anywhere; }
table.list-table td { white-space: nowrap; }
td .chip, .list-table .chip { white-space: nowrap; overflow-wrap: normal; }
svg.hbar { display: block; width: 100%; height: 8px; }
.hbar .track { fill: rgba(38, 37, 31, 0.07); }
.tone-accent, .tone-dict { fill: var(--accent); }
.tone-read { fill: var(--read); }
.tone-bad { fill: var(--bad); }
.tone-warn { fill: #c68a2b; }
.tone-quiet { fill: var(--ink-faint); }
.mini-num { display: flex; align-items: center; gap: 0.6rem; min-width: 7rem; }
.mini-num span { min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.mini-num svg.hbar { flex: 1; min-width: 3rem; }

/* ---------------- Charts ---------------- */
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--ink-faint); font-size: 11px; font-family: var(--font); }
.chart rect:hover { opacity: 0.8; }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; margin: 0 0 0.6rem; font-size: 0.85rem; color: var(--ink-muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend span::before { content: ""; width: 0.75rem; height: 0.75rem; border-radius: 3px; background: var(--accent); }
.legend .k-read::before { background: var(--read); }
.legend .k-bad::before { background: var(--bad); border-radius: 50%; }
.legend .k-warn::before { background: #c68a2b; border-radius: 50%; }
.chart-totals { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--ink-muted); }
.chart-totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }

details.more { margin-top: 0.75rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; margin-bottom: 0.5rem; }
details summary:hover { color: var(--accent-strong); }

/* ---------------- Activity feed (change log) ---------------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-day { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); margin: 1.1rem 0 0.3rem; }
.feed-day:first-child { margin-top: 0; }
.event { display: flex; gap: 0.85rem; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.feed-day + .feed .event:first-child, .feed .event:first-child { border-top: 0; }
.event-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--wash); color: var(--ink-muted); flex: none; }
.event-icon .icon { width: 1rem; height: 1rem; }
.event.good .event-icon { background: var(--accent-tint); color: var(--accent-strong); }
.event.warn .event-icon { background: var(--warn-tint); color: var(--warn); }
.event.bad .event-icon { background: var(--bad-tint); color: var(--bad); }
.event-body { flex: 1; min-width: 0; }
.event-title { margin: 0; font-weight: 500; }
.event-meta { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--ink-muted); display: flex; gap: 0.35rem 1rem; flex-wrap: wrap; }
.event-code { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--ink-faint); font-family: var(--font-mono); letter-spacing: 0; overflow-wrap: anywhere; }
.event-code .chip { font-family: var(--font); }

/* ---------------- Filters and pager ---------------- */
.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(8rem, 1fr)); gap: 0 0.75rem; align-items: end; }
.filters label { margin-top: 0; font-size: 0.85rem; color: var(--ink-muted); font-weight: 500; }
@media (max-width: 1000px) { .filters { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); } .filters label { margin-top: 0.6rem; } }
.toolbar .actions { margin-top: 1rem; }
.result-count { margin: 0 0 0.6rem; color: var(--ink-muted); }
.pager { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.pager a { display: inline-flex; padding: 0.45rem 0.9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); text-decoration: none; color: var(--ink); background: var(--raised); }
.pager a:hover { background: var(--wash); }

/* ---------------- Account page (admin) ---------------- */
.user-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.user-head .who { flex: 1; min-width: 14rem; }
.user-head h1 { margin: 0 0 0.3rem; font-size: 1.5rem; overflow-wrap: anywhere; }
.user-head .meta { display: flex; gap: 0.4rem 1rem; flex-wrap: wrap; align-items: center; margin: 0; font-size: 0.88rem; color: var(--ink-muted); }
.user-head .meta > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.user-grid { display: grid; grid-template-columns: minmax(0, 1fr) 23rem; gap: 1.25rem; align-items: start; }
.user-grid > div > .card:last-child { margin-bottom: 0; }
@media (max-width: 1150px) { .user-grid { grid-template-columns: 1fr; } }
.side-title { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); margin: 0 0 0.6rem; }
.perm { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; padding: 0.1rem 0.55rem; border-radius: var(--radius-pill); margin: 0.1rem 0.25rem 0.1rem 0; background: var(--wash); color: var(--ink-muted); }
.perm.granted { background: var(--accent-tint); color: var(--accent-strong); }
.perm.denied { background: var(--bad-tint); color: var(--bad); }
.perm .icon { width: 0.9em; height: 0.9em; }
.device-status { display: grid; gap: 0.75rem; }
.device-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.9rem 1rem; }
.device-card h3 { margin: 0; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.98rem; }
.device-card .reported { margin: 0.1rem 0 0.6rem; font-size: 0.82rem; color: var(--ink-muted); }
.device-card dl { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.3rem 0.8rem; margin: 0; font-size: 0.88rem; }
.device-card dt { color: var(--ink-muted); }
.device-card dd { margin: 0; }
.cloud-figures { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
.cloud-figures div { display: flex; flex-direction: column; }
.cloud-figures strong { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cloud-figures span { font-size: 0.85rem; color: var(--ink-muted); }

/* ---------------- Problem reports ---------------- */
.report { border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: var(--radius-md); padding: 1rem 1.1rem; margin-bottom: 0.9rem; background: var(--raised); }
.report.resolved { border-left-color: var(--accent); background: var(--surface); }
.report.resolved .report-message { opacity: 0.75; }
.report-head { display: flex; gap: 0.4rem 1rem; flex-wrap: wrap; align-items: center; margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--ink-muted); }
.report-head > span, .report-head > a { display: inline-flex; align-items: center; gap: 0.35rem; }
.report-head strong { color: var(--ink); }
.report-message { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--wash); border-radius: var(--radius-md); padding: 0.8rem 1rem; margin-bottom: 0.6rem; }
.report-foot { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.report-foot details { flex: 1; min-width: 12rem; }
.report-foot > p { margin: 0; }

/* ---------------- Releases ---------------- */
.platform-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.platform-head h2 { margin: 0; }
.platform-icon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: var(--radius-md); background: var(--wash); }
.live-box { border: 1px solid rgba(46, 125, 107, 0.3); background: var(--accent-wash); border-radius: var(--radius-md); padding: 0.9rem 1rem; margin-bottom: 1rem; }
.live-box p { margin: 0 0 0.5rem; }
.live-box table { background: var(--raised); border-radius: var(--radius-sm); }
.empty-box { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); padding: 0.9rem 1rem; color: var(--ink-muted); margin-bottom: 1rem; }
.empty-box p { margin: 0; }
details.card > summary { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin: 0; list-style-position: outside; }
details.card[open] > summary { margin-bottom: 0.75rem; }
.copy-block { font-family: var(--font-mono); font-size: 0.88rem; letter-spacing: 0; background: var(--side); color: #e9e7e0; border-radius: var(--radius-md); padding: 0.8rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 1rem; }
#upload-progress { width: 100%; height: 1.1rem; accent-color: var(--accent); margin-top: 1rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1rem; }

/* ---------------- One-time secrets and codes ---------------- */
.code { font-family: var(--font-mono); font-size: 2.2rem; letter-spacing: 0.14em; text-align: center; padding: 0.7rem 0; margin: 1rem 0; background: var(--wash); border-radius: var(--radius-md); }
.password-once, .link-once, .secret {
  font-family: var(--font-mono); letter-spacing: 0.06em; background: var(--warn-wash); border: 1.5px dashed rgba(138, 90, 16, 0.45);
  border-radius: var(--radius-md); padding: 0.75rem 1rem; overflow-wrap: anywhere; word-break: break-all;
}
.password-once { font-size: 1.35rem; }
.link-once { font-size: 0.95rem; letter-spacing: 0; }
.secret { font-size: 1.15rem; }
.once-card { border-color: rgba(138, 90, 16, 0.35); }
.qr-box { display: inline-block; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.5rem; line-height: 0; margin-bottom: 1rem; }
.qr { display: block; width: 200px; height: 200px; max-width: 100%; }
.codes { font-family: var(--font-mono); columns: 2; list-style: none; padding: 0.75rem 1rem; background: var(--wash); border-radius: var(--radius-md); }
.codes li { padding: 0.15rem 0; }
input.code-input { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: 0.2em; max-width: 12rem; }

/* ---------------- Legal pages ---------------- */
.legal h2 { margin-top: 1.75rem; }
.legal ul { padding-left: 1.25rem; margin: 0 0 1rem; }
.legal li { margin-bottom: 0.35rem; }
ul.legal { padding-left: 1.25rem; }

/* ---------------- Footer ---------------- */
.footer { display: flex; gap: 0.5rem 1.5rem; justify-content: center; flex-wrap: wrap; align-items: center; color: var(--ink-muted); padding: 1.5rem 1.25rem 2rem; font-size: 0.88rem; }
.footer p { margin: 0; }
.footer a { color: inherit; }
.footer-maker a { color: var(--read); font-weight: 700; text-decoration: none; }
.site-admin .footer-maker a { color: inherit; font-weight: 600; }
.footer-links { display: flex; gap: 1rem; }
.site-admin:not(.is-bare) .footer { justify-content: flex-start; border-top: 1px solid var(--border); }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; gap: 0.6rem; } .stat { padding: 0.8rem; } .stat .n { font-size: 1.5rem; } }
