/* 帮战助手 · 界面样式
   墨色侧栏、浅色工作区、黛蓝数据色与朱砂印章。所有颜色取自下方变量，深色模式只替换变量。 */

:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --line: #e3e6ec;
  --line-strong: #cfd4dd;
  --text: #121826;
  --text-2: #3f4a5c;
  --muted: #687386;
  --accent: #3453cc;
  --accent-hover: #2944ad;
  --accent-soft: #edf0fd;
  --accent-ink: #2a3f99;
  --accent-light: var(--accent-soft);
  --on-accent: #ffffff;
  --chart: #4766dd;
  --chart-track: #e6e9f2;
  --seal: #c23b2a;
  --gold: #a16207;
  --gold-soft: #fdf5e4;
  --gold-line: #f0d9a8;
  --danger: #c4320a;
  --danger-soft: #fef1ee;
  --success: #067647;
  --success-soft: #e9f9ef;
  --side-bg: #12151b;
  --side-line: #ffffff14;
  --side-text: #c4cad6;
  --side-muted: #7a8394;
  --side-hover: #1d2129;
  --side-active: #252b36;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .04);
  --shadow-lg: 0 18px 40px -12px rgb(16 24 40 / .28);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "SF Pro Display", "Segoe UI", "Roboto", "PingFang SC", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --side-w: 236px;
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1b1f27;
    --surface-3: #222732;
    --line: #2a303c;
    --line-strong: #3a4251;
    --text: #e8ebf2;
    --text-2: #b9c0cd;
    --muted: #8b94a5;
    --accent: #8299ff;
    --accent-hover: #9cafff;
    --accent-soft: #1e2643;
    --accent-ink: #bac6ff;
    --on-accent: #0d1020;
    --chart: #7088f5;
    --chart-track: #262c3a;
    --seal: #d9533f;
    --gold: #e3ad4f;
    --gold-soft: #2a2314;
    --gold-line: #4d3d1c;
    --danger: #f97a66;
    --danger-soft: #2e1916;
    --success: #4fd08f;
    --success-soft: #12291d;
    --side-bg: #0a0c10;
    --side-hover: #161a21;
    --side-active: #1e232d;
    --shadow: 0 1px 2px rgb(0 0 0 / .35);
    --shadow-lg: 0 18px 40px -12px rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1b1f27;
  --surface-3: #222732;
  --line: #2a303c;
  --line-strong: #3a4251;
  --text: #e8ebf2;
  --text-2: #b9c0cd;
  --muted: #8b94a5;
  --accent: #8299ff;
  --accent-hover: #9cafff;
  --accent-soft: #1e2643;
  --accent-ink: #bac6ff;
  --on-accent: #0d1020;
  --chart: #7088f5;
  --chart-track: #262c3a;
  --seal: #d9533f;
  --gold: #e3ad4f;
  --gold-soft: #2a2314;
  --gold-line: #4d3d1c;
  --danger: #f97a66;
  --danger-soft: #2e1916;
  --success: #4fd08f;
  --success-soft: #12291d;
  --side-bg: #0a0c10;
  --side-hover: #161a21;
  --side-active: #1e232d;
  --shadow: 0 1px 2px rgb(0 0 0 / .35);
  --shadow-lg: 0 18px 40px -12px rgb(0 0 0 / .6);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
h2 { font-size: 16px; font-weight: 650; line-height: 1.4; }
h3 { font-size: 14px; font-weight: 650; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: 10px; transform: translateY(-200%); background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 50; }
.skip:focus { transform: none; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 应用框架：侧栏 + 顶栏 ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--side-w);
  display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; color: #fff; font-weight: 650; font-size: 16px; letter-spacing: .06em; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { display: block; width: 32px; height: 32px; flex: none; }
