@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Inter.var.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: hsl(210 20% 98%);
  --surface: hsl(0 0% 100%);
  --surface-2: hsl(210 16% 96%);
  --sidebar: hsl(210 20% 97%);
  --ink: hsl(214 25% 15%);
  --ink-muted: hsl(214 12% 40%);
  --line: hsl(213 16% 88%);
  --control-line: hsl(213 12% 52%);
  --accent: hsl(157 72% 26%);
  --accent-ink: hsl(0 0% 100%);
  --accent-soft: hsl(155 32% 93%);
  --accent-soft-ink: hsl(157 72% 22%);
  --warn-bg: hsl(43 96% 92%);
  --warn-ink: hsl(32 81% 24%);
  --ok-bg: hsl(152 45% 92%);
  --ok-ink: hsl(155 65% 20%);
  --danger-bg: hsl(0 80% 95%);
  --danger-ink: hsl(0 65% 33%);
  --radius: 12px;
  --focus: hsl(157 60% 32%);
  --shadow: 0 1px 2px hsl(214 25% 15% / 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: hsl(215 28% 7%);
    --surface: hsl(215 24% 10%);
    --surface-2: hsl(215 21% 14%);
    --sidebar: hsl(215 27% 8%);
    --ink: hsl(210 24% 93%);
    --ink-muted: hsl(213 16% 68%);
    --line: hsl(215 20% 20%);
    --control-line: hsl(213 16% 52%);
    --accent: hsl(155 51% 56%);
    --accent-ink: hsl(215 30% 7%);
    --accent-soft: hsl(156 24% 14%);
    --accent-soft-ink: hsl(155 51% 68%);
    --warn-bg: hsl(38 45% 16%);
    --warn-ink: hsl(43 90% 74%);
    --ok-bg: hsl(152 35% 14%);
    --ok-ink: hsl(150 55% 70%);
    --danger-bg: hsl(0 40% 16%);
    --danger-ink: hsl(0 85% 80%);
    --focus: hsl(155 51% 56%);
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px / 1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.app-shell {
  min-height: 100dvh;
}
.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  margin: 0.75rem 1rem 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--sidebar) 72%, var(--accent) 28%);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.4rem;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.brand-mark svg {
  width: 20px;
  height: 20px;
}
.brand-text {
  display: grid;
  line-height: 1.2;
}
.brand-name {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand-text small {
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.context-card {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.context-card select {
  width: 100%;
  max-width: 18rem;
}
.context-card #session-status {
  justify-self: start;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sidebar-foot {
  flex: none;
}
.sidebar-foot .nav-group-label {
  margin: 0.2rem 0.2rem 0;
}
.viewer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.viewer-tools .button {
  font-size: 0.78rem;
  min-height: 32px;
  padding: 0.3rem 0.6rem;
}
#data-badge {
  justify-self: start;
}
/* Table actions stay on one compact line; the table scrolls instead of clipping a button. */
td .row-actions {
  flex-wrap: nowrap;
}
td .button {
  min-height: 30px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
}
.app-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  padding: 0.75rem 1.5rem calc(0.75rem + 4px);
  margin: 0 1rem 0.75rem;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: color-mix(in srgb, var(--sidebar) 72%, var(--accent) 28%);
}
.search-control {
  flex: 1 1 14rem;
  max-width: 24rem;
}
.workspace-tools {
  flex-basis: 100%;
  min-width: 0;
}
.language-control {
  flex: none;
  align-self: start;
}
.workspace-tools > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}
.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem 1rem;
}
@media (min-width: 961px) {
  .app-header,
  .topbar {
    padding-inline: 2rem;
  }
  .app-shell > .app-header {
    gap: 0.75rem;
    padding-block: 0.3rem;
  }
  .app-workspace > .topbar {
    gap: 0.5rem 1rem;
    padding-block: 0.4rem calc(0.25rem + 4px);
  }
  .topbar .control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
  }
  .topbar label {
    flex: none;
  }
  .context-card {
    flex-wrap: nowrap;
    align-items: center;
  }
  .language-control {
    align-self: center;
  }
  .topbar input {
    padding-block: 0.4rem;
  }
  .rail > ul > li > a {
    min-height: 40px;
  }
  .context-card select {
    max-width: 16rem;
    min-width: 0;
  }
  .context-card #session-status {
    font-size: 0.75rem;
  }
  .toolbar-controls {
    gap: 0.5rem;
  }
  .toolbar-controls .search-control {
    flex: 1 1 9rem;
    max-width: none;
  }
  .toolbar-controls #global-search {
    min-width: 0;
  }
  .toolbar-controls > .control:not(.search-control) {
    flex: 0 1 12rem;
  }
  .toolbar-controls > .control:not(.search-control) select {
    min-width: 0;
    width: 100%;
  }
  .topbar-tools {
    gap: 0.3rem;
  }
  .toolbar-controls .topbar-tools .button {
    padding-inline: 0.5rem;
  }
  .rail a,
  .nav-menu > summary {
    white-space: nowrap;
  }
  .workspace-tools > summary {
    display: none;
  }
}
@media (min-width: 961px) and (max-width: 1199px) {
  .brand-text small {
    display: none;
  }
  .toolbar-controls .control {
    display: grid;
    gap: 0.25rem;
  }
  .toolbar-controls > .control:not(.search-control) {
    flex-basis: 10rem;
  }
}
.search-control input {
  width: 100%;
}
.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}
.topbar-tools .button {
  font-size: 0.8rem;
  padding-inline: 0.7rem;
}
.control {
  display: grid;
  gap: 0.25rem;
}
.control label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-muted);
}
select,
input,
textarea {
  max-width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  min-height: 36px;
}
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.rail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
  margin-left: auto;
}
.nav-group-label {
  margin: 0.6rem 0.6rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-muted);
}
.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2px;
}
.nav-menu {
  position: relative;
}
.nav-menu > summary {
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-muted);
  font-weight: 500;
}
.nav-menu[open] > summary,
.nav-menu:has(a[aria-current="page"]) > summary {
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
}
.nav-menu > ul {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 25;
  display: grid;
  width: max-content;
  min-width: 13rem;
  max-width: calc(100vw - 2rem);
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px hsl(214 25% 15% / 0.12);
}
.nav-menu:last-child > ul {
  left: auto;
  right: 0;
}
.rail a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 160ms, color 160ms;
}
.nav-icon {
  width: 17px;
  height: 17px;
  flex: none;
}
.rail a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.rail a[aria-current="page"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-soft-ink);
  font-weight: 600;
}

