/* Curl — design tokens
   Navy + signal yellow (road-sign / telegraph-slip vernacular). Yellow marks the ONE thing that matters
   on a screen: the short link, the primary action, today's bar. Everything else is navy/slate. */
:root {
    color-scheme: light;
    --navy: #13204a;
    --navy-2: #1d2d60;
    --navy-3: #2a3b74;
    --navy-ink: #b9c3e3;        /* text on navy */
    --paper: #f4f5f7;
    --surface: #ffffff;
    --ink: #1a2238;
    --slate: #5d6680;
    --faint: #8a92a8;
    --rule: #e2e5ec;
    --rule-strong: #cdd2dd;
    --signal: #f2c230;
    --signal-deep: #c99a08;
    --signal-wash: #fdf4d3;
    --good: #1d8a5f;
    --good-wash: #e3f4ec;
    --bad: #bf3434;
    --bad-wash: #fbeaea;

    --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --text: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;

    --r-lg: 14px;   /* big containers */
    --r: 9px;       /* panels, inputs */
    --r-sm: 6px;    /* buttons inside tables, badges */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--text); font-feature-settings: "tnum" 1; }
a { color: var(--navy-3); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--navy); text-decoration: underline; }
.btn:hover, .mark:hover, .nav a:hover, .chip:hover { text-decoration: none; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--slate); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px;
       border: 1px solid transparent; border-radius: var(--r); background: var(--navy); color: #fff;
       font: 600 14px/1 var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
       transition: background-color .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--navy-2); color: #fff; }
.btn svg { width: 16px; height: 16px; }
.btn-signal { background: var(--signal); color: var(--navy); }
.btn-signal:hover { background: #ffd24a; color: var(--navy); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-quiet:hover { background: var(--paper); color: var(--ink); border-color: var(--faint); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #e7b9b9; }
.btn-danger:hover { background: var(--bad-wash); color: var(--bad); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .55; cursor: default; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--slate); }
.input, select.input { height: 42px; width: 100%; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: var(--r);
         background: var(--surface); color: var(--ink); font: 15px var(--text); }
.input:focus { outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(242, 194, 48, .45); }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--navy); }


/* =====================================================================
   PUBLIC SITE
   ===================================================================== */
