:root {
  --bg: #f3f6fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(84, 99, 140, 0.14);
  --ink: #24314b;
  --muted: #7f8aa3;
  --accent: #45bdf7;
  --accent-strong: #25a9ee;
  --accent-soft: rgba(69, 189, 247, 0.12);
  --accent-soft-strong: rgba(69, 189, 247, 0.2);
  --good: #daf2df;
  --warn: #fff1c9;
  --bad: #ffd9d5;
  --shadow: 0 24px 60px rgba(112, 126, 190, 0.14);
  --sidebar-shadow: 0 30px 70px rgba(98, 118, 192, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(101, 213, 255, 0.2), transparent 24%),
    radial-gradient(circle at top right, rgba(201, 200, 248, 0.32), transparent 28%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  font-family: "Nunito", "Helvetica Neue", Arial, sans-serif;
}

.dashboard-shell {
  width: min(1600px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 22px;
}

.workspace-shell {
  display: grid;
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  min-height: calc(100vh - 40px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(240, 244, 255, 0.88));
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--sidebar-shadow);
  padding: 22px 18px 20px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-brand-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #e9f3ff, #f9fbff);
  color: #6872c6;
  font-size: 24px;
  box-shadow: 0 10px 30px rgba(85, 102, 180, 0.12);
}

.sidebar-eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 800;
  color: #a3a1c7;
  text-transform: uppercase;
  letter-spacing: 0.28em;
}

.sidebar-title {
  margin: 0;
  font-size: 34px;
  line-height: 0.95;
  color: #575372;
}

