:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --ink: #202430;
  --ink-strong: #111827;
  --muted: #697386;
  --muted-2: #8a94a8;
  --line: #dfe5f0;
  --navy: #06245f;
  --navy-2: #0a317b;
  --blue: #315cf6;
  --blue-soft: #eef3ff;
  --teal: #08766f;
  --green: #12946a;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(24, 39, 75, 0.09);
  --soft-shadow: 0 10px 30px rgba(24, 39, 75, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

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

h1 {
  margin-bottom: 8px;
  color: var(--ink-strong);
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  color: var(--ink-strong);
  font-size: 22px;
  line-height: 1.15;
}

p {
  color: var(--muted);
  line-height: 1.48;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #f7faff 0%, #eef3ff 100%);
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 44px;
}

.login-copy {
  margin-bottom: 24px;
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 92, 246, 0.14);
}

.login-card button,
.tool-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 850;
  letter-spacing: 0;
}

.error {
  padding: 11px 12px;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(49, 92, 246, 0.25);
}

.login-card .brand-mark {
  margin-bottom: 20px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 26px 22px;
  background: var(--navy);
  color: white;
}

.sidebar-brand {
  display: flex;
  gap: 13px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 20px;
  line-height: 1.15;
}

.sidebar-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-top: 28px;
}

.side-nav a {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 760;
  text-decoration: none;
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
}

.side-status {
  display: flex;
  gap: 11px;
  align-items: center;
  min-height: 72px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.side-status strong,
.side-status span {
  display: block;
}

.side-status strong {
  font-size: 14px;
}

.side-status span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 28px 34px 36px;
}

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

.workspace-title p:last-child {
  max-width: 780px;
  margin-bottom: 0;
  font-size: 15px;
}

.top-tools,
.command-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
  align-items: center;
}

.last-updated {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.command-strip {
  justify-content: flex-start;
  margin: 24px 0 22px;
}

.tool-button {
  display: inline-flex;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  box-shadow: 0 10px 22px rgba(49, 92, 246, 0.16);
  white-space: nowrap;
}

.tool-button.primary {
  background: #234ae8;
}

.tool-button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-strong);
  box-shadow: none;
}

.tool-button.danger {
  background: #fff1f0;
  color: var(--red);
  box-shadow: none;
}

.tool-button.icon-only {
  width: 44px;
  padding: 0;
}

.button-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.decision-card,
.research-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.metric-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 124px;
  padding: 18px;
}

.metric-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 950;
}

.metric-card span {
  display: block;
  color: #99a5c1;
  font-size: 13px;
  font-weight: 850;
}

.metric-card strong {
  display: block;
  margin-top: 2px;
  color: #172036;
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric-card p {
  margin: 5px 0 0;
  font-size: 12px;
}

.metric-card.green .metric-icon,
.metric-card.calm .metric-icon {
  background: #eafaf5;
  color: var(--green);
}

.metric-card.warn .metric-icon {
  background: #fff7e8;
  color: var(--amber);
}

.metric-card.hot .metric-icon {
  background: #fff1f0;
  color: var(--red);
}

.primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 18px;
}

.decision-card,
.research-card,
.panel {
  padding: 24px;
}

.decision-card {
  min-height: 330px;
}

.decision-topline,
.signal-hero-row,
.panel-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.decision-topline {
  margin-bottom: 24px;
}

.status-pill,
.quiet-pill,
.source-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.status-pill.good,
.source-status.ok {
  background: #eafaf5;
  color: var(--green);
}

.status-pill.warn,
.source-status.warn {
  background: #fff7e8;
  color: var(--amber);
}

.status-pill.bad {
  background: #fff1f0;
  color: var(--red);
}

.status-pill.idle,
.quiet-pill {
  background: #eef3ff;
  color: #53617a;
}

.status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
}

.status-dot.good,
.status-dot.hot {
  background: var(--green);
}

.status-dot.warn {
  background: var(--amber);
}

.status-dot.bad {
  background: var(--red);
}

.status-dot.idle {
  background: var(--muted-2);
}

.decision-card h2 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: 44px;
  letter-spacing: 0;
}

.decision-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: #3f485a;
  font-size: 17px;
}

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

