:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f0f4f7;
  --text: #11181f;
  --muted: #60707d;
  --subtle: #84929e;
  --line: #d8e2ea;
  --line-strong: #bfccd6;
  --primary: #0c5cab;
  --primary-2: #13a3aa;
  --green: #10b981;
  --blue: #2f6feb;
  --orange: #d1840f;
  --red: #d93d4b;
  --purple: #5e6ad2;
  --pet-accent: #ff6363;
  --shadow: 0 18px 44px rgba(17, 24, 31, 0.08);
  --shadow-tight: 0 8px 24px rgba(17, 24, 31, 0.06);
  --radius: 8px;
  --sidebar: #ffffff;
  --glow: rgba(19, 163, 170, 0.18);
  --hero-line: rgba(12, 92, 171, 0.14);
  --grid-line: rgba(12, 92, 171, 0.055);
}

body.dark {
  color-scheme: dark;
  --bg: #07080a;
  --surface: #101111;
  --surface-2: #17191d;
  --text: #f7f8f8;
  --muted: #c8ced6;
  --subtle: #8a8f98;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --primary: #55b3ff;
  --primary-2: #39c6c7;
  --green: #5fc992;
  --blue: #76a8ff;
  --orange: #ffbc33;
  --red: #ff6363;
  --purple: #828fff;
  --pet-accent: #ff6363;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-tight: 0 12px 34px rgba(0, 0, 0, 0.32);
  --sidebar: #0c0d10;
  --glow: rgba(85, 179, 255, 0.16);
  --hero-line: rgba(85, 179, 255, 0.13);
  --grid-line: rgba(85, 179, 255, 0.045);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(19, 163, 170, 0.045), transparent 320px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 32px 32px, 32px 32px, auto;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  text-wrap: pretty;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 99, 99, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(85, 179, 255, 0.16), rgba(95, 201, 146, 0.08));
}

.pet-face {
  font-size: 25px;
}

.pulse-dot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 106, 0.16);
}

.brand h1,
.topbar h2,
.drawer h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.nav-icon {
  width: 20px;
  color: var(--primary);
  text-align: center;
}

.sidebar-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.sidebar-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar h2 {
  font-size: 28px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.mode-chip.live {
  border-color: rgba(16, 185, 129, 0.34);
}

.mode-chip.snapshot {
  border-color: rgba(47, 111, 235, 0.28);
}

.mode-chip .mode-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(199, 123, 19, 0.12);
}

.mode-chip.live .mode-dot,
.mode-chip.snapshot .mode-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 106, 0.12);
}

.mode-chip.offline .mode-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(211, 59, 71, 0.12);
}

.mode-chip span:not(.mode-dot) {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mode-chip strong {
  display: block;
  font-size: 13px;
  line-height: 1.1;
}

.select-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.select-label[hidden] {
  display: none;
}

select,
.text-filter {
  min-height: 38px;
  padding: 0 34px 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.system-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.system-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 64px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
  position: relative;
  overflow: hidden;
}

.system-item::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.42;
}

.system-item span:not(.status-light) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.system-item strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.status-light {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 106, 0.12);
}

.status-light.warn {
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(199, 123, 19, 0.12);
}

.status-light.bad {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(211, 59, 71, 0.12);
}

.page-root {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
  position: relative;
  overflow: hidden;
}

.card,
.panel {
  padding: 16px;
  min-width: 0;
}

.metric-card {
  min-height: 112px;
  padding: 15px;
}

.metric-card::before,
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.25;
}

.metric-card .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-card .value {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  font-weight: 800;
}

.metric-card .text-value {
  font-size: 18px;
  line-height: 1.28;
}

.metric-card .hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.good {
  color: var(--green);
}

.badge.warn {
  color: var(--orange);
}

.badge.bad {
  color: var(--red);
}

.badge.info {
  color: var(--blue);
}

.overview-command {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.command-primary,
.command-side {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.command-primary {
  display: grid;
  align-content: center;
  min-height: 132px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(85, 179, 255, 0.12), transparent 42%),
    var(--surface);
}

.command-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--hero-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.52;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.7), transparent);
}

.command-primary > * {
  position: relative;
  z-index: 1;
}

.command-primary h3 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(24px, 2.7vw, 36px);
  line-height: 1.12;
}