.sidebar-copy {
  margin: 18px 4px 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.sidebar-group + .sidebar-group {
  margin-top: 18px;
}

.sidebar-group-title {
  margin: 0 6px 10px;
  font-size: 11px;
  font-weight: 800;
  color: #a3a1c7;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(243, 245, 255, 0.78);
  color: var(--ink);
  padding: 13px 16px;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.sidebar-link:hover {
  transform: translateY(-1px);
  background: rgba(236, 241, 255, 0.96);
}

.sidebar-link.is-active {
  color: #fff;
  background: linear-gradient(180deg, #49d0ff 0%, var(--accent-strong) 100%);
  box-shadow: 0 18px 32px rgba(55, 198, 255, 0.28);
}

.hero {
  padding: 22px 24px;
  overflow: hidden;
}

.hero-title {
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 0.94;
  margin: 0;
  max-width: 980px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #e08b54;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 12px;
  font-weight: 800;
}

h2 {
  margin: 0;
}

h2 {
  font-size: 22px;
}

.subtle {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hero > *,
.section-heading > *,
.panel-header > *,
.panel-actions > * {
  min-width: 0;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 0 0 16px;
  flex-wrap: wrap;
}

.section-heading h3 {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.05;
}

.section-kicker {
  margin: 0;
  color: #b99672;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.28em;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 0 0 14px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.tab.is-active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-panel {
  padding: 20px 22px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(10, minmax(140px, 1fr));
  gap: 12px;
}

.filter-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.filter-span-2 {
  grid-column: span 2;
}

.filter-field input,
.filter-field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.multi-select {
  position: relative;
}

.multi-select-trigger,
.multi-select-search {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.multi-select-trigger {
  text-align: left;
  cursor: pointer;
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 220px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 20;
}

.multi-select-options {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  color: var(--ink);
}

.multi-select-option input {
  margin: 0;
}

.multi-select-empty {
  padding: 8px 4px;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 4px 0 0;
}

.card {
  padding: 20px;
}

.stage-card {
  cursor: pointer;
}

.stage-card.is-selected {
  border-color: rgba(55, 102, 255, 0.35);
  background: rgba(55, 102, 255, 0.08);
}

.card-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.card-value {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.card-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.layout {
  display: grid;
  gap: 16px;
}

.two-column-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.action-grid {
  display: grid;
  gap: 12px;
}

.action-card {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(242,246,255,0.88));
  color: var(--ink);
  padding: 18px 18px 16px;
  border-radius: 22px;
  cursor: pointer;
  font: inherit;
}

.action-card strong {
  font-size: 17px;
}

.action-card span {
  color: var(--muted);
  line-height: 1.5;
}

.pulse-best-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.pulse-filter-panel {
  display: grid;
  gap: 18px;
}

.pulse-filterbar {
  display: grid;
  gap: 16px;
}

.pulse-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.pulse-filter-group {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.pulse-filter-grow {
  flex: 1 1 420px;
}

.pulse-filter-actions {
  min-width: 150px;
}

.pulse-filter-row .multi-select {
  width: 100%;
}

.pulse-filter-row .multi-select-trigger {
  background: linear-gradient(180deg, rgba(27, 39, 72, 0.92), rgba(20, 29, 58, 0.92));
  color: #eef4ff;
  border-color: rgba(120, 145, 215, 0.18);
}

.pulse-filter-row .multi-select-menu {
  background: linear-gradient(180deg, rgba(19, 29, 57, 0.98), rgba(14, 22, 44, 0.98));
  border-color: rgba(120, 145, 215, 0.16);
}

.pulse-filter-row .multi-select-option {
  color: #e7efff;
}

.pulse-filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}

.pulse-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pulse-chip {
  border: 1px solid rgba(130, 153, 215, 0.18);
  background: rgba(25, 36, 67, 0.7);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.pulse-chip.is-active,
.pulse-chip:hover {
  background: rgba(70, 121, 255, 0.2);
  color: #eaf2ff;
  border-color: rgba(70, 121, 255, 0.38);
}

body.theme-dark .pulse-custom-range input {
  background: linear-gradient(180deg, rgba(27, 39, 72, 0.92), rgba(20, 29, 58, 0.92));
  color: #eef4ff;
  border: 1px solid rgba(120, 145, 215, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

body.theme-dark .pulse-custom-range input::placeholder {
  color: #95a4ca;
}

.pulse-kpi-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pulse-kpi-source-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(120, 145, 215, 0.12);
  background: rgba(20, 29, 58, 0.72);
  color: #b7c5e8;
  font-size: 13px;
  line-height: 1.5;
}

.pulse-kpi-source-note strong {
  color: #eef4ff;
}

.pulse-kpi-column {
  border: 1px solid rgba(120, 145, 215, 0.14);
  border-radius: 24px;
  background: rgba(18, 27, 52, 0.82);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.pulse-kpi-column-head h4 {
  margin: 0;
  font-size: 20px;
}

.pulse-kpi-column-head .subtle {
  margin-top: 4px;
}

.pulse-kpi-items {
  display: grid;
  gap: 12px;
}

.pulse-kpi-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(120, 145, 215, 0.12);
}

.pulse-kpi-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.pulse-kpi-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pulse-kpi-value {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.pulse-kpi-plan {
  margin: 6px 0 0;
  color: #9fb0d7;
  font-size: 12px;
}

.pulse-kpi-meta {
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: end;
}

.pulse-kpi-delta {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  align-self: center;
}

.pulse-kpi-delta.is-positive {
  color: #62d38f;
}

.pulse-kpi-delta.is-negative {
  color: #ff8e8e;
}

.pulse-kpi-delta.is-neutral {
  color: #9db0db;
}

.pulse-three-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.pulse-list-grid,
.pulse-actions-list,
.pulse-insights-grid {
  display: grid;
  gap: 12px;
}

.ai-marketing-panel {
  display: grid;
  gap: 18px;
}

.ai-marketing-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.ai-marketing-topbar .subtle {
  max-width: 420px;
  color: rgba(230, 238, 255, 0.74);
}

.ai-marketing-shell {
  display: grid;
  gap: 0;
  border: 1px solid rgba(212, 221, 237, 0.9);
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(79, 170, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.98));
  box-shadow: 0 22px 60px rgba(14, 23, 42, 0.16);
}

.ai-marketing-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(224, 231, 245, 0.95);
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(244, 248, 255, 0.98));
}

.ai-marketing-suggestions .ghost-button {
  border-color: rgba(183, 200, 230, 0.9);
  background: #ffffff;
  color: #2a446d;
  box-shadow: 0 6px 18px rgba(120, 145, 191, 0.16);
}

.ai-marketing-suggestions .ghost-button:hover {
  border-color: rgba(101, 169, 255, 0.8);
  background: rgba(240, 248, 255, 0.98);
  color: #0d5db8;
}

.ai-marketing-chat {
  min-height: 420px;
  max-height: 62vh;
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 22px 18px 18px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at top left, rgba(103, 172, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(244, 247, 253, 0.98));
}

.ai-message {
  display: grid;
  gap: 8px;
  max-width: min(820px, 88%);
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(219, 228, 243, 0.96);
  box-shadow: 0 18px 36px rgba(20, 31, 56, 0.08);
}

.ai-message-user {
  margin-left: auto;
  border-bottom-right-radius: 10px;
  border-color: rgba(126, 186, 255, 0.72);
  background: linear-gradient(180deg, rgba(224, 241, 255, 1), rgba(212, 235, 255, 0.96));
}

.ai-message-assistant {
  margin-right: auto;
  border-bottom-left-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.98));
}

.ai-message-intro {
  max-width: min(760px, 94%);
  background: linear-gradient(180deg, rgba(245, 249, 255, 1), rgba(238, 245, 255, 0.98));
  border-color: rgba(187, 207, 236, 0.92);
}

.ai-message-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7890b7;
}

.ai-message-content {
  font-size: 16px;
  line-height: 1.6;
  color: #243654;
}

.ai-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #7890b7;
}

.ai-message-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ai-followup-chip {
  border: 1px solid rgba(187, 207, 236, 0.95);
  background: linear-gradient(180deg, rgba(245, 249, 255, 1), rgba(235, 243, 255, 0.98));
  color: #35527e;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ai-followup-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(83, 163, 255, 0.42);
  box-shadow: 0 10px 20px rgba(83, 163, 255, 0.12);
}

.ai-marketing-form {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
  border-top: 1px solid rgba(224, 231, 245, 0.95);
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.99), rgba(244, 248, 255, 0.99));
}

