/* ============================================================
   KitchenOS — Design Tokens
   Pulled directly from KitchenOS_DesignSystem.md
   ============================================================ */
:root {
  /* --- Surfaces --- */
  --surface: #FFFFFF;
  --surface-dim: #F8F9FA;
  --surface-container-low: #F1F3F4;
  --surface-container-high: #E8EAE9;

  /* --- Brand / Primary --- */
  --primary: #00A36C;
  --primary-tint: #E6F4EA;
  --primary-dark: #007A52;

  /* --- Text --- */
  --text-primary: #0B1326;
  --text-secondary: #5F6368;
  --text-tertiary: #9AA0A6;
  --text-on-primary: #FFFFFF;

  /* --- Semantic Status --- */
  --success: #00A36C;
  --success-tint: #E6F4EA;
  --warning: #F9AB00;
  --warning-text: #9A6B00; /* deep amber — all at-risk TEXT for readability */
  --warning-tint: #FEF7E0;
  --error: #D93025;
  --error-tint: #FCE8E6;
  --info: #1A73EB;
  --info-tint: #E8F0FE;

  /* --- Source App --- */
  --zomato: #E23946;
  --swiggy: #FC8019;
  --own-app: #00A36C;
  /* slightly deepened variants for TEXT readability on the chip fill */
  --zomato-text: #C92F3B;
  --swiggy-text: #E06A00;

  /* --- Borders --- */
  --border-default: #E8EAE9;
  --border-subtle: #F1F3F4;

  /* --- Spacing & layout --- */
  --rail-width: 64px;
  --gutter: 12px;
  --margin: 16px;
  --card-padding: 12px;
  --stack-gap: 8px;
  --row-height: 40px;
  --feed-width: 320px;

  /* --- Radius --- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* --- Elevation --- */
  --shadow-modal: 0px 4px 16px rgba(0, 0, 0, 0.12);

  /* --- Type families --- */
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-data: 'JetBrains Mono', monospace;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--surface-dim);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ============================================================
   APP GRID  (nav rail | feed | stations)  + header + footer
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) var(--feed-width) 1fr;
  grid-template-rows: 64px 1fr 32px;
  grid-template-areas:
    "header header header"
    "rail   feed    stations"
    "rail   footer  footer";
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--surface);
}

/* ============================================================
   HEADER BAR
   ============================================================ */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-default);
}

.header__brand { display: flex; align-items: center; gap: 10px; }
.header__brand-icon { color: var(--primary); flex: none; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.brand-name .os { color: var(--primary); }

.label-caps {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.label-caps--regular { font-weight: 400; font-size: 10px; }
.header__counters { display: flex; gap: 10px; margin-left: 18px; }
.counter-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}
.counter-pill .count {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 700;
}
.counter-pill--risk-active {
  border-color: var(--warning);
  color: var(--warning-text);
  background: var(--warning-tint);
}
.counter-pill--breach-active {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-tint);
}

