:root {
    color-scheme: light;
    --bg: #f5f2eb;
    --surface: #fffdf9;
    --surface-raised: #ece7dc;
    --surface-note: #faf6ee;
    --line: #dfd9cc;
    --line-active: #b5ad9e;
    --text: #1b1917;
    --muted: #666057;
    --accent: #1e4a72;
    --accent-hover: #143654;
    --accent-soft: #e8f0f6;
    --signal: #c84b31;
    --signal-soft: #fbece8;
    --danger: #b4323b;
    --shadow: 0 1px 2px rgba(27, 25, 23, .05);
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    --radius: 6px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: var(--sans); scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; }
body > main { min-height: calc(100vh - 144px); }
h1, h2, h3, p, ul, ol, dl, dd, figure, pre { margin: 0; }
h1, h2, h3 { line-height: 1.24; letter-spacing: -.025em; font-weight: 680; }
h2 { font-size: clamp(1.18rem, 2vw, 1.52rem); }
h3 { font-size: 1rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #fff; }
.frame { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .92); backdrop-filter: blur(10px); }
.topbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; width: max-content; font-size: 1.08rem; font-weight: 700; letter-spacing: -.03em; }
.brand > span > span { color: var(--accent); }
.brand-mark { position: relative; width: 24px; height: 24px; display: inline-block; border: 1.5px solid var(--text); border-radius: 4px; background: var(--surface); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 7px; height: 7px; }
.brand-mark::before { top: 4px; left: 4px; border: 1.5px solid var(--accent); }
.brand-mark::after { bottom: 4px; right: 4px; background: var(--signal); }
.topbar nav { display: flex; gap: 26px; align-items: center; height: 100%; }
.topbar nav a { display: flex; align-items: center; position: relative; color: var(--muted); font-size: .9rem; font-weight: 500; height: 100%; white-space: nowrap; transition: color .15s ease; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--text); }
.topbar nav a[aria-current] { font-weight: 620; }
.topbar nav a[aria-current]::after { content: ""; position: absolute; bottom: -1px; inset-inline: 0; height: 2px; background: var(--text); }
.topbar nav a.nav-admin { gap: 6px; color: var(--accent); font-weight: 600; }
.topbar nav a.nav-admin::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); flex-shrink: 0; }
.topbar nav a.nav-admin[aria-current]::after { background: var(--accent); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.footer { border-top: 1px solid var(--line); margin-top: 72px; color: var(--muted); background: var(--surface); }
.footer-inner { display: flex; min-height: 72px; gap: 20px; align-items: center; font-size: .85rem; }
.footer-inner > a:last-child { margin-left: auto; white-space: nowrap; color: var(--text); font-weight: 560; }
.footer-inner > a:last-child:hover { color: var(--accent); }
.footer .brand { color: var(--text); font-size: .98rem; }
.footer .brand-mark { transform: scale(.85); }
.skip { position: fixed; transform: translateY(-120%); z-index: 30; background: var(--text); color: #fff; padding: 10px 18px; }
.skip:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.kicker { color: var(--muted); font: 500 .76rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 14px; border: 1px solid var(--line-active); border-radius: 5px; color: var(--text); background: var(--surface); font-size: .87rem; font-weight: 580; line-height: 1.25; white-space: nowrap; flex-shrink: 0; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button:hover { border-color: var(--text); background: var(--surface-raised); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.subtle { background: transparent; border-color: var(--line); }
.button.subtle:hover { background: var(--surface-raised); border-color: var(--line-active); }
.button.compact { min-height: 32px; padding: 5px 10px; font-size: .8rem; }
.button.danger { color: var(--danger); border-color: #e2c2c4; }
.button.danger:hover { background: #fdf0f1; border-color: var(--danger); }
.text-link { color: var(--accent); font-size: .88rem; font-weight: 580; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-title, .panel-bar { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.panel-bar { min-height: 48px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.panel-bar h2, .panel-title h2 { font-size: 1.08rem; }
.stack { display: grid; gap: 15px; }
.status { color: var(--accent); font-size: .84rem; min-height: 1.2em; }
.status:empty { display: none; }
.status[data-tone="error"] { color: var(--danger); }
.status[data-tone="busy"] { color: var(--muted); }
input:not([type="radio"], [type="checkbox"]), select, textarea { min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line-active); border-radius: 5px; padding: 9px 11px; transition: border-color .15s ease; }
input:not([type="radio"], [type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #8c857b; }
textarea { resize: vertical; }
input[type="file"] { max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; color: var(--text); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px; margin-right: 10px; cursor: pointer; }
.field { display: grid; gap: 6px; color: var(--text); font-size: .88rem; font-weight: 580; }
.field small, .compact-field { color: var(--muted); font-weight: 450; }
.compact-field { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; }
.compact-field select { padding: 5px 8px; font-size: .82rem; }
fieldset { margin: 0; min-inline-size: 0; padding: 0; border: 0; }
legend { font-size: .88rem; margin-bottom: 8px; padding: 0; font-weight: 580; }
.channel-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.channel-buttons button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 820px) {
    .frame { width: min(100% - 32px, 1180px); }
    .topbar-inner { grid-template-columns: 1fr 1fr; gap: 0 12px; min-height: 0; padding-top: 10px; }
    .topbar nav { grid-row: 2; grid-column: 1 / -1; gap: 0; justify-content: space-between; }
    .topbar nav a { padding: 10px 0; }
}
@media (max-width: 420px) {
    .frame { width: calc(100% - 24px); }
    .topbar nav a, .footer-inner small { font-size: .79rem; }
    .footer-inner { gap: 11px; }
    .footer-inner > a:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