.ai-marketing-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.ai-marketing-form textarea {
  width: 100%;
  border: 1px solid rgba(191, 205, 229, 0.95);
  border-radius: 22px;
  padding: 16px 18px;
  resize: vertical;
  min-height: 72px;
  max-height: 180px;
  font: inherit;
  color: #22344f;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 250, 255, 1));
}

.ai-marketing-send {
  min-width: 56px;
  height: 56px;
  border-radius: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 14px 28px rgba(79, 170, 255, 0.3);
}

.ai-marketing-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pulse-creative-card,
.pulse-insight-card,
.pulse-alert {
  border: 1px solid rgba(120, 145, 215, 0.14);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(27, 39, 72, 0.92), rgba(20, 29, 58, 0.92));
  padding: 16px;
}

.pulse-creative-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.pulse-creative-head,
.pulse-alert-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.pulse-creative-head h4 {
  margin: 0 0 4px;
  font-size: 17px;
  line-height: 1.3;
}

.pulse-priority,
.pulse-severity {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pulse-priority-high,
.pulse-alert-high .pulse-severity {
  background: rgba(255, 100, 100, 0.16);
  color: #ff9c9c;
}

.pulse-priority-medium,
.pulse-alert-medium .pulse-severity {
  background: rgba(255, 195, 100, 0.16);
  color: #ffd27f;
}

.pulse-priority-low,
.pulse-alert-low .pulse-severity {
  background: rgba(110, 180, 255, 0.14);
  color: #8dc9ff;
}

.pulse-creative-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pulse-creative-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.pulse-action-button {
  padding: 8px 12px;
  font-size: 12px;
  min-height: 34px;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}

.pulse-alert p,
.pulse-insight-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.pulse-alert-action {
  margin-top: 10px;
  font-weight: 700;
  color: #eef4ff;
}

.pulse-insight-positive {
  border-color: rgba(98, 211, 143, 0.2);
}

.pulse-insight-negative {
  border-color: rgba(255, 136, 136, 0.18);
}

.pulse-insight-neutral {
  border-color: rgba(110, 180, 255, 0.18);
}

.pulse-empty {
  border: 1px dashed rgba(120, 145, 215, 0.22);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
  background: rgba(19, 29, 57, 0.62);
}

.pulse-best-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,255,0.92));
}

.pulse-best-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.pulse-best-card .subtle {
  margin: 0 0 12px;
}

.pulse-best-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pulse-best-empty,
.empty-state-panel {
  min-height: 280px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 28px;
}

.empty-state h2 {
  font-size: 34px;
}

.empty-state p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 16px;
}

.view-section[hidden] {
  display: none;
}

body.best-mode #summary-cards,
body.pulse-mode #summary-cards,
body.lab-mode #summary-cards,
body.predict-mode #summary-cards,
body.aihub-mode #summary-cards,
body.knowledge-mode #summary-cards,
body.logs-mode #summary-cards,
body.settings-mode #summary-cards {
  display: none !important;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding: 22px 22px 12px;
  border-bottom: 1px solid rgba(84, 99, 140, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(247,250,255,0.55));
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  flex-wrap: wrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-panel,
.best-panel {
  overflow: hidden;
}

.analytics-panel-primary,
.best-panel-primary {
  background:
    radial-gradient(circle at top right, rgba(69, 189, 247, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.92));
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}

.ghost-button[hidden] {
  display: none;
}

.best-controls {
  padding: 16px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.best-source-pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(69, 189, 247, 0.1);
  color: #237fb4;
  font-size: 13px;
  font-weight: 700;
}

.compact-tabs {
  padding-bottom: 0;
}

.best-cards {
  padding: 8px 18px 18px;
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 22px 14px;
  padding: 13px 16px;
  border-radius: 18px;
  border: 1px solid rgba(69, 189, 247, 0.16);
  background: linear-gradient(180deg, rgba(69, 189, 247, 0.08), rgba(245, 249, 255, 0.9));
  color: var(--ink);
}

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

.stage-board {
  display: grid;
  gap: 18px;
  padding: 18px 22px 22px;
  overflow: hidden;
}

.stage-group {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(84, 99, 140, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,255,0.92));
}

.stage-group-compact {
  max-width: 430px;
}

.stage-group-header {
  padding: 2px 2px 0;
}

.stage-group-eyebrow {
  margin: 0 0 6px;
  color: #7fa0d7;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  font-weight: 800;
}

.stage-group-header h3 {
  margin: 0;
  font-size: 34px;
  line-height: 0.96;
}

.stage-board-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  align-items: start;
}

.stage-column {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(84, 99, 140, 0.1);
  border-radius: 20px;
  background: rgba(251, 252, 255, 0.92);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  min-width: 0;
  overflow: visible;
  cursor: pointer;
}

.stage-column.is-selected {
  border-color: rgba(69, 189, 247, 0.28);
  background: linear-gradient(180deg, rgba(69, 189, 247, 0.1), rgba(255,255,255,0.92));
  box-shadow: 0 12px 30px rgba(69, 189, 247, 0.12);
}

