:root {
  --navy-950: #071d42;
  --navy-800: #15345f;
  --ink-950: #0b1d3a;
  --ink-600: #536176;
  --track-red: #ff4b4b;
  --published-green: #31a870;
  --line-200: #dfe4ea;
  --surface-muted: #f7f9fb;
  --white: #ffffff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --space-unit: 4px;
  --sidebar-width: 208px;
  color: var(--ink-950);
  background: var(--white);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--white); color: var(--ink-950); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
:focus-visible { outline: 2px solid var(--track-red); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy-950); color: var(--white); }
.brand { min-height: 104px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 20px 24px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { width: 46px; height: 46px; color: var(--track-red); stroke-width: 2.3; }
.nav-links { display: flex; flex-direction: column; padding: 8px 0; }
.nav-link { position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 24px; color: #dce7f6; font-size: 14px; font-weight: 600; }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-link:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-link.is-active { background: var(--navy-800); color: var(--white); }
.nav-link.is-active::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--track-red); }
.nav-toggle { display: none; }
.sidebar-user { margin: auto 18px 20px; padding: 16px 0 0; border-top: 1px solid rgba(255,255,255,.24); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.logout-form { margin-left: auto; }
.nav-logout { padding: 4px 0; border: 0; background: transparent; color: rgba(255,255,255,.72); font: inherit; cursor: pointer; }
.nav-logout:hover { color: var(--white); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy-950); }
.login-panel { width: min(100%, 420px); padding: 36px; border-top: 4px solid var(--track-red); background: var(--white); }
.login-panel h1 { margin: 4px 0 10px; font-size: 30px; }
.login-panel > p:not(.eyebrow):not(.form-error) { color: var(--ink-600); line-height: 1.65; }
.form-error { margin: 16px 0 0; padding: 10px 12px; border-left: 3px solid var(--track-red); color: #9a2929; background: #fff7f7; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; }

.workspace { min-width: 0; padding: 32px 40px 48px; background: var(--white); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line-200); }
.page-header h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -.025em; }
.eyebrow { margin: 0; color: var(--ink-600); font-size: 13px; line-height: 1.4; font-weight: 600; }
.primary-button, .secondary-button, .small-button { min-height: 40px; border: 1px solid transparent; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; font-size: 13px; line-height: 1.4; font-weight: 600; }
.primary-button { background: var(--track-red); color: var(--white); }
.primary-button:hover { background: #e94242; }
.primary-button svg { width: 17px; height: 17px; }
.secondary-button { border-color: var(--line-200); background: var(--white); color: var(--ink-950); }
.secondary-button:hover, .small-button:hover { background: var(--surface-muted); }
.small-button { min-height: 34px; padding: 7px 10px; border-color: var(--line-200); background: var(--white); }

.kpi-strip { display: flex; gap: 0; max-width: 650px; padding: 18px 0 20px; }
.kpi-strip > div { min-width: 150px; padding: 0 28px; border-right: 1px solid var(--line-200); }
.kpi-strip > div:first-child { padding-left: 0; }
.kpi-strip > div:last-child { border-right: 0; }
.kpi-strip span { display: block; color: var(--ink-600); font-size: 13px; font-weight: 500; }
.kpi-strip strong { display: block; margin-top: 4px; color: var(--track-red); font-size: 34px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-strip .published-number { color: var(--published-green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 24px; align-items: start; }
.dashboard-main { min-width: 0; }
.weekly-rail { padding: 20px 0 24px; border-top: 1px solid var(--line-200); }
.weekly-rail h2, .queue-section h2, .training-context h2, .review-section h2, .detail-section h2, .form-section h2, .action-panel h2 { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 650; }
.weekly-rail ol { position: relative; list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); margin: 16px 0 0; padding: 0; }
.weekly-rail ol::before { content: ""; position: absolute; top: 49px; left: 7%; right: 7%; height: 1px; background: var(--line-200); }
.weekly-rail li { position: relative; min-width: 0; text-align: center; }
.weekly-rail time { display: flex; flex-direction: column; color: var(--ink-950); font-size: 13px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.weekly-rail time span { color: var(--ink-600); }
.weekly-rail i { position: relative; z-index: 1; display: block; width: 12px; height: 12px; margin: 10px auto 0; border: 1.5px solid #aab4c1; border-radius: 50%; background: var(--white); }
.weekly-rail .is-today i { border-color: var(--track-red); background: var(--track-red); }
.weekly-rail .is-today time { color: var(--track-red); font-weight: 600; }
.weekly-rail .is-scheduled i { border-color: var(--track-red); background: var(--track-red); }
.weekly-rail .is-scheduled time, .weekly-rail .is-scheduled .weekly-state { color: var(--track-red); font-weight: 600; }
.weekly-rail .is-published i { border-color: var(--published-green); background: var(--published-green); }
.weekly-rail .is-published time, .weekly-rail .is-published .weekly-state { color: var(--published-green); font-weight: 600; }
.weekly-state { display: block; min-height: 18px; margin-top: 7px; color: var(--ink-600); font-size: 11px; line-height: 1.35; }

.section-toolbar, .section-heading-row, .training-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-button { min-height: 32px; padding: 6px 13px; border: 1px solid var(--line-200); border-radius: 5px; background: var(--white); color: var(--ink-600); font-size: 13px; line-height: 1.4; font-weight: 600; }
.filter-button:hover { background: var(--surface-muted); color: var(--ink-950); }
.filter-button.is-active { border-color: var(--track-red); background: #fff4f4; color: var(--track-red); }

.queue-board { margin-top: 14px; border: 1px solid var(--line-200); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); }
.queue-board.is-filtered { grid-template-columns: minmax(0, 1fr); }
.queue-column { min-width: 0; display: flex; flex-direction: column; min-height: 310px; border-right: 1px solid var(--line-200); }
.queue-column:last-child { border-right: 0; }
.queue-column-header { min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line-200); }
.queue-column-header h3 { margin: 0; font-size: 14px; font-weight: 650; }
.queue-count { color: var(--ink-600); font-size: 13px; font-variant-numeric: tabular-nums; }
.queue-rows { flex: 1; padding: 8px; }
.queue-row { margin-bottom: 6px; padding: 10px; border: 1px solid transparent; border-bottom-color: var(--line-200); }
.queue-row:last-child { margin-bottom: 0; }
.queue-row.is-selected { border-color: var(--track-red); background: #fff7f7; }
.queue-row[hidden] { display: none; }
.queue-title { display: block; font-size: 13px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.queue-title:hover { color: var(--track-red); }
.queue-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; color: var(--ink-600); font-size: 12px; }
.queue-meta span { display: inline-flex; align-items: center; gap: 4px; }
.queue-meta svg { width: 14px; height: 14px; }
.empty-row { margin: 12px 4px; color: var(--ink-600); font-size: 13px; }
.column-link { min-height: 42px; border-top: 1px solid var(--line-200); display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--ink-600); font-size: 12px; font-weight: 600; }
.column-link:hover { color: var(--track-red); background: var(--surface-muted); }
.column-link svg, .external-link svg { width: 14px; height: 14px; }
.inline-form, .publish-form { display: grid; gap: 6px; margin-top: 10px; }
.inline-form label, .publish-form label { color: var(--track-red); font-size: 11px; font-weight: 600; }
.inline-form input, .publish-form input { width: 100%; min-width: 0; height: 34px; padding: 6px 8px; border: 1px solid var(--line-200); border-radius: 5px; color: var(--ink-950); background: var(--white); font-size: 12px; }
.external-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: #245ca6; font-size: 12px; font-weight: 600; }

.training-context { border: 1px solid var(--line-200); border-radius: var(--radius-md); overflow: hidden; background: var(--white); }
.training-heading-row, .training-source, .training-insight, .topic-suggestion, .manual-reminder { padding: 14px; border-bottom: 1px solid var(--line-200); }
.training-heading-row time { color: var(--ink-600); font-size: 12px; }
.training-source { color: var(--ink-950); font-size: 13px; font-weight: 600; }
.training-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 8px; border-bottom: 1px solid var(--line-200); }
.training-stats div { min-width: 0; text-align: center; }
.training-stats svg { display: block; width: 17px; height: 17px; margin: 0 auto 5px; color: var(--navy-800); }
.training-stats strong { display: block; white-space: nowrap; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.training-stats span { display: block; margin-top: 2px; color: var(--ink-600); font-size: 11px; }
.training-context h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.training-context p { margin: 0; color: var(--ink-600); font-size: 12px; line-height: 1.6; }
.topic-suggestion { background: #fffafa; }
.topic-suggestion a { display: block; margin-bottom: 8px; color: var(--track-red); font-size: 14px; font-weight: 650; }
.topic-suggestion p + p { margin-top: 4px; }
.manual-reminder { border-bottom: 0; }
.manual-reminder p { color: var(--track-red); font-weight: 600; }

.review-section { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-200); }
.section-heading-row a { color: var(--ink-600); font-size: 12px; font-weight: 600; }
.table-scroll { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line-200); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 10px 12px; border-right: 1px solid var(--line-200); border-bottom: 1px solid var(--line-200); text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
th { background: var(--surface-muted); color: var(--ink-600); font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: #245ca6; font-weight: 600; }
.empty-table { color: var(--ink-600); text-align: center !important; }

.detail-layout { max-width: 880px; }
.detail-section { padding: 26px 0; border-bottom: 1px solid var(--line-200); }
.detail-section .lead { font-size: 16px; line-height: 1.75; }
.detail-section p { margin: 12px 0 0; color: var(--ink-600); }
pre { margin: 12px 0 0; padding: 14px; overflow: auto; border: 1px solid var(--line-200); border-radius: var(--radius-sm); background: var(--surface-muted); color: var(--ink-950); font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

.topics-layout, .editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; margin-top: 24px; align-items: start; }
.page-filters { padding-bottom: 14px; border-bottom: 1px solid var(--line-200); }
.topic-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line-200); }
.topic-row h2 { margin: 0; font-size: 15px; line-height: 1.45; font-weight: 650; }
.topic-row p { margin: 6px 0; color: var(--ink-600); font-size: 13px; }
.topic-row span { color: var(--ink-600); font-size: 12px; }
.form-section, .action-panel { padding: 20px; border: 1px solid var(--line-200); border-radius: var(--radius-md); background: var(--white); }
.stacked-form { display: grid; gap: 16px; margin-top: 16px; }
.stacked-form label { display: grid; gap: 6px; color: var(--ink-600); font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line-200); border-radius: var(--radius-sm); background: var(--white); color: var(--ink-950); padding: 9px 10px; font-size: 14px; line-height: 1.5; }
input, select { min-height: 40px; }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #bac3ce; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.editor-form { margin-top: 0; }
.action-panel p { color: var(--ink-600); }
.action-panel form { margin-top: 16px; }
.compact { padding-top: 6px; border-top: 1px solid var(--line-200); }
.danger-link { border: 0; background: transparent; padding: 6px 0; color: #a43737; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.queue-page-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0 2px; color: var(--ink-600); }
.queue-page-intro strong { color: var(--track-red); font-size: 13px; }
.operations-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.operations-layout-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.data-section { min-width: 0; }
.section-note, .format-hint, .empty-note { margin: 10px 0 0; color: var(--ink-600); font-size: 13px; line-height: 1.65; }
.format-hint code { overflow-wrap: anywhere; color: var(--ink-950); }
.form-message, .import-result, .review-summary { margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--track-red); background: #fff7f7; font-size: 13px; }
.form-message.is-error { color: #9a2929; }
.import-result { display: grid; gap: 4px; }
.import-result span { color: var(--ink-600); }
.import-result p, .review-summary p { margin: 3px 0 0; color: var(--ink-600); }
.review-summary strong { display: block; margin-top: 5px; }
.review-period { font-variant-numeric: tabular-nums; }

@media (min-width: 1180px) {
  .sidebar { width: var(--sidebar-width); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 288px; }
  .queue-board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 768px) and (max-width: 1179px) {
  :root { --sidebar-width: 72px; }
  .brand { min-height: 78px; padding: 14px; align-items: center; }
  .brand span, .nav-link span, .sidebar-user span:not(.avatar) { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link svg { width: 20px; height: 20px; }
  .sidebar-user { justify-content: center; margin-inline: 12px; }
  .workspace { padding: 28px 28px 40px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .training-context { display: grid; grid-template-columns: 1fr 1fr; }
  .training-heading-row, .training-source { grid-column: span 1; }
  .training-stats { grid-column: 1 / -1; }
  .queue-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-column:nth-child(2) { border-right: 0; }
  .queue-column:nth-child(-n+2) { border-bottom: 1px solid var(--line-200); }
  .topics-layout, .editor-layout { grid-template-columns: 1fr; }
  .operations-layout { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 20; top: 0; width: 100%; height: auto; min-height: 58px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .brand { min-height: 58px; flex-direction: row; justify-content: flex-start; align-items: center; padding: 8px 16px; font-size: 17px; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; min-width: 84px; margin-right: 12px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius-sm); background: transparent; color: var(--white); font-size: 13px; font-weight: 600; }
  .nav-toggle svg { width: 17px; height: 17px; }
  .nav-links { display: none; grid-column: 1 / -1; padding: 4px 0 10px; border-top: 1px solid rgba(255,255,255,.18); }
  .sidebar.is-open .nav-links { display: grid; grid-template-columns: repeat(2, 1fr); }
  .nav-link { min-height: 44px; padding: 0 16px; }
  .sidebar-user { display: none; }
  .sidebar.is-open .sidebar-user { grid-column: 1 / -1; display: flex; min-height: 60px; margin: 0 16px 12px; padding: 10px 0 0; }
  .nav-logout { min-width: 64px; min-height: 44px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.55); border-radius: var(--radius-sm); color: var(--white); }
  .nav-logout:hover, .nav-logout:active { background: rgba(255,255,255,.1); }
  .workspace { padding: 22px 16px 36px; }
  .page-header { align-items: flex-end; }
  .page-header h1 { font-size: 24px; }
  .primary-button { flex: 0 0 auto; }
  .kpi-strip { width: 100%; }
  .kpi-strip > div { flex: 1; min-width: 0; padding: 0 10px; }
  .kpi-strip strong { font-size: 30px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .weekly-rail { overflow-x: auto; }
  .weekly-rail ol { min-width: 620px; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .filter-group { width: 100%; }
  .filter-button { flex: 1 1 auto; text-align: center; }
  .queue-board { grid-template-columns: 1fr; }
  .queue-column { min-height: 220px; border-right: 0; border-bottom: 1px solid var(--line-200); }
  .queue-column:last-child { border-bottom: 0; }
  .training-context { margin-top: 2px; }
  .section-heading-row { align-items: flex-start; }
  .topics-layout, .editor-layout { grid-template-columns: 1fr; gap: 20px; }
  .operations-layout { grid-template-columns: 1fr; gap: 20px; }
  .form-section, .action-panel { padding: 16px; }
  .topic-row { grid-template-columns: 1fr; gap: 12px; }
  .topic-row form, .topic-row button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .queue-page-intro { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
