:root {
  color-scheme: light;
  font: 15px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --page: #f2f5f6;
  --paper: #fff;
  --ink: #192a30;
  --muted: #53646c;
  --line: #d5dfe2;
  --accent: #126456;
  --accent-dark: #0a4b40;
  --sidebar: #142f34;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--page); }
a { color: var(--accent-dark); }
button, input, select, .button { font: inherit; }
button, .button, input, select {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 44px;
  color: var(--ink);
  background: var(--paper);
  padding: .48rem .8rem;
}
button, .button, summary { cursor: pointer; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
button:hover, .button:hover { background: #eaf2f0; }
button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); }
:focus-visible { outline: 3px solid #368fd0; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.035em; }
h2 { font-size: 1.14rem; }
h3 { font-size: 1rem; }
label { display: grid; gap: .35rem; color: var(--muted); }
label input, label select { width: 100%; }
.skip { position: fixed; left: 1rem; top: -10rem; padding: .5rem; background: white; z-index: 10; }
.skip:focus { top: 1rem; }
.shell { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); padding: 24px 14px; }
.brand { display: flex; align-items: center; gap: 11px; color: white; font-weight: 750; text-decoration: none; white-space: nowrap; }
.mark { flex: 0 0 auto; width: 25px; height: 25px; background: #a5ead3; border-radius: 7px; position: relative; display: inline-block; }
.mark::before { content: ""; position: absolute; inset: 6px; border: 2px solid var(--sidebar); border-radius: 3px; }
.sidebar nav { display: grid; gap: 7px; margin-top: 36px; }
.sidebar nav a { padding: 10px 12px; min-height: 44px; border-radius: 7px; color: #d5e7e8; text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { color: white; background: #275152; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); min-height: 68px; padding: 10px 24px; }
.topbar, .section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
#top-title { font-weight: 650; color: var(--muted); }
.actions, .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters { align-items: end; gap: 12px; margin: 14px 0; }
.filters label { flex: 1 1 145px; min-width: 0; }
.workspace { max-width: 1560px; margin: auto; padding: clamp(16px, 3vw, 32px); display: grid; gap: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.kpis, .agent-cards, .extensions, .comparison { display: grid; gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis .card { display: flex; flex-direction: column; gap: 7px; }
.kpis strong { font-size: 1.9rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpis span, .muted { color: var(--muted); }
.kpis .card:first-child { background: #e8f5ef; border-color: #aed5c5; }
.agent-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agent-cards .card > * + *, .dialog-content > * + * { margin-top: 12px; }
.extensions, .comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.comparison { margin-top: 14px; }
.comparison p { background: var(--page); padding: 8px 12px; border-radius: 7px; }
.table-wrap { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 9px 10px; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { background: var(--page); color: var(--muted); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
td .actions { min-width: max-content; }
.pagination { justify-content: flex-end; margin-top: 12px; }
.pill { display: inline-block; color: #344f58; background: #e9f0f2; border-radius: 999px; padding: 3px 9px; font-weight: 650; font-size: .85rem; }
.good { color: #145342; background: #dbf3e8; }
.warn { color: #694300; background: #fff0c7; }
.bad, .error { color: #a32a32; }
.bad { background: #fce4e6; }
.notice { margin: 12px 24px 0; background: #e2f5ea; padding: 10px 16px; border-radius: 7px; }
.notice.error { background: #fce4e6; }
summary { font-weight: 650; padding: 8px 0; }
.priorities { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 12px 0 0; }
.wedrive .actions { margin-top: 12px; }
.drop-zone { text-align: center; background: #eff7f4; border: 2px dashed #91b9aa; border-radius: var(--radius); padding: 1.2rem 1rem; margin-top: 12px; cursor: pointer; color: var(--accent-dark); font-weight: 650; }
.drop-zone span { font-weight: 400; }
.drop-zone input { cursor: pointer; margin: .35rem auto 0; width: min(100%, 380px); }
.drop-zone.dragging { background: #d8eee5; }
progress { width: 100%; accent-color: var(--accent); }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at top, #dceee8, var(--page) 65%); }
.login-card { width: min(100%, 420px); display: grid; gap: 16px; padding: 32px; }
.login-card .error:empty, #upload-status:empty, #split-error:empty, #admin-error:empty, #eval-error:empty { display: none; }
dialog { width: min(1024px, 94vw); max-height: 94vh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
dialog::backdrop { background: #12282dbb; }
dialog header { position: sticky; z-index: 1; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: white; border-bottom: 1px solid var(--line); padding: 12px 20px; }
dialog.drawer { margin: 0 0 0 auto; width: min(860px, 96vw); height: 100vh; max-height: 100vh; border-radius: 12px 0 0 12px; }
.dialog-content { padding: 20px; }
.preview-image { display: block; max-width: 100%; max-height: 75vh; margin: auto; }
iframe { width: 100%; height: 70vh; border: 1px solid var(--line); }
pre { padding: 12px; background: var(--page); border-radius: 7px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.materials { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
.materials .card { padding: 10px; overflow-wrap: anywhere; }
.materials button { width: 100%; }
.materials img { display: block; width: 100%; height: 85px; object-fit: contain; }
#spread-frame { background: #e6eeef; padding: 8px; text-align: center; }
canvas { display: inline-block; width: auto; max-width: 100%; vertical-align: middle; touch-action: none; }
.check { display: flex; align-items: center; min-height: 44px; gap: 7px; }
.check input { width: auto; min-height: auto; }
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 10px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .sidebar nav { display: flex; flex-wrap: wrap; margin: 0; }
}
@media (max-width: 660px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-cards, .extensions, .comparison { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding-inline: 12px; }
}
