:root {
  --bg: #f5f7fa;
  --surface: #fff;
  --text: #10213d;
  --muted: #65738a;
  --border: #dfe5ec;
  --accent: #1268f3;
  --accent-dark: #0b54cd;
  --accent-soft: #eaf2ff;
  --red: #e51f2b;
  --red-dark: #c91520;
  --red-soft: #fff1f2;
  --teal: #1aa69a;
  --teal-soft: #eaf8f6;
  --orange: #d97706;
  --orange-soft: #fff7e8;
  --radius: 10px;
  --sidebar: 228px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-size: 14px; line-height: 1.55; }
a { color: #1769d2; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff;
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: #7086a6; box-shadow: 0 0 0 3px rgba(78, 105, 144, .1); }
textarea { resize: vertical; min-height: 88px; }
label { display: grid; gap: 8px; color: #2d3c55; font-weight: 600; }
label b, legend b { color: var(--red); }
small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 22px;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.brand { font-size: 18px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
.workspace-switch { min-width: 174px; display: flex; justify-content: space-between; align-items: center; padding: 9px 13px; background: #fff; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; }
.topbar-spacer { flex: 1; }
.top-create svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.admin-name { font-weight: 600; }
.topbar { padding-left: 24px; background: #08294e; border-bottom-color: #173d65; }
.workspace-switch { color: #dce8f6; background: #10365f; border-color: #315476; }
.admin-name, .topbar .text-button { color: #dce8f6; }
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); display: flex; flex-direction: column; padding: 18px 12px; background: #06284d; border-right: 1px solid #173d65; }
.nav-link { position: relative; display: flex; align-items: center; gap: 13px; min-height: 48px; padding: 0 16px; border-radius: 6px; color: #d8e6f5; font-size: 15px; font-weight: 600; }
.nav-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nav-link:hover { color: #fff; background: #103b69; }
.nav-link.active { color: #fff; background: var(--accent); }
.nav-link.active::before { display: none; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding: 16px; color: #8eacc9; font-size: 12px; }
.sidebar-foot a { color: #d8e6f5; }
.sidebar-foot span { display: block; }
.main-content { min-width: 0; min-height: calc(100vh - 64px); padding: 28px 34px 48px; background: #fff; }
.page-head { min-height: 50px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: -.6px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: var(--text); background: #fff; border-color: var(--border); }
.button-secondary:hover { background: #f8fafc; border-color: #bcc7d5; }
.button-danger { color: #b91c1c; background: #fff; border-color: #f0a3aa; }
.button-danger:hover { background: var(--red-soft); }
.button-block { width: 100%; }
.text-button { border: 0; padding: 4px 6px; background: transparent; color: #1769d2; cursor: pointer; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head > span { color: var(--muted); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.dashboard-main, .dashboard-rail { display: grid; align-content: start; gap: 16px; }
.priority-strip { min-height: 76px; display: flex; align-items: center; gap: 18px; padding: 0 22px; border: 1px solid #f1a7ad; border-radius: var(--radius); color: var(--red); background: linear-gradient(90deg, #fff7f7, #fff); font-size: 19px; font-weight: 800; }
.target-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #f3b9be; border-radius: 50%; font-size: 28px; }
.workflow-rail { list-style: none; margin: 0; padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.workflow-rail li { display: flex; align-items: center; gap: 9px; font-weight: 700; white-space: nowrap; }
.workflow-rail li:not(:last-child)::after { content: "→"; color: #aeb8c6; margin-left: 16px; font-size: 19px; }
.workflow-rail span { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #b8c3d1; border-radius: 50%; color: #53647d; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; text-align: left; color: #53647d; background: #f8fafc; font-size: 12px; font-weight: 700; white-space: nowrap; }
td { padding: 13px 14px; border-top: 1px solid #edf0f4; vertical-align: middle; }
tbody tr[data-href] { cursor: pointer; }
tbody tr:hover { background: #f8fbff; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.cost { color: var(--red); font-weight: 800; white-space: nowrap; }
.status { display: inline-flex; padding: 3px 7px; border: 1px solid #cbd5e1; border-radius: 5px; color: #53647d; background: #f8fafc; font-size: 12px; white-space: nowrap; }
.status-待审核, .status-候选 { color: var(--orange); border-color: #f3c782; background: var(--orange-soft); }
.status-已审核, .status-已投放, .status-已确认 { color: #087f75; border-color: #8bd8d1; background: var(--teal-soft); }
.status-启用 { color: #087f75; border-color: #8bd8d1; background: var(--teal-soft); }
.status-已停用 { color: #64748b; border-color: #cbd5e1; background: #f1f5f9; }
.funnel-row { display: flex; align-items: center; justify-content: space-between; padding: 23px 18px; }
.funnel-row > b { color: #b2bdca; font-size: 24px; }
.funnel-step { min-width: 100px; }
.funnel-step span { display: block; color: var(--muted); font-size: 12px; }
.funnel-step strong { display: block; margin-top: 6px; font-size: 19px; }
.funnel-foot { padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); text-align: right; }
.pending-panel > a { display: flex; justify-content: space-between; padding: 18px; color: var(--text); border-bottom: 1px solid var(--border); font-weight: 600; }
.pending-panel > a:last-child { border-bottom: 0; }
.pending-panel > a strong { color: var(--accent); font-size: 18px; }
.timeline { list-style: none; margin: 0; padding: 4px 16px 12px; }
.timeline li { position: relative; display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 16px 0 16px 14px; border-left: 1px solid #d9e0e8; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 21px; width: 9px; height: 9px; background: var(--teal); border: 2px solid #fff; border-radius: 50%; }
.timeline time { color: var(--muted); font-size: 12px; }
.timeline strong { font-size: 13px; }
.timeline p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.empty { padding: 32px 18px; color: var(--muted); text-align: center; }
.flash-stack { position: fixed; z-index: 50; top: 76px; right: 24px; display: grid; gap: 8px; }
.flash { max-width: 420px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.flash-success { color: #087f75; border-color: #9adfd8; background: var(--teal-soft); }
.flash-error { color: #b91c1c; border-color: #f0a3aa; background: var(--red-soft); }
.flash-info { color: #1d4ed8; border-color: #b6ccf7; background: #eff6ff; }
.upload-panel { padding: 18px; margin-bottom: 18px; }
.upload-form { display: grid; grid-template-columns: 1fr 180px minmax(240px, 1fr) auto; align-items: end; gap: 12px; }
.file-control input { padding: 8px; }
.form-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.knowledge-list { display: grid; gap: 12px; }
.knowledge-row { display: flex; justify-content: space-between; gap: 24px; padding: 20px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.knowledge-copy { min-width: 0; }
.knowledge-copy h2 { margin: 9px 0 6px; font-size: 17px; }
.knowledge-copy p { margin: 0 0 9px; color: #40506a; }
.row-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 3px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tab.active { color: var(--accent); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 20px; }
.editor-main { padding: 20px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.field-row, .field-grid { margin-bottom: 18px; }
.field-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { margin: 0 0 18px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; }
legend { padding: 0 6px; color: #2d3c55; font-weight: 700; }
.source-search { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.source-search span { white-space: nowrap; color: var(--muted); }
.source-options { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.source-option { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); font-weight: 500; cursor: pointer; }
.source-option:last-child { border-bottom: 0; }
.source-option:hover { background: #f8fbff; }
.source-option input { width: auto; }
.source-option time { color: var(--muted); font-size: 12px; }
.file-tag { padding: 2px 5px; border-radius: 4px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 800; }
.strategy-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.strategy-row > span { width: 80px; color: var(--muted); }
.check-chip { display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-weight: 600; cursor: pointer; }
.check-chip input { width: auto; accent-color: var(--accent); }
.output-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; }
.output-list strong { margin-right: 8px; }
.output-list span { color: #516078; font-size: 12px; }
.output-list span::before { content: "✓"; margin-right: 4px; color: var(--teal); }
.form-success { padding: 11px 13px; color: #087f75; border: 1px solid #a7ded8; border-radius: 7px; background: var(--teal-soft); }
.editor-rail, .script-rail { position: sticky; top: 84px; display: grid; gap: 12px; }
.summary-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 16px; margin: 0; }
.summary-panel dt { color: var(--muted); }
.summary-panel dd { margin: 0; font-weight: 700; text-align: right; }
.risk-boundary { margin: 0; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--red); font-size: 12px; font-weight: 700; }
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.code-panel pre { max-height: 72vh; margin: 0; padding: 20px; overflow: auto; white-space: pre-wrap; color: #24344d; background: #fbfcfe; font: 13px/1.65 "SFMono-Regular", Consolas, monospace; }
.import-panel { position: sticky; top: 84px; padding-bottom: 14px; }
.import-panel form { display: grid; gap: 12px; padding: 16px; }
.import-panel .form-success { margin: 0 16px; }
.script-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.script-main { display: grid; gap: 14px; }
.script-copy, .prompt-copy { padding: 20px; white-space: pre-wrap; font-size: 16px; line-height: 1.85; }
.prompt-copy { font-size: 14px; color: #34445d; }
.shot-list article { display: grid; grid-template-columns: 78px 1fr; gap: 16px; padding: 16px; border-top: 1px solid var(--border); }
.shot-list article:first-child { border-top: 0; }
.shot-list time { color: var(--red); font-weight: 800; }
.shot-list p { margin: 4px 0; }
.shot-list small { line-height: 1.7; }
.risk-panel p { margin: 0; padding: 16px; color: #9f1d27; }
.provenance-panel ul { margin: 0; padding: 14px 16px 14px 34px; }
.status-form { display: grid; gap: 10px; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.settings-list > div { padding: 20px; border-bottom: 1px solid var(--border); }
.settings-list > div:last-child { border-bottom: 0; }
.settings-list h2 { margin: 0; font-size: 16px; }
.settings-list p { margin: 5px 0 0; color: var(--muted); }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.password-panel form { padding: 18px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(120deg, #f7f9fc, #fff 55%); }
.login-panel { width: min(420px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.login-brand { color: var(--red); font-weight: 800; }
.login-panel h1 { margin: 18px 0 6px; font-size: 27px; }
.login-panel > p { margin: 0 0 24px; color: var(--muted); }
.stack-form { display: grid; gap: 16px; }

/* 资料中心 */
.compact-head { margin-bottom: 14px; }
.collapsible { display: none; }
.collapsible.open { display: block; }
.source-upload-form { display: grid; grid-template-columns: minmax(180px, 1fr) 150px minmax(220px, 1fr) auto; align-items: end; gap: 14px; }
.source-upload-form .transcript-field { grid-column: 1 / -1; }
.resource-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.filter-tabs { display: flex; gap: 32px; }
.filter-tabs a { padding: 13px 2px 11px; border-bottom: 2px solid transparent; color: #43536b; font-weight: 700; }
.filter-tabs a.active { color: var(--accent); border-color: var(--accent); }
.search-form { display: grid; grid-template-columns: minmax(240px, 340px) auto; gap: 8px; padding-bottom: 8px; }
.resource-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.resource-summary > div { padding: 18px 28px; border-right: 1px solid var(--border); }
.resource-summary > div:last-child { border-right: 0; }
.resource-summary span { display: block; color: var(--muted); }
.resource-summary strong { display: block; margin-top: 4px; color: var(--accent); font-size: 24px; }
.resource-table { border-radius: 6px; }
.resource-name { display: flex; align-items: center; gap: 12px; min-width: 280px; }
.format-icon { width: 38px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #cdd8e6; border-radius: 5px; color: #53647d; background: #f8fafc; font-size: 9px; font-weight: 900; }
.format-pdf { color: #d92d20; border-color: #f2b7b2; background: #fff5f4; }
.format-csv, .format-txt, .format-md { color: #07845b; border-color: #9ad9c2; background: #f0fbf6; }
.format-mp4, .format-mov, .format-m4v { color: #6841d8; border-color: #cbbcf2; background: #f6f3ff; }
.type-label { color: var(--accent); font-weight: 700; }
.state-dot { width: 7px; height: 7px; display: inline-block; margin-right: 7px; border-radius: 50%; background: #a6b1c0; }
.state-dot.ready { background: #16a168; }
.state-dot.waiting { background: #f59e0b; }
.warning-text { color: #d97706 !important; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); }
.source-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.source-detail-rail { display: grid; gap: 16px; }
.source-preview { max-height: 72vh; margin: 0; padding: 22px; overflow: auto; white-space: pre-wrap; color: #33445d; background: #fbfcfe; font: 14px/1.75 "SFMono-Regular", Consolas, monospace; }
.transcript-panel form { padding: 16px; }

/* 生成记录 */
.history-filters { display: grid; grid-template-columns: minmax(260px, 420px) 180px auto auto; gap: 10px; margin-bottom: 18px; }
.history-table { border-radius: 6px; }
.action-links { display: flex; flex-wrap: wrap; gap: 10px; min-width: 130px; }
.task-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.task-primary, .task-side { display: grid; gap: 16px; }
.task-side { position: sticky; top: 84px; }
.task-brief dl { display: grid; grid-template-columns: 100px 1fr; gap: 14px 18px; margin: 0; padding: 20px; }
.task-brief dt { color: var(--muted); }
.task-brief dd { margin: 0; }
.reference-source-list { display: grid; grid-template-columns: repeat(2, 1fr); border-bottom: 1px solid var(--border); }
.reference-source-list > a { padding: 16px; color: var(--text); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.matched-fragments { padding: 18px; }
.matched-fragments h3 { margin: 0 0 12px; font-size: 15px; }
.matched-fragments article { display: grid; grid-template-columns: 200px 1fr; gap: 18px; padding: 12px 0; border-top: 1px solid #edf1f5; }
.matched-fragments article p { margin: 0; color: #45556d; }
.task-package-details summary { padding: 16px; color: var(--accent); font-weight: 700; cursor: pointer; }
.workflow-panel ol { list-style: none; margin: 0; padding: 16px 20px; }
.workflow-panel li { position: relative; padding: 0 0 24px 26px; color: var(--muted); }
.workflow-panel li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: 0; width: 1px; background: #cdd7e4; }
.workflow-panel li::before { content: ""; position: absolute; left: 0; top: 4px; width: 11px; height: 11px; border: 2px solid #aab6c6; border-radius: 50%; background: #fff; }
.workflow-panel li.done, .workflow-panel li.current { color: var(--text); font-weight: 700; }
.workflow-panel li.done::before { border-color: var(--accent); background: var(--accent); }
.workflow-panel li.current::before { border-color: var(--accent); }
.source-option.disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 1100px) {
  :root { --sidebar: 76px; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link span, .sidebar-foot { display: none; }
  .dashboard-layout, .editor-layout, .script-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-rail { grid-template-columns: 1fr 1fr; }
  .editor-rail, .script-rail { position: static; grid-template-columns: 1fr 1fr; }
  .task-layout { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .source-detail-layout, .task-workspace { grid-template-columns: 1fr; }
  .task-side { position: static; }
  .import-panel { position: static; }
  .workflow-rail li:not(:last-child)::after { margin-left: 6px; }
}

@media (max-width: 760px) {
  .topbar { height: 58px; padding: 0 14px; gap: 10px; }
  .brand { font-size: 17px; }
  .workspace-switch, .admin-name, .top-create { display: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; top: auto; height: 60px; flex-direction: row; justify-content: space-around; padding: 5px; border: 0; border-top: 1px solid var(--border); }
  .nav-link { width: 14%; min-height: 48px; }
  .nav-link.active::before { left: 20%; right: 20%; top: -5px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .main-content { padding: 20px 14px 82px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head h1 { font-size: 24px; }
  .dashboard-rail, .editor-rail, .script-rail { grid-template-columns: 1fr; }
  .workflow-rail { overflow-x: auto; justify-content: flex-start; }
  .workflow-rail li:not(:last-child)::after { margin-left: 6px; }
  .priority-strip { font-size: 16px; }
  .funnel-row { overflow-x: auto; gap: 16px; justify-content: flex-start; }
  .upload-form, .field-grid.two { grid-template-columns: 1fr; }
  .source-upload-form, .history-filters, .search-form { grid-template-columns: 1fr; }
  .resource-toolbar { align-items: stretch; flex-direction: column; }
  .filter-tabs { width: 100%; gap: 18px; overflow-x: auto; }
  .resource-summary { grid-template-columns: 1fr; }
  .resource-summary > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .resource-summary > div:last-child { border-bottom: 0; }
  .reference-source-list { grid-template-columns: 1fr; }
  .matched-fragments article { grid-template-columns: 1fr; gap: 6px; }
  .knowledge-row { flex-direction: column; }
  .row-actions { flex-wrap: wrap; }
  .source-option { grid-template-columns: auto auto 1fr; }
  .source-option time { display: none; }
  .shot-list article { grid-template-columns: 1fr; gap: 6px; }
}