main {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding: 1.75rem 2rem 3.5rem;
  min-width: 0;
}
main:focus {
  outline: none;
}

.screen-head {
  margin-bottom: 1rem;
}
.eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.screen h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.screen h2:focus {
  outline: none;
}
.screen-head .hint {
  max-width: 68ch;
}

.screen-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
.overview-priority {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.overview-priority > .panel {
  min-width: 0;
}
.overview-priority #cash-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat-value,
.truth-value {
  overflow-wrap: anywhere;
}
@media (min-width: 1200px) {
  .overview-priority {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
  }
}

.truth-strip {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  margin-bottom: 1rem;
}
.truth {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.truth h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-muted);
}
.truth-value {
  margin: 0.3rem 0 0;
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.panel {
  min-width: 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}
.panel h2,
.panel-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.hint,
.state {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: 0;
}

.kpis {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  margin-bottom: 0.6rem;
}
.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
.stat h3 {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-muted);
}
.stat-value {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.stat-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.queue-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
}
.queue-label {
  font-weight: 600;
}
.queue-item a {
  margin-left: auto;
  color: var(--accent);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.table-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  width: 11rem;
  min-width: 11rem;
  max-width: 11rem;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
td.table-actions {
  white-space: normal;
}
td.table-actions .row-actions {
  flex-wrap: wrap;
}
td.table-actions .button {
  white-space: normal;
  text-align: start;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface-2);
}
td {
  font-variant-numeric: tabular-nums;
}
td.num {
  font-variant-numeric: tabular-nums;
}
tbody tr.clickable {
  cursor: pointer;
}
tbody tr.clickable:hover,
tbody tr.clickable:focus-within {
  background: var(--surface-2);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-warning {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.badge-ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, filter 160ms;
}
.button:hover {
  filter: brightness(1.06);
}
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.button-quiet {
  background: var(--surface);
  border-color: var(--control-line);
  color: var(--ink);
}
.button-quiet:hover {
  background: var(--surface-2);
  filter: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.answer {
  display: grid;
  gap: 1rem;
}

.answer-text {
  margin: 0 0 0.8rem;
  font-size: 1.02rem;
  line-height: 1.6;
}

.limitations {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.evidence-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
  font-size: 0.85rem;
}
.evidence-list button {
  margin-left: auto;
}

.notice {
  display: grid;
  gap: 0.4rem;
  justify-items: start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.notice-block {
  background: var(--surface);
}

.form-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  margin-bottom: 1rem;
}

.collection-controls {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}
#screen-collections .field,
#screen-collections .field > select {
  min-width: 0;
}
#screen-collections .field > select {
  width: 100%;
}
.collection-controls > .panel {
  min-width: 0;
  margin: 0;
}
.collection-draft-list {
  display: grid;
  gap: 0.75rem;
}
.collection-draft-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.panel > summary {
  font-weight: 650;
  cursor: pointer;
}
.permissions {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
}
.permissions legend {
  font-size: 0.78rem;
  color: var(--ink-muted);
  padding: 0 0.25rem;
}

