:root {
  color-scheme: dark;
  --bg: #040a11;
  --panel: rgba(22, 43, 63, 0.98);
  --line: rgba(255, 255, 255, 0.22);
  --text: #f3f7fb;
  --muted: #9bb1c7;
  --muted-strong: #d4e0ec;
  --cyan: #42e7d2;
  --coral: #ff7a61;
  --gold: #ffcc63;
  --violet: #79a8ff;
  --danger: #ff6f7d;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --sans: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
  --display: "Bahnschrift", "Aptos Display", "Segoe UI Variable Display", sans-serif;
  --page-background:
    radial-gradient(circle at top left, rgba(66, 231, 210, 0.14), transparent 26%),
    radial-gradient(circle at 80% 10%, rgba(255, 122, 97, 0.13), transparent 24%),
    radial-gradient(circle at 50% 120%, rgba(121, 168, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #03070c 0%, #07111a 100%);
  --page-grid-color: rgba(255, 255, 255, 0.03);
  --surface-background: linear-gradient(180deg, rgba(20, 40, 58, 0.99), rgba(10, 22, 33, 0.99));
  --surface-shadow: 0 34px 90px rgba(0, 0, 0, 0.42);
  --banner-panel-background: rgba(255, 255, 255, 0.1);
  --banner-panel-border: rgba(255, 255, 255, 0.18);
  --banner-summary-background:
    linear-gradient(160deg, rgba(66, 231, 210, 0.1), transparent 50%),
    rgba(255, 255, 255, 0.12);
  --card-background: rgba(255, 255, 255, 0.11);
  --card-background-strong: rgba(255, 255, 255, 0.14);
  --card-border: rgba(255, 255, 255, 0.16);
  --card-border-strong: rgba(255, 255, 255, 0.18);
  --ghost-background: rgba(255, 255, 255, 0.1);
  --ghost-hover-background: rgba(66, 231, 210, 0.08);
  --ghost-hover-border: rgba(66, 231, 210, 0.34);
  --tab-bar-background: rgba(255, 255, 255, 0.07);
  --tab-bar-border: rgba(255, 255, 255, 0.16);
  --tab-button-background: rgba(255, 255, 255, 0.08);
  --tab-button-border: rgba(255, 255, 255, 0.12);
  --tab-button-text: var(--muted-strong);
  --tab-button-active-background: linear-gradient(135deg, rgba(66, 231, 210, 0.18), rgba(121, 168, 255, 0.16));
  --tab-button-active-border: rgba(66, 231, 210, 0.34);
  --tab-button-active-text: var(--text);
  --status-background: rgba(255, 255, 255, 0.12);
  --status-border: rgba(255, 255, 255, 0.14);
  --status-success-text: #d4fbf6;
  --status-success-background: rgba(66, 231, 210, 0.12);
  --status-warning-text: #ffe7d6;
  --status-warning-background: rgba(255, 122, 97, 0.12);
  --plot-fill: rgba(255, 255, 255, 0.03);
  --axis-line: rgba(255, 255, 255, 0.18);
  --grid-line: rgba(255, 255, 255, 0.08);
  --point-label: rgba(255, 255, 255, 0.65);
  --point-stroke: rgba(255, 255, 255, 0.55);
  --history-grid-line: rgba(255, 255, 255, 0.1);
  --history-point-stroke: rgba(255, 255, 255, 0.7);
  --progress-track-background: rgba(255, 255, 255, 0.18);
  --divider-line: rgba(255, 255, 255, 0.06);
  --tooltip-background: rgba(6, 14, 22, 0.94);
  --tooltip-border: rgba(255, 255, 255, 0.08);
  --tooltip-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --theme-toggle-background: rgba(10, 22, 33, 0.9);
  --theme-toggle-border: rgba(255, 255, 255, 0.16);
  --theme-toggle-text: var(--text);
  --theme-toggle-shadow: 0 24px 50px rgba(0, 0, 0, 0.34);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #edf4fa;
  --panel: rgba(248, 251, 254, 0.98);
  --line: rgba(22, 52, 76, 0.14);
  --text: #10263a;
  --muted: #47647a;
  --muted-strong: #243b51;
  --shadow: 0 24px 60px rgba(42, 86, 120, 0.12);
  --page-background:
    radial-gradient(circle at top left, rgba(66, 231, 210, 0.12), transparent 28%),
    radial-gradient(circle at 36% 8%, rgba(168, 135, 255, 0.08), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(255, 122, 97, 0.1), transparent 25%),
    radial-gradient(circle at 50% 120%, rgba(121, 168, 255, 0.1), transparent 32%),
    linear-gradient(180deg, #f8fbfe 0%, #edf4fa 100%);
  --page-grid-color: rgba(37, 84, 116, 0.04);
  --surface-background: linear-gradient(180deg, rgba(251, 250, 255, 0.995), rgba(239, 242, 251, 0.992));
  --surface-shadow: 0 24px 58px rgba(34, 74, 109, 0.14);
  --banner-panel-background: rgba(252, 249, 255, 0.94);
  --banner-panel-border: rgba(28, 73, 106, 0.18);
  --banner-summary-background:
    linear-gradient(160deg, rgba(66, 231, 210, 0.07), rgba(168, 135, 255, 0.08) 48%, transparent 70%),
    rgba(251, 247, 255, 0.955);
  --card-background: rgba(250, 246, 255, 0.93);
  --card-background-strong: rgba(253, 249, 255, 0.97);
  --card-border: rgba(28, 73, 106, 0.16);
  --card-border-strong: rgba(28, 73, 106, 0.2);
  --ghost-background: rgba(250, 246, 255, 0.92);
  --ghost-hover-background: rgba(160, 127, 255, 0.14);
  --ghost-hover-border: rgba(66, 231, 210, 0.3);
  --tab-bar-background: rgba(248, 244, 255, 0.9);
  --tab-bar-border: rgba(28, 73, 106, 0.16);
  --tab-button-background: rgba(251, 247, 255, 0.94);
  --tab-button-border: rgba(28, 73, 106, 0.15);
  --tab-button-text: #304d63;
  --tab-button-active-background: linear-gradient(135deg, rgba(168, 135, 255, 0.18), rgba(121, 168, 255, 0.16));
  --tab-button-active-border: rgba(138, 110, 232, 0.28);
  --tab-button-active-text: #0e2538;
  --status-background: rgba(251, 247, 255, 0.94);
  --status-border: rgba(28, 73, 106, 0.16);
  --status-success-text: #0d5f55;
  --status-success-background: rgba(66, 231, 210, 0.2);
  --status-warning-text: #8d4d2e;
  --status-warning-background: rgba(255, 122, 97, 0.18);
  --plot-fill: rgba(28, 73, 106, 0.05);
  --axis-line: rgba(28, 73, 106, 0.16);
  --grid-line: rgba(28, 73, 106, 0.1);
  --point-label: rgba(16, 38, 58, 0.7);
  --point-stroke: rgba(248, 251, 254, 0.95);
  --history-grid-line: rgba(28, 73, 106, 0.12);
  --history-point-stroke: rgba(248, 251, 254, 0.95);
  --progress-track-background: rgba(39, 77, 110, 0.12);
  --divider-line: rgba(28, 73, 106, 0.08);
  --tooltip-background: rgba(250, 252, 255, 0.98);
  --tooltip-border: rgba(28, 73, 106, 0.12);
  --tooltip-shadow: 0 20px 44px rgba(34, 74, 109, 0.16);
  --theme-toggle-background: rgba(251, 247, 255, 0.965);
  --theme-toggle-border: rgba(28, 73, 106, 0.16);
  --theme-toggle-text: #10263a;
  --theme-toggle-shadow: 0 18px 36px rgba(34, 74, 109, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page-background);
  color: var(--text);
  font-family: var(--sans);
}

body {
  padding: 24px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--page-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--page-grid-color) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 92%);
}

button,
input {
  font: inherit;
}

button {
  line-height: 1.15;
}

button:not(:disabled) {
  cursor: pointer;
}

.theme-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 44px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-background);
  color: var(--theme-toggle-text);
  box-shadow: var(--theme-toggle-shadow);
  backdrop-filter: blur(14px);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.theme-toggle-button:hover {
  transform: translateY(-1px);
  border-color: var(--ghost-hover-border);
  background: var(--ghost-hover-background);
}

