/* =============================================================================
   WANPORTS Admin Console stylesheet — v2 (unified staff shell).

   One shell for the whole staff experience: the website console and the TradeFlow
   workbench share the same tokens, the same left rail + top bar (this file mirrors
   tradeflow.css §1–2, §4–5 of wanports-tradeflow-docs A1/A2.1) and the same motion
   rules, so moving between "Website" and "Documents" never looks like a second
   system. Sharper than v1 on purpose (the SpaceX brief): black ground, square
   fields, 8 px cards, mono uppercase micro-labels, amber reserved for the primary
   action and the active item.

   Class contract: every selector the admin templates and the integration tests
   rely on is preserved (admin-*, auth-*, nav-item*, module-*, role-chip*,
   form-field, btn*, alert*, error-*, data-table, status-chip, workflow-*). Only the
   visual treatment changed. System font stack only — no external fonts, no CDN.
   Motion is CSS-only and fully off under prefers-reduced-motion.
   ========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */
:root {
    --bg-0: #000000;
    --bg-1: #05070c;
    --panel: #0a0f18;
    --panel-2: #0d1522;
    --navy-800: #12304f;
    --amber: #d9962e;
    --amber-bright: #f0b95e;
    --ink-on-amber: #2a1a04;
    --text: #e8eef5;
    --text-soft: #93a5bb;
    --text-dim: #6b7d94;
    --line-soft: rgba(232, 238, 245, 0.09);
    --line-mid: rgba(232, 238, 245, 0.16);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-strong: rgba(255, 255, 255, 0.10);
    --ok: #7fd1a8;
    --warn: #f0b95e;
    --bad: #ff8a70;
    --info: #4fc3f7;
    --radius-lg: 8px;
    --radius-md: 4px;
    --radius-pill: 999px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --rail-w: 232px;
    --top-h: 54px;
    --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ------------------------------------------------------------------ 2. base */
* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    background-color: var(--bg-0);
    font-family: var(--font-stack);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    color-scheme: dark;
}

img { max-width: 100%; }
a { color: var(--amber-bright); }
a:hover { color: #fff; }
button { font-family: inherit; }

h1 { margin: 0 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
h2 { margin: 0 0 12px; font-size: 15.5px; font-weight: 700; letter-spacing: -0.005em; color: #fff; }
.zh { font-family: var(--font-stack); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-soft); }
h1 .zh { font-size: 13px; margin-left: 8px; font-weight: 500; }
h2 .zh { font-size: 12.5px; margin-left: 6px; }

:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: 2px; }

/* ----------------------------------------------------------------- 3. shell */
/* body.admin-body carries the shell: rail on the left, top bar above, dotted grid
   on the canvas and one slow-drifting glow — the same canvas as the TradeFlow
   workbench. */
body.admin-body {
    min-height: 100vh;
    padding-left: var(--rail-w);
    padding-top: var(--top-h);
    background-image: radial-gradient(rgba(232, 238, 245, .045) 1px, transparent 1.2px);
    background-size: 22px 22px;
    background-attachment: fixed;
}
body.admin-body::after {
    content: ""; position: fixed; width: 900px; height: 900px; left: -300px; top: -400px;
    pointer-events: none; z-index: -1; border-radius: 50%;
    background: radial-gradient(circle, rgba(18, 48, 79, .5), transparent 60%);
    animation: wp-drift 26s ease-in-out infinite alternate;
}
@keyframes wp-drift { from { transform: translate(0, 0); } to { transform: translate(260px, 180px); } }

.tf-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--amber-bright); color: var(--ink-on-amber); border-radius: var(--radius-md); }
.tf-skip:focus { left: 8px; }

/* rail */
.tf-rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w); z-index: 30;
    display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 12px; overflow-y: auto;
    background: linear-gradient(180deg, rgba(5, 7, 12, .98), rgba(0, 0, 0, .98));
    border-right: 1px solid var(--line-soft);
}
.tf-rail .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: var(--text); }
.tf-rail .brand-word { font-weight: 800; letter-spacing: .08em; font-size: 15.5px; color: #fff; }
.tf-rail .brand-pill { padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid rgba(240, 185, 94, .5); font-family: var(--mono); font-size: 9px; letter-spacing: .16em; color: var(--amber-bright); }
.tf-rail .grp { font-family: var(--mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-soft); padding: 12px 10px 4px; opacity: .8; }
.tf-nav { display: flex; flex-direction: column; gap: 2px; }
.tf-nav a, .tf-nav .nav-item-disabled {
    position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px;
    padding: 8px 10px 8px 12px; border-radius: var(--radius-md); border: 1px solid transparent;
    color: var(--text-soft); font-size: 13.5px; font-weight: 600; text-decoration: none; line-height: 1.25;
    transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.tf-nav a:hover { background: var(--glass); color: var(--text); transform: translateX(2px); }
.tf-nav a[aria-current="page"], .tf-nav .nav-item-active { color: var(--amber-bright); background: rgba(240, 185, 94, .09); border-color: rgba(240, 185, 94, .28); }
.tf-nav a::before { content: ""; position: absolute; left: -12px; top: 22%; height: 56%; width: 3px; border-radius: 3px; background: var(--amber-bright); opacity: 0; transform: scaleY(.2); transition: opacity .2s, transform .25s var(--ease-out); box-shadow: 0 0 12px rgba(240, 185, 94, .7); }
.tf-nav a[aria-current="page"]::before { opacity: 1; transform: scaleY(1); }
.tf-nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tf-nav .zh { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-soft); margin-top: -1px; }
.tf-nav a[aria-current="page"] .zh { color: rgba(240, 185, 94, .75); }
.tf-nav .cnt { font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-mid); color: var(--text-soft); }
.tf-nav .nav-item-disabled { opacity: .42; cursor: default; }
.tf-nav .ext { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.tf-rail .tele { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--text-soft); display: grid; gap: 6px; }
.tf-rail .tele .row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: baseline; }
.tf-rail .tele .row > span:first-child { white-space: nowrap; }
.tf-rail .tele .row > span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-led { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(127, 209, 168, .8); margin-right: 6px; vertical-align: middle; animation: wp-blink 3.2s ease-in-out infinite; }
.tf-led.warn { background: var(--warn); box-shadow: 0 0 8px rgba(240, 185, 94, .8); }
.tf-led.off { background: var(--text-dim); box-shadow: none; animation: none; }
@keyframes wp-blink { 0%, 90%, 100% { opacity: 1; } 95% { opacity: .35; } }