.checkbox {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.9rem;
  align-self: end;
  padding-bottom: 0.35rem;
}
.form-grid > .field {
  align-self: start;
}
#import-form {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}
:is(#screen-banking, #screen-reconciliation) .field,
:is(#screen-banking, #screen-reconciliation) .field > input,
:is(#screen-banking, #screen-reconciliation) .field > select {
  min-width: 0;
}
:is(#screen-banking, #screen-reconciliation) .field > input,
:is(#screen-banking, #screen-reconciliation) .field > select {
  width: 100%;
}
.form-grid .form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
}
.field {
  display: grid;
  gap: 0.25rem;
}
.field label {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(560px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.18);
  padding: 1.15rem;
  overflow-y: auto;
  z-index: 50;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.drawer h2 {
  margin: 0;
  font-size: 1rem;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
}
#drawer-body.drawer-rich {
  white-space: normal;
  font-family: inherit;
}
.forecast-lines {
  display: grid;
  gap: 0.9rem;
}
.forecast-line {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.forecast-line h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}
.forecast-line-totals {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.6rem;
  margin: 0.4rem 0;
  font-variant-numeric: tabular-nums;
}
.forecast-line-totals dt {
  color: var(--ink-muted);
  font-size: 0.8rem;
}
.forecast-line-totals dd {
  margin: 0;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 30;
}
.toast[data-tone="error"] {
  background: var(--danger-ink);
  color: var(--danger-bg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

code {
  font-size: 0.82rem;
}

.nav-count {
  display: inline-block;
  min-width: 1.4rem;
  margin-left: 0.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: 0.75rem;
  text-align: center;
}
.ops-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.ops-item {
  display: grid;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
  overflow-wrap: anywhere;
}
.ops-critical {
  border-left-color: var(--danger-ink);
}
.ops-high {
  border-left-color: var(--warn-ink);
}
.ops-item p {
  margin: 0;
}
.ops-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.ops-amount {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ops-facts {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
}
a.button {
  text-decoration: none;
  display: inline-block;
}

.briefing-narrative {
  margin: 0 0 0.6rem;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}
.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.7rem;
  margin: 0.8rem 0;
}
.insight {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  overflow-wrap: anywhere;
}
.insight h3,
.insight p {
  margin: 0;
}
.insight h3 {
  font-size: 0.95rem;
}
.freshness {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.scope-list {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}
.scope-list dt {
  font-weight: 600;
}
.scope-list dd {
  margin: 0;
  color: var(--ink-muted);
}
@media (max-width: 600px) {
  .scope-list {
    grid-template-columns: 1fr;
  }
  .scope-list dd {
    margin-bottom: 0.4rem;
  }
}
a.badge {
  text-decoration: none;
}

@media (max-width: 960px) {
  .app-header {
    min-width: 0;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.6rem;
    margin: 0.5rem 0.5rem 0;
  }
  .context-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex-basis: 100%;
  }
  .context-card #session-status {
    grid-column: 1 / -1;
  }
  .rail {
    flex-basis: 100%;
    gap: 0.25rem;
  }
  .nav-group-label {
    display: none;
  }
  .rail a {
    white-space: nowrap;
  }
  .sidebar-foot {
    margin-left: 0;
  }
  .topbar {
    position: static;
    padding: 0.75rem 1rem calc(0.75rem + 4px);
    margin: 0 0.5rem 0.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
  .context-card {
    grid-column: 1 / -1;
  }
  .language-control {
    grid-column: 2;
    grid-row: 2;
  }
  .workspace-tools {
    grid-column: 1;
    grid-row: 2;
  }
  .topbar:has(.workspace-tools[open]) .workspace-tools {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .toolbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding-block: 0.5rem;
  }
  .search-control,
  .topbar-tools {
    grid-column: 1 / -1;
    max-width: none;
  }
  .topbar-tools .button,
  .rail a,
  .workspace-tools > summary {
    min-height: 44px;
  }
  .topbar-tools {
    margin-left: 0;
  }
  main {
    padding: 1.25rem 1rem 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail a,
  .button {
    transition: none;
  }
}

@media (max-width: 600px) {
  .app-header .brand-text small {
    display: none;
  }
  .truth-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .truth-value {
    font-size: 1rem;
  }
  .overview-priority #cash-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  td.table-actions .button {
    min-height: 44px;
  }
}

/* Presentation mode: identifying values are masked in the DOM; the toggle states it plainly. */
#presentation-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Global search: one box in the top bar, results under it, never wider than the viewport. */
#global-search {
  min-width: 16rem;
}
.search-results {
  position: fixed;
  top: 4.75rem;
  right: 1rem;
  z-index: 30;
  width: min(32rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  padding: 0.75rem;
}
.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.search-hit {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.15rem 0.6rem;
  padding: 0.5rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.search-hit:hover,
.search-hit:focus-visible {
  background: var(--surface-2);
}
.search-hit .hint {
  grid-column: 1 / -1;
}
.search-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  align-self: center;
}
.search-amount {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  #global-search {
    min-width: 0;
    width: 100%;
  }
  #search-form {
    grid-column: 1 / -1;
  }
  .search-results {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}
#jobs-toggle[data-tone="danger"] {
  border-color: var(--danger-ink);
  color: var(--danger-ink);
}
#alerts-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.ops-group + .ops-group {
  margin-top: 0.75rem;
}
.ops-group-title {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* Role workspace: one card per focus area, coloured edge for its state, whole card is the link. */
.workspace-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}
.workspace-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  background: var(--surface);
}
.workspace-card:hover,
.workspace-card:focus-visible {
  background: var(--surface-2);
}
.workspace-ok {
  border-left-color: var(--ok-ink);
}
.workspace-warning {
  border-left-color: var(--warn-ink);
}
.workspace-danger {
  border-left-color: var(--danger-ink);
}
.workspace-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.workspace-value {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.policy-choices {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  grid-column: 1 / -1;
}
.policy-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.5rem;
  align-items: center;
}
.policy-choice .hint {
  grid-column: 2;
}