.theme-toggle-button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.theme-toggle-button:active,
.banner-toggle:active,
.primary-button:active,
.ghost-button:active,
.filter-button:active,
.tab-button:active,
.dropzone:active {
  transform: translateY(0);
}

.app-shell {
  min-height: calc(100vh - 208px);
}

.top-banner,
.panel,
.insight-board,
.empty-state {
  border: 1px solid var(--line);
  background: var(--surface-background);
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(18px);
}

body[data-theme="light"] .top-banner,
body[data-theme="light"] .panel,
body[data-theme="light"] .insight-board,
body[data-theme="light"] .empty-state {
  border-color: rgba(28, 73, 106, 0.18);
  box-shadow: 0 22px 52px rgba(34, 74, 109, 0.14);
  backdrop-filter: none;
}

.top-banner {
  position: relative;
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
  padding: 22px 24px;
  border-radius: 34px;
  overflow: hidden;
  isolation: isolate;
}

.banner-toggle {
  min-width: 118px;
  min-height: 44px;
  padding-inline: 12px;
}

.top-banner-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(440px, 1.15fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: start;
  grid-template-areas:
    "copy intake"
    "summary intake"
    "summary side";
}

.top-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(66, 231, 210, 0.18), transparent 30%),
    radial-gradient(circle at 88% 24%, rgba(255, 122, 97, 0.18), transparent 28%);
  pointer-events: none;
}