.stage-group-compact .stage-board-inner {
  grid-template-columns: minmax(280px, 1fr);
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
}

.stage-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stage-header h3 {
  margin: 0;
  font-size: 16px;
}

.stage-title-button {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.metric-info-inline {
  width: 22px;
  height: 22px;
  min-width: 22px;
  font-size: 12px;
}

.stage-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 4px;
}

.stage-list::-webkit-scrollbar {
  width: 8px;
}

.stage-list::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.08);
  border-radius: 999px;
}

.stage-list::-webkit-scrollbar-thumb {
  background: rgba(69, 189, 247, 0.22);
  border-radius: 999px;
}

.stage-item {
  display: grid;
  gap: 8px;
  text-align: left;
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249,251,255,0.94));
  padding: 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  min-width: 0;
  overflow: hidden;
}

.stage-item-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.stage-item-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.stage-item-lab-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(69, 189, 247, 0.12);
  border: 1px solid rgba(69, 189, 247, 0.22);
  font-size: 15px;
  line-height: 1;
}

.stage-item strong,
.stage-item span,
.stage-title-button {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(84, 99, 140, 0.08);
}

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

.stage-item-reason {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: rgba(214, 224, 248, 0.92);
  font-size: 12px;
  line-height: 1.35;
  min-height: 32px;
}

.stage-item.is-selected {
  border-color: rgba(69, 189, 247, 0.3);
  background: linear-gradient(180deg, rgba(69, 189, 247, 0.12), rgba(255,255,255,0.94));
}

.stage-empty {
  padding: 14px;
  border-radius: 14px;
  background: rgba(55, 102, 255, 0.05);
  color: var(--muted);
}

.best-detail {
  padding: 18px 22px 22px;
}

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

.detail-card {
  border: 1px solid rgba(84, 99, 140, 0.1);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,255,0.92));
  padding: 18px;
}

.detail-card h3 {
  margin: 0 0 8px;
}

.detail-card p {
  margin: 0;
}

.lab-summary-current {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(120, 145, 215, 0.14);
  background: linear-gradient(180deg, rgba(27, 39, 72, 0.9), rgba(20, 29, 58, 0.94));
}

.lab-summary-current-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93a3c7;
}

.lab-summary-current-name {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  color: #eef4ff;
  overflow-wrap: anywhere;
}

.lab-overall-status {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(120, 145, 215, 0.14);
  background: linear-gradient(180deg, rgba(27, 39, 72, 0.92), rgba(20, 29, 58, 0.96));
}

.lab-overall-status-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93a3c7;
}

.lab-overall-status-title {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  color: #eef4ff;
}

.lab-overall-status-note {
  margin: 8px 0 0;
  color: #c3d0ee;
  font-size: 13px;
  line-height: 1.45;
}

.lab-overall-status-good {
  border-color: rgba(72, 187, 120, 0.28);
  background: linear-gradient(180deg, rgba(18, 50, 40, 0.92), rgba(17, 39, 34, 0.96));
}

.lab-overall-status-warn {
  border-color: rgba(245, 189, 71, 0.28);
  background: linear-gradient(180deg, rgba(59, 46, 20, 0.92), rgba(45, 34, 13, 0.96));
}

.lab-overall-status-bad {
  border-color: rgba(248, 113, 113, 0.28);
  background: linear-gradient(180deg, rgba(60, 25, 30, 0.92), rgba(42, 19, 23, 0.96));
}

.lab-recent-windows-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.lab-recent-windows-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lab-recent-window-card {
  min-width: 0;
}

.lab-recent-window-card .detail-metrics {
  margin-top: 10px;
}

.lab-recent-window-card .pill {
  font-size: 12px;
}

@media (max-width: 1180px) {
  .lab-recent-windows-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .lab-recent-windows-grid {
    grid-template-columns: 1fr;
  }
}

.lab-burnout-good {
  color: #86efac;
}

.lab-burnout-warn {
  color: #fcd34d;
}

.lab-burnout-bad {
  color: #fca5a5;
}

.panel-inner {
  border: 1px solid rgba(84, 99, 140, 0.1);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,255,0.92));
  padding: 18px;
}

.lab-ai-deep-summary {
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(55, 102, 255, 0.06), #fbfcff);
}

.lab-ai-deep-summary > h3 {
  margin: 0 0 12px;
}

.detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
}

.audit-card {
  overflow: hidden;
}

.lab-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 22px 22px;
}

.lab-cta h3 {
  margin: 0 0 6px;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 16px;
  padding: 0 16px 16px;
}

.lab-main,
.lab-side {
  display: grid;
  gap: 16px;
}

.lab-form {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
  padding: 16px;
}

.lab-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.lab-creative-name-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lab-creative-name-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.lab-apply-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.lab-form textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  resize: vertical;
  font: inherit;
}

.lab-dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 116px;
  padding: 18px;
  border: 2px dashed rgba(55, 102, 255, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(55, 102, 255, 0.06), rgba(255, 255, 255, 0.9));
  color: var(--ink);
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.lab-dropzone span {
  color: var(--muted);
  font-size: 13px;
}

