:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d8dee8;
  --text: #172033;
  --subtle: #63708a;
  --brand: #155e75;
  --brand-soft: #e6f4f7;
  --danger: #9b1c1c;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.app-shell { max-width: 1360px; margin: 0 auto; padding: 20px; display: grid; gap: 16px; }
.hero, .card, .error-panel, .summary-grid article { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.hero { margin-bottom: 0; padding: 24px; box-shadow: 0 12px 28px rgba(23, 32, 51, 0.08); }
.shell-hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.hero h1 { margin: 4px 0 10px; font-size: clamp(30px, 4vw, 48px); line-height: 1.12; letter-spacing: 0; }
.hero p { max-width: 760px; margin: 0; color: #40506a; line-height: 1.65; }
.eyebrow { margin: 0 0 6px; color: var(--subtle); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.summary-grid article { padding: 14px; min-width: 0; }
.summary-grid span { display: block; color: var(--subtle); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.summary-grid strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 18px; }
.workspace-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workspace-nav article, .audit-workflow-map article { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.workspace-nav h2 { margin: 10px 0 6px; font-size: 18px; }
.workspace-nav p, .audit-workflow-map p { margin: 0; color: var(--subtle); line-height: 1.5; }
.workspace-nav .button { display: inline-flex; align-items: center; justify-content: center; width: fit-content; margin-top: 12px; }
.operation-feedback { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; border-left: 4px solid #166534; background: #f7fcf9; }
.operation-feedback p { margin: 6px 0; color: #40506a; line-height: 1.55; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.card { padding: 18px; box-shadow: 0 8px 20px rgba(23, 32, 51, 0.05); }
.shell-auth-panel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(360px, 2fr); gap: 14px; align-items: end; }
.teacher-dashboard-card { grid-column: 1 / -1; }
.teacher-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.card-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.section-intro { color: #40506a; line-height: 1.55; margin: 10px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
button, .button { border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px; padding: 8px 12px; text-decoration: none; cursor: pointer; min-height: 36px; }
.button.secondary { background: var(--brand-soft); color: #0e4b5f; border-color: #b8dbe4; white-space: nowrap; }
button:disabled { border-color: #b8c0d8; background: #d9deea; color: var(--subtle); cursor: not-allowed; }
.teacher-target-control { display: grid; grid-template-columns: auto minmax(180px, 320px) auto; align-items: end; gap: 8px; margin: 4px 0 14px; }
.teacher-target-control label { color: var(--subtle); font-size: 12px; font-weight: 800; }
.teacher-target-control input { width: 100%; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); background: #fff; }
.teacher-target-control input:focus { border-color: var(--brand); outline: 2px solid rgba(21, 94, 117, 0.16); outline-offset: 2px; }
.shell-token-control { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto auto; align-items: end; gap: 8px; }
.shell-token-control label { color: var(--subtle); font-size: 12px; font-weight: 800; }
.shell-token-control input { width: 100%; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); background: #fff; }
.shell-token-control input:focus { border-color: var(--brand); outline: 2px solid rgba(21, 94, 117, 0.16); outline-offset: 2px; }
.status-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; background: var(--brand-soft); color: #0e4b5f; font-size: 12px; font-weight: 800; }
.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.kv-grid p { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.kv-grid span { display: block; color: var(--subtle); font-size: 12px; }
.kv-grid strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.ops-panel { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcff; }
.audit-workflow-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.audit-workflow-map article { display: grid; gap: 6px; }
.audit-workflow-map strong { overflow-wrap: anywhere; }
.operations-state, .evidence-export, .batch-safety-panel { background: #f8fbfc; }
.batch-safety-panel { border-color: #f3c36b; background: #fffaf0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-title strong, .panel-title span { overflow-wrap: anywhere; }
.panel-title span { color: var(--subtle); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.metric-row span { display: grid; gap: 2px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 800; overflow-wrap: anywhere; }
.metric-row small { font-size: 11px; text-transform: uppercase; }
.timeline-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.timeline-list li { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.timeline-list strong, .timeline-list span, .timeline-list small { overflow-wrap: anywhere; }
.case-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.case-row { width: 100%; display: grid; gap: 3px; text-align: left; color: var(--text); background: #fff; border-color: var(--line); }
.case-row:hover, .case-row:focus-visible, .case-row.is-selected { border-color: var(--brand); outline: 2px solid rgba(21, 94, 117, 0.16); outline-offset: 2px; }
.case-row span, .case-row small, .case-row strong { overflow-wrap: anywhere; }
.muted, small, .empty { color: var(--subtle); }
.empty { border: 1px dashed #b8c0d8; border-radius: 8px; padding: 12px; background: #fbfcff; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px; background: #e8ecff; color: #253b8f; }
.badge.warn { background: #fff5d6; color: #7a5300; }
.badge.redact { background: #f4e6ff; color: #5b248a; }
.badge.block { background: #ffe3e3; color: var(--danger); }
.badge.attention { background: #fff5d6; color: #7a5300; }
.error-panel { border-color: #f0b6b6; padding: 16px; }
pre { overflow: auto; background: #f1f3f8; border-radius: 8px; padding: 12px; max-height: 360px; }
details { margin: 12px 0; }
summary { cursor: pointer; color: #0e4b5f; font-weight: 700; }

@media (max-width: 920px) {
  .app-shell { padding: 14px; }
  .shell-hero { flex-direction: column; }
  .shell-auth-panel { grid-template-columns: 1fr; align-items: stretch; }
  .operation-feedback { grid-template-columns: 1fr; }
  .summary-grid, .workspace-nav, .audit-workflow-map, .kv-grid, .metric-row, .teacher-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .summary-grid, .workspace-nav, .audit-workflow-map, .kv-grid, .metric-row, .teacher-layout { grid-template-columns: 1fr; }
  .workspace-nav .button, .operation-feedback .button { width: 100%; }
  .teacher-target-control, .shell-token-control { grid-template-columns: 1fr; align-items: stretch; }
}
