:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d8e0e8;
  --accent: #0b3d5c;
  --accent-soft: #e8f1f6;
  --good: #1b7a4e;
  --warn: #b36b00;
  --bad: #a32020;
  --radius: 10px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #e9eef3 0%, var(--bg) 220px);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand strong {
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

nav.tabs a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}

nav.tabs a:hover,
nav.tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(16, 36, 54, 0.04);
}

.card h1,
.card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.metric {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.75rem;
}

.metric .label {
  font-size: 0.8rem;
  color: var(--muted);
}

.metric .value {
  font-size: 1.4rem;
  font-weight: 650;
  color: var(--accent);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--bad);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

form.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #eef2f5;
}

.badge.gap,
.badge.high,
.badge.failed {
  background: #fde8e8;
  color: var(--bad);
}

.badge.partial,
.badge.medium,
.badge.awaiting_human {
  background: #fff3dd;
  color: var(--warn);
}

.badge.satisfied,
.badge.approved,
.badge.low {
  background: #e5f6ec;
  color: var(--good);
}

pre.md {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.5;
}

.flash {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  background: #e8f6ee;
  color: var(--good);
  border: 1px solid #c6e6d2;
}

.flash.error {
  background: #fdeeee;
  color: var(--bad);
  border-color: #f0c4c4;
}

footer.note {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Graph view */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 0.35rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend-item i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  display: inline-block;
}

.graph-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0.85rem;
  padding: 0.75rem;
}

@media (max-width: 800px) {
  .graph-panel {
    grid-template-columns: 1fr;
  }
}

.graph-canvas {
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfe;
}

.graph-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: var(--accent-soft);
  min-height: 200px;
}

.graph-detail h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.graph-detail code {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
}

/* Dashboard polish */
.hero-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.hero-strip h1 {
  margin-top: 0;
}

.metrics-tight {
  min-width: 280px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

a.dash-tile,
.dash-tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 36, 54, 0.04);
  transition: border-color 0.15s, transform 0.15s;
}

a.dash-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.dash-tile.static {
  background: var(--accent-soft);
}

.dash-tile .label {
  font-size: 0.82rem;
  color: var(--muted);
}

.dash-tile .value {
  font-size: 1.65rem;
  font-weight: 650;
  color: var(--accent);
  margin: 0.15rem 0;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.path-grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

ol.steps {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
}

ol.steps li {
  margin: 0.25rem 0;
}

/* Risk register */
.risk-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.risk-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(16, 36, 54, 0.04);
}

.risk-card.score-high {
  border-left-color: var(--bad);
}

.risk-card.score-medium {
  border-left-color: var(--warn);
}

.risk-card.score-low {
  border-left-color: var(--good);
}

.risk-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.risk-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.risk-card.score-high .score-pill {
  background: var(--bad);
}

.risk-card.score-medium .score-pill {
  background: var(--warn);
}

.risk-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.88rem;
  margin: 0.5rem 0;
  color: var(--muted);
}

.risk-card .linked .label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

/* Decision inbox */
.decision-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.decision-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  border-top: 3px solid var(--muted);
}

.decision-card.urgency-high {
  border-top-color: var(--bad);
  background: linear-gradient(180deg, #fff8f7 0%, #fff 40%);
}

.decision-card.urgency-medium {
  border-top-color: var(--warn);
}

.decision-card.urgency-low {
  border-top-color: var(--good);
}

.decision-card.settled {
  opacity: 0.88;
  background: #fafbfc;
}

.decision-card h3 {
  margin: 0.4rem 0 0.5rem;
  font-size: 1.02rem;
}

.decision-top {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.decision-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.muted-board {
  opacity: 0.95;
}

.badge.open {
  background: #fff3dd;
  color: var(--warn);
}

.badge.treated,
.badge.accepted,
.badge.approved {
  background: #e5f6ec;
  color: var(--good);
}

.badge.rejected {
  background: #fde8e8;
  color: var(--bad);
}

.badge.pending {
  background: #e8f1f6;
  color: var(--accent);
}

ul.steps {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

ul.steps li {
  margin: 0.25rem 0;
}

.jennifer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #f0f7fa;
  border: 1px solid #cce5ef;
  font-size: 0.78rem;
  color: #0b3d5c;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.green {
  background: #1b7a4e;
  box-shadow: 0 0 6px rgba(27, 122, 78, 0.45);
}

.status-dot.amber {
  background: #b36b00;
  box-shadow: 0 0 6px rgba(179, 107, 0, 0.45);
}

.status-dot.red {
  background: #a32020;
  box-shadow: 0 0 6px rgba(163, 32, 32, 0.55);
}

/* Pre-Exam War Room & CDR Styles */
.war-room-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: rgba(14, 116, 144, 0.1);
  border: 1px solid rgba(14, 116, 144, 0.25);
  border-radius: 999px;
  color: #0e7490;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.war-room-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .war-room-grid {
    grid-template-columns: 1fr;
  }
}