.lab-dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(55, 102, 255, 0.14), rgba(255, 255, 255, 0.98));
  transform: translateY(-1px);
}

.lab-file-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.lab-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.inline-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.inline-button.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

#lab-open-creative.is-active-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(55, 102, 255, 0.24);
}

#lab-open-creative.is-active-link:hover {
  filter: brightness(1.03);
}

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

.lab-media {
  width: 100%;
  max-height: 460px;
  border-radius: 14px;
  object-fit: contain;
  background: #eef3fb;
}

.lab-records-list {
  display: grid;
  gap: 10px;
}

.lab-records-table {
  display: grid;
  gap: 8px;
}

.lab-records-head,
.lab-record-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(120px, 0.8fr) minmax(180px, 1.2fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr);
  gap: 12px;
  align-items: center;
}

.lab-records-head {
  padding: 0 14px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lab-record-row {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}

.lab-record-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.lab-record-primary {
  display: grid;
  gap: 4px;
}

.lab-record-primary strong {
  color: var(--ink);
}

.lab-record-primary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.lab-record-row.is-selected {
  border-color: rgba(55, 102, 255, 0.35);
  background: rgba(55, 102, 255, 0.08);
}

.lab-library-list {
  display: grid;
  gap: 10px;
}

.lab-recommend-head {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.lab-library-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.lab-library-item summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.lab-library-item summary::-webkit-details-marker {
  display: none;
}

.lab-library-body {
  padding: 0 14px 14px;
  border-top: 1px solid rgba(21, 34, 53, 0.06);
}

.lab-record-item {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}

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

.lab-record-item.is-selected {
  border-color: rgba(55, 102, 255, 0.35);
  background: rgba(55, 102, 255, 0.08);
}

.lab-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.lab-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(21, 34, 53, 0.08);
  overflow: hidden;
  margin-bottom: 14px;
}

.lab-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3766ff 0%, #7ea1ff 100%);
  transition: width 0.22s ease;
}

.lab-progress-steps {
  display: grid;
  gap: 10px;
}

.lab-progress-step {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--muted);
}

.lab-progress-step strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.lab-progress-step p {
  margin: 0;
  font-size: 13px;
}

.lab-progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(21, 34, 53, 0.16);
  margin-top: 4px;
}

.lab-progress-step.is-active .lab-progress-dot {
  background: #3766ff;
  box-shadow: 0 0 0 4px rgba(55, 102, 255, 0.14);
}

.lab-progress-step.is-done .lab-progress-dot {
  background: #31b06e;
}

.compact-card {
  padding: 16px;
}

.compact-value {
  font-size: 24px;
}

.audit-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
}

.legend-blue {
  background: #156ef2;
}

.legend-light {
  background: #9dd0ff;
}

.legend-red {
  background: #ff5b57;
}

.audit-chart-svg {
  width: 100%;
  height: 260px;
  display: block;
  background: linear-gradient(180deg, rgba(21, 110, 242, 0.04), rgba(255,255,255,0));
  border-radius: 12px;
}

.audit-chart-svg.is-large {
  height: 420px;
}

.audit-chart-shell {
  cursor: zoom-in;
}

.audit-chart-shell.is-large {
  cursor: default;
}

.audit-expand-button {
  margin: 0 0 12px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(69, 189, 247, 0.2);
  background: rgba(69, 189, 247, 0.1);
  color: #bfe8ff;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.audit-chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
}

.audit-chart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 20, 0.68);
  backdrop-filter: blur(6px);
}

.audit-chart-dialog {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 48px));
  margin: 36px auto;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(18, 28, 48, 0.98), rgba(15, 24, 42, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  padding: 24px;
}

.audit-chart-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.audit-chart-dialog-head h3 {
  margin: 0 0 6px;
}

.audit-chart-close {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(24, 37, 61, 0.9);
  color: #eff6ff;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.audit-chart-dialog-body {
  min-height: 460px;
}

.audit-grid-line {
  stroke: rgba(21, 34, 53, 0.12);
  stroke-width: 1;
}

.audit-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.audit-point {
  opacity: 0.9;
}

.audit-point-blue {
  fill: #156ef2;
}

.audit-point-light {
  fill: #9dd0ff;
}

.audit-point-red {
  fill: #ff5b57;
}

.audit-reasons {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: center;
}

.reason-pie {
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.reason-pie-label {
  fill: white;
  font-size: 13px;
  font-weight: 700;
}

.reason-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.reason-legend li {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.reason-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.floating-audit-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(122, 168, 255, 0.22) !important;
  background: linear-gradient(180deg, rgba(16, 24, 46, 0.98), rgba(24, 36, 68, 0.98)) !important;
  box-shadow: 0 20px 44px rgba(4, 10, 28, 0.38) !important;
  color: #eef4ff !important;
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.floating-audit-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff !important;
}

.metric-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.metric-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.metric-info-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: none;
  width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-line;
}

.metric-info-wrap.is-open .metric-info-popover {
  display: block;
}