.command-primary p:not(.eyebrow) {
  max-width: 880px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.command-side {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.command-side strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.mode-brief {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 8px;
}

.mode-brief div {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.mode-brief strong {
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-brief span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.qls-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.qls-summary {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 104px;
  padding: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qls-summary strong {
  color: var(--text);
  font-size: 13px;
}

.compact-score .score-card {
  width: 104px;
  height: 104px;
}

.compact-score .score-card::before {
  inset: 7px;
}

.compact-score .score-card::after {
  inset: -5px;
}

.compact-score .score-ring {
  width: 92px;
  height: 92px;
}

.compact-score .ring-track,
.compact-score .ring-value {
  stroke-width: 8;
}

.compact-score .score-label span {
  font-size: 24px;
}

.compact-score .score-label strong,
.compact-score .score-label em {
  font-size: 10px;
}

.secondary-metrics .metric-card {
  min-height: 96px;
}

.mission-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 260px;
  gap: 18px;
  min-height: 240px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(19, 163, 170, 0.13), transparent 42%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mission-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--hero-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.8), transparent);
}

.mission-hero::after {
  content: "AGENT FLOW";
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.mission-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}

.mission-copy h3 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
}

.mission-copy p:not(.eyebrow) {
  max-width: 680px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.score-orbit {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.score-card {
  position: relative;
  display: grid;
  width: 178px;
  height: 178px;
  place-items: center;
}

.score-card::before,
.score-card::after {
  content: "";
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.score-card::before {
  inset: 8px;
}

.score-card::after {
  inset: -8px;
  border-style: dashed;
  opacity: 0.65;
}

.score-ring {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 10;
}

.ring-track {
  stroke: var(--line);
}

.ring-value {
  stroke: url("#scoreGradient");
  stroke: var(--primary);
  stroke-linecap: round;
}

.score-label {
  position: absolute;
  display: grid;
  place-items: center;
  text-align: center;
}

.score-label span {
  font-size: 36px;
  font-weight: 900;
}

.score-label strong,
.score-label em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.chart-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.empty-state {
  display: grid;
  min-height: 112px;
  align-content: center;
  gap: 8px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-state strong {
  font-size: 16px;
}

.empty-state span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.line-chart {
  width: 100%;
  min-height: 190px;
  overflow: visible;
}

.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px var(--glow));
}

.chart-point {
  fill: var(--surface);
  stroke: var(--primary-2);
  stroke-width: 3;
}

.spark-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.spark-labels span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.spark-labels strong {
  color: var(--text);
  font-size: 14px;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  overflow: hidden;
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: inherit;
}

.bar-track i.warn {
  background: linear-gradient(90deg, var(--orange), var(--primary));
}

.bar-track i.bad {
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.bar-row strong {
  color: var(--text);
}

.diagnostic-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(19, 163, 170, 0.12), transparent 50%),
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnostic-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diagnostic-card h4 {
  margin: 0;
  font-size: 20px;
}

.diagnostic-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.diagnostic-card dt {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.diagnostic-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.diagnostic-panel {
  display: grid;
  gap: 14px;
}

.diagnostic-advice {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnostic-advice h4,
.diagnostic-advice p {
  margin: 0;
}

.diagnostic-advice p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.risk-matrix {
  display: grid;
  grid-template-columns: 92px repeat(5, minmax(72px, 1fr));
  gap: 7px;
  overflow-x: auto;
}

.risk-matrix strong {
  display: grid;
  min-height: 36px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.matrix-cell {
  display: grid;
  min-height: 48px;
  place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.matrix-cell.good {
  background: color-mix(in srgb, var(--green) 26%, var(--surface));
}

.matrix-cell.warn {
  background: color-mix(in srgb, var(--orange) 28%, var(--surface));
}

.matrix-cell.bad {
  background: color-mix(in srgb, var(--red) 26%, var(--surface));
}

.score-breakdown {
  display: grid;
  gap: 14px;
}

.score-row {
  display: grid;
  gap: 7px;
}

.dual-trend {
  display: grid;
  gap: 18px;
}

.dual-trend .line-chart {
  min-height: 140px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-step {
  min-height: 112px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pipeline-step strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.pipeline-step .count {
  font-size: 26px;
  font-weight: 800;
}

.pipeline-step .tiny {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  width: 100%;
  padding: 12px;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.list-item:hover {
  border-color: var(--primary);
}

.list-item h4 {
  margin: 0 0 7px;
  font-size: 14px;
}

.list-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.compact-list {
  gap: 8px;
}

.workflow-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(95, 166, 255, 0.14), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-hero h3 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.12;
}

.workflow-hero p {
  max-width: 840px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.workflow-hero-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-hero-card strong {
  font-size: 13px;
  color: var(--primary);
}

.workflow-hero-card span {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.workflow-audience-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workflow-purpose {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-purpose div {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.workflow-purpose div:last-child {
  border-right: 0;
}

.workflow-purpose strong {
  font-size: 13px;
  color: var(--primary);
}

.workflow-purpose span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workflow-audience,
.workflow-reader-action {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-audience strong,
.workflow-reader-action strong {
  font-size: 14px;
}

.workflow-audience span,
.workflow-reader-action span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workflow-story {
  display: grid;
  grid-template-columns: repeat(7, minmax(156px, 1fr));
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workflow-story-step {
  display: grid;
  gap: 12px;
  min-height: 172px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-story-step > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--bg);
  background: var(--primary);
  border-radius: 999px;
  font-weight: 900;
}

.workflow-story-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.workflow-story-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workflow-role-list,
.decision-rules,
.workflow-reader-grid {
  display: grid;
  gap: 10px;
}

.workflow-role-list div,
.decision-rules div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.workflow-role-list div:last-child,
.decision-rules div:last-child {
  border-bottom: 0;
}

.workflow-role-list strong,
.decision-rules strong {
  font-size: 13px;
}

.workflow-role-list span,
.decision-rules span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.contract-list div {
  grid-template-columns: 180px minmax(0, 1fr);
}

.active-loop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.active-loop-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.active-loop-card .split-line {
  align-items: center;
}

.active-loop-card .split-line strong {
  color: var(--text);
  font-size: 15px;
}

.active-loop-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.active-loop-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.active-loop-card dl div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.active-loop-card dt {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.active-loop-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.stop-condition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stop-condition {
  display: grid;
  gap: 7px;
  padding: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stop-condition strong {
  color: var(--text);
  font-size: 14px;
}

.stop-condition span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workflow-maintenance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-maintenance h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.workflow-maintenance p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.workflow-doc-grid,
.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.workflow-doc,
.skill-pill {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-doc strong,
.skill-pill strong {
  font-size: 13px;
}

.workflow-doc p,
.skill-pill span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.state-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.event {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.event:last-child {
  border-bottom: 0;
}

.event-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.event strong {
  display: block;
  font-size: 14px;
}

.event span {
  color: var(--muted);
  font-size: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 12px;
  max-width: 100%;
  overflow-x: auto;
}

.kanban-column {
  min-height: 420px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kanban-column h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 14px;
}

.issue-card,
.pr-card,
.decision-card {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.issue-card:hover,
.pr-card:hover,
.decision-card:hover {
  border-color: var(--primary);
}

.issue-card h4,
.pr-card h4,
.decision-card h4 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.card-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.split-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.health-card {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.health-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.health-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workflow-rail {
  display: grid;
  gap: 10px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step-num {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  font-weight: 800;
}

.workflow-step h4 {
  margin: 0 0 4px;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.roadmap {
  display: grid;
  gap: 12px;
}

.roadmap-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress {
  overflow: hidden;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.28);
  z-index: 20;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  transform: translateX(100%);
  transition: transform 180ms ease;
  z-index: 30;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.drawer-section {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drawer-section h4 {
  margin: 0 0 8px;
}

.drawer-section p,
.drawer-section li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.drawer-section ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-card {
    margin-top: 0;
  }

  .system-strip,
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .health-grid,
  .workflow-hero,
  .workflow-story,
  .workflow-doc-grid,
  .skill-grid,
  .qls-summary-grid,
  .active-loop-grid,
  .stop-condition-grid,
  .overview-command,
  .mode-brief,
  .mission-hero {
    grid-template-columns: 1fr 1fr;
  }

  .mission-hero {
    align-items: center;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .select-label {
    flex: 1;
  }

  .nav-list,
  .system-strip,
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .health-grid,
  .workflow-hero,
  .workflow-audience-grid,
  .workflow-purpose,
  .workflow-story,
  .workflow-doc-grid,
  .skill-grid,
  .qls-summary-grid,
  .active-loop-grid,
  .stop-condition-grid,
  .workflow-maintenance,
  .roadmap-item,
  .overview-command,
  .command-side,
  .mode-brief,
  .mission-hero {
    grid-template-columns: 1fr;
  }

  .mission-hero {
    min-height: 0;
  }

  .score-orbit {
    justify-content: start;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .workflow-role-list div,
  .decision-rules div,
  .active-loop-card dl div,
  .workflow-purpose div {
    grid-template-columns: 1fr;
  }

  .workflow-purpose div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-purpose div:last-child {
    border-bottom: 0;
  }

  .risk-matrix {
    grid-template-columns: 76px repeat(5, 86px);
  }

  .metric-card .value {
    font-size: 26px;
  }
}