body[data-theme="light"] .top-banner::before {
  background:
    radial-gradient(circle at 12% 20%, rgba(66, 231, 210, 0.12), transparent 30%),
    radial-gradient(circle at 56% 16%, rgba(168, 135, 255, 0.14), transparent 26%),
    radial-gradient(circle at 88% 24%, rgba(255, 122, 97, 0.12), transparent 28%);
  opacity: 0.34;
}

.top-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 10, 17, 0.08), rgba(4, 10, 17, 0.12)),
    url("./assets/banner-constellation.svg") center/cover no-repeat;
  opacity: 0.36;
  mix-blend-mode: screen;
  pointer-events: none;
}

body[data-theme="light"] .top-banner::after {
  opacity: 0.08;
  mix-blend-mode: normal;
}

.top-banner-copy,
.top-banner-side,
.banner-summary,
.intake-panel,
.top-banner-accent {
  position: relative;
  z-index: 1;
}

.top-banner-copy {
  grid-area: copy;
}

.banner-summary {
  grid-area: summary;
  display: grid;
  gap: 16px;
}

.banner-summary-body {
  display: grid;
  gap: 12px;
}

.banner-data-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}

.banner-data-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-border-strong);
  background: var(--card-background-strong);
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.banner-data-pill.is-success {
  border-color: rgba(66, 231, 210, 0.26);
  color: var(--status-success-text);
}

.banner-data-pill.is-warning {
  border-color: rgba(255, 122, 97, 0.24);
  color: var(--status-warning-text);
}

.banner-data-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.banner-summary-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.banner-summary-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.banner-summary-note {
  max-width: 42ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.intake-panel {
  grid-area: intake;
}

.top-banner-side {
  grid-area: side;
  display: grid;
  gap: 12px;
  align-content: start;
}

.banner-title-art {
  display: block;
  width: min(100%, 700px);
  height: auto;
  max-height: 132px;
  margin: 0;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.28));
}

.top-banner .lede {
  max-width: 34ch;
  margin: 10px 0 0;
}

.banner-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.banner-summary-head .hero-kicker {
  margin: 0;
}

.banner-summary-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-instruction {
  margin: 4px 0 0;
  color: var(--muted-strong);
  line-height: 1.45;
  font-size: 0.94rem;
}

.banner-panel {
  padding: 14px 16px;
  border-radius: 22px;
  background: var(--banner-panel-background);
  border: 1px solid var(--banner-panel-border);
  overflow: hidden;
}

.banner-primary-button {
  min-width: 144px;
}

.utility-button {
  border-color: rgba(138, 110, 232, 0.18);
  box-shadow: inset 0 0 0 1px rgba(138, 110, 232, 0.04);
}

.clear-button {
  color: var(--muted);
  border-color: rgba(22, 52, 76, 0.08);
  background: rgba(255, 255, 255, 0.35);
}

.top-banner-accent {
  position: absolute;
  top: 14px;
  right: 18px;
  width: min(12vw, 120px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 35%, rgba(66, 231, 210, 0.86), transparent 28%),
    radial-gradient(circle at 68% 56%, rgba(255, 122, 97, 0.82), transparent 34%),
    radial-gradient(circle at center, rgba(121, 168, 255, 0.24), transparent 66%);
  filter: saturate(1.15);
}

body[data-theme="light"] .top-banner-accent {
  opacity: 0.24;
  filter: saturate(0.8);
}

.top-banner.is-collapsed {
  padding-block: 16px;
}

.top-banner.is-collapsed .top-banner-content {
  grid-template-columns: minmax(520px, 0.58fr) minmax(360px, 1fr);
  grid-template-areas: "copy summary";
  align-items: center;
  gap: 16px;
}

.top-banner.is-collapsed .top-banner-copy {
  display: block;
}

.top-banner.is-collapsed .banner-title-art {
  width: min(100%, 660px);
  max-height: 118px;
}

.top-banner.is-collapsed .hero-instruction,
.top-banner.is-collapsed .hero-summary,
.top-banner.is-collapsed .banner-data-copy,
.top-banner.is-collapsed .banner-summary-note {
  display: none;
}