.table-wrap {
  overflow: auto;
  padding: 16px 18px 18px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 12px 14px;
  border-top: 1px solid rgba(84, 99, 140, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(248,250,255,0.98), rgba(243,246,255,0.98));
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
  color: #8190ab;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

tbody tr td {
  background: rgba(255,255,255,0.86);
}

tbody tr:first-child td {
  border-top-color: rgba(84, 99, 140, 0.1);
}

tbody tr td:first-child {
  border-left: 1px solid rgba(84, 99, 140, 0.08);
}

tbody tr td:last-child {
  border-right: 1px solid rgba(84, 99, 140, 0.08);
}

tbody tr:first-child td:first-child {
  border-top-left-radius: 16px;
}

tbody tr:first-child td:last-child {
  border-top-right-radius: 16px;
}

tbody tr:last-child td:first-child {
  border-bottom-left-radius: 16px;
}

tbody tr:last-child td:last-child {
  border-bottom-right-radius: 16px;
}

tbody tr:last-child td {
  border-bottom: 1px solid rgba(84, 99, 140, 0.08);
}

.clickable-row {
  cursor: pointer;
  transition: transform 0.14s ease;
}

.clickable-row:hover {
  transform: translateY(-1px);
}

.clickable-row:hover td {
  background: rgba(69, 189, 247, 0.06);
}

.clickable-row.is-selected td {
  background: rgba(69, 189, 247, 0.12);
}

td.numeric,
th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(69, 189, 247, 0.1);
  color: #247caf;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid rgba(69, 189, 247, 0.08);
}

.pill.good {
  background: var(--good);
  color: #1f6e39;
}

.pill.warn {
  background: var(--warn);
  color: #966200;
}

.pill.bad {
  background: var(--bad);
  color: #9d3029;
}

#prediction-summary-cards .card[data-predict-direction] {
  cursor: pointer;
}

#prediction-summary-cards .card.is-selected {
  border-color: #5b6cff;
  box-shadow: 0 0 0 2px rgba(91, 108, 255, 0.12);
}

.prediction-row-good td {
  background: rgba(111, 200, 132, 0.08);
}

.prediction-row-warn td {
  background: rgba(255, 196, 64, 0.08);
}

.prediction-row-bad td {
  background: rgba(255, 111, 97, 0.08);
}

.prediction-cell-good {
  color: #1f6e39;
  font-weight: 700;
}

.prediction-cell-warn {
  color: #966200;
  font-weight: 700;
}

.prediction-cell-bad {
  color: #9d3029;
  font-weight: 700;
}

.prediction-cell-live {
  color: #2341a8;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

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

.recommendations-list {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}

.recommendation {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(84, 99, 140, 0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,255,0.92));
}

.recommendation strong {
  display: block;
  margin-bottom: 6px;
}

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

a:hover {
  text-decoration: underline;
}

.loading,
.error {
  padding: 24px;
  margin: 24px auto;
  max-width: 700px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.error {
  border-color: rgba(210, 57, 57, 0.35);
}

@media (max-width: 1100px) {
  .dashboard-shell,
  .two-column-layout,
  .pulse-kpi-board,
  .pulse-three-grid {
    grid-template-columns: 1fr;
  }

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

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

  .lab-layout,
  .lab-form-grid,
  .stage-board-inner,
  .detail-grid,
  .audit-reasons {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .panel-actions,
  .selection-bar,
  .lab-cta,
  .lab-preview-head,
  .pulse-filter-row {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 1200px) {
  .filters {
    grid-template-columns: repeat(5, minmax(140px, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-shell {
    width: min(100vw, calc(100vw - 12px));
    padding-top: 10px;
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    overflow: auto;
    padding-bottom: 10px;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar,
  .hero,
  .panel,
  .card {
    border-radius: 22px;
  }

  .lab-actions {
    flex-direction: column;
  }

  table {
    min-width: 920px;
  }
}

body.theme-dark {
  --bg: #0c1220;
  --panel: rgba(17, 24, 39, 0.9);
  --panel-strong: #111827;
  --line: rgba(148, 163, 184, 0.16);
  --ink: #e5edf9;
  --muted: #93a4bf;
  --accent: #53c7ff;
  --accent-strong: #27b7f3;
  --accent-soft: rgba(83, 199, 255, 0.14);
  --accent-soft-strong: rgba(83, 199, 255, 0.24);
  --good: rgba(34, 197, 94, 0.14);
  --warn: rgba(250, 204, 21, 0.18);
  --bad: rgba(248, 113, 113, 0.16);
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
  --sidebar-shadow: 0 30px 70px rgba(2, 6, 23, 0.5);
  background:
    radial-gradient(circle at top left, rgba(83, 199, 255, 0.1), transparent 24%),
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.12), transparent 28%),
    linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
}

body.theme-dark .sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.92));
  border-color: rgba(148, 163, 184, 0.14);
}

body.theme-dark .sidebar-brand-icon {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  color: #7dd3fc;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.35);
}

body.theme-dark .sidebar-eyebrow,
body.theme-dark .sidebar-group-title {
  color: #64748b;
}

body.theme-dark .sidebar-title,
body.theme-dark .hero-title,
body.theme-dark .stage-group-header h3,
body.theme-dark .empty-state h2,
body.theme-dark .section-heading h3 {
  color: #f8fbff;
}

body.theme-dark .panel-header h2 {
  color: #f8fbff;
}

body.theme-dark .ai-marketing-chat {
  background:
    radial-gradient(circle at top left, rgba(103, 172, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(244, 247, 253, 0.98));
}

body.theme-dark .ai-message-assistant {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.98));
}

body.theme-dark .ai-message-user {
  background: linear-gradient(180deg, rgba(224, 241, 255, 1), rgba(212, 235, 255, 0.96));
}

body.theme-dark .ai-message-content {
  color: #243654;
}

body.theme-dark .ai-message-meta {
  color: #7890b7;
}

body.theme-dark .ai-marketing-form textarea {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 250, 255, 1));
  color: #22344f;
  border-color: rgba(191, 205, 229, 0.95);
}