.brand small { display: block; margin-top: 1px; color: var(--side-muted); font-size: 11px; font-weight: 450; letter-spacing: .04em; }
#site-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #ffffff22 transparent; }
.nav-section { display: grid; gap: 2px; padding-top: 14px; }
.nav-section > span { padding: 0 10px 6px; color: var(--side-muted); font-size: 11.5px; letter-spacing: .08em; }
.nav-section a {
  display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 10px; border-radius: 8px;
  color: var(--side-text); font-size: 14px; text-decoration: none; transition: background .15s, color .15s;
}
.nav-section a .icon { color: var(--side-muted); transition: color .15s; }
.nav-section a:hover { background: var(--side-hover); color: #fff; }
.nav-section a:hover .icon { color: #dfe3ea; }
.nav-section a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--seal); }
.nav-section a[aria-current="page"] .icon { color: #ff9b85; }
.account {
  display: flex; align-items: center; gap: 10px; margin: 0 12px 14px; padding: 10px; border-radius: 10px;
  background: var(--side-hover); border: 1px solid var(--side-line);
}
.account-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: #2c3442; color: #fff; font-weight: 650; }
.account > div { min-width: 0; flex: 1; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { color: #fff; font-size: 13px; font-weight: 600; }
.account small { color: var(--side-muted); font-size: 11.5px; }
.account button { display: grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--side-muted); cursor: pointer; }
.account button:hover { background: var(--side-active); color: #fff; }

.app { min-width: 0; }
.signed-in .app { padding-left: var(--side-w); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--line-strong); }
.topbar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.guild-chip { display: inline-flex; align-items: center; gap: 7px; max-width: min(420px, 50vw); height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.guild-chip i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.guild-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
#nav-toggle { display: none; }
.scrim { display: none; }
body:not(.signed-in) .sidebar, body:not(.signed-in) .topbar { display: none; }

main { width: min(1440px, 100%); margin-inline: auto; padding: clamp(18px, 2.6vw, 32px) clamp(16px, 3vw, 36px) 72px; outline: none; }

@media (max-width: 1023px) {
  .signed-in .app { padding-left: 0; }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
  .nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(8 10 14 / .45); }
  #nav-toggle { display: grid; }
}
@media (max-width: 560px) {
  .guild-chip { display: none; }
  .topbar { height: 52px; }
}

/* ---------- 页面标题 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; margin-bottom: 20px; }
.page-head > div:first-child { min-width: 0; max-width: 760px; }
.page-head p { margin-top: 6px; color: var(--muted); }
.eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eyebrow .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.page-actions, .actions, .controls, .file-links { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-actions { gap: 8px; }

/* ---------- 卡片 ---------- */
.layout { display: grid; gap: 16px; }
.panel, .card {
  --pad: clamp(16px, 2vw, 22px);
  min-width: 0; padding: var(--pad); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.panel + .panel, .panel + .card, .card + .panel, .card + .card { margin-top: 16px; }
.layout > .panel + .panel, .layout > * + * { margin-top: 0; }
.panel > h2, .card-head { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel > h2 + p, .panel > h2 + .controls { margin-top: -6px; margin-bottom: 12px; }
.section-space { margin-top: 14px; }
.empty { padding: 28px 0 22px; text-align: center; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ---------- 按钮 ---------- */
main button, dialog button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 15px; border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 13.5px; font-weight: 550; line-height: 1.2;
  white-space: nowrap; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
main button:hover, dialog button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
main button.secondary, dialog button.secondary, .button.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow); }
main button.secondary:hover, dialog button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
main button.light { background: transparent; border-color: transparent; color: var(--accent); padding-inline: 8px; box-shadow: none; }
main button.light:hover { background: var(--accent-soft); color: var(--accent-ink); }
main button.small, .button.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
main button:disabled, dialog button:disabled { opacity: .45; cursor: not-allowed; }
.button .icon, main button .icon { width: 16px; height: 16px; }

/* ---------- 表单 ---------- */
label { display: flex; flex-direction: column; gap: 5px; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  min-height: 36px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 400; transition: border-color .15s, box-shadow .15s;
}
textarea { padding: 9px 11px; line-height: 1.6; }
select { padding-right: 30px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[readonly] { background: var(--surface-2); }
input[type="date"], input[type="month"] { min-width: 150px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
input[type="file"] { font: inherit; font-size: 13px; color: var(--muted); }
::file-selector-button { font: inherit; font-size: 13px; margin-right: 10px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; }
::placeholder { color: var(--muted); opacity: .8; }
.form-stack { display: grid; gap: 14px; }
.form-stack > label { max-width: 460px; }
.form-row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.form-row label { flex: 1 1 140px; min-width: 120px; }
.form-row .date-field { flex: 0 1 180px; }
.form-row .grow { flex: 2 1 220px; }
.message { color: var(--danger); font-size: 13px; }
.message:empty { display: none; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.check-row label, .inline-check { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; font-weight: 450; color: var(--text-2); font-size: 13px; }
.breakable { overflow-wrap: anywhere; }

/* ---------- 提示 / 徽章 ---------- */
.callout { padding: 11px 14px; border: 1px solid var(--gold-line); border-radius: var(--radius-sm); background: var(--gold-soft); color: var(--text); font-size: 13px; }
.callout ul { margin: 0; padding-left: 18px; }
.callout li + li { margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 550; white-space: nowrap; }
.badge.warn { background: var(--gold-soft); color: var(--gold); }
.badge.muted { background: var(--surface-3); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.notice {
  position: fixed; right: clamp(14px, 3vw, 32px); bottom: 22px; z-index: 60; width: min(400px, calc(100vw - 28px));
  padding: 13px 16px 13px 42px; border-radius: 12px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: rise .25s ease;
}
.notice::before { content: ""; position: absolute; left: 16px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 30%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 指标卡 ---------- */
.kpis, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0; }
.kpis > div, .kpi {
  position: relative; min-width: 0; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.kpis dt, .kpi dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.kpi dt .icon { width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.kpis dd, .kpi dd { margin: 8px 0 2px; font: 650 clamp(22px, 2.2vw, 30px)/1.15 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi dd.small-value { font-size: clamp(15px, 1.4vw, 19px); line-height: 1.4; }
.kpis small, .kpi small { display: block; font-size: 12px; color: var(--muted); }
.kpi.primary { background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 72%, #7c3aed) 100%); border-color: transparent; color: var(--on-accent); }
.kpi.primary dt, .kpi.primary small { color: color-mix(in srgb, var(--on-accent) 76%, transparent); }
.kpi.primary dt .icon { background: color-mix(in srgb, var(--on-accent) 16%, transparent); color: var(--on-accent); }
.kpi.primary::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: #ffffff14; }
.kpi.ok dd { color: var(--success); }
.kpi.warn dd { color: var(--gold); }

/* ---------- 表格 ---------- */
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table-wrap.scroll { max-height: 560px; }
.table-wrap:empty { display: none; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
td a { font-weight: 550; }
.number { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
th button.light, th button.light.small {
  min-height: 0; height: auto; padding: 0; gap: 4px; border: 0; background: none; color: inherit; font-size: 12px; font-weight: 600;
}
th button.light:hover { background: none; color: var(--text); }
th[aria-sort] { color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface-2)); }
th[aria-sort] button.light { color: var(--accent); }
table input:not([type="checkbox"]), table select { min-height: 30px; padding: 3px 8px; font-size: 13px; }
table select { padding-right: 26px; }
.roster-edit td { padding: 6px; }
.roster-edit input { width: 96px; }
.roster-edit input[name="name"] { width: 128px; }
.roster-edit input[name="squad"] { width: 104px; }
.roster-edit select { max-width: 140px; }
.color-dot { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.color-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-size: 12px; }
.colors-row { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 12px; }
.color-table { max-width: 600px; }
.color-table td:first-child { width: 30px; }

/* ---------- 折叠 ---------- */
details > summary { display: flex; align-items: center; gap: 8px; width: fit-content; cursor: pointer; list-style: none; color: var(--text); font-weight: 600; font-size: 13.5px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.6px 1.6px 0; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg) translate(-1px, -1px); }
details[open] > summary { margin-bottom: 12px; }
summary:hover { color: var(--accent); }

/* ---------- 对话框 ---------- */
dialog { width: min(480px, 94vw); margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgb(8 10 14 / .5); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 14px; }
dialog .actions { margin-top: 18px; justify-content: flex-end; }
dialog label select { width: 100%; }

/* ---------- 加载与错误 ---------- */
.loading { display: grid; gap: 14px; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state-card { display: grid; justify-items: center; gap: 10px; max-width: 520px; margin: 8vh auto 0; padding: 36px 28px; text-align: center; }
.state-card .state-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); }
.state-card .state-icon .icon { width: 24px; height: 24px; }
.state-card p { color: var(--muted); }
.state-card .page-actions { margin-top: 8px; }

/* ---------- 导入 ---------- */
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.uploader {
  position: relative; display: grid; align-content: center; justify-items: start; gap: 8px; min-height: 150px; padding: 22px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.uploader::before { content: ""; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft) url("/icon-upload.svg") center / 20px no-repeat; }
.uploader:hover, .uploader:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.uploader strong { color: var(--text); font-size: 15px; }
.uploader span { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.uploader input { width: 100%; }
.sources { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-block: 14px 4px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.roster-review { grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); }
.roster-review > div { min-width: 0; }
.roster-figure { margin: 12px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.roster-figure a { display: block; }
.roster-figure img { display: block; width: 100%; height: auto; }
.roster-figure figcaption { padding: 8px 12px; font-size: 12.5px; color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px calc(-1 * var(--pad)) calc(-1 * var(--pad)); padding: 14px var(--pad); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); }
.intake-item { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.pair-hint { color: var(--muted); }
.review-text { display: block; white-space: pre-wrap; line-height: 1.8; }
.review-text:not(:empty) { margin-top: 14px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }

/* ---------- 日历 ---------- */
#calendar-matches { scroll-margin-top: 74px; }
#calendar-matches .match-note { min-width: 8em; overflow-wrap: anywhere; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.calendar-head h2 { font-size: 18px; font-variant-numeric: tabular-nums; }
.month-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.month-nav a.icon-button:hover { text-decoration: none; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-grid > .weekday { padding: 4px 8px; color: var(--muted); font-size: 12px; text-align: left; }
.calendar-grid > .cell {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 78px; padding: 8px 9px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums;
}
.calendar-grid > .cell.blank { border-color: transparent; background: transparent; }
.calendar-grid > .cell.today { border-color: var(--line-strong); color: var(--text); font-weight: 650; }
.calendar-grid > a.cell { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-ink); font-weight: 650; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.calendar-grid > a.cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.calendar-grid > a.cell[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.calendar-grid .cell small { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 1px 7px; border-radius: 999px; background: var(--surface); color: inherit; font-size: 11.5px; font-weight: 550; }
.calendar-grid a.cell[aria-current] small:not(.pending) { background: #ffffff2e; }
.calendar-grid .cell small.pending { background: var(--gold-soft); color: var(--gold); }
.calendar-grid .pending-short { display: none; }

/* ---------- 成员 ---------- */
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 650; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #7c3aed)); color: #fff; }
.profile-avatar { display: inline-flex; flex: none; }
.avatar.lg.career-avatar { display: block; padding: 8px; background: #22252b; object-fit: contain; }
.name-cell { display: inline-flex; align-items: center; gap: 10px; }
.search-field { position: relative; display: block; max-width: 420px; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; min-height: 42px !important; padding-left: 38px !important; border-radius: 11px !important; font-size: 14.5px !important; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.radar-pick { max-width: 460px; margin-bottom: 6px; }
.chip.personal-match { min-height: 26px; max-width: 100%; height: auto; padding-block: 3px; white-space: normal; overflow-wrap: anywhere; }
th.number button.light { justify-content: flex-end; }

/* ---------- 总览：筛选栏 ---------- */
.desk-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.desk-filter > :is(.compare-shortcuts, .scope-columns, .extra-filters[open], .message) { grid-column: 1 / -1; }
.desk-filter > .scope-columns { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.compare-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.scope-columns { display: grid; align-items: start; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.compare-filter .scope-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scope-set legend { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0; color: var(--text); font-weight: 650; font-size: 13.5px; }
.scope-set legend::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--accent); }
.compare-filter .scope-set + .scope-set legend::before { background: var(--gold); }
.match-select, .date-range { max-width: 460px; }
.compare-filter :is(.match-select, .date-range) { max-width: none; }
.match-select select { text-overflow: ellipsis; }
.date-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.extra-filters > summary { min-height: 32px; color: var(--accent); }
.shared-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.shared-filters > label { flex: 0 1 180px; }
.shared-filters .check-row { min-height: 36px; margin-top: 0; }
.extra-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.scope-status { margin-top: 8px; color: var(--muted); font-size: 13px; }
.scope-status:empty { margin: 0; }
.desk-filter label { min-width: 0; }
.desk-filter :is(select, input:not([type="checkbox"])) { width: 100%; }
.desk-filter input[type="date"] { min-width: 0; }
.filter-actions { grid-column: 2; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.filter-actions a { font-size: 13px; white-space: nowrap; }

/* ---------- 总览：区块 ---------- */
.range-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-size: 18px; }
.range-title::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); }
#frozen-evidence .battle-period + .battle-period .range-title::before, main > .battle-period + .battle-period .range-title::before { background: var(--gold); }
.battle-period > .kpi-grid { margin-bottom: 16px; }
.battle-breakdown { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
.battle-breakdown > .card + .card { margin-top: 0; }
.group-tools { display: flex; align-items: center; gap: 12px; }
.group-tools select { min-height: 32px; font-size: 13px; }
.breakdown-grid > .table-wrap { max-width: none; max-height: none; border: 0; border-radius: 0; margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--pad)); border-top: 1px solid var(--line); }
.breakdown-grid td { padding-block: 8px; white-space: nowrap; }
.breakdown-grid th:first-child, .breakdown-grid td:first-child, .member-grid th:first-child, .member-grid td:first-child { padding-left: var(--pad); }
.breakdown-grid th:last-child, .breakdown-grid td:last-child, .member-grid th:last-child, .member-grid td:last-child { padding-right: var(--pad); }
.group-name { display: inline-flex; align-items: center; gap: 8px; }
.group-name .color-dot { width: 10px; height: 10px; border-radius: 3px; }
main button.drill { min-height: 26px; padding: 0 6px; margin: -3px -6px; border-radius: 6px; color: var(--accent); font-weight: 550; font-size: 13.5px; }
.group-name button.drill { color: var(--text); font-weight: 600; }
.group-name button.drill:hover { color: var(--accent-ink); }
.bar-value { display: inline-grid; gap: 4px; min-width: 7.5em; text-align: right; font-weight: 550; }
.battle-period progress, .team-ledger progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; appearance: none; -webkit-appearance: none; background: var(--chart-track); color: var(--chart); overflow: hidden; }
.battle-period progress::-webkit-progress-bar, .team-ledger progress::-webkit-progress-bar { background: var(--chart-track); border-radius: 999px; }
.battle-period progress::-webkit-progress-value, .team-ledger progress::-webkit-progress-value { background: var(--chart); border-radius: 999px; }
.battle-period progress::-moz-progress-bar, .team-ledger progress::-moz-progress-bar { background: var(--chart); border-radius: 999px; }
.bar-value progress { height: 4px; }
.team-ledger .ledger-caption { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.team-ledger ul { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.team-ledger li { padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.team-ledger li div, .team-ledger li small { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
.team-ledger li div strong { font-size: 13.5px; }
.team-ledger li div span { font: 650 17px/1 var(--font-num); color: var(--accent); }
.team-ledger li small { font-size: 12px; color: var(--muted); }
.team-ledger progress { margin: 9px 0 7px; height: 7px; }
.member-section { margin-top: 16px; }
.member-grid > .table-wrap { max-width: none; border: 0; border-radius: 0; margin: 0 calc(-1 * var(--pad)); border-block: 1px solid var(--line); }
.member-grid > .table-wrap.scroll { max-height: 620px; }
.member-grid td { white-space: nowrap; }
.member-section .section-top h2:focus-visible { outline-offset: 4px; }
.charts-area:not(:empty) { margin-top: 20px; display: grid; gap: 14px; }
.charts-area h3 { color: var(--text-2); }
.chart-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.trend { display: block; width: 100%; height: auto; }
.trend .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.trend .axis-label { fill: var(--muted); font: 11px var(--font-num); }
.trend .trend-line { fill: none; stroke: var(--chart); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.trend .trend-area { fill: url(#trend-fill); }
.trend .trend-dot { fill: var(--surface); stroke: var(--chart); stroke-width: 2.2; }
.trend .stop-a { stop-color: var(--chart); stop-opacity: .22; }
.trend .stop-b { stop-color: var(--chart); stop-opacity: 0; }
.period-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.period-notes details { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.period-notes details[open] { grid-column: 1 / -1; }
.period-notes p { margin: 6px 0; color: var(--text-2); font-size: 13px; }
.period-notes .table-wrap { margin-top: 10px; }
.period-empty { margin-top: 8px; padding: 40px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.period-empty h2, .period-empty h3 { font-size: 17px; }
.period-empty p { margin: 8px auto 16px; max-width: 46ch; color: var(--muted); }
.range-diff { margin-bottom: 4px; }
.range-diff .diff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.diff-stat { padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.diff-stat span { display: block; color: var(--muted); font-size: 12px; }
.diff-stat strong { display: block; margin-top: 4px; font: 650 20px/1.2 var(--font-num); font-variant-numeric: tabular-nums; }
.diff-stat strong.up { color: var(--success); }
.diff-stat strong.down { color: var(--danger); }
.range-diff details { margin-top: 14px; }

/* ---------- 复盘 ---------- */
#report-conclusions { display: grid; gap: 10px; }
#report-conclusions p { padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--surface-2); line-height: 1.8; }
#report-conclusions .evidence-ref { display: inline-flex; min-height: 0; height: 22px; margin: 0 3px; padding: 0 8px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; vertical-align: 1px; }
#report-conclusions .evidence-ref:hover { background: var(--accent); color: #fff; }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* ---------- 登录 / 注册 ---------- */
body:not(.signed-in) main:has(> .auth-spread) { display: grid; place-items: center; width: 100%; max-width: none; min-height: 100svh; padding: clamp(16px, 4vh, 48px) clamp(16px, 4vw, 48px); }
body:has(.auth-spread) { background: radial-gradient(1200px 600px at 10% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent), var(--bg); }
.auth-spread { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); width: min(1120px, 100%); min-height: min(720px, 86svh); overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); }
.auth-cover {
  display: grid; grid-template-rows: 1fr auto; align-items: center; gap: 24px;
  padding: clamp(28px, 4vw, 48px); background: #f5f7f5; color: #23322e;
}
.auth-art {
  display: block; width: 100%; height: auto; mix-blend-mode: multiply;
  /* The source photograph ends in five black scanlines. Keep them outside the artwork. */
  clip-path: inset(0 0 1.5%);
}
.auth-series { color: #586660; font-size: 12.5px; letter-spacing: .1em; }
.auth-brand { margin-top: 10px; font: 700 clamp(36px, 4.4vw, 54px)/1.15 var(--serif); letter-spacing: .06em; }
.auth-tagline { margin-top: 14px; max-width: 30em; color: #465650; font-size: 14px; line-height: 1.8; text-wrap: pretty; }
.auth-features { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 18px; color: #586660; font-size: 12px; }
.auth-sheet { display: grid; place-items: center; padding: clamp(28px, 5vw, 64px); }
.auth-content { width: min(100%, 400px); }
.auth-title { margin-bottom: 26px; }
.auth-title h1 { font-size: 26px; }
.auth-title p { margin-top: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.auth-form { display: grid; gap: 16px; }
.auth-location { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-form label { min-width: 0; font-size: 13px; color: var(--text-2); }
.auth-form :is(input, select) { width: 100%; min-height: 44px !important; border-radius: 10px !important; font-size: 15px !important; }
.auth-form select:disabled { background-color: var(--surface-2); color: var(--muted); }
.auth-select { display: block; }
.auth-help { margin-top: -10px; color: var(--muted); font-size: 12px; }
.auth-form .auth-submit { width: 100%; min-height: 46px; margin-top: 4px; border-radius: 10px; font-size: 15px; font-weight: 600; letter-spacing: .1em; }
.auth-switch { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13.5px; }
.auth-switch a { margin-left: 4px; font-weight: 600; }
@media (max-width: 860px) {
  .auth-spread { grid-template-columns: 1fr; min-height: 0; }
  .auth-cover { grid-template: auto / minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
  .auth-brand { font-size: 34px; }
  .auth-tagline { margin-top: 10px; }
  .auth-features { display: none; }
}
@media (max-width: 480px) {
  body:not(.signed-in) main:has(> .auth-spread) { padding: 0; place-items: start stretch; }
  .auth-spread { border: 0; border-radius: 0; box-shadow: none; min-height: 100svh; align-content: start; }
  .auth-cover { grid-template: auto auto / 1fr; gap: 6px; padding: 12px 20px 20px; }
  .auth-art { width: min(100%, 300px); margin-inline: auto; }
  .auth-imprint { text-align: center; }
  .auth-brand { margin-top: 6px; }
  .auth-tagline { display: none; }
  .auth-sheet { padding: 26px 18px; }
  .auth-location { gap: 10px; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .battle-breakdown { grid-template-columns: 1fr; }
  .team-ledger ul { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 920px) {
  .roster-review, .grid-2 { grid-template-columns: 1fr; }
  .period-notes { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-head { align-items: flex-start; }
  .upload-grid { grid-template-columns: 1fr; }
  .kpis, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi, .kpis > div { padding: 13px 14px; }
  .kpi dt .icon { display: none; }
  .compare-filter .scope-columns { grid-template-columns: minmax(0, 1fr); }
  .desk-filter .filter-actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .calendar-grid { gap: 4px; }
  .calendar-grid > .weekday { padding-inline: 0; text-align: center; white-space: nowrap; }
  .calendar-grid > .cell { align-items: center; justify-content: flex-start; gap: 2px; min-height: 54px; padding: 4px 2px; font-size: 12px; }
  .calendar-grid .cell small { display: block; max-width: 100%; padding: 0 2px; text-align: center; overflow-wrap: anywhere; font-size: 10.5px; }
  .calendar-grid .pending-full { display: none; }
  .calendar-grid .pending-short { display: inline; }
  th, td { padding: 8px 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { select { appearance: auto; background-image: none; } }
