:root { color-scheme: light; font-family: system-ui, sans-serif; color: #172033; background: #f4f6f8; }
* { box-sizing: border-box; }
body { margin: 0; }
nav { padding: 1rem max(1rem, calc((100% - 1100px)/2)); background: #17365d; }
nav a { color: white; font-weight: 700; }
main { max-width: 1100px; margin: auto; padding: 1.25rem; }
.dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card, section { background: white; border: 1px solid #d8dee8; border-radius: .5rem; padding: 1rem; margin-bottom: 1rem; }
label { display: grid; gap: .3rem; }
input, textarea, select, button, .button { min-height: 44px; padding: .6rem; font: inherit; border: 1px solid #8693a6; border-radius: .3rem; }
button, .button { background: #175ea8; color: white; border: 0; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
:focus-visible { outline: 3px solid #ef9b0f; outline-offset: 2px; }
form, .actions { display: grid; gap: .8rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
fieldset { border: 1px solid #ccd4df; margin: 1rem 0; }
legend { font-weight: 700; }
label span { color: #586779; font-size: .85rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #d8dee8; padding: .6rem; text-align: left; vertical-align: top; }
td form { min-width: 230px; }
@media (max-width: 800px) { .dashboard, .fields { grid-template-columns: 1fr; } }
.role-choice form { display: flex; flex-wrap: wrap; gap: .5rem; }
.role-badge { font-weight: 700; font-size: 1.05rem; }
.field { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-bottom: .6rem; }
.field .field-label { flex: 1 1 12rem; }
.field .field-unit { color: #586779; font-size: .85rem; }
.field input { flex: 1 1 8rem; max-width: 12rem; }
.field[data-editable="false"] { opacity: .55; }
.field-value { font-weight: 600; }
.field[data-save-state="saved"] .save-state { color: #1b7f3b; }
.field[data-save-state="conflict"] .save-state,
.field[data-save-state="refused"] .save-state { color: #b00020; font-weight: 700; }
.field[data-save-state="saving"] .save-state,
.field[data-save-state="dirty"] .save-state,
.field[data-save-state="offline"] .save-state { color: #586779; }
.error { color: #b00020; font-weight: 700; }
.muted { color: #586779; font-size: .9rem; }
.projector { font-size: 1.6rem; }
.projector h1 { font-size: 2.6rem; margin: 0 0 .25rem; }
.projector h2 { font-size: 1.9rem; }
.projector .projector-year { font-size: 2.1rem; font-weight: 700; margin: 0 0 .25rem; }
.projector .projector-timer, .projector .projector-wait { color: #586779; }
.projector table { font-size: 1.5rem; }
.projector .projector-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.bankrupt { border-color: #b00020; }
@media print {
  nav, .actions { display: none !important; }
  body, :root { background: white; font-size: 9pt; }
  main { max-width: none; padding: 0; }
  section { border: 0; padding: 0; margin: 0; }
  fieldset { break-inside: avoid; margin: .25rem 0; padding: .25rem; }
  input { min-height: 22px; padding: .1rem; border: 0; border-bottom: 1px solid #333; }
}

/* Team decision zones: the role is told by mark, heading and text, never by
   colour alone. */
.role-zone {
  background: white;
  border: 1px solid #d8dee8;
  border-radius: .5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}
/* The accent lives on the zone heading, together with the mark and the role
   name: the role is never told by colour alone. */
.role-zone > h2, .role-zone > legend {
  border-bottom: 2px solid var(--role-accent, #8693a6);
  padding-bottom: .35rem;
}
.role-zone--general { --role-accent: #17365d; }
.role-zone--finance { --role-accent: #1b7f3b; }
.role-zone--commercial { --role-accent: #8a5a00; }
.role-zone--operations { --role-accent: #6a3d9a; }
.role-zone--current { box-shadow: 0 0 0 2px var(--role-accent); }
.role-zone h2 { margin-top: 0; }
.zone-mark { color: var(--role-accent); }
.decision-row { font-variant-numeric: tabular-nums; }
.decision-row .field-previous { color: #586779; font-size: .85rem; flex: 0 0 auto; }
.decision-row .field-delta { font-weight: 700; flex: 0 0 3.5rem; }
/* A stock row states what the quantity becomes; it is the row's answer, so it
   carries the same weight as a delta and is allowed to wrap on a phone. */
.decision-row .field-becomes { font-weight: 700; flex: 0 1 auto; }
.decision-row .field-error { color: #b00020; font-weight: 700; flex: 1 1 100%; }
.field-help { flex: 0 0 auto; }
.field-help summary {
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #8693a6;
  border-radius: 50%;
  font-weight: 700;
  transition: background-color 120ms;
}
.field-help[open] summary { background: #e7edf5; }
.field-help p { flex: 1 1 100%; margin: .4rem 0 0; color: #172033; }
.team-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
@media (max-width: 800px) {
  .decision-row { display: grid; grid-template-columns: 1fr auto; }
  .decision-row .field-label { grid-column: 1 / -1; }
  .decision-row .field-help[open] p { grid-column: 1 / -1; }
  .decision-row .field-error { grid-column: 1 / -1; }
  .decision-row input { max-width: none; }
}
.button--off { background: #8693a6; cursor: not-allowed; }

/* Host cockpit: desktop-first. The persistent bar carries the stage, the four
   team chips and the room screen; the tabs only select what is below. */
.host-bar { display: grid; gap: 1rem; }
.host-bar h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.host-bar p { margin: .15rem 0; }
.host-bar-teams { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.host-bar-teams li {
  border: 1px solid #d8dee8;
  border-radius: .3rem;
  padding: .4rem .6rem;
  display: grid;
  min-width: 8rem;
}
.host-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }
.host-tabs a {
  padding: .7rem 1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8dee8;
  border-bottom: 0;
  border-radius: .3rem .3rem 0 0;
  background: #e7edf5;
  color: #17365d;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 120ms;
}
.host-tabs a[aria-current="page"] { background: white; border-bottom: 3px solid #175ea8; }
.team-switch { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.team-switch a {
  padding: .7rem 1rem; min-height: 44px; display: inline-flex; align-items: center;
  border: 1px solid #8693a6; border-radius: .3rem; text-decoration: none;
}
.team-switch a[aria-current="true"] { background: #17365d; color: white; }
.host-control button[data-primary-action] { font-size: 1.1rem; padding: .9rem 1.4rem; }
.blockers { display: grid; gap: .6rem; padding-left: 1.2rem; }
.blockers li { display: grid; gap: .2rem; }
.result-table { font-variant-numeric: tabular-nums; }
.result-table meter { display: block; width: 100%; height: .5rem; }
.result-table tr[data-direction="up"] td:last-child { color: #1b7f3b; }
.result-table tr[data-direction="down"] td:last-child { color: #b00020; }
@media (min-width: 900px) {
  .host-bar { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; align-items: start; }
}
.host-team-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.host-team-actions form { display: inline; }

/* Above 900px the overview keeps the team table wide and the actions beside
   it; below 800px everything becomes one readable column. */
@media (min-width: 900px) {
  .host-tab[data-tab="overview"] { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
  .host-tab[data-tab="overview"] > section:first-child { grid-column: 1 / -1; }
  .host-tab[data-tab="control"] { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
}
@media (max-width: 800px) {
  .host-tab, .host-bar { display: block; }
  .host-bar-teams li { min-width: 100%; }
  .role-zone .field-previous, .role-zone .field-delta,
  .role-zone .field-becomes { font-size: .85rem; }
}