.site { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.hero { background: var(--navy); color: #fff; position: relative; overflow: hidden; padding-bottom: 64px; }
.hero-coil { position: absolute; right: -120px; top: -40px; width: 620px; height: 620px; color: var(--navy-2); pointer-events: none; overflow: visible; }
.site-head { position: relative; display: flex; align-items: center; justify-content: space-between; height: 72px; }
.mark { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 21px/1 var(--display); letter-spacing: -0.02em; }
.mark:hover { color: #fff; }
.mark svg { width: 30px; height: 30px; }
.site-head .tagline { color: var(--navy-ink); font-size: 13.5px; }

.hero-body { position: relative; padding-top: 56px; max-width: 760px; }
.hero h1 { color: #fff; font-size: clamp(38px, 6.4vw, 68px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; max-width: 12ch; }
.hero .lede { color: var(--navy-ink); font-size: 18px; line-height: 1.5; margin: 20px 0 0; max-width: 46ch; }

.shorten { position: relative; margin-top: 36px; display: flex; gap: 0; background: #fff; border-radius: var(--r-lg); padding: 6px;
           box-shadow: 0 18px 40px -18px rgba(3, 9, 30, .55); max-width: 760px; }
.shorten input { flex: 1; min-width: 0; height: 56px; border: 0; padding: 0 16px; font: 17px var(--text); color: var(--ink); background: transparent; border-radius: var(--r); }
.shorten input:focus { outline: none; }
.shorten:focus-within { box-shadow: 0 0 0 3px var(--signal), 0 18px 40px -18px rgba(3, 9, 30, .55); }
.shorten .btn { height: 56px; padding: 0 26px; font-size: 16px; border-radius: 10px; }
.shorten-zone { position: relative; max-width: 760px; }
.form-coil { position: absolute; left: calc(100% + 40px); top: 50%; width: 540px; height: 540px; transform: translateY(-50%); overflow: visible; color: var(--navy-2); pointer-events: none; }

/* the slip: long link collapses, short link appears */
.slip { position: relative; margin-top: 18px; max-width: 760px; background: var(--surface); color: var(--ink); border-radius: var(--r-lg); padding: 20px 22px; display: grid; gap: 12px; }
.slip-long { font-size: 13.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-long span { display: inline-block; transform-origin: left center; }
.slip.done .slip-long { color: var(--slate); font-weight: 500; }
.slip-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.slip-short { font: 700 clamp(24px, 4vw, 34px)/1.1 var(--display); letter-spacing: -0.02em; color: var(--navy); text-decoration: none;
              background: linear-gradient(transparent 62%, var(--signal) 62%, var(--signal) 92%, transparent 92%); padding: 0 2px; word-break: break-all; }
.slip-short:hover { color: var(--navy); }
.slip-short .host { color: var(--slate); font-weight: 600; }
.slip-actions { display: flex; gap: 8px; }
.slip.play .slip-long span { animation: squeeze .7s cubic-bezier(.6, 0, .3, 1) forwards; }
.slip.play .slip-short { animation: reveal .55s .35s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes squeeze { to { transform: scaleX(.18); letter-spacing: -0.3em; opacity: .35; } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.section { padding: 56px 0 72px; flex: 1; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 28px; letter-spacing: -0.02em; }
.section-head p { margin: 6px 0 0; color: var(--slate); max-width: 60ch; }
.fid { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate); background: var(--surface);
       border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px 6px 10px; }
.fid svg { width: 15px; height: 15px; color: var(--navy-3); }
.fid code { color: var(--ink); font-size: 12.5px; }

.ledger { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.ledger-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 80px 110px 76px; gap: 18px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--rule); }
.ledger-row:first-child { border-top: 0; }
.ledger-head { font-size: 12.5px; color: var(--slate); padding-top: 11px; padding-bottom: 11px; background: #fafbfc; }
.ledger .code { font: 700 19px/1.2 var(--display); color: var(--navy); text-decoration: none; letter-spacing: -0.01em; }
.ledger .code:hover { text-decoration: underline; }
.ledger .dest { min-width: 0; }
.ledger .dest b { display: block; font-weight: 600; font-size: 14.5px; }
.ledger .dest span { display: block; color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger .clicks { font: 600 18px/1 var(--display); text-align: right; }
.ledger .clicks small { display: block; font: 400 12px var(--text); color: var(--faint); margin-top: 3px; }
.ledger .when { font-size: 13px; color: var(--slate); }
.ledger-empty { padding: 44px 20px; text-align: center; color: var(--slate); }
.ledger-empty b { display: block; color: var(--ink); font: 600 17px var(--display); margin-bottom: 4px; }
.tag-off { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--bad); background: var(--bad-wash); border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: 2px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--rule); }
.facts h3 { font-size: 17px; margin-bottom: 6px; }
.facts p { margin: 0; color: var(--slate); font-size: 14.5px; max-width: 34ch; }

.site-foot { border-top: 1px solid var(--rule); padding: 22px 0; font-size: 13px; color: var(--faint); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-foot a { color: var(--slate); }

@media (max-width: 1240px) { .form-coil { left: calc(100% + 16px); width: 380px; height: 380px; } }
@media (max-width: 1100px) { .form-coil { display: none; } }
@media (max-width: 760px) {
    .wrap { padding: 0 16px; }
    .site-head .tagline { display: none; }
    .hero-body { padding-top: 28px; }
    .hero-coil { width: 380px; height: 380px; right: -170px; top: 10px; }
    .form-coil { display: none; }
    .shorten { flex-direction: column; gap: 6px; }
    .shorten input { height: 50px; }
    .shorten .btn { height: 50px; }
    .ledger-head { display: none; }
    .ledger-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
    .ledger .dest { grid-column: 1 / -1; grid-row: 2; }
    .ledger .when { grid-row: 3; }
    .ledger .clicks { text-align: left; grid-row: 3; grid-column: 2; text-align: right; }
    .ledger-row > .copy-cell { grid-row: 1; grid-column: 2; }
    .facts { grid-template-columns: 1fr; gap: 20px; }
}

/* =====================================================================
   ADMIN
   ===================================================================== */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: var(--navy-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; }
.side .mark { padding: 4px 8px 22px; font-size: 19px; }
.side .mark small { font: 500 12px var(--text); color: var(--navy-ink); margin-left: 2px; letter-spacing: 0; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--navy-ink); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; opacity: .8; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
.nav a[aria-current="page"] svg { opacity: 1; color: var(--signal); }
.nav-sep { height: 1px; background: var(--navy-2); margin: 12px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--navy-2); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-3); color: #fff; display: grid; place-items: center; font: 700 13px var(--display); flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { font-size: 12px; }
.side-foot button { color: var(--navy-ink); padding: 6px; border-radius: 6px; }
.side-foot button:hover { background: var(--navy-2); color: #fff; }
.side-foot button svg { width: 18px; height: 18px; }

.main { min-width: 0; padding: 28px 36px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; letter-spacing: -0.025em; }
.page-head p { margin: 4px 0 0; color: var(--slate); font-size: 14.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.panel-head h2 { font-size: 17px; }
.panel-head a { font-size: 13.5px; font-weight: 500; }
.panel-body { padding: 16px 20px 20px; }
.panel > .data { margin-top: 8px; }
.panel-note { padding: 0 20px 16px; font-size: 13px; color: var(--slate); }

/* stats strip: one panel, four figures split by rules (not four cards) */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 20px 22px; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; }
.stat .label { font-size: 13px; color: var(--slate); }
.stat .value { font: 700 34px/1.1 var(--display); letter-spacing: -0.03em; margin-top: 6px; color: var(--ink); }
.stat .delta { font-size: 12.5px; color: var(--slate); margin-top: 4px; }
.stat .delta b { color: var(--good); font-weight: 600; }

/* bar chart */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 190px; padding: 22px 20px 0; position: relative; }
.chart::before { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; border-bottom: 1px solid var(--rule-strong); }
.bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar i { display: block; width: 100%; max-width: 38px; min-height: 2px; background: var(--navy-3); border-radius: 4px 4px 0 0; opacity: .85; transition: opacity .15s; }
.bar.today i { background: var(--signal); opacity: 1; }
.bar:hover i { opacity: 1; }
.bar .v { font-size: 11.5px; color: var(--slate); margin-bottom: 4px; font-weight: 600; }
.chart-axis { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; padding: 8px 20px 18px; font-size: 11.5px; color: var(--faint); text-align: center; }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
.stack { display: grid; gap: 20px; margin-bottom: 20px; }

/* tables */
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--slate); padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: #fafbfc; }
.data th:first-child, .data td:first-child { padding-left: 20px; }
.data th:last-child, .data td:last-child { padding-right: 20px; }
.data td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover td { background: #fafbfd; }
.data .code { font: 700 15px var(--display); color: var(--navy); text-decoration: none; letter-spacing: -0.005em; }
.data .code:hover { text-decoration: underline; }
.data .clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data .sub { display: block; color: var(--faint); font-size: 12.5px; }
.data .empty { text-align: center; padding: 36px 20px; color: var(--slate); }
.data .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ip { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fp { font-family: var(--mono); font-size: 12.5px; color: var(--navy-3); text-decoration: none; }
.fp:hover { text-decoration: underline; }

/* rank list (top links / IPs) */
.rank { list-style: none; margin: 0; padding: 6px 20px 14px; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 0; border-top: 1px solid var(--rule); align-items: center; }
.rank li:first-child { border-top: 0; }
.rank .meter { grid-column: 1 / -1; height: 3px; background: var(--paper); border-radius: 2px; overflow: hidden; }
.rank .meter i { display: block; height: 100%; background: #7e8cc0; border-radius: 2px; }
.rank .count { font: 600 15px var(--display); }
.rank .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rank .label small { color: var(--faint); margin-left: 6px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-admin { background: var(--navy); color: #fff; }
.badge-subadmin { background: var(--signal-wash); color: #7a5b00; }
.badge-viewer { background: var(--paper); color: var(--slate); border: 1px solid var(--rule-strong); }
.badge-on { background: var(--good-wash); color: var(--good); }
.badge-off { background: var(--bad-wash); color: var(--bad); }
.badge-on::before, .badge-off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.filters .input { height: 38px; width: auto; min-width: 150px; font-size: 14px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters .count { margin-left: auto; font-size: 13px; color: var(--slate); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; height: 38px; }
.seg a { display: grid; place-items: center; padding: 0 13px; font-size: 13.5px; color: var(--slate); text-decoration: none; border-left: 1px solid var(--rule-strong); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current="true"] { background: var(--navy); color: #fff; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--slate); }
.pager div { display: flex; gap: 8px; }

/* detail blocks */
.facts-list { display: grid; grid-template-columns: 160px 1fr; margin: 0; }
.facts-list dt, .facts-list dd { padding: 11px 20px; border-top: 1px solid var(--rule); margin: 0; font-size: 14px; }
.facts-list dt { color: var(--slate); padding-right: 0; }
.facts-list dt:first-of-type, .facts-list dt:first-of-type + dd { border-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule); font-size: 13px; color: var(--ink); text-decoration: none; }
.chip small { color: var(--faint); }
.chip:hover { border-color: var(--rule-strong); color: var(--ink); }

.link-summary { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 18px 20px; }
.link-summary .big { font: 700 26px/1.1 var(--display); color: var(--navy); letter-spacing: -0.02em; }
.link-summary .to { color: var(--slate); font-size: 14px; word-break: break-all; margin-top: 4px; }

/* forms in admin */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.role-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-pick label { display: grid; gap: 3px; align-content: start; padding: 11px 12px 11px 36px; border: 1px solid var(--rule-strong); border-radius: var(--r); cursor: pointer; position: relative; font-size: 13px; color: var(--slate); font-weight: 400; }
.role-pick label b { color: var(--ink); font-size: 14px; }
.role-pick input { position: absolute; left: 12px; top: 13px; accent-color: var(--navy); width: 16px; height: 16px; }
.role-pick label:has(input:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: #f7f8fc; }
.role-pick label:has(input:disabled) { opacity: .6; cursor: default; }
.narrow { max-width: 720px; }
.danger-zone { border-color: #efcaca; }
.danger-zone .panel-body { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.danger-zone p { margin: 0; color: var(--slate); font-size: 14px; max-width: 52ch; }

.empty-state { max-width: 460px; margin: 80px auto; text-align: center; }
.empty-state h2 { font-size: 24px; margin-bottom: 8px; }
.empty-state p { color: var(--slate); margin: 0 0 20px; }

/* login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--navy); color: var(--navy-ink); position: relative; overflow: hidden; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .hero-coil { right: -180px; top: auto; bottom: -200px; width: 640px; height: 640px; }
.login-art h1 { position: relative; color: #fff; font-size: clamp(30px, 3.2vw, 44px); line-height: 1.08; letter-spacing: -0.03em; max-width: 14ch; }
.login-art p { position: relative; max-width: 38ch; margin: 14px 0 0; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login-form h2 { font-size: 26px; letter-spacing: -0.02em; }
.login-form .btn { height: 46px; font-size: 15px; }

@media (max-width: 1100px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; overflow-x: auto; }
    .side .mark { padding: 0 6px 0 2px; }
    .side .mark small { display: none; }
    .nav { display: flex; gap: 2px; }
    .nav a { padding: 8px 10px; white-space: nowrap; }
    .nav a span { display: none; }
    .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--signal); }
    .nav-sep { display: none; }
    .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
    .side-foot .who { display: none; }
    .main { padding: 20px 16px 48px; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { min-height: 220px; padding: 28px 24px; }
    .form-grid, .role-pick { grid-template-columns: 1fr; }
    .facts-list { grid-template-columns: 1fr; }
    .facts-list dt { padding-bottom: 0; border-top: 1px solid var(--rule); }
    .facts-list dd { border-top: 0; padding-top: 2px; }
}
@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .stat .value { font-size: 26px; }
    .chart { gap: 3px; padding: 18px 12px 0; height: 150px; }
    .chart::before { left: 12px; right: 12px; }
    .chart-axis { gap: 3px; padding: 8px 12px 14px; font-size: 10px; }
    .chart .v { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
.rank a.code { font: 700 15px var(--display); color: var(--navy); text-decoration: none; }
.rank a.code:hover { text-decoration: underline; }

/* ---------- analytics ---------- */
.stats-flat { border-top: 1px solid var(--rule); }
.linechart { position: relative; margin: 14px 20px 0 64px; height: 280px; outline: none; }
.linechart:focus-visible { box-shadow: 0 0 0 3px var(--signal); border-radius: 6px; }
.linechart svg { position: absolute; inset: 0 0 26px 0; width: 100%; height: calc(100% - 26px); overflow: visible; }
.linechart .grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.linechart .grid.base { stroke: var(--rule-strong); }
.linechart .area { fill: rgba(42, 59, 116, .10); }
.linechart .line { fill: none; stroke: var(--navy-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .cross { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.lc-y { position: absolute; left: -64px; top: 0; bottom: 26px; width: 56px; }
.lc-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.lc-x { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; }
.lc-x span { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.lc-x span:last-child { transform: translateX(-100%); }
.lc-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
          background: var(--navy-3); box-shadow: 0 0 0 2px var(--surface); }
.lc-dot.today { background: var(--signal); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--signal-deep); }
.lc-plot { position: absolute; inset: 0 0 26px 0; pointer-events: none; }
.tip { position: absolute; top: -6px; z-index: 3; display: grid; gap: 1px; padding: 8px 11px; background: var(--navy); color: #fff; border-radius: 8px;
       font-size: 12.5px; line-height: 1.4; pointer-events: none; white-space: nowrap; box-shadow: 0 8px 20px -10px rgba(3, 9, 30, .6); }
.tip b { font-weight: 600; }
.tip span { color: var(--navy-ink); }
.tip.floating { position: absolute; transform: translate(-50%, -100%); top: 0; }
.table-view { padding: 6px 20px 16px; }
.table-view summary { cursor: pointer; font-size: 13.5px; color: var(--navy-3); font-weight: 500; padding: 6px 0; }
.table-view .data { margin-top: 8px; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.table-view .table-wrap { max-height: 360px; overflow: auto; }

.heat-wrap { padding: 16px 20px 18px; overflow-x: auto; }
.heat { display: grid; grid-template-columns: 38px repeat(24, minmax(16px, 1fr)); gap: 3px; min-width: 560px; }
.heat i { display: block; aspect-ratio: 1.6; border-radius: 3px; min-height: 14px; }
.heat i:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat .wd { font-size: 12px; color: var(--slate); align-self: center; }
.heat .hh { font-size: 11px; color: var(--faint); text-align: left; }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12px; color: var(--slate); justify-content: flex-end; }
.heat-legend i { width: 18px; height: 12px; border-radius: 3px; display: block; }
.heat-legend span { margin: 0 4px; }

/* ---------- API page ---------- */
.doc h3 { font-size: 15px; margin: 22px 0 6px; }
.doc h3:first-child { margin-top: 0; }
.doc p { margin: 0 0 8px; color: var(--slate); font-size: 14px; max-width: 72ch; }
.doc pre { margin: 0 0 6px; padding: 12px 14px; background: #0f1a3d; color: #e6e9f5; border-radius: var(--r); overflow-x: auto; font: 12.8px/1.55 var(--mono); }
.doc pre .c { color: #8f9bc4; }
.doc table { margin: 4px 0 8px; }
@media (max-width: 560px) { .linechart { margin-left: 52px; margin-right: 12px; height: 220px; } .lc-y { left: -52px; width: 46px; } }

/* ---------- abuse / human check ---------- */
.human-check { margin-top: 14px; min-height: 65px; }
.disclaimer { margin: 12px 0 0; max-width: 760px; font-size: 13px; color: var(--navy-ink); line-height: 1.5; }
.disclaimer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.report-form { display: grid; gap: 16px; max-width: 620px; }
.report-form textarea.input { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.legal { max-width: 68ch; color: var(--slate); font-size: 14.5px; }
.legal h3 { color: var(--ink); font-size: 16px; margin: 22px 0 6px; }
.legal ul { padding-left: 20px; margin: 6px 0; }
.page-plain { background: var(--navy); color: #fff; padding-bottom: 36px; }
.page-plain h1 { color: #fff; font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.03em; margin-top: 30px; }
.page-plain p { color: var(--navy-ink); max-width: 60ch; margin: 10px 0 0; font-size: 16px; }
.nav .count-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--signal); color: var(--navy); font: 700 11.5px/20px var(--text); text-align: center; }
.badge-new { background: var(--signal-wash); color: #7a5b00; }
.badge-resolved { background: var(--good-wash); color: var(--good); }
.badge-dismissed { background: var(--paper); color: var(--slate); border: 1px solid var(--rule-strong); }
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 420px; font-size: 13.5px; }

/* ---------- FAQ ---------- */
.faq { margin-top: 56px; max-width: 760px; }
.faq h2 { font-size: 24px; letter-spacing: -0.02em; margin-bottom: 12px; }
.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font: 600 16px/1.4 var(--display); color: var(--ink); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font: 400 24px/1 var(--text); color: var(--slate); transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--slate); max-width: 64ch; }

/* =====================================================================
   TOASTS (sticky notifications) + MODALS — driven by wwwroot/ui.js
   ===================================================================== */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 1000; display: grid; gap: 10px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: 20px 1fr 24px; gap: 10px; align-items: start; padding: 12px 12px 12px 14px;
         background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-left-width: 1px; border-radius: 12px;
         box-shadow: 0 14px 34px -14px rgba(3, 9, 30, .38); font-size: 14px; line-height: 1.45; animation: toast-in .2s cubic-bezier(.2,.8,.2,1); }
.toast svg { width: 20px; height: 20px; margin-top: 1px; }
.toast-text { min-width: 0; overflow-wrap: anywhere; }
.toast-text b { font-weight: 600; }
.toast-x { background: none; border: 0; padding: 0; width: 24px; height: 24px; border-radius: 6px; font: 400 20px/1 var(--text); color: var(--faint); cursor: pointer; }
.toast-x:hover { background: var(--paper); color: var(--ink); }
.toast-ok svg { color: var(--good); }
.toast-error { background: #fffafa; border-color: #efc4c4; }
.toast-error svg { color: var(--bad); }
.toast-warn { background: #fffdf4; border-color: #efdb98; }
.toast-warn svg { color: var(--signal-deep); }
.toast-info svg { color: var(--navy-3); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 560px) { .toasts { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; } }

dialog.modal { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px));
               max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 30px 70px -20px rgba(3, 9, 30, .55); }
dialog.modal.modal-sm { width: min(440px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 17, 40, .55); }
dialog.modal[open] { animation: modal-in .18s cubic-bezier(.2,.8,.2,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-box { padding: 24px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-title { font-size: 21px; letter-spacing: -0.02em; margin: 0; }
.modal-text { margin: 0; color: var(--slate); font-size: 14.5px; line-height: 1.55; }
.modal-x { background: none; border: 0; width: 32px; height: 32px; margin: -6px -8px 0 0; border-radius: 8px; font: 400 24px/1 var(--text); color: var(--faint); cursor: pointer; }
.modal-x:hover { background: var(--paper); color: var(--ink); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.btn-danger-solid { background: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #a42a2a; color: #fff; }
.modal .form-grid { gap: 14px; }
.modal-key { display: block; font: 14px/1.5 var(--mono); padding: 12px 14px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r); overflow-wrap: anywhere; color: var(--ink); }
.modal-note { font-size: 13px; color: #6b5000; background: var(--signal-wash); border-radius: var(--r); padding: 9px 12px; margin: 0; }
.modal-ref { font: 700 28px/1 var(--display); letter-spacing: .04em; color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .toast, dialog.modal[open] { animation: none; } }