.fact-tile {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.fact-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.fact-tile strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 8px;
  color: var(--ink-strong);
  font-size: 15px;
  line-height: 1.3;
}

.ticker {
  display: block;
  color: var(--teal);
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.hero-score {
  color: var(--ink-strong);
  font-size: 52px;
  line-height: 1;
}

.panel-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head.inline {
  padding-bottom: 0;
  border-bottom: 0;
}

.panel-head span,
#healthBadge,
#eventCount,
#signalCount {
  color: var(--teal);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.bar-list {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

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

.bar-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.bar-track {
  overflow: hidden;
  height: 12px;
  border-radius: 8px;
  background: #edf1f8;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-row strong {
  color: var(--ink-strong);
  font-size: 13px;
  text-align: right;
}

.work-note,
.pending-note {
  margin-top: 24px;
  padding: 15px;
  border-radius: 8px;
  background: var(--blue-soft);
}

.work-note strong,
.work-note span {
  display: block;
}

.work-note span,
.pending-note {
  margin-top: 4px;
  color: #566177;
  font-size: 13px;
  line-height: 1.4;
}

.pending-note {
  background: #fff7e8;
  color: #76521d;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  margin-top: 18px;
}

.panel-wide {
  grid-row: span 2;
}

.list {
  display: grid;
  margin-top: 4px;
}

.list.compact {
  margin-top: 0;
}

.list-row,
.empty-state {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child,
.empty-state:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-row strong,
.empty-state strong {
  display: block;
  margin-top: 6px;
  color: var(--ink-strong);
  font-size: 16px;
}

.list-row p,
.empty-state p {
  margin: 7px 0 0;
  font-size: 14px;
}

.row-time {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 850;
}

.empty-state {
  min-height: 120px;
  display: grid;
  align-content: center;
}

.empty-state.compact {
  min-height: 90px;
}

.signal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.signal-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.signal-main strong {
  display: block;
  margin: 4px 0 7px;
  color: var(--ink-strong);
  font-size: 20px;
}

.signal-main p,
.signal-details p {
  margin-bottom: 0;
}

.signal-meta {
  display: grid;
  align-content: start;
  gap: 9px;
}

.signal-meta span {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.signal-meta b {
  color: var(--ink-strong);
}

.signal-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.signal-details b {
  color: var(--ink-strong);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(380px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .primary-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-row: auto;
  }
}

@media (max-width: 920px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    position: static;
    display: block;
    height: auto;
    padding: 18px;
  }

  .sidebar-brand {
    padding-bottom: 14px;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding-top: 14px;
  }

  .side-nav a {
    min-height: 42px;
    justify-content: center;
    padding: 0 8px;
    font-size: 13px;
  }

  .nav-icon {
    display: none;
  }

  .side-status {
    margin-top: 14px;
  }

  .workspace {
    padding: 22px 16px 28px;
  }

  .workspace-head {
    grid-template-columns: 1fr;
  }

  .top-tools,
  .command-strip {
    justify-content: flex-start;
  }

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

  .decision-card h2 {
    font-size: 34px;
  }

  .decision-facts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 30px;
  }

  .workspace {
    padding: 18px 12px 24px;
  }

  .sidebar {
    padding: 12px;
  }

  .sidebar-brand {
    padding-bottom: 10px;
  }

  .sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
  }

  .sidebar-brand strong {
    font-size: 16px;
  }

  .sidebar-brand span {
    font-size: 11px;
  }

  .side-nav {
    display: none;
  }

  .side-status {
    min-height: 54px;
    margin-top: 10px;
    padding: 10px;
  }

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

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

  .tool-button {
    flex: 1 1 100%;
  }

  .top-tools .tool-button {
    flex: 1 1 120px;
  }

  .top-tools .icon-only {
    flex: 0 0 44px;
  }

  .decision-card,
  .research-card,
  .panel {
    padding: 18px;
  }

  .decision-card h2 {
    font-size: 30px;
  }

  .decision-copy {
    font-size: 15px;
  }

  .signal-hero-row,
  .decision-topline,
  .panel-head {
    align-items: flex-start;
  }

  .hero-score {
    font-size: 42px;
  }

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