.top-banner.is-collapsed .banner-summary {
  gap: 10px;
  padding: 12px 14px;
}

.top-banner.is-collapsed .intake-panel,
.top-banner.is-collapsed .top-banner-side,
.top-banner.is-collapsed .top-banner-accent {
  display: none;
}

.banner-summary h2,
.panel-head h3,
.empty-state h3 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.02em;
}

.lede,
.hero-summary,
.panel-copy,
.sidebar-note p,
.status-banner,
.empty-state p {
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow,
.section-label,
.hero-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--cyan);
}

.intake-panel,
.coverage-panel,
.sidebar-note {
  display: grid;
  gap: 10px;
}

.dropzone {
  width: 100%;
  display: grid;
  gap: 6px;
  position: relative;
  padding: 16px 16px 16px 56px;
  border-radius: 18px;
  border: 1px dashed var(--card-border);
  background: var(--card-background);
  text-align: left;
  color: var(--text);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.dropzone::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(66, 231, 210, 0.26), rgba(168, 135, 255, 0.24));
  border: 1px solid rgba(28, 73, 106, 0.14);
  box-shadow: 0 10px 24px rgba(34, 74, 109, 0.08);
}

.dropzone:hover,
.dropzone.is-active {
  transform: translateY(-2px);
  border-color: rgba(138, 110, 232, 0.42);
  background: var(--ghost-hover-background);
  box-shadow: 0 16px 32px rgba(34, 74, 109, 0.1);
}

.dropzone.is-active::before {
  background: linear-gradient(135deg, rgba(66, 231, 210, 0.34), rgba(168, 135, 255, 0.3));
  box-shadow: 0 0 0 5px rgba(168, 135, 255, 0.1), 0 12px 28px rgba(34, 74, 109, 0.12);
}

.dropzone.is-success {
  border-color: rgba(66, 231, 210, 0.34);
  box-shadow: inset 0 0 0 1px rgba(66, 231, 210, 0.08);
}

.dropzone.is-warning {
  border-color: rgba(255, 122, 97, 0.3);
}

.dropzone-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.dropzone-copy {
  color: var(--muted);
  font-size: 0.85rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 13px;
  min-height: 44px;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease;
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.filter-button:focus-visible,
.dropzone:focus-visible,
.tab-button:focus-visible {
  outline: 2px solid rgba(138, 110, 232, 0.7);
  outline-offset: 3px;
}

.primary-button:disabled,
.ghost-button:disabled,
.filter-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.primary-button {
  background: linear-gradient(120deg, var(--coral), #ff9565);
  color: #1c0806;
  font-weight: 700;
}

.ghost-button,
.filter-button {
  background: var(--ghost-background);
  color: var(--text);
  border-color: var(--line);
}

.ghost-button {
  padding-inline: 12px;
}

.primary-button:hover,
.ghost-button:hover,
.filter-button:hover,
.filter-button.is-active {
  transform: translateY(-1px);
}

.ghost-button:hover,
.filter-button:hover,
.filter-button.is-active {
  border-color: var(--ghost-hover-border);
  background: var(--ghost-hover-background);
  box-shadow: 0 12px 24px rgba(34, 74, 109, 0.08);
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.filter-button:focus-visible,
.banner-toggle:focus-visible,
.theme-toggle-button:focus-visible,
.tab-button:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid rgba(138, 110, 232, 0.9);
  outline-offset: 3px;
}

.primary-button[disabled],
.ghost-button[disabled],
.filter-button[disabled],
.banner-toggle[disabled],
.theme-toggle-button[disabled],
.tab-button[disabled],
.dropzone[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-button.is-loading,
.ghost-button.is-loading,
.filter-button.is-loading,
.banner-toggle.is-loading,
.theme-toggle-button.is-loading,
.tab-button.is-loading {
  position: relative;
  padding-right: 38px;
}

.primary-button.is-loading::after,
.ghost-button.is-loading::after,
.filter-button.is-loading::after,
.banner-toggle.is-loading::after,
.theme-toggle-button.is-loading::after,
.tab-button.is-loading::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.status-banner {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--status-background);
  border: 1px solid var(--status-border);
  font-size: 0.92rem;
  color: var(--muted-strong);
  line-height: 1.45;
}

.status-banner-badge {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-banner-copy {
  min-width: 0;
}

.status-banner::before {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--muted-strong);
  box-shadow: 0 0 0 4px rgba(121, 168, 255, 0.12);
}

.status-banner.is-success {
  color: var(--status-success-text);
  background: var(--status-success-background);
  border-color: rgba(66, 231, 210, 0.28);
}

.status-banner.is-success::before {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(66, 231, 210, 0.14);
}

.status-banner.is-warning {
  color: var(--status-warning-text);
  background: var(--status-warning-background);
  border-color: rgba(255, 122, 97, 0.24);
}

.status-banner.is-warning::before {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 122, 97, 0.14);
}

.status-banner.is-loading {
  color: var(--muted-strong);
  background: linear-gradient(180deg, rgba(168, 135, 255, 0.14), var(--status-background));
  border-color: rgba(138, 110, 232, 0.24);
}

.status-banner.is-loading::before {
  background: transparent;
  border: 2px solid currentColor;
  border-right-color: transparent;
  box-shadow: none;
  animation: spin 0.8s linear infinite;
}

.coverage-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.coverage-item,
.stack-item,
.table-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border-strong);
}