.header__right { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.header-metric { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.header-metric.center { align-items: center; }
.header-metric__value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-metric__value.mono { font-family: var(--font-data); }
.header-metric__value.green { color: var(--primary); }

.header__time {
  padding: 6px 14px;
  background: var(--surface-container-low);
  border-radius: var(--radius-sm);
}

.bell-btn {
  border: none; background: none; color: var(--text-secondary);
  display: flex; align-items: center; padding: 6px; border-radius: var(--radius-sm);
}
.bell-btn:hover { background: var(--surface-container-low); }

.live-btn {
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.live-btn:hover { background: var(--primary-dark); }

/* ============================================================
   NAV RAIL
   ============================================================ */
.rail {
  grid-area: rail;
  background: var(--surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 6px;
}
.rail__spacer { flex: 1; }
.rail-item {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  border: none;
  background: none;
  border-left: 3px solid transparent;
  position: relative;
}
.rail-item:hover { color: var(--text-secondary); }
.rail-item--active {
  color: var(--primary);
  border-left-color: var(--primary);
}

/* ============================================================
   ORDER FEED PANEL
   ============================================================ */
.feed {
  grid-area: feed;
  background: var(--surface-dim);
  border-right: 1px solid var(--border-default);
  padding: var(--margin);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  flex: none;        /* keep full height even when cards below expand */
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 14px;
}
.search input {
  border: none; outline: none; background: none; flex: 1;
  font-family: var(--font-ui); font-size: 14px; color: var(--text-primary);
}
.search input::placeholder { color: var(--text-tertiary); }
.filter-icon { color: var(--text-secondary); cursor: pointer; }

.tabs { display: flex; gap: 18px; flex: none; border-bottom: 1px solid var(--border-subtle); }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 0 10px;
  background: none; border: none;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab .tab-count { font-size: 16px; font-weight: 700; }
.tab--active { color: var(--primary); border-bottom-color: var(--primary); }

.feed__list { display: flex; flex-direction: column; gap: var(--stack-gap); }

/* --- Order Card --- */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--card-padding);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.2s ease;
  position: relative;
}
.order-card:hover { border-color: var(--surface-container-high); }

.order-card__row1 { display: flex; align-items: baseline; justify-content: space-between; }
.order-id { font-size: 16px; font-weight: 500; color: var(--text-primary); }

.order-card__row2 {
  display: flex; align-items: center; gap: 7px;
  margin-top: 6px;
}
/* Source app chip: brand-colored name in a small rounded tag (no dot) */
.source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  background: var(--surface-container-low);
  border-radius: var(--radius-full);
  flex: none;
}
.source-name {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  /* color comes inline per brand (Zomato red / Swiggy orange / Own App green) */
}
.promised-eta {
  margin-left: auto;
  font-family: var(--font-data);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
  line-height: 1.1;
}
.order-card__items {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
/* item rows with brand icons (collapsed card) */
.order-card__items-list {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 5px;
}
.item-line { display: flex; align-items: center; gap: 8px; }
.brand-ico { display: inline-flex; flex: none; }
.item-line__txt { font-size: 12px; color: var(--text-secondary); }

/* status pill on card (NEW / AT RISK etc) */
.card-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.card-tag--new { color: var(--info); background: var(--info-tint); }
.card-tag--risk { color: var(--warning-text); background: var(--warning-tint); }
.card-tag--breach { color: var(--error); background: var(--error-tint); }
.card-tag--ontime { color: var(--primary); background: var(--primary-tint); }

/* card states */
.order-card--risk {
  border-left: 3px solid var(--warning);
  background: var(--warning-tint);
}
.order-card--risk .promised-eta { color: var(--warning-text); }

.order-card--breach {
  border-left: 3px solid var(--error);
  background: var(--error-tint);
}
.order-card--breach .promised-eta { color: var(--error); }

.order-card--ontime {
  border-left: 3px solid var(--primary);
}

/* manual attention flag — amber marker, NO tint */
.order-card--manual { border-left: 3px solid var(--warning); }
.manual-marker {
  position: absolute; top: 10px; right: 10px;
  width: 9px; height: 9px; border-radius: var(--radius-full);
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-tint);
}

/* "Auto slotted" annotation: quiet label + (i) toggle; details on demand */
.annotation {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.annotation__row { display: flex; align-items: center; gap: 6px; }
.annotation__label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--info);
}
.annotation__info-btn {
  width: 16px; height: 16px;
  border: 1px solid var(--info); border-radius: var(--radius-full);
  background: none; color: var(--info);
  font-size: 10px; font-weight: 700; font-family: Georgia, serif; font-style: italic;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; flex: none;
}
.annotation__info-btn:hover { background: var(--info-tint); }
.annotation__detail {
  padding: 9px 10px;
  background: var(--info-tint);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.annotation__detail .a-title {
  font-weight: 700; color: var(--info); text-transform: uppercase;
  letter-spacing: 0.04em; font-size: 10px; display: block; margin-bottom: 4px;
}
.annotation__detail .a-calc { font-family: var(--font-data); color: var(--text-primary); }
.annotation__detail .a-eq { color: var(--info); font-weight: 700; }

/* at-risk (i) disclosure on the order card (Screen 4) */
.tag-group { display: inline-flex; align-items: center; gap: 6px; }
.annotation__info-btn--risk { border-color: var(--warning); color: var(--warning-text); }
.annotation__info-btn--risk:hover { background: var(--warning-tint); }
/* white so it stays visible on the amber-tinted at-risk card */
.annotation__detail--risk {
  margin-top: 10px;
  background: var(--surface);
  color: var(--text-secondary);
}
.annotation__detail--risk b { font-weight: 500; color: var(--text-primary); }
/* tighter spacing when the problem box sits inside a station queue row */
.queue-row__body .annotation__detail--risk { margin-top: 4px; margin-bottom: 4px; }
/* problem line: amber text + warning icon — read first, no fill */
.annotation__detail--risk .rd-problem {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 13px; /* 2pt above the 11px body of the bubble */
  font-weight: 500; color: var(--warning-text);
}
.annotation__detail--risk .rd-problem svg { flex: none; margin-top: 2px; }
.annotation__detail--risk .rd-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-secondary);
  margin-top: 8px; margin-bottom: 2px;
}
.annotation__detail--risk .rd-finish { margin-top: 6px; }