/* top bar: crumbs, clock, jump, who, sign out; a single amber scan on page load */
.tf-top {
    position: fixed; top: 0; left: var(--rail-w); right: 0; height: var(--top-h); z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 22px;
    background: rgba(5, 7, 12, .85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
}
.tf-top::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 22%; background: linear-gradient(90deg, transparent, var(--amber-bright), transparent); opacity: 0; animation: wp-scan 1.1s var(--ease-out) .1s 1; }
@keyframes wp-scan { 0% { left: -22%; opacity: 0; } 15% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
.tf-top .crumbs { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-top .crumbs b { color: var(--text); font-weight: 700; }
.tf-top .right { display: flex; align-items: center; gap: 12px; }
.tf-top .clock { font-family: var(--mono); font-size: 11px; color: var(--text-soft); letter-spacing: .06em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tf-kbtn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: var(--radius-md); border: 1px solid var(--line-mid); background: var(--glass); color: var(--text-soft); font-size: 12.5px; cursor: pointer; transition: border-color .18s, color .18s; white-space: nowrap; }
.tf-kbtn:hover { border-color: rgba(240, 185, 94, .5); color: var(--text); }
.tf-kbtn kbd { font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line-mid); }
.tf-who { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }
.tf-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--amber-bright), var(--amber)); color: var(--ink-on-amber); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; letter-spacing: .02em; }
.tf-logout, .admin-logout-form .btn { padding: 6px 11px; border-radius: var(--radius-md); border: 1px solid var(--line-mid); background: transparent; color: var(--text-soft); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .18s, color .18s; }
.tf-logout:hover, .admin-logout-form .btn:hover { border-color: rgba(255, 138, 112, .6); color: var(--bad); transform: none; }
.admin-logout-form { margin: 0; }
.tf-menu { display: none; width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--line-mid); background: var(--glass); color: var(--text); font-size: 18px; cursor: pointer; }

/* jump palette (⌘K) */
.tf-palette { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tf-palette[hidden] { display: none; }
.tf-palette .box { width: min(640px, 92vw); background: var(--panel); border: 1px solid var(--line-mid); border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; animation: wp-in .18s ease-out; }
.tf-palette input { width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); font-size: 15px; font-family: inherit; border-radius: 0; }
.tf-palette input:focus { outline: none; }
.tf-palette ul { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow: auto; }
.tf-palette li { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; font-size: 13.5px; color: var(--text); }
.tf-palette li .k { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); }
.tf-palette li:hover, .tf-palette li.sel { background: rgba(240, 185, 94, .1); color: var(--amber-bright); }
.tf-palette li.empty { color: var(--text-soft); cursor: default; }
.tf-palette li.empty:hover { background: transparent; color: var(--text-soft); }

/* responsive shell */
@media (max-width: 960px) {
    body.admin-body { padding-left: 0; }
    .tf-rail { transform: translateX(-100%); transition: transform .22s ease-out; box-shadow: none; }
    body.tf-rail-open .tf-rail { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
    .tf-top { left: 0; padding: 0 14px; }
    .tf-menu { display: inline-flex; align-items: center; justify-content: center; }
    .tf-top .clock, .tf-who span:not(.tf-avatar) { display: none; }
}

/* legacy topbar (login / error pages that have no rail) */
.admin-topbar { position: sticky; top: 0; z-index: 20; background: var(--bg-1); border-bottom: 1px solid var(--line-soft); }
.admin-topbar-inner { max-width: 1240px; margin: 0 auto; padding: 12px 26px; display: flex; align-items: center; gap: 16px; }
.admin-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.admin-brand-name { font-size: 17px; font-weight: 800; letter-spacing: 0.06em; color: #fff; }
.admin-brand-scope { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber-bright); border: 1px solid rgba(240, 185, 94, 0.35); background: rgba(240, 185, 94, 0.07); padding: 4px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.admin-topbar-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.admin-topbar-username { font-size: 13.5px; font-weight: 600; color: var(--text-soft); }

/* ------------------------------------------------------------- 4. page frame */
.admin-main { max-width: 1280px; margin: 0 auto; padding: 26px 28px 60px; min-width: 0; animation: wp-in .28s ease-out both; }
.admin-main-narrow { max-width: 820px; }
.admin-intro { margin: 0 0 22px; color: var(--text-soft); font-size: 14px; max-width: 78ch; }
.admin-back { margin: 0 0 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }
.admin-back a { color: var(--text-soft); text-decoration: none; }
.admin-back a:hover { color: var(--amber-bright); }
.admin-hint { margin: 14px 0 0; font-size: 12.5px; color: var(--text-soft); }
.setting-meta { margin: 0 0 22px; }
.setting-meta .admin-intro { margin: 0 0 6px; }
.setting-meta .admin-hint { margin: 0; }
@keyframes wp-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* legacy two-column shell (kept for compatibility; the rail replaces it) */
.admin-shell { max-width: none; margin: 0; padding: 0; display: block; }
.admin-sidenav { display: none; }
.admin-shell .admin-main { max-width: 1280px; margin: 0 auto; padding: 26px 28px 60px; }

/* ------------------------------------------------------------- 5. overview */
.admin-identity { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.admin-identity-line { margin: 0; font-size: 14px; color: var(--text-soft); }
.admin-identity-line strong { color: #fff; }
.admin-identity-username { color: var(--text-soft); }
.role-chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.role-chip { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; color: var(--amber-bright); border: 1px solid rgba(240, 185, 94, 0.4); background: rgba(240, 185, 94, 0.07); padding: 4px 11px; border-radius: var(--radius-pill); }

.tf-kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tf-kpi { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 16px 18px; position: relative; overflow: hidden; transition: transform .2s, border-color .2s; animation: wp-in .4s var(--ease-out) both; }
.tf-kpi:nth-child(2) { animation-delay: .05s; } .tf-kpi:nth-child(3) { animation-delay: .1s; } .tf-kpi:nth-child(4) { animation-delay: .15s; }
.tf-kpi:hover { transform: translateY(-2px); border-color: var(--line-mid); }
.tf-lbl { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); }
.tf-lbl .zh { font-size: 11px; color: var(--text-dim); margin-left: 6px; }
.tf-kpi .n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; color: #fff; }
.tf-kpi .d { font-size: 12px; color: var(--text-soft); }
.tf-kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line-mid); }
.tf-kpi.warn::after { background: var(--warn); } .tf-kpi.info::after { background: var(--info); }
.tf-kpi.ok::after { background: var(--ok); } .tf-kpi.bad::after { background: var(--bad); }
.tf-grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .tf-grid-2, .tf-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tf-grid-2 { grid-template-columns: 1fr; } }