.coverage-item.is-ready {
  border-color: rgba(66, 231, 210, 0.24);
}

.coverage-item-head,
.stack-item-head,
.table-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.coverage-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.workspace {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-radius: 999px;
  border: 1px solid var(--tab-bar-border);
  background: var(--tab-bar-background);
  box-shadow: 0 18px 34px rgba(34, 74, 109, 0.08);
}

.tab-button {
  position: relative;
  border: 1px solid var(--tab-button-border);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  background: var(--tab-button-background);
  color: var(--tab-button-text);
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.tab-button::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transform: scaleX(0.55);
  transform-origin: center;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
}

.tab-button:hover,
.tab-button.is-active {
  transform: translateY(-1px);
  background: var(--tab-button-active-background);
  border-color: var(--tab-button-active-border);
  color: var(--tab-button-active-text);
  box-shadow: inset 0 -3px 0 rgba(138, 110, 232, 0.42), 0 10px 20px rgba(34, 74, 109, 0.06);
}

.tab-button.is-active::after {
  background: rgba(138, 110, 232, 0.72);
  opacity: 1;
  transform: scaleX(1);
}

.tab-panel {
  display: none;
  gap: 20px;
}

.tab-panel.is-active {
  display: grid;
}

code {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.92em;
}

.insight-board,
.empty-state,
.panel {
  border-radius: var(--radius-xl);
}

.hero-row {
  display: grid;
  gap: 12px;
}

.banner-summary {
  background: var(--banner-summary-background);
}

.banner-summary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/summary-rings.svg") right center/cover no-repeat;
  opacity: 0.28;
  pointer-events: none;
}

body[data-theme="light"] .banner-summary::before {
  opacity: 0.08;
}

.banner-summary h2 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 0.92;
}

.hero-summary {
  margin: 0;
  max-width: none;
  font-size: 0.98rem;
}

.coverage-chips,
.segment-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coverage-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--card-border-strong);
  background: var(--card-background-strong);
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.coverage-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 111, 125, 0.14);
}

.coverage-chip.is-ready .coverage-chip-dot {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(66, 231, 210, 0.14);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 30px;
  text-align: center;
}

.kpi-ribbon {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.executive-ribbon {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi {
  padding: 22px 20px;
  border-radius: 24px;
  background: var(--surface-background);
  border: 1px solid var(--card-border-strong);
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity: 0;
  animation: rise-in 480ms ease forwards;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 17, 0.02), rgba(4, 10, 17, 0.16)),
    url("./assets/kpi-wave.svg") center/cover no-repeat;
  opacity: 0.3;
  pointer-events: none;
}

body[data-theme="light"] .kpi::before {
  opacity: 0.06;
}

.kpi > * {
  position: relative;
  z-index: 1;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.kpi-value {
  margin: 10px 0 8px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.9rem);
  line-height: 0.92;
}

.kpi-note {
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.insight-board {
  padding: 24px 24px 26px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.insight-board::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 17, 0.08), rgba(4, 10, 17, 0.04)),
    url("./assets/panel-grid.svg") center/cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
}

body[data-theme="light"] .insight-board::before,
body[data-theme="light"] .panel::before {
  opacity: 0;
}

.insight-board > *,
.panel > * {
  position: relative;
  z-index: 1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.insight {
  min-height: 180px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--card-border-strong);
  background: var(--card-background);
}

.insight-metric {
  font-family: var(--display);
  font-size: 2rem;
  margin: 12px 0;
}

.insight[data-tone="good"] {
  background: linear-gradient(180deg, rgba(66, 231, 210, 0.12), var(--card-background));
}

.insight[data-tone="warn"] {
  background: linear-gradient(180deg, rgba(255, 122, 97, 0.13), var(--card-background));
}

.insight[data-tone="focus"] {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.14), var(--card-background));
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 20px;
}

