:root {
  color-scheme: dark;
  --ink: #eef4f0;
  --muted: #9aa8a2;
  --line: #26332d;
  --paper: #090d0b;
  --panel: #111815;
  --panel-raised: #151f1a;
  --green: #52d696;
  --green-soft: #102f22;
  --blue: #7eb7ff;
  --blue-soft: #10233a;
  --amber: #ffd166;
  --amber-soft: #322710;
  --red: #ff8b7d;
  --red-soft: #351916;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 0%, rgba(82, 214, 150, 0.1), transparent 26rem),
    linear-gradient(180deg, #0d1411 0%, var(--paper) 42%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.96;
  max-width: 760px;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.eyebrow,
.section-label {
  margin-bottom: 8px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  font-size: clamp(1.15rem, 2.4vw, 1.9rem);
  letter-spacing: 0;
}

.section-label {
  font-size: 0.76rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.refresh-notice {
  position: sticky;
  top: 10px;
  z-index: 20;
  width: fit-content;
  margin: 14px 0 -4px auto;
  border: 1px solid #755d20;
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--amber-soft);
  color: var(--amber);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 750;
}

.status-strip {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.78rem;
  font-weight: 750;
  border: 1px solid transparent;
}

.pill.neutral {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #21496f;
}

.pill.warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #755d20;
}

.pill.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #76362f;
}

.mission-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 22px 0 16px;
}

.mission-panel,
.guardrail-panel,
.panel,
.metric-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mission-panel,
.guardrail-panel {
  padding: 22px;
}

.mission-panel h2,
.guardrail-panel h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.mission-copy,
.guardrail-panel p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.strategy-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  overflow: hidden;
}

.strategy-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 750;
}

.strategy-details summary::-webkit-details-marker {
  display: none;
}

.strategy-chevron {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}

.strategy-details[open] .strategy-chevron {
  transform: rotate(90deg);
}

.strategy-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.strategy-body p {
  max-width: none;
  color: var(--muted);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-grid article {
  min-height: 92px;
  padding: 15px;
}

.metric-grid span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-grid strong {
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.metric-grid .positive {
  color: var(--green);
}

.metric-grid .negative {
  color: var(--red);
}

.heading-count {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

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

.action-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.search-field,
.sort-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-field input,
.sort-field select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--panel-raised);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.search-field input {
  width: 150px;
}

.sort-field select {
  width: 116px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td strong {
  display: block;
  margin-bottom: 2px;
}

.return-value {
  font-weight: 800;
}

.return-value.positive {
  color: var(--green);
}

.return-value.negative {
  color: var(--red);
}

.return-value.neutral {
  color: var(--muted);
}

.empty-row td,
.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

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

.action-list li,
.watch-card,
.timeline li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-raised);
}

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

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

.subsection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subsection-heading h3 {
  margin: 0;
  font-size: 0.98rem;
}

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

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #202a25;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar-fill.warn {
  background: var(--amber);
}

.bar-fill.danger {
  background: var(--red);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.watch-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.watch-card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.watch-card {
  padding: 0;
  overflow: hidden;
}

.watch-card details {
  display: block;
}

.watch-card summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
}

.watch-card summary::-webkit-details-marker {
  display: none;
}

.watch-chevron {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}

.watch-card details[open] .watch-chevron {
  transform: rotate(90deg);
}

.watch-ticker {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.watch-meta {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: left;
}

.watch-details {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.watch-details p {
  margin: 0;
}

.trigger-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.trigger-stack div {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--amber);
  padding: 11px 12px;
  background: var(--panel-raised);
}

.trigger-stack strong {
  font-size: 1.35rem;
}

.trigger-stack span {
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  max-height: 430px;
  overflow-y: auto;
  padding: 0 6px 0 0;
}

.timeline-item h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 0.98rem;
}

.timeline-day {
  display: grid;
  gap: 10px;
}

.timeline-day + .timeline-day {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.timeline-date {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-side {
  font-weight: 850;
  text-transform: uppercase;
}

.action-side.positive {
  color: var(--green);
}

.action-side.negative {
  color: var(--red);
}

.timeline-item p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

code {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

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

  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 12;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    flex-direction: column;
  }

  .action-controls {
    justify-content: flex-start;
  }

  .status-strip {
    align-items: flex-start;
    min-width: 0;
    text-align: left;
  }

  .mission-grid,
  .metric-grid,
  .card-grid,
  .concentration-grid {
    grid-template-columns: 1fr;
  }
}