.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.module-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 20px 22px; transition: transform .22s var(--ease-out), border-color .22s; animation: wp-in .45s var(--ease-out) both; }
.module-card:nth-child(1) { animation-delay: .04s; } .module-card:nth-child(2) { animation-delay: .08s; } .module-card:nth-child(3) { animation-delay: .12s; }
.module-card:nth-child(4) { animation-delay: .16s; } .module-card:nth-child(5) { animation-delay: .2s; } .module-card:nth-child(6) { animation-delay: .24s; }
.module-card:nth-child(n+7) { animation-delay: .28s; }
.module-card:hover { transform: translateY(-3px); border-color: rgba(240, 185, 94, 0.3); }
.module-card h2 { margin: 0 0 8px; font-size: 15px; }
.module-note { margin: 0 0 12px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-soft); line-height: 1.7; }
.module-card p:last-child { margin: 0; }

.tf-quick { display: grid; gap: 8px; }
.tf-quick a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--line-soft); background: var(--glass); color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 600; transition: border-color .15s, transform .15s; }
.tf-quick a:hover { border-color: rgba(240, 185, 94, .45); transform: translateX(2px); color: var(--text); }
.tf-quick a .zh { display: block; font-size: 11px; font-weight: 500; color: var(--text-soft); }
.tf-quick a .arrow { color: var(--amber-bright); font-family: var(--mono); }
.tf-facts { margin: 0; display: grid; gap: 10px; }
.tf-facts .fact { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 13px; }
.tf-facts dt { color: var(--text-soft); font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.tf-facts dd { margin: 0; }
.tf-empty { padding: 26px 10px; text-align: center; color: var(--text-soft); font-size: 13px; }

/* ----------------------------------------------------------------- 6. cards */
.admin-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 18px; min-width: 0; transition: border-color .2s; }
.admin-card:hover { border-color: var(--line-mid); }
.admin-card h2 { margin: 0 0 12px; }
.admin-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-card-head h2 { margin: 0; }
.admin-logo-preview { display: block; margin: 10px 0 20px; padding: 16px 20px; background: #ffffff; border: 1px solid var(--line-mid); border-radius: var(--radius-md); }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; margin: 0; }
.fact { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.fact dt { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 4px; }
.fact dd { margin: 0; font-size: 14px; word-break: break-word; }
.message-block { margin: 0; padding: 14px 16px; border-radius: var(--radius-md); background: var(--bg-1); border: 1px solid var(--line-soft); font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: var(--text-soft); white-space: pre-wrap; word-break: break-word; }

/* ----------------------------------------------------------------- 7. forms */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft); }
.form-field input, .form-field textarea, .form-field select {
    width: 100%; padding: 10px 12px; border-radius: 0;
    background: rgba(255, 255, 255, .04); border: 1px solid var(--line-mid);
    color: var(--text); font-family: inherit; font-size: 14px; font-weight: 500;
    transition: border-color 0.2s ease, box-shadow .2s ease;
}
.form-field textarea { resize: vertical; min-height: 108px; line-height: 1.6; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-dim); }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { outline: none; border-color: rgba(240, 185, 94, 0.6); box-shadow: 0 0 0 3px rgba(240, 185, 94, .15); }
.form-field select option { background: var(--panel-2); color: var(--text); }
.form-field input[type="file"] { padding: 9px 12px; font-size: 13px; color: var(--text-soft); }
.form-field input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 15px; border-radius: var(--radius-md); border: 1px solid var(--line-mid); background: var(--glass-strong); color: var(--text); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* Bare controls outside .form-field — the audit filter bar and the inline row forms
   in tables — get the same square, dark field treatment; without this they fall
   back to the browser's white boxes (UI round 2 fix, seen on Accounts / Audit log). */
.filter-row select, .filter-row input:not([type="hidden"]),
.inline-form select, .inline-form input:not([type="hidden"]) {
    padding: 8px 11px; min-height: 36px; border-radius: 0;
    background: rgba(255, 255, 255, .04); border: 1px solid var(--line-mid);
    color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 500;
    transition: border-color 0.2s ease, box-shadow .2s ease;
}
.filter-row select, .inline-form select {
    min-width: 200px; padding-right: 34px; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a5bb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px;
}
.filter-row select option, .inline-form select option { background: var(--panel-2); color: var(--text); }
.filter-row input::placeholder, .inline-form input::placeholder { color: var(--text-dim); }
.filter-row select:focus, .filter-row input:focus, .inline-form select:focus, .inline-form input:focus {
    outline: none; border-color: rgba(240, 185, 94, 0.6); box-shadow: 0 0 0 3px rgba(240, 185, 94, .15);
}
.filter-row input[type="text"] { width: 200px; }
.filter-row .admin-hint, .inline-form .admin-hint {
    margin: 0; font-family: var(--mono); font-size: 9.5px; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft);
}
.filter-row .admin-hint + select, .filter-row .admin-hint + input { margin-right: 10px; }

