:root {
  color-scheme: light;
  --bg: #eee9d8;
  --paper: #fffdf1;
  --panel: #ffffff;
  --ink: #111315;
  --muted: #50565c;
  --grid: #b9b0a1;
  --grid-strong: #6f7478;
  --accent: #f0c400;
  --accent-strong: #7a5800;
  --blue: #003f7f;
  --green: #006b3f;
  --red: #a61919;
  --shadow: inset 0 0 0 1px rgba(17, 19, 21, 0.04);
  font-family:
    "Aptos Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--bg);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(17, 19, 21, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 19, 21, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(111, 116, 120, 0.05)),
    var(--bg);
  background-size: 28px 28px, 28px 28px, 100% 100%, auto;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--blue);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.boot-screen p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.boot-mark {
  border: 2px solid var(--ink);
  background: var(--accent);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 9px 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.terminal-shell {
  width: min(1560px, calc(100vw - 24px));
  margin: 12px auto 20px;
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  min-height: 58px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(240, 196, 0, 0.14), rgba(255, 253, 241, 0)),
    var(--paper);
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0;
  padding: 10px 14px 2px;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar p {
  margin: 0;
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-left: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.35);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-chip::before {
  content: "STAT:";
  margin-right: 6px;
  color: var(--muted);
}

.status-chip.is-live {
  background: #e5f4df;
  color: var(--green);
  border-color: var(--green);
}

.status-chip.is-partial {
  background: #fff2ad;
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--accent);
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.icon-button:hover {
  background: var(--blue);
  color: #ffffff;
}

.icon-button:focus-visible,
.tab:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2;
}

.ticker-label {
  display: block;
  border-bottom: 1px solid var(--grid);
  background: #e2deca;
  color: var(--muted);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 0;
  margin-top: 8px;
  border: 2px solid var(--ink);
  background: var(--paper);
  overflow-x: auto;
}

.tab {
  min-width: 120px;
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--grid-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.tab:last-child {
  border-right: 0;
}

.tab.is-active {
  background: var(--accent);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--accent-strong);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.dense-dashboard-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(250px, 0.62fr) minmax(250px, 0.62fr);
  align-items: start;
}

.dense-news-panel {
  grid-row: span 4;
}

.dense-panel {
  min-height: 0;
}

.panel {
  min-width: 0;
  border: 2px solid var(--grid-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.full-panel,
.training-layout {
  margin-top: 10px;
}

.training-command {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 0;
  margin-top: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.training-command.health-command {
  border-color: var(--green);
  background:
    linear-gradient(90deg, rgba(0, 107, 63, 0.1), transparent 58%),
    var(--paper);
}

.training-command-main {
  padding: 14px 16px;
}

.training-command-main strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.training-command-main p {
  max-width: 820px;
  margin: 10px 0 0;
  color: var(--ink);
  font-family:
    "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.training-pulse {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-left: 2px solid var(--ink);
}

.health-command .training-pulse {
  border-left-color: var(--green);
}

.pulse-cell {
  display: grid;
  align-content: center;
  min-height: 96px;
  padding: 0;
  border-right: 1px solid var(--grid-strong);
}

.pulse-cell:last-child {
  border-right: 0;
}

.pulse-cell span {
  display: block;
  border-bottom: 1px solid var(--grid);
  background: #e2deca;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pulse-cell strong {
  padding: 10px 8px;
  color: var(--green);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: keep-all;
}

.training-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.training-layout.is-polished {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
}

.training-secondary-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.health-priority-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(380px, 0.96fr);
  gap: 10px;
  margin-top: 10px;
}

.health-primary-panel {
  border-color: var(--green);
}

.health-primary-panel .panel-heading,
.health-history-panel .panel-heading {
  background:
    linear-gradient(90deg, rgba(0, 107, 63, 0.16), transparent 48%),
    #e3f1dd;
}

.health-history-panel .panel-heading {
  align-items: flex-start;
}

.health-history-panel .panel-heading > div {
  min-width: 0;
}

.health-history-panel .panel-heading span {
  white-space: normal;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--grid-strong);
}

.health-metrics div {
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid var(--grid);
  background: #eef7e8;
}

.health-metrics div:last-child {
  border-right: 0;
}

.health-metrics span,
.health-metrics strong {
  display: block;
}

.health-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.health-metrics strong {
  margin-top: 3px;
  color: var(--green);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.health-history-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--grid-strong);
  background: #eef7e8;
}

.health-history-summary strong,
.health-history-summary span {
  min-width: 0;
}

.health-history-summary strong {
  color: var(--green);
  font-size: 13px;
  line-height: 1.35;
}