body.theme-dark .sidebar-link {
  background: rgba(30, 41, 59, 0.7);
  color: #d8e4f4;
}

body.theme-dark .sidebar-link:hover {
  background: rgba(51, 65, 85, 0.9);
}

body.theme-dark .sidebar-link.is-active,
body.theme-dark .primary-button,
body.theme-dark #lab-open-creative.is-active-link {
  background: linear-gradient(180deg, #4ed4ff 0%, #22b5f0 100%);
  border-color: rgba(83, 199, 255, 0.45);
  color: #03111f;
  box-shadow: 0 16px 32px rgba(34, 181, 240, 0.24);
}

body.theme-dark .panel,
body.theme-dark .card,
body.theme-dark .stage-group,
body.theme-dark .stage-column,
body.theme-dark .detail-card,
body.theme-dark .panel-inner,
body.theme-dark .lab-form,
body.theme-dark .pulse-best-card,
body.theme-dark .recommendation,
body.theme-dark .action-card,
body.theme-dark .empty-state-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.88));
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: var(--shadow);
}

body.theme-dark .stage-column {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.92));
}

body.theme-dark .analytics-panel-primary,
body.theme-dark .best-panel-primary,
body.theme-dark .hero {
  background:
    radial-gradient(circle at top right, rgba(83, 199, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.9));
}

body.theme-dark .panel-header {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(17, 24, 39, 0.42));
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

body.theme-dark .subtle,
body.theme-dark .card-label,
body.theme-dark .card-note,
body.theme-dark .selection-label,
body.theme-dark .stage-item span,
body.theme-dark .recommendation div,
body.theme-dark .action-card span,
body.theme-dark .empty-state p,
body.theme-dark .lab-dropzone span,
body.theme-dark .metric-info-popover,
body.theme-dark .muted-text {
  color: #8ea2c2;
}

body.theme-dark .eyebrow,
body.theme-dark .section-kicker,
body.theme-dark .stage-group-eyebrow {
  color: #ffc98e;
  text-shadow: 0 0 12px rgba(255, 201, 142, 0.12);
}

body.theme-dark .stage-list::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.08);
}

body.theme-dark .stage-list::-webkit-scrollbar-thumb {
  background: rgba(83, 199, 255, 0.24);
}