.lower-grid {
  grid-template-columns: 1.15fr 1fr;
}

.panel {
  padding: 22px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.matrix-container {
  min-height: 380px;
}

.matrix-svg {
  width: 100%;
  height: auto;
  display: block;
}

.axis-label,
.tick-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--sans);
}

.grid-line {
  stroke: var(--grid-line);
  stroke-dasharray: 4 6;
}

.point-label {
  fill: var(--point-label);
  font-size: 10px;
  pointer-events: none;
}

.workflow-bars,
.segment-legend,
.segment-breakdown,
.stack-list,
.table-panel {
  display: grid;
  gap: 12px;
}

.segment-legend {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.legend-item {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px 14px;
  border-radius: 18px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.legend-item-head {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.legend-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.88rem;
}

.workflow-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.workflow-pie-card {
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.segment-pie-card {
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.pie-chart-block {
  display: grid;
  gap: 10px;
  justify-items: center;
  min-width: 0;
}

.pie-chart-title {
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.workflow-pie-wrap {
  position: relative;
  width: min(100%, 220px);
  aspect-ratio: 1;
  justify-self: center;
}

.segment-pie-wrap {
  position: relative;
  width: min(100%, 220px);
  aspect-ratio: 1;
  justify-self: center;
}

.workflow-pie {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.2));
}

.segment-pie {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.18));
}

.workflow-pie-hole {
  fill: var(--panel);
  stroke: var(--card-border);
  stroke-width: 1;
}

.workflow-pie-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 2px;
  text-align: center;
  pointer-events: none;
}

.workflow-pie-center strong {
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 0.9;
}

.workflow-pie-center span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.workflow-pie-legend {
  display: grid;
  gap: 10px;
}

.segment-pie-legend {
  display: grid;
  gap: 8px;
}

.workflow-legend-item {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider-line);
}

.segment-pie-item {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider-line);
}

.workflow-legend-item:last-child {
  border-bottom: none;
}

.segment-pie-item:last-child {
  border-bottom: none;
}

.workflow-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.workflow-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.workflow-meta {
  color: var(--muted);
}

.progress-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--progress-track-background);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.segment-row {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--divider-line);
}

.segment-row:last-child {
  border-bottom: none;
}

.segment-row-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.segment-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.segment-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.leaderboard-list {
  display: grid;
  gap: 14px;
}

.leader-card {
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--card-background-strong), var(--card-background));
  border: 1px solid var(--card-border-strong);
}

.leader-card[data-rank="1"] {
  background: linear-gradient(135deg, rgba(255, 204, 99, 0.22), rgba(255, 255, 255, 0.08));
}

.leader-card[data-rank="2"] {
  background: linear-gradient(135deg, rgba(121, 168, 255, 0.2), rgba(255, 255, 255, 0.08));
}

.leader-card[data-rank="3"] {
  background: linear-gradient(135deg, rgba(255, 122, 97, 0.2), rgba(255, 255, 255, 0.08));
}

body[data-theme="light"] .leader-card[data-rank="1"] {
  background: linear-gradient(135deg, rgba(255, 204, 99, 0.22), rgba(255, 255, 255, 0.94));
}

body[data-theme="light"] .leader-card[data-rank="2"] {
  background: linear-gradient(135deg, rgba(121, 168, 255, 0.2), rgba(255, 255, 255, 0.94));
}

body[data-theme="light"] .leader-card[data-rank="3"] {
  background: linear-gradient(135deg, rgba(255, 122, 97, 0.2), rgba(255, 255, 255, 0.94));
}

.leader-crest {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.leader-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.leader-top {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.leader-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.leader-rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted-strong);
  font-weight: 700;
  white-space: nowrap;
}

body[data-theme="light"] .leader-rank {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(28, 73, 106, 0.14);
}

.leader-subtitle {
  color: var(--muted);
  font-size: 0.94rem;
}

.leader-description {
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.45;
}