/* --- expanded card internals --- */
.order-card__expand {
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 14px;
}
.item-track__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 7px; gap: 8px;
}
.item-track__id { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.item-track__name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
/* Brand chip: grey outline, no fill — separates restaurant brands from the
   solid-filled source chips (text color set inline from BRAND_COLORS) */
.item-track__brand {
  align-self: flex-start;
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  margin-top: 2px;
}
/* right column: station on top, item timer below — the timer sits on the
   same horizontal line as the brand chip (both columns share the same gap) */
.item-track__right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 5px; flex: none;
}
.item-track__station {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  white-space: nowrap;
}
.item-track__timer {
  font-family: var(--font-data); font-size: 12px; font-weight: 500;
  color: var(--text-secondary); line-height: 20px; /* matches brand chip height */
}

/* progress dot track */
.dot-track { display: flex; align-items: center; }
.dot-track__dot {
  width: 9px; height: 9px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border-default);
  background: var(--surface);
  flex: none;
}
.dot-track__dot--done {
  background: var(--primary);
  border-color: var(--primary);
}
.dot-track__seg { flex: 1; height: 2px; background: var(--border-default); }
.dot-track__seg--done { background: var(--primary); }
.track-label {
  margin-top: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
}
.track-label--green { color: var(--primary); }
.track-label--neutral { color: var(--text-secondary); }
.track-label--amber { color: var(--warning-text); }

.rider-eta {
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}
.rider-eta__head { display: flex; align-items: baseline; justify-content: space-between; }
.rider-eta__val {
  font-family: var(--font-data); font-size: 13px; font-weight: 500;
  color: var(--info);
}
/* rider timeline: grey track + blue (info) elapsed fill */
.rider-bar {
  position: relative;
  height: 4px;
  background: var(--border-default);
  border-radius: var(--radius-full);
}
.rider-bar__fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--info);
  border-radius: var(--radius-full);
}
.rider-bar__marker {
  position: absolute; top: 50%;
  width: 9px; height: 9px; border-radius: var(--radius-full);
  background: var(--info);
  border: 2px solid var(--surface);
  transform: translate(-50%, -50%);
}

/* ============================================================
   STATION COLUMNS AREA
   ============================================================ */
.stations {
  grid-area: stations;
  background: var(--surface-dim);
  padding: var(--margin);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gutter);
  overflow: hidden;
}
.station {
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
}