.host-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}

.host-gu {
  border-left: 4px solid #b91c1c;
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.6) 0%, rgba(255, 255, 255, 0.8) 100%);
}

.host-jennifer {
  border-left: 4px solid #0891b2;
  background: linear-gradient(135deg, rgba(236, 254, 255, 0.6) 0%, rgba(255, 255, 255, 0.8) 100%);
}

.host-avatar {
  font-size: 2.2rem;
  line-height: 1;
}

.host-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.host-tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.tag-examiner {
  background: #fee2e2;
  color: #991b1b;
}

.tag-ciso {
  background: #cffafe;
  color: #155e75;
}

.host-info p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.verdict-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.verdict-score-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid #f59e0b;
  background: #fffbeb;
  flex-shrink: 0;
}

.score-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: #b45309;
  line-height: 1;
}

.score-denom {
  font-size: 0.65rem;
  color: #78350f;
}

.verdict-text h4 {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.95rem;
}

.verdict-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.verdict-status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.pill-amber {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Podcast Player Bar */
.podcast-player-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.5rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-play-podcast {
  background: #06b6d4;
  color: #0f172a;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.btn-play-podcast:hover {
  background: #22d3ee;
}

.btn-stop-podcast {
  background: #334155;
  color: #cbd5e1;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-stop-podcast:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audio-timer {
  font-family: monospace;
  font-size: 0.8rem;
  color: #94a3b8;
}

.waveform-container {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  flex: 1;
}

.wave-bar {
  width: 4px;
  height: 8px;
  background: #06b6d4;
  border-radius: 2px;
  transition: height 0.2s ease;
}

.wave-bar.animating {
  animation: waveMotion 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.15s; }
.wave-bar:nth-child(7) { animation-delay: 0.25s; }
.wave-bar:nth-child(8) { animation-delay: 0.35s; }
.wave-bar:nth-child(9) { animation-delay: 0.05s; }
.wave-bar:nth-child(10) { animation-delay: 0.45s; }

@keyframes waveMotion {
  0% { height: 6px; opacity: 0.4; }
  100% { height: 22px; opacity: 1; }
}

.player-status-text {
  font-size: 0.8rem;
  color: #cbd5e1;
}

/* Dialogue stream */
.dialogue-stream {
  padding: 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stream-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
}

.stream-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.dialogue-turns-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialogue-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.dialogue-card.turn-gu {
  background: rgba(254, 242, 242, 0.45);
  border-color: rgba(252, 165, 165, 0.4);
}

.dialogue-card.turn-jennifer {
  background: rgba(236, 254, 255, 0.45);
  border-color: rgba(165, 243, 252, 0.4);
}

.dialogue-card.active-turn {
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
  transform: translateX(4px);
}

.turn-avatar-badge {
  font-size: 1.8rem;
  line-height: 1;
}

.turn-content {
  flex: 1;
}

.turn-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.turn-speaker {
  font-size: 0.92rem;
}

.turn-delivery {
  font-size: 0.75rem;
  color: var(--muted);
}

.turn-role-tag {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: #e2e8f0;
  color: #334155;
}

.turn-bubble {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.turn-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.citation-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

/* CDR Cards */
.cdr-stream {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  margin-top: 1.2rem;
}

.cdr-card {
  padding: 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 5px solid var(--line);
}

.cdr-card.cdr-pending {
  border-left-color: #f59e0b;
}

.cdr-card.cdr-approved {
  border-left-color: #10b981;
}

.cdr-card.cdr-rejected {
  border-left-color: #ef4444;
}

.cdr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.cdr-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cdr-id-chip {
  font-family: monospace;
  font-size: 0.75rem;
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.cdr-steps-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cdr-step-box {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.cdr-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.cdr-step-body {
  flex: 1;
}

.cdr-step-body h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.cdr-step-body p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--fg);
  line-height: 1.45;
}

.cdr-statutes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.statute-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 4px;
}

.remediation-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.option-pill-card {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.option-recommended {
  border-color: #06b6d4;
  background: #ecfeff;
}

.opt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.badge-rec {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: #0891b2;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
}

.opt-meta {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.opt-tradeoff {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.35;
}

.rec-highlight-box {
  padding: 0.85rem;
  border-radius: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.rec-highlight-box strong {
  display: block;
  color: #166534;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

.rec-highlight-box p {
  color: #14532d;
  font-size: 0.85rem;
  line-height: 1.45;
}

.step-signoff {
  background: #fafaf9;
  padding: 0.85rem;
  border-radius: 6px;
  border: 1px solid #e7e5e4;
}

.signoff-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

.signoff-action-bar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.signoff-action-bar .form-input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