body.theme-dark .tab,
body.theme-dark .ghost-button,
body.theme-dark .multi-select-trigger,
body.theme-dark .multi-select-search,
body.theme-dark .filter-field input,
body.theme-dark .filter-field select,
body.theme-dark .lab-form textarea,
body.theme-dark .lab-file-row input[type="file"] {
  background: rgba(15, 23, 42, 0.78);
  color: #e5edf9;
  border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .tab.is-active {
  color: #03111f;
  background: var(--accent);
  border-color: var(--accent);
}

body.theme-dark .selection-bar,
body.theme-dark .best-source-pill,
body.theme-dark .stage-item.is-selected,
body.theme-dark .stage-column.is-selected,
body.theme-dark .stage-card.is-selected,
body.theme-dark .lab-dropzone,
body.theme-dark .metric-info {
  background: rgba(83, 199, 255, 0.12);
  border-color: rgba(83, 199, 255, 0.18);
  color: #9edfff;
}

body.theme-dark .stage-item,
body.theme-dark .detail-card,
body.theme-dark .panel-inner,
body.theme-dark .recommendation,
body.theme-dark .lab-library-item,
body.theme-dark .lab-record-item,
body.theme-dark .lab-record-row {
  background: linear-gradient(180deg, rgba(28, 45, 74, 0.92), rgba(24, 37, 61, 0.9));
}

body.theme-dark .audit-chart-svg {
  background: linear-gradient(180deg, rgba(51, 122, 255, 0.08), rgba(255,255,255,0));
}

body.theme-dark .lab-recommend-best .lab-record-item,
body.theme-dark .lab-recommend-worst .lab-record-item,
body.theme-dark .lab-library-list .lab-library-item,
body.theme-dark .lab-library-list .lab-record-item,
body.theme-dark .lab-record-row {
  background: linear-gradient(180deg, rgba(28, 45, 74, 0.96), rgba(22, 35, 58, 0.94)) !important;
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

body.theme-dark .stage-item:hover {
  background: linear-gradient(180deg, rgba(36, 58, 92, 0.94), rgba(28, 45, 74, 0.92));
}

body.theme-dark .lab-recommend-best .lab-record-item:hover,
body.theme-dark .lab-recommend-worst .lab-record-item:hover,
body.theme-dark .lab-library-list .lab-library-item:hover,
body.theme-dark .lab-library-list .lab-record-item:hover,
body.theme-dark .lab-record-row:hover {
  background: linear-gradient(180deg, rgba(35, 56, 88, 0.98), rgba(26, 42, 68, 0.96)) !important;
}

body.theme-dark .lab-library-item summary,
body.theme-dark .lab-record-item,
body.theme-dark .lab-record-row,
body.theme-dark .lab-library-body,
body.theme-dark .lab-recommend-head,
body.theme-dark .lab-records-head {
  color: #dbe8fb;
}

body.theme-dark .lab-record-item strong,
body.theme-dark .lab-record-primary strong,
body.theme-dark .lab-library-item strong,
body.theme-dark .lab-library-item summary span:first-child {
  color: #eff6ff;
}

body.theme-dark .lab-record-item span,
body.theme-dark .lab-record-row span,
body.theme-dark .lab-record-primary small,
body.theme-dark .lab-library-body .subtle,
body.theme-dark .lab-library-body li {
  color: #9cb1cf;
}

body.theme-dark .lab-library-item,
body.theme-dark .lab-record-item,
body.theme-dark .lab-record-row {
  border-color: rgba(148, 163, 184, 0.14);
}

body.theme-dark .lab-library-body {
  border-top-color: rgba(148, 163, 184, 0.1);
}

body.theme-dark .lab-record-item.is-selected,
body.theme-dark .lab-record-row.is-selected {
  background: linear-gradient(180deg, rgba(83, 199, 255, 0.14), rgba(31, 46, 74, 0.92));
  border-color: rgba(83, 199, 255, 0.26);
}

body.theme-dark .stage-empty,
body.theme-dark .pulse-best-empty {
  background: linear-gradient(180deg, rgba(27, 40, 64, 0.9), rgba(20, 30, 50, 0.86));
  color: #8ea2c2;
}

body.theme-dark .table-wrap {
  background: transparent;
}

body.theme-dark th {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
  color: #8ea2c2;
}

body.theme-dark tbody tr td {
  background: rgba(15, 23, 42, 0.84);
  border-top-color: rgba(148, 163, 184, 0.08);
  border-left-color: rgba(148, 163, 184, 0.08);
  border-right-color: rgba(148, 163, 184, 0.08);
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

body.theme-dark .best-detail,
body.theme-dark .stage-board {
  background: transparent;
}

body.theme-dark .clickable-row:hover td {
  background: rgba(83, 199, 255, 0.1);
}

body.theme-dark .clickable-row.is-selected td {
  background: rgba(83, 199, 255, 0.16);
}

body.theme-dark .pill {
  background: rgba(83, 199, 255, 0.12);
  color: #9edfff;
  border-color: rgba(83, 199, 255, 0.1);
}

body.theme-dark .pill.good {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

body.theme-dark .pill.warn {
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
}

body.theme-dark .pill.bad {
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
}

body.theme-dark .recommendation strong,
body.theme-dark .pulse-best-card h4,
body.theme-dark .detail-card h3,
body.theme-dark .panel-inner h3,
body.theme-dark .stage-title-button,
body.theme-dark .stage-item strong {
  color: #f8fbff;
}

body.theme-dark a {
  color: #73d7ff;
}

body.theme-dark .loading,
body.theme-dark .error {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.92));
  border-color: rgba(148, 163, 184, 0.14);
  color: #e5edf9;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 13, 27, 0.74);
  backdrop-filter: blur(14px);
}

.auth-overlay[hidden] {
  display: none !important;
}

.auth-card {
  width: min(480px, 100%);
  padding: 28px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-submit {
  width: 100%;
}

.auth-error {
  margin: 0;
  color: #ff7f93;
}

.sidebar-user-panel {
  margin-top: auto;
}

.sidebar-user-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-user-name {
  margin: 0;
  font-weight: 700;
  color: #f8fbff;
}

.sidebar-user-meta {
  margin: 0;
  color: #8ea2c2;
  font-size: 13px;
}

.sidebar-logout {
  justify-self: start;
}

.settings-table-wrap {
  overflow-x: auto;
}

.auth-settings-grid {
  display: grid;
  gap: 20px;
}

.auth-settings-panel {
  padding: 18px;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-settings-panel h3 {
  margin: 0 0 10px;
}

.auth-users-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.access-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 12px 0 6px;
}

.access-checklist label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #d8e0ec;
}

.settings-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-inline-note {
  font-size: 13px;
  color: #8ea2c2;
}

.auth-locked .dashboard-shell {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}