.leader-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.leader-stats span {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.leader-score {
  display: grid;
  gap: 6px;
  min-width: 132px;
  text-align: right;
}

.leader-score-value {
  font-family: var(--display);
  font-size: clamp(2rem, 2.8vw, 2.8rem);
  line-height: 0.9;
}

.leader-score-label {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.executive-brief,
.executive-highlights,
.history-summary,
.history-month-list,
.history-metric-definitions {
  display: grid;
  gap: 12px;
}

.executive-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.executive-scope-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.executive-scope-chip.is-history {
  background: rgba(66, 231, 210, 0.12);
  border-color: rgba(66, 231, 210, 0.24);
}

.executive-scope-chip.is-current {
  background: rgba(121, 168, 255, 0.12);
  border-color: rgba(121, 168, 255, 0.24);
}

.executive-scope-note {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.executive-brief-item,
.executive-highlight-item,
.history-summary-card,
.history-month-chip {
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.executive-brief-item h4,
.executive-highlight-item h4,
.history-summary-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.executive-brief-item p,
.executive-highlight-item p,
.history-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.history-month-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.history-metric-definitions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 4px;
}

.history-metric-definition {
  display: grid;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.history-metric-definition:hover {
  transform: translateY(-1px);
  border-color: rgba(66, 231, 210, 0.24);
  background: var(--card-background-strong);
}

.history-metric-definition.is-active {
  background: linear-gradient(180deg, rgba(66, 231, 210, 0.14), var(--card-background));
  border-color: rgba(66, 231, 210, 0.28);
}

.history-metric-definition strong {
  display: block;
  margin-bottom: 6px;
}

.history-metric-definition p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.history-metric-definition p span {
  color: var(--muted-strong);
  font-weight: 700;
}

.history-month-chip strong {
  display: block;
  margin-bottom: 6px;
}

.history-month-chip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-month-chip.is-current {
  background: linear-gradient(135deg, rgba(66, 231, 210, 0.16), rgba(255, 255, 255, 0.08));
  border-color: rgba(66, 231, 210, 0.28);
}

.history-month-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
  color: var(--muted-strong);
  font-size: 0.8rem;
}

.history-chart {
  min-height: 380px;
}

.history-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.history-axis,
.history-tick {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--sans);
}

.history-grid-line {
  stroke: var(--history-grid-line);
  stroke-dasharray: 4 6;
}

.history-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
}

.history-point {
  fill: var(--coral);
  stroke: var(--history-point-stroke);
  stroke-width: 2;
}

.history-point-label {
  fill: var(--muted-strong);
  font-size: 11px;
  font-family: var(--sans);
}

.history-summary-value {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  line-height: 0.92;
}

.history-summary-card[data-tone="up"] {
  background: linear-gradient(180deg, rgba(66, 231, 210, 0.14), rgba(255, 255, 255, 0.07));
}

.history-summary-card[data-tone="down"] {
  background: linear-gradient(180deg, rgba(255, 122, 97, 0.16), rgba(255, 255, 255, 0.07));
}

.history-summary-card[data-tone="best"] {
  background: linear-gradient(180deg, rgba(255, 204, 99, 0.16), rgba(255, 255, 255, 0.07));
}

.history-summary-card[data-tone="latest"] {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.16), rgba(255, 255, 255, 0.07));
}

.executive-codex-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(168, 135, 255, 0.14), var(--card-background));
  border: 1px solid var(--card-border-strong);
}

.executive-codex-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.executive-codex-card h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.executive-codex-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.executive-codex-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.executive-codex-metric {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
}

.executive-codex-metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.executive-codex-metric-value {
  margin: 8px 0 6px;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 0.94;
}

.executive-codex-note {
  color: var(--muted-strong);
}

.surface-row {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
}

.surface-row-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.surface-row-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.surface-row-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 6px rgba(121, 168, 255, 0.12);
}

.surface-row-share {
  color: var(--muted-strong);
  font-weight: 700;
}

.surface-metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.surface-metric-grid span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.codex-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.codex-activity-chart {
  margin-top: 14px;
}

.codex-activity-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.codex-activity-axis,
.codex-activity-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--sans);
}

.codex-activity-label {
  font-weight: 700;
}

.codex-activity-bar {
  opacity: 0.92;
}

.codex-day-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card-background-strong), var(--card-background));
  border: 1px solid var(--card-border);
}

.codex-day-date {
  font-weight: 700;
}

.codex-day-metrics {
  display: grid;
  gap: 8px;
}

.codex-day-metrics span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.codex-day-metrics strong {
  color: var(--muted-strong);
  font-weight: 700;
}

body[data-theme="light"] .history-summary-card[data-tone="up"] {
  background: linear-gradient(180deg, rgba(66, 231, 210, 0.16), rgba(255, 255, 255, 0.95));
}

body[data-theme="light"] .history-summary-card[data-tone="down"] {
  background: linear-gradient(180deg, rgba(255, 122, 97, 0.18), rgba(255, 255, 255, 0.95));
}

body[data-theme="light"] .history-summary-card[data-tone="best"] {
  background: linear-gradient(180deg, rgba(255, 204, 99, 0.18), rgba(255, 255, 255, 0.95));
}

body[data-theme="light"] .history-summary-card[data-tone="latest"] {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.18), rgba(255, 255, 255, 0.95));
}