.station__chip {
  align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
/* BUSY is an operational load state, not an alert — slate blue-grey keeps
   it apart from every semantic signal (green/amber/red/blue) */
.chip--busy { color: #546E7A; background: #ECEFF1; }
.chip--overloaded { color: var(--error); background: var(--error-tint); }
.chip--free { color: var(--primary); background: var(--primary-tint); }

.station__name { font-size: 16px; font-weight: 500; color: var(--text-primary); }
.station__load {
  margin-top: 6px; margin-bottom: 12px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
/* Cooking / Waiting / Items counts as chips */
.load-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  background: var(--surface-container-low);
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.load-chip .mono {
  font-family: var(--font-data); font-weight: 700; color: var(--text-primary);
}
/* Cooking chip: green — items actively on the cook line */
.load-chip--cooking {
  background: var(--primary-tint);
  color: var(--primary);
}
.load-chip--cooking .mono { color: var(--primary-dark); }

/* batched active card */
.batched-card {
  border: 1px solid var(--primary);
  background: var(--primary-tint);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 10px;
}
.batched-card__tag {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--primary); text-transform: uppercase;
}
.batched-card__tag .dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--primary); }
.batched-card__tag .timer { margin-left: auto; font-family: var(--font-data); font-size: 13px; }
.batched-card__name { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-top: 6px; }
.batched-card__ids {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-top: 2px;
}

/* active card overrun signal (Screen 4 — Hot Station 1) */
.batched-card--overrun {
  border-color: var(--error);
  background: var(--error-tint);
}
.batched-card--overrun .batched-card__tag,
.batched-card--overrun .batched-card__tag .dot { color: var(--error); }
.batched-card--overrun .batched-card__tag .dot { background: var(--error); }
.batched-card--overrun .batched-card__tag .timer { color: var(--error); font-weight: 700; }
.overrun-note {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--error); margin-top: 6px;
}