/* Row actions inside tables (Accounts): buttons on one line, the password reset
   as a compact inline form underneath instead of the two-column field grid. */
.row-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.row-actions .status-form { margin-top: 0; flex-wrap: nowrap; }
.inline-form { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-soft); }
.inline-form input[type="password"] { width: 168px; }
/* the label stays for screen readers and the click target; the placeholder carries the cue */
.inline-form .admin-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.data-table .btn { padding: 7px 13px; font-size: 12.5px; white-space: nowrap; }
.data-table .mono-cell { white-space: nowrap; }
.data-table td:last-child { width: 1%; }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.workflow-reason { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.workflow-reason .form-field { margin-bottom: 12px; }
.status-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* --------------------------------------------------------------- 8. buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-md); border: 1px solid transparent;
    font-family: inherit; font-size: 13.5px; font-weight: 700; text-decoration: none; line-height: 1.2;
    cursor: pointer; transition: transform 0.15s var(--ease-out), filter 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .42; cursor: not-allowed; transform: none; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--amber-bright), var(--amber)); color: var(--ink-on-amber); }
.btn-primary:hover { color: var(--ink-on-amber); }
.btn-secondary { background: var(--glass); color: var(--text); border-color: var(--line-mid); }
.btn-secondary:hover { border-color: rgba(240, 185, 94, 0.5); color: var(--text); }
/* R3-1: the one destructive button the console has (media delete) — bordered in the
   "bad" hue so it never reads as the ordinary action of a page. */
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(255, 138, 112, .55); }
.btn-danger:hover { background: rgba(255, 138, 112, .10); border-color: var(--bad); color: var(--bad); }
.btn-block { width: 100%; }
.btn .zh { font-size: 12px; opacity: .8; margin-left: 2px; font-weight: 600; color: inherit; }

/* ------------------------------------------------------ 9. alerts and flashes */
.alert, .admin-flash { border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 18px; font-size: 13.5px; border: 1px solid; animation: wp-in .3s ease-out both; }
.alert-error, .admin-flash-error { color: var(--bad); border-color: rgba(255, 138, 112, 0.45); background: rgba(255, 138, 112, 0.08); }
.alert-success, .admin-flash-success { color: var(--ok); border-color: rgba(127, 209, 168, 0.45); background: rgba(127, 209, 168, 0.08); }
.tf-notice { background: rgba(240, 185, 94, .08); border: 1px solid rgba(240, 185, 94, .45); color: var(--amber-bright); padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 18px; }
.tf-notice a { color: inherit; font-weight: 700; }

/* ---------------------------------------------------------------- 10. tables */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 9px 10px; white-space: nowrap; border-bottom: 1px solid var(--line-mid); font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft); }
.data-table th .zh { font-size: 10.5px; color: var(--text-dim); margin-left: 6px; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--glass); }
.cell-sub { font-family: var(--mono); font-size: 10px; color: var(--text-soft); margin-left: 6px; }
.mono-cell { font-family: var(--mono); font-size: 12px; color: var(--text-soft); }
.mono-link { font-family: var(--mono); font-size: 12px; text-decoration: none; }
.mono-link:hover { text-decoration: underline; }

.status-chip { display: inline-flex; align-items: center; white-space: nowrap; font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-mid); color: var(--text-soft); background: var(--glass); }
.status-new, .status-in-review { color: var(--info); border-color: rgba(79, 195, 247, 0.45); background: rgba(79, 195, 247, 0.09); }
.status-in-review { animation: wp-pulse 2.6s ease-in-out infinite; }
.status-quoted, .status-draft { color: var(--amber-bright); border-color: rgba(240, 185, 94, 0.45); background: rgba(240, 185, 94, 0.09); }
.status-won, .status-published { color: var(--ok); border-color: rgba(127, 209, 168, 0.45); background: rgba(127, 209, 168, 0.09); }
.status-lost, .status-archived, .status-unpublished { color: var(--text-soft); }
@keyframes wp-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0); } 50% { box-shadow: 0 0 0 4px rgba(79, 195, 247, .12); } }

.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.filter-chip { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--text-soft); border: 1px solid var(--line-mid); border-radius: var(--radius-pill); padding: 6px 14px; transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.filter-chip:hover { color: var(--text); background: var(--glass); }
.filter-chip-on { color: var(--amber-bright); border-color: rgba(240, 185, 94, 0.5); background: rgba(240, 185, 94, 0.1); }

/* ----------------------------------------------------------- 11. sign-in page */
.auth-body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: radial-gradient(120% 90% at 50% -10%, #0e1a2c 0%, #060b14 45%, var(--bg-0) 100%); }
.auth-card { width: 100%; max-width: 410px; background: var(--panel); border: 1px solid var(--line-mid); border-radius: var(--radius-lg); padding: 36px 34px; animation: wp-in .35s ease-out both; }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand-name { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.1em; color: #fff; }
.auth-brand-scope { margin: 6px 0 0; font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-soft); }
.auth-form { margin: 0; }
.auth-footer { margin: 22px 0 0; text-align: center; font-size: 13px; }
.auth-footer a { color: var(--text-soft); text-decoration: none; }
.auth-footer a:hover { color: var(--amber-bright); }

/* ------------------------------------------------------------ 12. error card */
.error-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 34px; text-align: center; }
.error-code { margin: 0; font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: 0.06em; color: var(--bad); }
.error-text { color: var(--text-soft); font-size: 14.5px; max-width: 460px; margin: 10px auto 22px; }

