:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f1419;
  --text: #26323f;
  --muted: #667385;
  --line: #dbe2ea;
  --line-soft: #edf1f5;
  --accent: #1d9bf0;
  --accent-2: #00ba7c;
  --danger: #f4212e;
  --warn: #ff9f0a;
  --shadow: 0 18px 60px rgba(15, 20, 25, 0.08), 0 1px 2px rgba(15, 20, 25, 0.04);
  --radius: 22px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", ui-monospace, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05080d;
  --surface: #0f1419;
  --surface-2: #151b23;
  --ink: #f7f9f9;
  --text: #d9e1e8;
  --muted: #8b98a5;
  --line: #26313c;
  --line-soft: #1c2630;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38), 0 1px 2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 30% 0%, rgba(29, 155, 240, 0.16), transparent 36rem),
    radial-gradient(circle at 85% 10%, rgba(0, 186, 124, 0.12), transparent 30rem),
    var(--bg);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 28px;
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.left-rail {
  position: sticky;
  top: 24px;
  display: flex;
  height: calc(100vh - 48px);
  min-height: 620px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #7856ff);
  font-weight: 900;
}

.brand strong {
  font-size: 20px;
  letter-spacing: -0.01em;
}

.rail-nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
}

.rail-nav a:hover,
.rail-nav a.active {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}

.rail-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-2);
}

.rail-status strong,
.rail-status small {
  display: block;
}

.rail-status small {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-2) 16%, transparent);
}

.main {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.eyebrow,
.section-head p {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(30px, 3.4vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.top-actions,
.action-row,
.hero-head,
.chart-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  width: max-content;
  max-width: 100%;
}

.top-actions .button,
.top-actions .segmented {
  flex: 0 0 auto;
}

.button,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.open-x-button {
  min-width: 92px;
  padding-inline: 18px;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 24%, transparent);
}

.button.secondary,
.segmented button {
  color: var(--ink);
  background: var(--surface);
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.segmented button.active {
  color: white;
  background: var(--accent);
}

.hero-grid,
.content-grid,
.trend-grid {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.8fr);
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  margin-top: 18px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

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

.hero-card,
.focus-card,
.panel,
.chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.hero-card {
  padding: 24px;
}

.focus-card,
.panel {
  padding: 20px;
}

.hero-head {
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  font-family: var(--sans);
  font-weight: 900;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.stale {
  color: var(--warn);
}

.status-pill.offline {
  color: var(--danger);
}

.hero-card h2 {
  max-width: 780px;
  margin: 28px 0 12px;
  color: var(--ink);
  font-size: clamp(34px, 6vw, 76px);
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.hero-card p,
.focus-card p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.hero-metrics div {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 15px;
  background: var(--surface-2);
}

.hero-metrics span,
.hero-metrics small {
  display: block;
  color: var(--muted);
}

.hero-metrics span {
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 34px;
  letter-spacing: -0.04em;
}

.hero-metrics small {
  margin-top: 3px;
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  display: block;
}

.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  letter-spacing: -0.02em;
}

.panel {
  margin-top: 18px;
}

.chart-card {
  padding: 16px;
}

.chart-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-title strong {
  color: var(--ink);
}

.chart-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.chart-wrap {
  height: 230px;
}

svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

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

.area {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
}

.line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bar {
  fill: color-mix(in srgb, var(--accent) 72%, var(--surface));
}

.chart-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.freshness-list,
.task-list,
.funnel-list,
.language-track-grid,
.decision-grid,
.evidence-grid,
.post-list,
.draft-list,
.advice-list,
.endpoint-list {
  display: grid;
  gap: 12px;
}

.freshness-row,
.task-card,
.funnel-row,
.language-track-card,
.decision-card,
.evidence-card,
.post-card,
.draft-card,
.advice-card,
.endpoint-row {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-2);
}

.freshness-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.freshness-row strong,
.task-card strong,
.funnel-row strong,
.language-track-card strong,
.evidence-card strong {
  display: block;
  color: var(--ink);
}

.freshness-row span,
.task-card span,
.funnel-row span,
.language-track-card span,
.evidence-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.freshness-state {
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.freshness-state.warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.freshness-state.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.task-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
}

.task-check {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-weight: 900;
}

.task-card.done {
  opacity: 0.62;
}

.task-card.done .task-check {
  color: white;
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.task-actions,
.evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 86px;
  gap: 14px;
  align-items: center;
}

.funnel-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: var(--line-soft);
}

.funnel-bar div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.funnel-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}

.language-track-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.language-track-card {
  display: grid;
  gap: 14px;
}

.language-track-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.language-track-code {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #7856ff);
  font-weight: 950;
}

.language-track-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.language-track-meta span,
.language-track-status {
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.language-track-status {
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

.language-track-status.scheduled {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.language-track-status.done {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.language-track-progress {
  display: grid;
  gap: 8px;
}

.language-track-progress div {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--line-soft);
}

.language-track-progress div span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

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

.language-track-kpis div {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface);
}

.language-track-kpis b {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

.decision-grid {
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(220px, 0.85fr));
}

.decision-card {
  display: grid;
  min-height: 148px;
  align-content: start;
  gap: 10px;
}

.decision-card.primary {
  grid-row: span 2;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 52%),
    var(--surface-2);
}

.decision-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.decision-card.primary strong {
  font-size: clamp(28px, 3vw, 44px);
  line-height: 0.98;
}

.decision-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.decision-meta,
.decision-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-meta span,
.decision-list div {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
}

.decision-list {
  display: grid;
}

.decision-list div {
  display: grid;
  gap: 2px;
  border-radius: 14px;
}

.decision-list strong {
  font-size: 13px;
}

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

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

.evidence-card p {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.post-meta,
.draft-meta,
.advice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-family: var(--sans);
  font-weight: 850;
}

.post-card p,
.draft-card p,
.advice-card p {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.post-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-stats span {
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.copy-button,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  font-weight: 850;
}

.cost-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.cost-ring {
  display: grid;
  width: 168px;
  height: 168px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--accent-2) var(--cost-used, 0%), var(--line) 0);
}

.cost-ring strong,
.cost-ring span {
  grid-area: 1 / 1;
}

.cost-ring strong {
  transform: translateY(-8px);
  color: var(--ink);
  font-size: 34px;
  letter-spacing: -0.04em;
}

.cost-ring span {
  transform: translateY(24px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.cost-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.endpoint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
}

.endpoint-row strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 44px));
  transform: translateY(20px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  opacity: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface-2);
}

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

  .left-rail {
    position: static;
    height: auto;
    min-height: 0;
  }

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

  .hero-grid,
  .content-grid,
  .ops-grid,
  .language-track-grid,
  .decision-grid,
  .evidence-grid,
  .trend-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .section-head,
  .footer {
    display: block;
  }

  .top-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .cost-card {
    grid-template-columns: 1fr;
  }

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

  .funnel-value {
    text-align: left;
  }

  .language-track-head {
    display: grid;
  }

  .language-track-kpis {
    grid-template-columns: 1fr;
  }
}