/* queue rows */
.queue { display: flex; flex-direction: column; }
.queue-row {
  min-height: var(--row-height);
  display: flex; align-items: center;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: grab;
  position: relative;
}
.queue-row:active { cursor: grabbing; }
.queue-row__body { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.queue-row__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.queue-row__name {
  flex: 1;
  font-size: 14px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* order ID beneath the item name — Inter, same grey as all station order IDs */
.queue-row__oid {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
}
.queue-row__timer {
  margin-left: auto; padding-left: 8px;
  font-family: var(--font-data); font-size: 13px; color: var(--text-secondary);
  flex: none;
}

/* drag visuals (queue rows + packing ready rows) */
.queue-row.dragging, .ready-row.dragging { opacity: 0.4; }
.queue-row.drag-over, .ready-row.drag-over { border-top: 2px solid var(--primary); }
.drag-handle { color: var(--text-tertiary); margin-right: 8px; flex: none; display: flex; }

/* hero biryani markers */
.queue-row--hero-new { background: var(--info-tint); border-radius: var(--radius-sm); }
.queue-row--hero-amber {
  background: var(--warning-tint);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
}
.queue-row--hero-amber .queue-row__timer { color: var(--warning-text); font-weight: 700; }
.queue-row--hero-ontrack {
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
}
.queue-row--hero-ontrack .queue-row__timer { color: var(--primary); font-weight: 700; }
.row-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1px 7px; border-radius: var(--radius-full); margin-left: 8px; flex: none;
}
.row-tag--new { color: var(--info); background: #fff; border: 1px solid var(--info); }
.row-tag--amber { color: var(--warning-text); background: #fff; border: 1px solid var(--warning); }
.row-tag--green { color: var(--primary); background: #fff; border: 1px solid var(--primary); }
.row-tag--cook { color: var(--primary); background: #fff; border: 1px solid var(--primary); }

/* currently-cooking rows: green + locked (not draggable) */
.queue-row--cooking {
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: not-allowed;
}
.queue-row--cooking .drag-handle { color: var(--primary); }
.queue-row--cooking .queue-row__name { font-weight: 500; }
.queue-row--cooking .queue-row__timer { color: var(--primary); font-weight: 700; }

/* ready items (packing) */
.ready-row {
  min-height: var(--row-height);
  display: flex; align-items: center; gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: grab;
}
.ready-row:active { cursor: grabbing; }
.ready-row__body { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ready-row__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ready-row__name {
  flex: 1;
  font-size: 14px; font-weight: 400; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ready-row__oid {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
}
.ready-row__timer {
  margin-left: auto; padding-left: 8px; flex: none;
  font-family: var(--font-data); font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
}
.ready-row--hero { background: var(--primary-tint); border-radius: var(--radius-sm); }

/* ============================================================
   STATUS BOTTOM BAR
   ============================================================ */
.footer {
  grid-area: footer;
  background: var(--surface-dim);
  border-top: 1px solid var(--border-default);
  display: flex; align-items: center; gap: 22px;
  padding: 0 16px;
}
.footer__item {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.footer .status-dot { width: 7px; height: 7px; border-radius: var(--radius-full); }
.status-dot--green { background: var(--primary); }
.status-dot--amber { background: var(--warning); }
.footer__version {
  margin-left: auto; font-family: var(--font-data);
  font-size: 11px; color: var(--text-tertiary);
}

/* ============================================================
   AT-RISK ALERT PANEL  (Screen 3 — in-layout, non-blocking)
   The panel is a 6th column in the station area; the five station
   columns squeeze to make room. No overlay, no dimming.
   ============================================================ */
.stations--alert { grid-template-columns: repeat(5, 1fr) 268px; }
.stations--alert-collapsed { grid-template-columns: repeat(5, 1fr) 44px; }

.alert-panel {
  background: var(--surface);
  border: 1px solid var(--error);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
  animation: panel-in 0.25s ease;
}
@keyframes panel-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.alert-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--border-default);
  flex: none;
}
.alert-panel__title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--error);
}
.alert-panel__icon { flex: none; }
.alert-panel__collapse {
  border: none; background: none; color: var(--text-secondary);
  padding: 3px; display: flex; border-radius: var(--radius-sm);
}
.alert-panel__collapse:hover { background: #fff; color: var(--text-primary); }

/* Panel body = a stack of alert/message cards (more can arrive below).
   Layout per the Figma reference: each entry is one enclosed card, so
   multiple alerts stack and read as distinct units. */
.alert-panel__body {
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}

/* One self-contained alert card. Background is semantic:
   grey = neutral message · amber tint = at risk · red tint = breached */
.alert-card {
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.alert-card--risk { background: var(--warning-tint); }
.alert-card--breach { background: var(--error-tint); }
.alert-card__actions {
  display: flex; flex-direction: column; gap: 8px;
}

/* note that the user opted to handle the alert manually (Screen 4) */
.handling-note {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
}
.handling-note svg { flex: none; margin-top: 2px; }
.handling-note b { font-weight: 500; color: var(--text-primary); }

/* ghost/text action (per DS): green text, no border or fill, underline on hover */
.link-action {
  align-self: flex-start;
  border: none; background: none; padding: 0;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--primary);
  cursor: pointer;
}
.link-action:hover { text-decoration: underline; color: var(--primary-dark); }

/* order header row: #id / source chip on the left, timer / mins-remaining on
   the right. Columns stretch so the chip bottom-aligns with "mins remaining". */
.alert-order { display: flex; justify-content: space-between; align-items: stretch; gap: 10px; }
.alert-order__left {
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 2px; min-width: 0;
}
.alert-order__id { font-size: 18px; font-weight: 500; color: var(--text-primary); }
.alert-order__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.affected__timer {
  font-family: var(--font-data); font-size: 26px; font-weight: 500;
  letter-spacing: -0.02em; color: var(--warning-text); line-height: 1.1;
}
.alert-order__remain { font-size: 11px; color: var(--text-secondary); }

/* collapsed: slim vertical tab at the right edge */
.alert-tab {
  background: var(--surface-container-low);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  color: var(--text-primary);
  animation: panel-in 0.2s ease;
}
.alert-tab:hover { background: var(--surface-container-high); }
.alert-tab__badge {
  width: 20px; height: 20px; border-radius: var(--radius-full);
  background: var(--error); color: #fff;
  font-family: var(--font-data); font-size: 11px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.alert-tab__label {
  writing-mode: vertical-rl;
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
}

/* idle (no alerts): the tab stays visible but goes quiet neutral grey */
.alert-tab--idle {
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.alert-tab--idle .alert-tab__badge { background: var(--text-tertiary); }

.alert-panel--idle {
  border-color: var(--border-default);
  border-left: 3px solid var(--border-default);
}
.alert-panel--idle .alert-panel__title { color: var(--text-secondary); }

/* empty state inside the expanded idle panel */
.alert-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px;
  padding: 28px 10px;
}
.alert-empty__title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
/* source chip inside the panel follows the tab's medium-weight rule */
.alert-panel .source-name { font-weight: 500; }
.alert-empty__text { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

.at-risk-block { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.at-risk-block strong { font-weight: 500; color: var(--text-primary); }
.at-risk-block .pos {
  font-family: var(--font-data); font-weight: 500; color: var(--error);
}

/* Suggested plan: white inner box with a green stroke — the system's
   recommended (safe) path, nested inside the alert card */
.suggestion {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px;
}
.suggestion__label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 5px;
}
.suggestion__text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.suggestion__text b { font-weight: 500; color: var(--primary); }
.suggestion__finish { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }
.suggestion__finish b { font-weight: 500; color: var(--text-primary); }

.modal__actions { display: flex; gap: 10px; padding: 4px 18px 18px; }
.btn {
  /* appearance reset + min-height guarantee the height actually applies to
     <button> elements in every browser (Safari ignores height on native buttons) */
  appearance: none;
  -webkit-appearance: none;
  height: 42px;
  min-height: 42px;
  flex: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  padding: 12px 16px; display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}
.btn--primary { background: var(--primary); color: #fff; border: none; flex: 1; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--secondary { background: #fff; color: var(--text-primary); border: 1px solid var(--border-default); flex: 1; }
.btn--secondary:hover { background: var(--surface-container-low); }

/* ============================================================
   NARRATIVE NAV CONTROL
   ============================================================ */
/* Capture mode: clean screens for screenshots → Figma (hide chrome & hints) */
body.capture .nav-control,
body.capture .drag-hint,
body.capture .toast { display: none !important; }

.nav-control {
  position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-modal);
  border-radius: var(--radius-full);
  padding: 7px 10px;
}
.nav-btn {
  height: 34px; padding: 0 16px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; border: none;
}
.nav-btn--ghost { background: none; color: var(--text-secondary); }
.nav-btn--ghost:hover { background: var(--surface-container-low); }
.nav-btn--ghost:disabled { color: var(--text-tertiary); opacity: 0.5; cursor: not-allowed; }
.nav-btn--primary { background: var(--primary); color: #fff; }
.nav-btn--primary:hover { background: var(--primary-dark); }
.nav-btn--primary:disabled { background: var(--surface-container-high); color: var(--text-tertiary); cursor: not-allowed; }

.nav-progress { display: flex; align-items: center; gap: 12px; }
.nav-dots { display: flex; gap: 6px; }
.nav-dot {
  width: 7px; height: 7px; border-radius: var(--radius-full);
  background: var(--surface-container-high);
}
.nav-dot--active { background: var(--primary); width: 18px; }
.nav-screen-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-secondary); white-space: nowrap;
}
.nav-screen-label .scr-num { font-family: var(--font-data); color: var(--primary); }

/* toast hint shown on resolution moment */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius-full);
  z-index: 300; box-shadow: var(--shadow-modal);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 0.25s ease;
}
.toast .toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