body[data-theme="light"] .executive-codex-card {
  background: linear-gradient(135deg, rgba(168, 135, 255, 0.16), rgba(255, 255, 255, 0.96));
}

.table-row {
  gap: 10px;
}

.table-meta,
.stack-meta,
.metric-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-inline span,
.stack-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--card-background-strong);
  border: 1px solid var(--card-border);
}

.rank-badge {
  min-width: 38px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--card-background-strong);
  color: var(--muted-strong);
  font-weight: 700;
}

body[data-theme="light"] .banner-panel,
body[data-theme="light"] .dropzone,
body[data-theme="light"] .coverage-chip,
body[data-theme="light"] .coverage-item,
body[data-theme="light"] .status-banner,
body[data-theme="light"] .tab-bar,
body[data-theme="light"] .tab-button,
body[data-theme="light"] .theme-toggle-button,
body[data-theme="light"] .insight,
body[data-theme="light"] .leader-card,
body[data-theme="light"] .history-summary-card,
body[data-theme="light"] .history-month-chip,
body[data-theme="light"] .history-metric-definition,
body[data-theme="light"] .executive-codex-card,
body[data-theme="light"] .executive-codex-metric,
body[data-theme="light"] .surface-row,
body[data-theme="light"] .codex-day-card,
body[data-theme="light"] .metric-inline span,
body[data-theme="light"] .stack-meta span,
body[data-theme="light"] .rank-badge {
  backdrop-filter: none;
}

body[data-theme="light"] .tab-bar {
  border-color: rgba(138, 110, 232, 0.18);
  box-shadow: 0 16px 34px rgba(34, 74, 109, 0.12);
}

body[data-theme="light"] .tab-button.is-active {
  box-shadow: inset 0 -3px 0 rgba(138, 110, 232, 0.5), 0 10px 20px rgba(34, 74, 109, 0.05);
}

body[data-theme="light"] .tab-button.is-active::after {
  background: rgba(138, 110, 232, 0.82);
}

.stack-item {
  padding: 16px;
}

.tooltip {
  position: fixed;
  z-index: 40;
  max-width: 240px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--tooltip-border);
  background: var(--tooltip-background);
  box-shadow: var(--tooltip-shadow);
  color: var(--text);
  pointer-events: none;
}

.tooltip p {
  margin: 0;
}

.tooltip p + p {
  margin-top: 6px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1280px) {
  .kpi-ribbon,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-metric-definitions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .executive-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .executive-codex-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  body {
    padding: 16px;
  }

  .analysis-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .top-banner-content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "summary"
      "intake"
      "side";
  }

  .coverage-list {
    grid-template-columns: 1fr;
  }

  .top-banner-accent {
    width: min(28vw, 180px);
  }

  .top-banner.is-collapsed .top-banner-content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "summary";
    gap: 12px;
  }

  .banner-title-art {
    width: min(100%, 620px);
  }

  .top-banner.is-collapsed .banner-title-art {
    width: min(100%, 460px);
    max-height: 70px;
  }

  .banner-summary-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hero-row {
    gap: 10px;
  }

  .kpi-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-pie-card,
  .segment-pie-card {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 720px) {
  .app-shell {
    gap: 16px;
  }

  .theme-toggle-button {
    min-width: 104px;
    padding: 9px 12px;
  }

  .top-banner,
  .panel,
  .insight-board,
  .empty-state {
    border-radius: 24px;
  }

  .top-banner {
    padding: 22px;
  }

  .top-banner-accent {
    width: 120px;
    top: 18px;
    right: 18px;
  }

  .banner-title-art {
    width: 100%;
    max-height: 98px;
  }

  .banner-toggle {
    min-width: 0;
  }

  .banner-summary-footer {
    flex-direction: column;
  }

  .banner-summary-primary {
    width: 100%;
  }

  .kpi-ribbon,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .segment-legend {
    grid-template-columns: 1fr;
  }

  .history-metric-definitions {
    grid-template-columns: 1fr;
  }

  .executive-ribbon,
  .history-month-list {
    grid-template-columns: 1fr;
  }

  .executive-codex-metrics {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    padding: 8px;
  }

  .tab-button {
    flex: 1 1 0;
    justify-content: center;
  }

  .leader-card {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .workflow-pie-wrap,
  .segment-pie-wrap {
    max-width: 190px;
  }

  .leader-score {
    min-width: 0;
    text-align: left;
  }

  .button-row,
  .coverage-chips,
  .segment-filters {
    width: 100%;
  }

  .hero-row,
  .coverage-chips {
    width: 100%;
  }

  .top-banner.is-collapsed .top-banner-copy .lede {
    max-width: none;
  }

  .primary-button,
  .ghost-button,
  .filter-button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