/* ------------------------------------------------------------- 13. responsive */
@media (max-width: 900px) {
    .module-grid { grid-template-columns: 1fr 1fr; }
    .field-row, .fact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .admin-main, .admin-shell .admin-main { padding: 20px 16px 50px; }
    .module-grid, .tf-kpi-row { grid-template-columns: 1fr; }
    .admin-brand-scope { display: none; }
}

/* ----------------------------------------------------- 15. media library (P1a-2) */
.status-needs { color: var(--bad); border-color: rgba(255, 138, 112, .45); background: rgba(255, 138, 112, .09); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.media-toolbar { justify-content: space-between; }
.media-toolbar > .filter-row { margin: 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.media-card { display: block; text-decoration: none; color: var(--text); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--panel); overflow: hidden; transition: border-color .18s, transform .18s; }
.media-card:hover { border-color: rgba(240, 185, 94, .5); transform: translateY(-2px); color: var(--text); }
.media-card-archived { opacity: .55; }
.thumb { position: relative; width: 100%; height: 132px; background: #0b0f16; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-large { height: 260px; border-radius: var(--radius-md); }
.thumb-large img { object-fit: contain; }
.thumb-dims { position: absolute; right: 8px; bottom: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; color: rgba(255, 255, 255, .75); background: rgba(0, 0, 0, .5); padding: 2px 6px; border-radius: 3px; }
.media-body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.media-title { font-weight: 700; font-size: 13.5px; color: #fff; }
.media-meta { font-size: 11px; }
.media-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.media-refs { font-size: 12px; color: var(--text-soft); }
.media-hero { margin-bottom: 12px; }
.facts { margin: 0; }
.elig { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.elig li { position: relative; padding-left: 24px; font-size: 13.5px; }
.elig li::before { content: "\2713"; position: absolute; left: 0; top: 0; font-weight: 800; color: var(--ok); }
.elig li.bad::before { content: "\2717"; color: var(--bad); }
.elig li.bad { color: #fff; }
.rule-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-soft); }
.rule-list b { color: var(--text); }
.form-field .chk-row { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-family: var(--font-stack); font-size: 13.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); }
.form-field .chk-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--amber-bright); }
.pick-list { display: grid; gap: 8px; }
.pick { position: relative; display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--bg-1); cursor: pointer; }
/* R3-1: the settings list's "Where it appears" column is clamped to four lines; the
   key's own page carries the whole sentence. */
.where-cell { max-width: 30ch; }
.settings-table td:nth-child(2), .settings-table td:nth-child(3) { max-width: 30ch; overflow-wrap: anywhere; }
.where-clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.where-clamp .zh { display: inline; margin-left: 4px; }
/* R3-1: `.form-field label` (block, mono, uppercase) outranks `.pick`, so the picker used to
   collapse into full-width images with the title underneath; the element selector
   restores the grid. A wide picture is shown whole, not cropped. */
.form-field label.pick { display: grid; margin: 0; text-transform: none; letter-spacing: 0; font-family: var(--font-stack); font-size: 13.5px; font-weight: 500; color: var(--text); }
.pick .thumb { display: block; width: 96px; height: 64px; border-radius: 3px; }
.pick .thumb img { object-fit: contain; }
.pick input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick:has(input:checked), .pick-on { border-color: rgba(240, 185, 94, .6); box-shadow: 0 0 0 3px rgba(240, 185, 94, .12); }
.pick:focus-within { outline: 2px solid var(--amber-bright); outline-offset: 2px; }
.pick-body { display: grid; gap: 3px; }
.pick-static { cursor: default; }
.inline-form input[type="file"] { padding: 6px 8px; font-size: 12.5px; color: var(--text-soft); width: auto; }
.inline-form input[type="file"]::file-selector-button { margin-right: 10px; padding: 5px 11px; border-radius: var(--radius-md); border: 1px solid var(--line-mid); background: var(--glass-strong); color: var(--text); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.stepper { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stepper li { position: relative; padding: 12px 14px 12px 46px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--panel); }
.stepper .step-n { position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-mid); display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-soft); }
.stepper .step-t { display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: #fff; }
.stepper .step-s { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-soft); }
.stepper li.done .step-n { background: rgba(127, 209, 168, .15); border-color: rgba(127, 209, 168, .5); color: var(--ok); }
.stepper li.cur { border-color: rgba(240, 185, 94, .5); box-shadow: 0 0 0 3px rgba(240, 185, 94, .1); }
.stepper li.cur .step-n { background: rgba(240, 185, 94, .15); border-color: rgba(240, 185, 94, .6); color: var(--amber-bright); animation: wp-pulse 2.4s ease-in-out infinite; }
@media (max-width: 1100px) { .edit-grid, .stepper { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- 14. motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, body.admin-body::after { animation: none !important; transition: none !important; }
    .tf-nav a:hover, .tf-kpi:hover, .btn:hover, .tf-quick a:hover, .module-card:hover { transform: none; }
}

/* ============================================================
   §16 Cookie notice + IP blocklist (P1c)
   ============================================================ */

/* A table whose last column is prose: let it take the slack and wrap, instead of
   the equal-width default that squeezes sentences into a ribbon. */
.data-table.wide-last td:last-child { width: auto; white-space: normal; }
.data-table.wide-last td { white-space: normal; }

.admin-card h3 {
    font-size: 12px;
    font-family: var(--mono);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin: 18px 0 8px;
}
.admin-card h3 .zh { margin-left: 8px; }

/* Checkbox rows read as sentences, not as form labels. */
.chk-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-family: var(--font-stack);
    font-size: 13.5px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
}
.chk-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--amber-bright); }
.chk-row input:disabled + span { opacity: .55; }