.health-history-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.health-history-wrap {
  max-height: 430px;
}

.health-history-table {
  min-width: 780px;
}

.health-history-table th,
.health-history-table td {
  padding: 8px 9px;
  white-space: nowrap;
}

.health-history-table th:first-child,
.health-history-table td:first-child {
  min-width: 92px;
}

.health-history-table tbody tr.is-missing td {
  color: #737373;
  background: #f6f3e8;
}

.health-history-table tbody tr.is-partial td {
  background: #fff8d6;
}

.health-history-table tbody tr.is-ready td:nth-child(n + 3) {
  color: var(--green);
  font-weight: 800;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 6px 8px;
  border-bottom: 2px solid var(--grid-strong);
  background:
    linear-gradient(90deg, rgba(240, 196, 0, 0.24), transparent 42%),
    #e2deca;
}

.panel-heading h1,
.panel-heading h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.panel-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.news-tools {
  align-items: end;
}

.news-panel {
  background: var(--paper);
}

.news-group-stack {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.politics-economy-summary {
  display: grid;
  grid-template-columns: 0.7fr 0.7fr minmax(0, 1.6fr);
  margin: 10px;
  border: 1px solid var(--grid-strong);
  background: var(--panel);
}

.politics-economy-summary > div {
  min-width: 0;
  border-right: 1px solid var(--grid-strong);
}

.politics-economy-summary > div:last-child {
  border-right: 0;
}

.politics-economy-summary strong {
  display: block;
  padding: 10px 8px;
  font-size: 14px;
  line-height: 1.25;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.news-group {
  min-width: 0;
  border: 1px solid var(--grid-strong);
  background: var(--panel);
}

.news-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid-strong);
  background: #ece6cf;
}

.news-group-heading h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
}

.news-group-heading span,
.news-group-heading strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.news-group-heading strong {
  white-space: nowrap;
}

.filters {
  display: flex;
  align-items: end;
  gap: 10px;
}

.filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.filters input,
.filters select {
  width: 180px;
  min-height: 32px;
  border: 1px solid var(--grid-strong);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  background: #e2deca;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  line-height: 1.34;
}

.news-table {
  min-width: 1260px;
}

.news-table.is-compact {
  min-width: 1160px;
}

.news-col-rank {
  width: 58px;
}

.news-col-headline {
  width: 40%;
}

.news-col-source {
  width: 126px;
}

.news-col-date {
  width: 86px;
}

.news-col-category {
  width: 132px;
}

.news-col-score {
  width: 68px;
}

.news-col-summary {
  width: 27%;
}

.news-table.is-compact .news-col-headline {
  width: 40%;
}

.news-table.is-compact .news-col-summary {
  width: 29%;
}

.news-table td:nth-last-child(1) {
  font-family:
    "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.news-table th,
.news-table td {
  overflow-wrap: break-word;
}

.news-table td:nth-child(2) {
  font-size: 13px;
  line-height: 1.42;
}

.dense-table-wrap {
  max-height: 680px;
}

.dense-news-table {
  min-width: 100%;
}

.dense-news-table th:nth-child(1),
.dense-news-table td:nth-child(1) {
  width: 36px;
}

.dense-news-table th:nth-child(2),
.dense-news-table td:nth-child(2) {
  width: 238px;
}

.dense-news-table th:nth-child(3),
.dense-news-table td:nth-child(3) {
  width: 76px;
}

.dense-news-table th:nth-child(4),
.dense-news-table td:nth-child(4) {
  width: 62px;
}

.dense-news-table th:nth-child(5),
.dense-news-table td:nth-child(5) {
  width: 64px;
}

.dense-news-table th:nth-child(6),
.dense-news-table td:nth-child(6) {
  width: 46px;
}

.dense-news-table th:nth-child(7),
.dense-news-table td:nth-child(7) {
  width: 76px;
}

.dense-news-table th:nth-child(9),
.dense-news-table td:nth-child(9) {
  width: 44px;
}

tbody tr:nth-child(even) td {
  background: #fffaf0;
}

th:nth-child(1),
td:nth-child(1) {
  width: 58px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 150px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 100px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 72px;
}

.news-table th,
.news-table td {
  width: auto;
}

.mono,
.score {
  font-weight: 900;
}

.score {
  color: var(--green);
}

.category,
.table-status {
  display: inline-block;
  min-width: 64px;
  border: 1px solid var(--grid-strong);
  background: var(--paper);
  padding: 2px 6px;
  color: var(--ink);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-status.ready {
  color: var(--green);
  border-color: var(--green);
  background: #e5f4df;
}

.table-status.missing {
  color: var(--red);
  border-color: var(--red);
  background: #ffe4df;
}

.table-status.partial {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  background: #fff2ad;
}

.mini-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--grid-strong);
}

