:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --paper-2: #fffdf7;
  --ink: #163234;
  --muted: #6e7d7f;
  --line: #ddd4c4;
  --gold: #d9a441;
  --gold-soft: #f4e2b5;
  --coral: #c96f5b;
  --teal: #173a3a;
  --sage: #a8b8a4;
  --shadow: 0 18px 48px rgba(34, 47, 45, .10);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 310px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; background: var(--teal); color: #f7f1e7; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.rose { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50% 50% 46% 54%; background: var(--gold); color: var(--teal); font-size: 24px; box-shadow: inset 0 0 0 6px rgba(255,255,255,.14); }
.brand strong { display: block; font-family: STSong, Songti SC, serif; font-size: 20px; letter-spacing: .04em; }
.brand span { color: #b9cac7; font-size: 12px; }
.local-badge { display: inline-flex; gap: 6px; align-items: center; padding: 6px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #d7e3df; font-size: 11px; }
.local-badge::before { content: ""; width: 7px; height: 7px; background: #98c88e; border-radius: 50%; }
.team-session-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px; }
.team-logout { width: 100%; padding-inline: 8px; border-color: rgba(255,255,255,.18); background: transparent; color: #dbe8e4; }

.nav { display: grid; gap: 7px; margin: 22px 0; }
.nav button { border: 0; border-radius: 12px; padding: 11px 13px; text-align: left; color: #dbe8e4; background: transparent; }
.nav button:hover, .nav button.active { background: rgba(255,255,255,.11); color: white; }
.nav small { display: block; margin-top: 2px; color: #9eb6b2; }
.side-section { margin-top: 24px; }
.side-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #9eb6b2; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }
.side-title button { width: 27px; height: 27px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: transparent; color: white; }
.card-nav { display: grid; gap: 7px; }
.card-nav button { border: 1px solid transparent; border-radius: 12px; padding: 10px 11px; text-align: left; color: #d8e4e1; background: rgba(255,255,255,.04); }
.card-nav button.active { border-color: rgba(217,164,65,.7); background: rgba(217,164,65,.13); }
.card-nav strong { display: block; font-size: 13px; line-height: 1.45; }
.card-nav span { display: inline-block; margin-top: 5px; font-size: 10px; color: #a9bfbb; }

.main { min-width: 0; padding: 28px 34px 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 6px; color: var(--coral); font-weight: 700; font-size: 12px; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3 { font-family: STSong, Songti SC, serif; font-weight: 700; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 44px); line-height: 1.1; }
h2 { margin: 0 0 14px; font-size: 25px; }
h3 { margin: 0 0 10px; font-size: 18px; }
.subtitle { margin: 8px 0 0; max-width: 760px; color: var(--muted); line-height: 1.7; }
.button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--paper-2); color: var(--ink); }
.button:hover { border-color: var(--gold); }
.button.primary { border-color: var(--teal); background: var(--teal); color: white; }
.button.gold { border-color: var(--gold); background: var(--gold); color: var(--teal); font-weight: 700; }
.button.danger { border-color: #d9aaa0; color: #8e4235; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat, .panel { border: 1px solid var(--line); background: rgba(255,253,247,.88); border-radius: 18px; box-shadow: var(--shadow); }
.stat { padding: 19px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 9px; font: 700 31px/1 STSong, Songti SC, serif; }
.panel { padding: 22px; }
.dashboard-grid { margin-top: 18px; grid-template-columns: 1.2fr .8fr; }
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 18px; }
.pipeline-step { min-height: 104px; padding: 13px; border-radius: 14px; background: #eee8dc; }
.pipeline-step strong { display: block; margin-bottom: 7px; color: var(--coral); font-size: 12px; }
.pipeline-step span { font-size: 12px; line-height: 1.5; }
.notice { padding: 14px 16px; border-left: 4px solid var(--gold); border-radius: 8px; background: #fbf0d6; color: #5e533d; line-height: 1.65; }
.notice.safe { border-color: #7caa82; background: #edf6ed; }
.notice.warn { border-color: var(--coral); background: #faeae5; }
.mini-list { display: grid; gap: 12px; }
.mini-item { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.mini-item:last-child { border-bottom: 0; }
.mini-item strong { display: block; }
.mini-item span { color: var(--muted); font-size: 12px; }

.workbench { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.15fr); gap: 20px; align-items: start; }
.sticky-col { position: sticky; top: 20px; }
.source-box { max-height: 240px; overflow: auto; padding: 16px; border-radius: 12px; background: #f0eadf; line-height: 1.75; font-size: 13px; white-space: pre-wrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 16px; }
.tag { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: #e8e1d5; color: #5d6766; font-size: 11px; }
.tag.gold { background: var(--gold-soft); color: #73561c; }
.tag.green { background: #dceadc; color: #35643c; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; color: #536466; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fffefb; color: var(--ink); }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.65; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid rgba(217,164,65,.28); border-color: var(--gold); }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.preview-card { min-height: 280px; position: relative; overflow: hidden; padding: 28px; border: 1px solid #d7c9ad; border-radius: 16px; background: radial-gradient(circle at 85% 15%, rgba(217,164,65,.26), transparent 34%), linear-gradient(135deg, #fffaf0, #e8eee9); }
.preview-card::after { content: "文字预演 · 不是正式图片"; position: absolute; right: 14px; bottom: 12px; color: #8a7f6b; font-size: 10px; letter-spacing: .08em; }
.preview-card h3 { max-width: 75%; font-size: 24px; }
.preview-card p { max-width: 82%; line-height: 1.75; white-space: pre-wrap; }
.preview-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.preview-map div { min-height: 74px; padding: 12px; border: 1px dashed #b7aa91; border-radius: 10px; background: rgba(255,255,255,.5); font-size: 11px; line-height: 1.5; }

.canvas-wrap { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #e9e5dc; }
canvas { display: block; width: 100%; height: 300px; background: white; border-radius: 9px; touch-action: none; }
.canvas-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reference-grid, .version-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.asset { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: white; }
.asset img { width: 100%; aspect-ratio: 4/3; display: block; object-fit: contain; background: #ece9e1; }
.asset-body { padding: 10px; }
.asset-body strong { display: block; font-size: 12px; }
.asset-body span { color: var(--muted); font-size: 11px; }

.restatement { display: grid; gap: 12px; padding: 18px; border-radius: 15px; background: #e8efec; }
.restatement textarea { min-height: 78px; }
.codex-box { display: grid; gap: 16px; padding: 18px; border: 1px solid #c8d5d1; border-radius: 15px; background: linear-gradient(135deg, #edf4f1, #fff8e8); }
.codex-capabilities { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.codex-capabilities div { min-height: 82px; padding: 12px; border-radius: 11px; background: rgba(255,255,255,.72); }
.codex-capabilities strong, .codex-capabilities span { display: block; }
.codex-capabilities strong { margin-bottom: 6px; font-size: 12px; }
.codex-capabilities span, .microcopy { color: var(--muted); font-size: 11px; line-height: 1.55; }
.codex-capabilities .muted-capability { opacity: .72; }
.codex-job { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border-left: 4px solid var(--gold); border-radius: 9px; background: #fffaf0; }
.codex-job.hidden { display: none; }
.codex-job strong, .codex-job span { display: block; }
.codex-job span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.seedream-box { display: grid; gap: 16px; padding: 18px; border: 1px solid #d8c493; border-radius: 15px; background: linear-gradient(135deg, #fff9e8, #f0f6f2); }
.delivery-box { padding: 18px; border: 1px solid #b9cec7; border-radius: 15px; background: linear-gradient(135deg, #eef5f2, #fffaf0); }
.seedream-usage { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 11px; background: rgba(255,255,255,.75); }
.seedream-usage strong, .seedream-usage span { display: block; }
.seedream-usage span { color: var(--muted); font-size: 11px; }
.reference-selector { display: grid; gap: 8px; max-height: 220px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fffefb; }
.request-preview { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); }
.request-preview summary { cursor: pointer; font-weight: 700; }
.request-preview textarea { width: 100%; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f4ed; color: var(--ink); line-height: 1.6; }
.model-default-form { align-items: end; margin: 18px 0; padding: 16px; border-radius: 12px; background: #f7f3e9; }
.model-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; margin: 18px 0; }
.model-provider-form { box-shadow: none; border: 1px solid #d8d1bf; }
.microcopy { margin: 0; }
.checkline { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.5; }
.approval-gate { padding: 16px; border: 1px solid #d5b464; border-radius: 14px; background: #fff6dd; }
.gate-list { display: grid; gap: 6px; margin: 10px 0; font-size: 12px; }
.gate-pass { color: #397044; }
.gate-fail { color: #9b4d3c; }

.compare-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.compare-version { border: 2px solid transparent; }
.compare-version.selected { border-color: var(--gold); }
.compare-version img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; background: #e8e5dd; }
.empty { padding: 34px; border: 1px dashed #bdb29f; border-radius: 16px; text-align: center; color: var(--muted); }
.bible-grid { grid-template-columns: 1fr 1fr; }
.map-method { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.map-method div { padding: 13px; border-radius: 12px; background: #eee8dc; }
.map-method strong, .map-method span { display: block; }
.map-method span { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.map-filters { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 12px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.map-card { display: grid; gap: 12px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fffefb; }
.map-card-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.map-card h3 { margin: 3px 0 0; line-height: 1.35; }
.candidate-id { color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.priority { min-width: 38px; padding: 7px 8px; border-radius: 9px; text-align: center; font-size: 11px; font-weight: 800; }
.priority.p0 { background: #173a3a; color: white; }
.priority.p1 { background: var(--gold-soft); color: #73561c; }
.priority.p2 { background: #e4e7e2; color: #59645c; }
.map-thought, .map-preview { padding: 12px 13px; border-radius: 11px; }
.map-thought { background: #f1ece2; }
.map-preview { background: #edf4ef; }
.map-thought strong, .map-preview strong { color: var(--coral); font-size: 11px; }
.map-thought p, .map-preview p { margin: 6px 0 0; line-height: 1.65; font-size: 13px; }
.map-preview small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.5; }
.map-card details { color: var(--muted); font-size: 12px; line-height: 1.6; }
.map-card summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.footer-note { margin-top: 26px; color: var(--muted); font-size: 11px; text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 360px; padding: 13px 16px; border-radius: 11px; background: var(--teal); color: white; box-shadow: var(--shadow); }
.toast.error { background: #933f32; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(18,36,37,.62); }
.modal { width: min(720px, 100%); max-height: 82vh; overflow: auto; padding: 24px; border-radius: 18px; background: var(--paper-2); box-shadow: var(--shadow); }
.book-options { display: grid; gap: 6px; max-height: 48vh; overflow: auto; margin: 14px 0; }
.book-options button { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: white; text-align: left; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 78% 16%, rgba(217,164,65,.26), transparent 28%), var(--paper); }
.login-card { width: min(460px, 100%); display: grid; gap: 17px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper-2); box-shadow: var(--shadow); }
.login-card .rose { margin-bottom: 4px; }
.login-card h1, .login-card p { margin-top: 0; }
.loading-inline { padding: 18px; color: var(--muted); }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 250px 1fr; }
  .main { padding: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workbench { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .map-method, .map-filters { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 18px; }
  .brand { margin-bottom: 13px; }
  .nav { grid-template-columns: repeat(2, 1fr); margin: 14px 0; }
  .side-section { margin-top: 14px; }
  .card-nav { display: flex; overflow-x: auto; }
  .card-nav button { min-width: 210px; }
  .main { padding: 22px 16px 50px; }
  .topbar { align-items: flex-start; }
  .stats, .dashboard-grid, .form-grid, .bible-grid { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .reference-grid, .version-grid { grid-template-columns: 1fr; }
  .codex-capabilities { grid-template-columns: 1fr; }
  .model-settings-grid { grid-template-columns: 1fr; }
  .map-method, .map-filters, .map-grid { grid-template-columns: 1fr; }
  .preview-card h3, .preview-card p { max-width: 100%; }
  .preview-map { grid-template-columns: 1fr; }
}