fieldset.form-field {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    padding: 10px 12px 12px;
    display: grid;
    gap: 8px;
}
fieldset.form-field legend {
    padding: 0 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* An amber-edged aside for the things an administrator must read before acting:
   an overlap with an existing rule, a scope that reaches further than it sounds. */
.tf-notice {
    border: 1px solid rgba(240, 185, 94, .45);
    background: rgba(240, 185, 94, .08);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 13.5px;
}
.tf-notice b { color: #fff; }
.tf-notice.tf-notice-bad {
    border-color: rgba(232, 106, 106, .5);
    background: rgba(232, 106, 106, .1);
}

/* ============================================================
   §17 Fixed pages (P1b-1)
   ============================================================ */

/* A qualifier inside a field label: "required", "normally empty". It has to read
   as an aside rather than as part of the label, so it drops the mono uppercase
   treatment the label itself carries. */
.form-field label .req {
    margin-left: 8px;
    font-family: var(--font-stack);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-dim);
}

/* A quiet line under a screen: where the inventory is bound, what the numbers mean. */
.admin-main .page-note {
    font-size: 12.5px;
    color: var(--text-soft);
    margin: -6px 0 18px;
}
.admin-main .page-note code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--amber-bright);
}

/* The four takeover states, explained once on the list screen. A definition list
   rather than a table: these are terms and their meanings, not rows of data. */
.state-help { display: grid; gap: 4px 16px; margin: 0; }
.state-help dt {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: .1em;
    color: var(--amber-bright);
    margin-top: 10px;
}
.state-help dd { margin: 0; font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }

/* ------------------------------------------------ 16. fixed-page editor (H4) */
/* The edit screen is a sticky status strip, a sticky outline and a column of
   collapsed blocks. Class prefix fp-; the shell's classes are reused where they fit
   (status-chip, tf-lbl, admin-card, form-field, btn). */
.fp-editor .cell-note { display: block; font-size: 12.5px; color: var(--text-soft); margin: 0 0 8px; line-height: 1.55; }
.fp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.fp-head h1 { margin: 0; }
.fp-sub { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; }
.fp-links { display: flex; gap: 8px; flex-wrap: wrap; }

.fp-strip {
    position: sticky; top: var(--top-h); z-index: 5;
    margin: 0 -28px 18px; padding: 12px 28px;
    background: rgba(5, 7, 12, .96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line-soft);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: center;
}
.fp-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.fp-fact { display: flex; flex-direction: column; gap: 2px; }
.fp-fact .tf-lbl { margin-bottom: 0; }
.fp-val { font-weight: 700; color: #fff; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.fp-next { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; justify-content: flex-end; }
.fp-next .fp-inline { margin: 0; padding: 0; border: 0; }
.fp-why { font-size: 12.5px; color: var(--text-soft); max-width: 44ch; line-height: 1.45; }
.fp-why-bad { color: var(--bad); }
.fp-inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.fp-reason-form { margin-top: 10px; }
.fp-reason-form input[type="text"] { width: 280px; max-width: 100%; }
.fp-notice-zh { display: block; margin-top: 4px; font-size: 12.5px; }
.tf-notice a { text-decoration: underline; }

.fp-pane { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 22px; align-items: start; }
.fp-outline {
    position: sticky; top: calc(var(--top-h) + 72px);
    max-height: calc(100vh - var(--top-h) - 90px); overflow-y: auto;
    font-size: 13px; padding-right: 4px;
}
.fp-outline-grp { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); margin: 14px 0 6px; font-weight: 700; }
.fp-outline-grp:first-child { margin-top: 0; }
.fp-outline a { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 5px 8px; border-radius: 4px; border-left: 2px solid transparent; }
.fp-outline a:hover { background: var(--glass); color: var(--text); }
.fp-outline a.is-current { border-left-color: var(--amber-bright); background: var(--glass); }
.fp-o-n { font-family: var(--mono); font-size: 11px; color: var(--text-dim); width: 18px; flex: none; text-align: right; }
.fp-o-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-o-c { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.fp-outline a.fp-o-hidden .fp-o-t { color: var(--text-dim); text-decoration: line-through; }
.fp-o-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber-bright); display: none; flex: none; }
.fp-outline a.is-dirty .fp-o-dot { display: block; }

.fp-content { min-width: 0; }
.fp-content .admin-card, .fp-block { scroll-margin-top: calc(var(--top-h) + 84px); }
.fp-blocks-note { margin: 0 0 10px; font-size: 12.5px; color: var(--text-soft); }