.period-banner {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

#copilot-form {
  grid-template-columns: minmax(0, 1fr);
}
#copilot-question {
  width: 100%;
  max-width: 48rem;
}
/* A caveat cell wraps instead of sliding under the sticky action column. */
.cell-wrap {
  display: inline-block;
  min-width: 9rem;
  white-space: normal;
}

/* ── Visual refresh (EFIOS-48616): one calm green system, a hero figure, softer surfaces. ── */
:root {
  --bg: hsl(150 24% 97%);
  --ink: hsl(152 22% 11%);
  --ink-muted: hsl(152 8% 36%);
  --line: hsl(150 14% 87%);
  --surface-2: hsl(150 16% 95.5%);
  --sidebar: hsl(0 0% 100% / 0.72);
  --cta: hsl(152 44% 15%);
  --cta-ink: hsl(0 0% 100%);
  --hero-a: hsl(153 46% 15%);
  --hero-b: hsl(158 62% 23%);
  --bar-2: hsl(38 78% 44%);
  --bar-3: hsl(8 62% 46%);
  --radius: 14px;
  --shadow: 0 1px 2px hsl(152 22% 11% / 0.04), 0 10px 28px -18px hsl(152 22% 11% / 0.22);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(160 22% 6%);
    --ink: hsl(150 18% 93%);
    --ink-muted: hsl(150 10% 68%);
    --line: hsl(158 16% 18%);
    --surface: hsl(160 18% 9.5%);
    --surface-2: hsl(160 16% 13%);
    --sidebar: hsl(160 22% 7% / 0.8);
    --cta: hsl(155 51% 56%);
    --cta-ink: hsl(160 30% 7%);
    --hero-a: hsl(156 40% 13%);
    --hero-b: hsl(158 50% 19%);
    --bar-2: hsl(40 80% 60%);
    --bar-3: hsl(8 75% 66%);
    --shadow: none;
  }
}
body {
  background:
    radial-gradient(1100px 420px at 50% -120px, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.app-header {
  position: sticky;
  top: 0;
  padding-block: 0.6rem;
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.brand-mark {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--hero-a), var(--hero-b));
  color: hsl(0 0% 100%);
}
.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.rail {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.rail a,
.nav-menu > summary {
  border-radius: 999px;
}
.nav-menu > ul a {
  border-radius: 10px;
}
.topbar {
  background: color-mix(in srgb, var(--sidebar) 72%, var(--accent) 28%);
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
  padding-block: 0.9rem 0.25rem;
}
select,
input,
textarea {
  border-color: color-mix(in srgb, var(--control-line) 62%, var(--line));
  border-radius: 10px;
  transition: border-color 160ms, box-shadow 160ms;
}
select:hover,
input:hover,
textarea:hover {
  border-color: var(--control-line);
}
.screen-head {
  margin-bottom: 1.25rem;
}
.screen h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 620;
  letter-spacing: -0.032em;
  line-height: 1.15;
}
.screen-head .hint {
  margin-top: 0.35rem;
  font-size: 0.98rem;
}
.panel,
.truth {
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
}
.panel h2,
.panel-title {
  font-size: 1.05rem;
  font-weight: 640;
  letter-spacing: -0.015em;
}
.button {
  border-radius: 999px;
  padding-inline: 1rem;
  font-weight: 600;
}
.button:not(.button-quiet) {
  border-color: var(--cta);
  background: var(--cta);
  color: var(--cta-ink);
  box-shadow: 0 1px 0 hsl(0 0% 100% / 0.12) inset, 0 6px 16px -10px var(--cta);
}
.button-quiet {
  border-color: color-mix(in srgb, var(--control-line) 62%, var(--line));
}
.badge {
  border-radius: 999px;
}
thead th {
  font-weight: 600;
  letter-spacing: 0.01em;
}
/* Status strip: four compact facts above the answer cards. */
.truth-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.truth {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-radius: 16px;
  box-shadow: none;
}
.truth h3 {
  font-size: 0.8rem;
}
.truth-value {
  margin: 0;
  font-size: 1rem;
  font-weight: 640;
  white-space: nowrap;
}
/* Answer cards: a question, its exact parts, one figure. */
.answers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.answer {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 1.5rem 1.6rem 1.35rem;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.answer-question {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  font-weight: 560;
  letter-spacing: -0.015em;
}
.answer-bars {
  display: grid;
  gap: 0.55rem;
  margin-bottom: auto;
  padding-bottom: 1.25rem;
}
.answer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.answer-bar-amount {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.answer-bar-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.answer-bar-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background: var(--accent);
}
.answer-bar:nth-child(2) .answer-bar-fill {
  background: var(--bar-2);
}
.answer-bar:nth-child(3) .answer-bar-fill {
  background: var(--bar-3);
}
.answer-figure {
  margin: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.2rem);
  font-weight: 480;
  letter-spacing: -0.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.answer-lead {
  margin: 0.45rem 0 0;
  font-weight: 640;
}
.answer-note {
  margin: 0.1rem 0 0.9rem;
  min-height: 2.7em;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.answer-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--accent-soft-ink);
  font-weight: 600;
  text-underline-offset: 3px;
}
.answer-link::after {
  content: "→";
  margin-left: 0.4rem;
}
.answer-hero {
  border: 0;
  background: linear-gradient(160deg, var(--hero-b), var(--hero-a) 70%);
  color: hsl(0 0% 100%);
  box-shadow: 0 24px 44px -26px var(--hero-b);
}
.answer-hero .answer-bar,
.answer-hero .answer-note {
  color: hsl(150 32% 86%);
}
.answer-hero .answer-bar-amount,
.answer-hero .answer-link {
  color: hsl(0 0% 100%);
}
.answer-hero .answer-bar-track {
  background: hsl(0 0% 100% / 0.16);
}
.answer-hero .answer-bar-fill,
.answer-hero .answer-bar:nth-child(2) .answer-bar-fill {
  background: hsl(150 62% 70%);
}
.answer-hero .answer-bar:nth-child(3) .answer-bar-fill {
  background: hsl(42 90% 68%);
}
@media (max-width: 900px) {
  .truth-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .truth {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
  .truth-value {
    white-space: normal;
  }
  .answers {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    border-radius: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  select,
  input,
  textarea {
    transition: none;
  }
}
/* Display figures read as words, not columns; tables keep tabular figures. */
.truth-value,
.stat-value {
  font-variant-numeric: normal;
}
input[type="checkbox"],
input[type="radio"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  accent-color: var(--accent);
}
/* Text and its background never animate: a theme switch must not pass through an unreadable frame. */
.button {
  transition: border-color 160ms, filter 160ms, box-shadow 160ms;
}
.rail a {
  transition: none;
}