.mini-metric {
  min-width: 0;
  border-right: 1px solid var(--grid);
  background: #fffaf0;
}

.mini-metric:last-child {
  border-right: 0;
}

.mini-metric span {
  display: block;
  border-bottom: 1px solid var(--grid);
  background: #e2deca;
  color: var(--muted);
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-metric strong {
  display: block;
  padding: 7px 6px;
  font-size: 12px;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.mini-metric.is-good strong {
  color: var(--green);
}

.mini-metric.is-warn strong {
  color: var(--accent-strong);
}

.source-tape {
  display: grid;
}

.source-tape-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid var(--grid);
  background: rgba(255, 255, 255, 0.78);
}

.source-tape-row:nth-child(even) {
  background: #fffaf0;
}

.source-tape-row:last-child {
  border-bottom: 0;
}

.source-tape-row strong,
.source-tape-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-tape-row strong {
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.source-tape-row em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.impact-bar {
  display: inline-block;
  color: var(--green);
  font-size: 10px;
  letter-spacing: 0;
  white-space: nowrap;
}

.terminal-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 8px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.terminal-status-strip span {
  min-height: 26px;
  padding: 6px 9px;
  border-right: 1px solid rgba(255, 253, 241, 0.32);
}

.terminal-status-strip .is-good {
  color: #9cffbd;
}

.terminal-status-strip .is-alert {
  color: #ffb1a8;
}

.key-points {
  margin: 5px 0 0;
  padding-left: 15px;
  color: var(--muted);
  font-size: 11px;
}

.digest {
  margin: 0;
  padding: 10px;
  color: var(--ink);
  font-family:
    "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1.52;
}

.compact-list {
  margin: 0;
  padding: 8px 10px 9px 30px;
}

.compact-list li {
  margin-bottom: 7px;
}

.compact-list strong,
.compact-list span {
  display: block;
}

.compact-list strong {
  font-size: 12px;
  line-height: 1.32;
}

.compact-list span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.report-block {
  min-height: 360px;
  max-height: 68vh;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--ink);
  background: #fffaf0;
  font-size: 13px;
  line-height: 1.65;
}

.training-notice {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  border: 2px solid var(--accent-strong);
  background: #fff2ad;
}

.training-notice strong,
.training-notice span {
  padding: 10px 12px;
  min-width: 0;
}

.training-notice strong {
  border-right: 1px solid var(--accent-strong);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.training-notice span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.training-section-stack {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--paper);
}

.training-card {
  border: 1px solid var(--grid-strong);
  background: var(--panel);
  box-shadow: none;
}

.training-card.is-action {
  border-color: var(--accent-strong);
  background: #fff2ad;
}

.training-card.is-health {
  border-color: var(--green);
  background: #eef7e8;
}

.training-card-titleline {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.training-card-titleline h3,
.fatigue-summary h3 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
  text-transform: uppercase;
}

.training-card-titleline h3 {
  margin-bottom: 0;
}

.training-card-index,
.training-card-tone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border: 1px solid var(--grid-strong);
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.training-card-index {
  color: var(--ink);
  background: #e2deca;
}

.training-card-tone {
  min-width: 74px;
  padding: 0 8px;
  color: var(--blue);
}

.training-card.is-action .training-card-tone {
  color: var(--ink);
  border-color: var(--accent-strong);
  background: var(--accent);
}

.training-card.is-health .training-card-tone {
  color: var(--green);
  border-color: var(--green);
  background: #e3f1dd;
}

.training-card-content {
  min-width: 0;
  padding: 12px;
}

.training-insights {
  display: grid;
  gap: 6px;
}

.training-insight {
  display: grid;
  grid-template-columns: minmax(82px, 0.28fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--grid);
  background: #fffaf0;
  font-family:
    "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.58;
}

.training-insight:not(.has-label) {
  grid-template-columns: 1fr;
}

.training-insight span {
  color: var(--accent-strong);
  font-family:
    "Aptos Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.training-insight strong {
  color: var(--ink);
  font-weight: 500;
}

.fatigue-summary {
  display: grid;
  gap: 0;
}

.fatigue-summary section {
  padding: 13px 14px;
  border-bottom: 1px solid var(--grid);
  background: rgba(255, 255, 255, 0.72);
}

.fatigue-summary section:nth-child(even) {
  background: #fffaf0;
}

.fatigue-summary p {
  margin: 0;
  color: var(--muted);
  font-family:
    "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

.raw-report {
  border-top: 2px solid var(--grid-strong);
}

.raw-report summary {
  min-height: 40px;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.raw-report .report-block {
  min-height: 260px;
  max-height: 44vh;
  border-top: 1px solid var(--grid);
}

.history-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.history-date-panel {
  align-self: start;
}

.history-date-list {
  display: grid;
}

.history-date-button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--grid);
  background: #ffffff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.history-date-button:hover,
.history-date-button.is-active {
  background: var(--accent);
}

.history-date-button strong {
  font-size: 13px;
  line-height: 1.1;
}

.history-date-button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-detail-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.history-command {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  border: 1px solid var(--grid-strong);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.history-command-main {
  padding: 14px 16px;
}

.history-command-main strong {
  display: block;
  margin-top: 7px;
  font-size: 26px;
  line-height: 1;
}

.history-command-main p {
  margin: 10px 0 0;
  color: var(--muted);
  font-family:
    "Inter", "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.history-pulse {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-left: 1px solid var(--grid);
}

.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.history-detail-grid .panel-heading > div {
  min-width: 0;
}

.history-detail-grid .panel-heading > div > span {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.history-news-report {
  border-top: 1px solid var(--grid-strong);
}

.history-table {
  min-width: 1040px;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 118px;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 280px;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 170px;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
  width: 280px;
}

.history-cell-text {
  margin: 8px 0 0;
  color: var(--ink);
}

.history-count,
.history-meta,
.history-path {
  display: block;
}

.history-count {
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.history-meta,
.history-path {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sources-table {
  min-width: 720px;
}

.sources-table th:nth-child(1),
.sources-table td:nth-child(1) {
  width: 220px;
}

.sources-table th:nth-child(2),
.sources-table td:nth-child(2) {
  width: 96px;
}

.sources-table th:nth-child(3),
.sources-table td:nth-child(3) {
  width: 280px;
}

.sources-table th:nth-child(4),
.sources-table td:nth-child(4) {
  width: auto;
}

.empty-state,
.error-panel p {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.error-panel {
  max-width: 760px;
  margin: 80px auto 0;
  border-color: var(--red);
}

.error-panel .panel-heading {
  background: #ffe4df;
  border-color: var(--red);
}

.error-panel .panel-heading span {
  color: var(--red);
}

.error-panel .icon-button {
  margin: 0 16px 16px;
}

@media (max-width: 960px) {
  .terminal-shell {
    width: min(100vw - 20px, 1480px);
    margin-top: 10px;
  }

  .topbar,
  .news-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: space-between;
    border-top: 2px solid var(--ink);
    border-left: 0;
  }

  .dashboard-grid,
  .dense-dashboard-grid,
  .politics-economy-summary,
  .health-priority-layout,
  .training-layout,
  .history-workspace,
  .history-detail-grid {
    grid-template-columns: 1fr;
  }

  .training-command,
  .history-command,
  .training-notice {
    grid-template-columns: 1fr;
  }

  .training-notice strong {
    border-right: 0;
    border-bottom: 1px solid var(--accent-strong);
  }

  .training-pulse,
  .history-pulse {
    border-top: 2px solid var(--ink);
    border-left: 0;
  }

  .history-date-list {
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    overflow-x: auto;
  }

  .history-date-button {
    border-right: 1px solid var(--grid);
    border-bottom: 0;
  }

  .training-layout.is-polished {
    grid-template-columns: 1fr;
  }

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

  .health-history-summary {
    grid-template-columns: 1fr;
  }

  .health-history-summary span {
    text-align: left;
  }

  .health-history-panel .panel-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .filters input,
  .filters select {
    width: 100%;
  }

  table {
    min-width: 920px;
  }

  .dense-news-table {
    min-width: 860px;
  }

  .training-card-titleline,
  .training-insight {
    grid-template-columns: 1fr;
  }

  .training-card-index,
  .training-card-tone {
    justify-self: start;
  }
}

@media (max-width: 560px) {
  .topbar h1 {
    font-size: 23px;
    line-height: 1.08;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .tab {
    min-width: 112px;
  }

  .mini-matrix {
    grid-template-columns: 1fr;
  }

  .mini-metric {
    border-right: 0;
    border-bottom: 1px solid var(--grid);
  }

  .mini-metric:last-child {
    border-bottom: 0;
  }

  .training-pulse {
    grid-template-columns: 1fr;
  }

  .pulse-cell {
    border-right: 0;
    border-bottom: 1px solid var(--grid-strong);
  }

  .pulse-cell:last-child {
    border-bottom: 0;
  }

  th,
  td {
    padding: 8px;
  }
}