/* the collapsible blocks */
.fp-block { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--panel); margin-bottom: 10px; transition: border-color .2s; }
.fp-block[open] { border-color: var(--line-mid); }
.fp-block.is-hidden { border-style: dashed; opacity: .78; }
.fp-block > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; }
.fp-block > summary::-webkit-details-marker { display: none; }
.fp-block > summary:focus-visible { outline: 2px solid var(--amber-bright); outline-offset: -2px; border-radius: var(--radius-lg); }
.fp-b-n { font-family: var(--mono); font-size: 11px; color: var(--text-dim); text-align: right; }
.fp-b-head { min-width: 0; }
.fp-b-title { font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fp-b-ex { display: block; color: var(--text-soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.fp-block.is-hidden .fp-b-ex { text-decoration: line-through; }
.fp-b-right { display: flex; gap: 10px; align-items: center; }
.fp-b-caret { color: var(--text-dim); font-size: 12px; transition: transform .15s; }
.fp-block[open] > summary .fp-b-caret { transform: rotate(90deg); }
.fp-block-body { padding: 4px 16px 16px; border-top: 1px solid var(--line-soft); }
.fp-block-body > form { margin-top: 10px; }
.fp-block-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.fp-tools-l, .fp-tools-r { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fp-tools-r .cell-note { margin: 0; }

/* rows (items) */
.fp-items { margin-top: 14px; border-top: 1px dashed var(--line-soft); padding-top: 12px; }
.fp-items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.fp-items-head .tf-lbl { margin: 0; }
.fp-items-head .cell-note { margin: 0; max-width: 60ch; }
.fp-item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.fp-item:first-of-type { border-top: 0; }
.fp-item.is-hidden .fp-item-fields { opacity: .55; }
.fp-item-id { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; align-items: flex-start; }
.fp-item-id .mono-cell { color: var(--text); }
.fp-item-type { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--text-dim); }
.fp-item-fields .form-field { margin-bottom: 8px; }
.fp-item-fields textarea { min-height: 64px; }
.fp-item-ops { display: flex; gap: 4px; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.fp-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.fp-add-row { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); margin-top: 6px; flex-wrap: wrap; }
.fp-add-row .cell-note { margin: 0; max-width: 62ch; }

/* folded field groups */
.fp-more { margin: 4px 0 12px; }
.fp-more > summary { cursor: pointer; list-style: none; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); padding: 6px 0; }
.fp-more > summary::-webkit-details-marker { display: none; }
.fp-more > summary::before { content: "\25B8  "; color: var(--text-dim); }
.fp-more[open] > summary::before { content: "\25BE  "; }
.fp-more > summary .zh { font-size: 11px; letter-spacing: 0; text-transform: none; }
.fp-more-body { padding-top: 8px; }
.fp-more-danger > summary { color: var(--text-dim); }

/* buttons that only appear here */
.btn-ico { padding: 6px 9px; min-width: 32px; }
.btn-quiet { background: transparent; color: var(--text-soft); border-color: transparent; padding: 6px 9px; }
.btn-quiet:hover { color: var(--text); background: var(--glass); }

/* unsaved state (set by admin-fixed-page.js; nothing here is load-bearing). The
   chips and the strip's counter are display:flex, which outranks the browser's own
   [hidden] rule, so the attribute is given its meaning back here. */
.fp-editor [hidden] { display: none !important; }
.fp-chip-unsaved { color: var(--warn); border-color: rgba(240, 185, 94, .5); background: rgba(240, 185, 94, .09); }
.fp-chip-unsaved::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 6px; }
form.is-dirty .fp-save { background: linear-gradient(135deg, var(--amber-bright), var(--amber)); color: var(--ink-on-amber); border-color: transparent; }
.fp-guard {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40;
    max-width: 560px; width: calc(100% - 40px);
    background: #1a1206; border: 1px solid rgba(240, 185, 94, .55); color: var(--text);
    padding: 14px 16px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}
.fp-guard-text { margin: 0 0 10px; }
.fp-guard-text b { color: var(--amber-bright); }

/* publish guide + switch-over stepper */
.fp-guide { border-left: 2px solid var(--line-mid); background: var(--glass); padding: 10px 14px; margin: 0 0 12px; font-size: 13.5px; color: var(--text-soft); }
.fp-guide b { color: #fff; }
.fp-guide-warn { border-left-color: var(--warn); }
.fp-steps { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fp-step { padding: 10px 12px; border: 1px solid var(--line-soft); border-left-width: 0; background: rgba(255, 255, 255, .02); min-width: 0; }
.fp-step:first-child { border-left-width: 1px; border-radius: 6px 0 0 6px; }
.fp-step:last-child { border-radius: 0 6px 6px 0; }
.fp-step-k { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-step-t { display: block; font-weight: 700; color: var(--text-soft); margin-top: 2px; }
.fp-step.is-done .fp-step-t { color: var(--text); }
.fp-step.is-done .fp-step-k::after { content: " \2713"; color: var(--ok); }
.fp-step.is-current { background: rgba(240, 185, 94, .08); border-color: rgba(240, 185, 94, .45); border-left-width: 1px; }
.fp-step.is-current .fp-step-k { color: var(--amber-bright); }
.fp-step.is-current .fp-step-t { color: #fff; }
.fp-move { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin: 10px 0 0; }
.fp-move .form-field { margin: 0; }
.fp-move-back { grid-template-columns: 1fr auto; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.fp-guide-ok { border-left-color: var(--ok); }
.fp-readonly .cell-note .tf-lbl { display: inline-block; margin: 0 8px 0 0; }
.fp-readonly .cell-note { color: var(--text); }
.fp-move + .data-table { margin-top: 16px; }

@media (max-width: 1100px) {
    .fp-pane { grid-template-columns: 1fr; }
    .fp-outline { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 2px 6px; }
    .fp-outline-grp { width: 100%; margin: 8px 0 2px; }
    .fp-outline a { padding: 3px 8px; }
    .fp-strip { grid-template-columns: 1fr; }
    .fp-next { justify-content: flex-start; }
    .fp-steps { grid-template-columns: 1fr 1fr; }
    .fp-step:first-child, .fp-step:last-child { border-radius: 6px; }
    .fp-step { border-left-width: 1px; }
    .fp-move { grid-template-columns: 1fr; }
    .fp-item { grid-template-columns: 1fr; }
    .fp-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) { .fp-strip { margin: 0 -16px 18px; padding: 10px 16px; } }
@media (prefers-reduced-motion: reduce) { .fp-b-caret, .fp-block { transition: none; } }

/* ------------------------------------------------ 17. fixed-page images (H5-a2) */
.fp-image { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; align-items: center; border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 10px; margin: 0 0 14px; background: rgba(255, 255, 255, .02); }
.fp-image-thumb { width: 120px; height: 76px; border-radius: 4px; background: #0b0f16; border: 1px solid var(--line-mid); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.fp-image-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fp-image-none { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.fp-image-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; min-width: 0; }
.fp-image-meta b { color: #fff; }
.fp-image-meta .cell-note { margin: 0; flex-basis: 100%; }
.fp-image-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }

.fp-picker { position: fixed; inset: 0; z-index: 45; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px; background: rgba(0, 0, 0, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto; }
.fp-picker-box { width: min(880px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-mid); border-radius: var(--radius-lg); padding: 18px 20px 20px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.fp-picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.fp-picker-head h2 { margin: 0; }
.fp-picker-tools { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.fp-picker-tools input[type="search"] { flex: 1; min-width: 220px; padding: 9px 11px; border-radius: 0; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-mid); color: var(--text); font: inherit; font-size: 13.5px; }
.fp-picker-tools input[type="search"]:focus { outline: none; border-color: rgba(240, 185, 94, .6); box-shadow: 0 0 0 3px rgba(240, 185, 94, .15); }
.fp-picker-upload { border: 1px dashed var(--line-mid); border-radius: var(--radius-md); padding: 12px 14px 10px; margin-bottom: 14px; }
.fp-picker-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 0 0 10px; }
.fp-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.fp-tile { display: block; text-align: left; padding: 0; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; transition: border-color .15s, transform .15s; }
.fp-tile:hover, .fp-tile:focus-visible { border-color: rgba(240, 185, 94, .6); transform: translateY(-2px); outline: none; }
.fp-tile-unready { opacity: .78; }
.fp-tile-thumb { display: block; height: 96px; background: #0b0f16; }
.fp-tile-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fp-tile-cap { display: grid; gap: 4px; padding: 8px 10px 10px; font-size: 12.5px; }
.fp-tile-cap b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-tile-cap .status-chip { justify-self: start; }
.fp-tile-cap .cell-note { margin: 0; }
@media (max-width: 620px) { .fp-image { grid-template-columns: 1fr; } .fp-picker { padding: 10px; } }

/* ---------------------------------------------- 18. the editor inside the visual page (H5-c) */
/* body.admin-embed: the fixed-page editor reduced to the sections the visual page named
   (fp-embed-show) inside its side panel. The chrome, the strip, the outline and every
   other section are hidden; what remains is the form, at panel width. */
body.admin-embed { padding-left: 0; padding-top: 0; background-image: none; }
body.admin-embed::after { display: none; }
body.admin-embed .tf-rail, body.admin-embed .tf-top, body.admin-embed .tf-skip, body.admin-embed .admin-back,
body.admin-embed .fp-head, body.admin-embed #fp-strip, body.admin-embed #fp-outline,
body.admin-embed #publish, body.admin-embed #switch-over, body.admin-embed #history { display: none !important; }
body.admin-embed .admin-main, body.admin-embed .admin-shell .admin-main { max-width: none; padding: 12px 14px 40px; animation: none; }
body.admin-embed .fp-pane { display: block; }
body.admin-embed .fp-content { width: 100%; }
body.admin-embed #page-fields:not(.fp-embed-show), body.admin-embed .fp-block:not(.fp-embed-show) { display: none !important; }
body.admin-embed .fp-block.fp-embed-show > summary { pointer-events: none; }
body.admin-embed .fp-block.fp-embed-show > summary::marker, body.admin-embed .fp-block.fp-embed-show > summary::-webkit-details-marker { display: none; }
body.admin-embed .field-row { grid-template-columns: 1fr; }
body.admin-embed .fp-image { grid-template-columns: 96px minmax(0, 1fr); }
body.admin-embed .fp-picker { padding: 10px; }
body.admin-embed .fp-picker-box { padding: 14px; }

/* ---- 19. R2 console clarity (2026-09-06) ---------------------------------------- */
/* A card that folds: the settings nothing on the site reads yet, the blocklist's
   "what has been seen" detail. The summary is the card's heading. */
details.admin-card > summary { cursor: pointer; list-style: none; font-size: 15px; }
details.admin-card > summary::-webkit-details-marker { display: none; }
details.admin-card > summary::before { content: "\25B8"; display: inline-block; width: 1.1em; color: var(--text-dim); }
details.admin-card[open] > summary::before { content: "\25BE"; }
details.admin-card > summary .zh { margin-left: 8px; }
/* A numbered procedure in the operator's words (settings source, blocklist notes). */
.fp-steps-plain { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 8px; max-width: 78ch; line-height: 1.55; }
.fp-steps-plain li .zh { display: block; }
.fp-steps-plain i { font-style: normal; font-weight: 600; }
/* Small stat tiles with a legend line under them (blocklist "seen" panel). */
.seen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 4px 0 14px; }
.seen-tile { border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; }
.seen-tile .tf-lbl { display: block; margin-bottom: 4px; }
.seen-tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.seen-tile .cell-sub { display: block; margin-top: 2px; }
/* The cases editor: every cell input fills its cell. */
#cases-form .data-table td input { width: 100%; box-sizing: border-box; }
/* The generic "last column is a narrow actions column" rule must not squash the
   editor's Title / Value inputs, which are the last column of their tables. */
#cases-form .data-table td:last-child { width: auto; }
#cases-form .data-table th:first-child { width: 200px; }
#cases-form .cases-entry > summary { cursor: pointer; }
/* R6 Visitors: a wide list beside a narrow column of context (pages, countries,
   address files, housekeeping). The list wins the width; the column folds under
   it on a narrow screen. */
.visitors-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.visitors-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; min-width: 0; align-items: start; }
.visitors-side .admin-card { margin-bottom: 0; }
.visitors-main .data-table td { vertical-align: top; }
.visitors-location { min-width: 12ch; max-width: 22ch; }
.visitors-main .data-table td:first-child { white-space: nowrap; }
.visitors-kpis .tf-kpi b { font-size: 26px; }
.visitors-filter .chk-inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }
.visitors-filter .chk-inline input { width: 15px; height: 15px; accent-color: var(--amber-bright); }
.visitors-ua { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitors-seen { white-space: nowrap; }
.visitors-ua-full { word-break: break-all; }
tr.is-blocked td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.visitors-err { color: var(--bad); }
.visitors-404 { color: var(--amber-bright); }
.geo-facts { grid-template-columns: 1fr; }
.fp-steps-plain-wrap { margin: 8px 0 12px; }
.fp-steps-plain-wrap > summary { cursor: pointer; }
.visitors-attribution { margin-top: 12px; font-size: 11.5px; }
.visitor-ip { font-size: inherit; color: inherit; }
