/* =========================================================
   Four Anjels Production Board
   Custom CSS — no framework. System fonts. Lightweight.
   ========================================================= */

:root {
  --brand-charcoal: #3a3a42;
  --brand-charcoal-dark: #1a1a2e;
  --brand-blue: #7AA9D0;            /* halo accent */
  --brand-blue-deep: #4A90D9;       /* deeper accent */
  --brand-blue-tint: #e8f4fd;       /* GF swim lane */
  --brand-cream: #fdfaf5;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e5ea;
  --border-strong: #cdd1d8;
  --text: #1f2433;
  --text-muted: #6b7280;
  --text-soft: #94a0b1;

  --rag-green: #28a745;
  --rag-amber: #ffc107;
  --rag-red:   #dc3545;
  --rag-grey:  #6c757d;

  --rag-green-tint: #e8f8ee;
  --rag-amber-tint: #fff7df;
  --rag-red-tint:   #fde7e9;
  --rag-grey-tint:  #eef0f3;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.18);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Brush Script MT", "Lucida Handwriting", "Apple Chancery", cursive;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
.muted { color: var(--text-muted); font-size: 0.875rem; }

/* ---------- Staging banner ---------- */
.env-banner {
  background: linear-gradient(90deg, #ff8b1f, #ff6a00);
  color: #fff;
  text-align: center;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 6px 12px;
  font-size: 12px;
  text-transform: uppercase;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 8px rgba(255, 106, 0, .35);
}
.env-banner__icon { margin-right: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 200px 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 4px 18px 4px 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 100%);
  color: #f5f5f7;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 14px rgba(0,0,0,0.18);
  min-height: 96px;
}
.body--board .env-banner ~ .topbar { top: 30px; }

.topbar__brand {
  display: flex; align-items: center; justify-content: center;
  padding: 0 14px;
  min-width: 0;
  align-self: stretch;
}
.brand { display: flex; align-items: center; gap: .5rem; max-width: 100%; }
.brand__logo {
  display: block;
  height: 42px;
  width: auto;
  object-fit: contain;
}
.brand__logo--large { height: 140px; }
.brand__logo--hero { height: 86px; max-width: 180px; }
.brand__logo--icon { height: 28px; }
.topbar .brand__logo { filter: drop-shadow(0 1px 6px rgba(122, 169, 208, .35)); }
.brand__tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-blue);
  font-weight: 600;
  opacity: .85;
}

.topbar__equipment {
  display: flex; gap: .35rem; align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}
.eq-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  font-size: 12px;
  color: #e6e9f0;
  cursor: pointer;
  transition: background .15s, transform .15s;
  white-space: nowrap;
}
.eq-pill:hover { background: rgba(255,255,255,.14); }
.eq-pill__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 0 2px rgba(40,167,69,.25);
}
.eq-pill[data-status="limited"] .eq-pill__dot { background: var(--rag-amber); box-shadow: 0 0 0 2px rgba(255,193,7,.3); }
.eq-pill[data-status="down"] .eq-pill__dot   { background: var(--rag-red);   box-shadow: 0 0 0 2px rgba(220,53,69,.35); }
.eq-pill[data-status="down"] {
  background: rgba(220,53,69,.18);
  border-color: rgba(220,53,69,.4);
  color: #ffd5da;
}

.topbar__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.3; }
.topbar__meta .brand__tag { order: -1; margin-bottom: 2px; }
.clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #d6dbe5;
  font-weight: 500;
}
.update-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: #98a3b8;
}
.update-indicator .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 8px rgba(40,167,69,.6);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.topbar__actions { display: flex; align-items: center; gap: .5rem; }

/* ---------- User menu ---------- */
.usermenu { position: relative; }
.usermenu__button {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #fff;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  font-size: 13px;
  transition: background .15s;
}
.usermenu__button:hover { background: rgba(255,255,255,.13); }
.usermenu__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-blue);
  color: var(--brand-charcoal-dark);
  font-weight: 700;
  font-size: 12px;
}
.usermenu__chev { font-size: 10px; opacity: .7; }
.usermenu__dropdown {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  min-width: 220px;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 50;
}
.usermenu__dropdown[hidden] { display: none; }
.usermenu__dropdown a {
  display: block;
  padding: 8px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.usermenu__dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.usermenu__dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.usermenu__info {
  padding: 10px 14px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.usermenu__role { font-size: 11px; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: var(--brand-blue-deep);
  color: #fff;
  border-color: var(--brand-blue-deep);
  box-shadow: 0 1px 3px rgba(74, 144, 217, .35);
}
.btn--primary:hover { background: #3779be; border-color: #3779be; }
.btn--ghost {
  background: transparent;
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.18);
}
.btn--ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn--danger { background: var(--rag-red); color: #fff; border-color: var(--rag-red); }
.btn--danger:hover { background: #b22633; border-color: #b22633; }
.btn--block { width: 100%; }
.btn--big { padding: 14px 18px; font-size: 15px; min-height: 56px; }
.btn--lg  { padding: 12px 18px; font-size: 14px; min-height: 48px; }

/* ---------- Login ---------- */
.body--login {
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 60%, #2d3155 100%);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.body--login::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 20% 0%, rgba(122, 169, 208, .15), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(122, 169, 208, .12), transparent 60%);
  pointer-events: none;
}
.login-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
}
.login-card__brand { text-align: center; margin-bottom: 24px; }
.login-card__brand .brand__logo { margin: 0 auto; height: 110px; }
.login-card__tag {
  margin: 8px 0 0;
  color: var(--text-muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}
.login-form { display: grid; gap: 16px; margin-top: 8px; }
.login-card__hint {
  margin-top: 18px; padding: 12px 14px;
  background: var(--brand-blue-tint);
  border-radius: var(--radius-md);
  font-size: 12px; color: var(--text-muted);
  border-left: 3px solid var(--brand-blue);
}
.login-footer {
  text-align: center; padding: 18px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  z-index: 1;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-blue-deep);
  box-shadow: 0 0 0 3px rgba(74,144,217,.18);
}
.field textarea { resize: vertical; min-height: 90px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert {
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 10px;
}
.alert--error { background: var(--rag-red-tint); color: #76151c; border-left: 3px solid var(--rag-red); }
.alert--info  { background: var(--brand-blue-tint); color: #19476b; border-left: 3px solid var(--brand-blue-deep); }
.alert--ok    { background: var(--rag-green-tint); color: #10522a; border-left: 3px solid var(--rag-green); }

/* ---------- Board ---------- */
.body--board { background: var(--bg); }
.board-root { padding: 0; }
.board-grid {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}

/* Stage column header */
.board-table {
  display: grid;
  background: #fff;
  position: relative;
  overflow: auto;
  /* grid-template-columns set inline via JS based on stage count */
}
.board-cell { padding: 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 70px; }
.board-cell--header {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, #f1f3f7, #e6eaf2);
  font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text);
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-strong);
  text-align: center;
}
.board-cell--lane-label {
  position: sticky; left: 0; z-index: 6;
  background: var(--surface-2);
  border-right: 2px solid var(--border-strong);
  display: flex; flex-direction: column; justify-content: center;
  padding: 14px 16px;
  font-weight: 700; font-size: 14px;
  color: var(--text);
}
.board-cell--lane-label.is-allergen {
  background: var(--brand-blue-tint);
  border-left: 4px solid var(--brand-blue-deep);
}
.lane-label__sub {
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em;
  margin-top: 2px;
}
.board-cell--header.is-final { background: linear-gradient(180deg, #e8e9ec, #d8dae0); }
.board-cell--corner {
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 100%);
  border-right: 2px solid rgba(255,255,255,0.1);
  border-bottom: 2px solid var(--border-strong);
}

.lane-row.is-allergen .board-cell:not(.board-cell--lane-label) { background: var(--brand-blue-tint); }
.lane-row .board-cell { background: #fff; transition: background .15s; }
.lane-row .board-cell.is-final { background: #f6f7f9; }
.lane-row.is-allergen .board-cell.is-final { background: #dde9f3; }

.board-cell.drop-target {
  background: rgba(74,144,217,0.18) !important;
  outline: 2px dashed var(--brand-blue-deep);
  outline-offset: -4px;
}

/* SortableJS states */
.sortable-ghost {
  opacity: 0.35 !important;
  background: var(--brand-blue-tint) !important;
  border-left-color: var(--brand-blue-deep) !important;
}
.sortable-chosen {
  box-shadow: 0 0 0 2px var(--brand-blue-deep), var(--shadow-md) !important;
}
.sortable-drag {
  cursor: grabbing;
  transform: rotate(1deg);
  box-shadow: var(--shadow-lg) !important;
}
.card.is-landed {
  animation: kanban-flash 1.5s ease-out;
}
@keyframes kanban-flash {
  0%   { background: #fff7df; box-shadow: 0 0 20px rgba(245,158,11,0.55); transform: scale(1.03); }
  40%  { background: #fffbe8; box-shadow: 0 0 10px rgba(245,158,11,0.25); transform: scale(1.01); }
  100% { background: inherit;  box-shadow: var(--shadow-sm); transform: scale(1); }
}
/* Cards are grab-cursored when the board is editable (SortableJS handles drag) */
.board-root[data-role="admin"] .card:not(.is-final),
.board-root[data-role="edit"] .card:not(.is-final) { cursor: grab; }
.board-root[data-role="admin"] .card:not(.is-final):active,
.board-root[data-role="edit"] .card:not(.is-final):active { cursor: grabbing; }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 4px solid var(--rag-grey);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: transform .15s, box-shadow .2s, border-color .15s;
  position: relative;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.card.is-rag-green { border-left-color: var(--rag-green); }
.card.is-rag-amber { border-left-color: var(--rag-amber); background: #fffdf6; }
.card.is-rag-red {
  border-left-color: var(--rag-red);
  background: var(--rag-red-tint);
}
.card.is-rag-grey { border-left-color: var(--rag-grey); }
.card.is-final { opacity: .55; background: #f7f8fa; }
.card.is-final:hover { opacity: .85; }
.card.is-active { outline: 3px solid rgba(74,144,217,.55); outline-offset: 1px; }

.card__title {
  font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 2px;
  display: flex; justify-content: space-between; gap: 6px;
}
.card__code {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.card__meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.card__meta strong { color: var(--text); }
.card.is-rag-red .card__meta strong { color: #8a1a26; }
.card__icons {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; font-size: 11px;
}
.card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-blue-tint); color: var(--brand-blue-deep);
  border-radius: 999px; padding: 2px 6px; font-weight: 600; gap: 2px;
}
.card__icon--issue { background: var(--rag-red-tint); color: #8a1a26; }

/* Action bar */
.card-action-bar {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  display: grid; gap: 6px;
}
.card-action-bar .btn { width: 100%; }
/* Override ghost styling inside cards — topbar ghost is white-on-dark,
   but cards need dark-on-light readable text. */
.card-action-bar .btn--ghost {
  background: var(--surface-2);
  color: var(--brand-charcoal-dark);
  border-color: var(--border-strong);
  font-weight: 600;
}
.card-action-bar .btn--ghost:hover {
  background: var(--brand-blue-tint);
  color: var(--brand-blue-deep);
  border-color: var(--brand-blue-deep);
}
/* Red/amber cards get a light ghost button that stays readable */
.card.is-rag-red .card-action-bar .btn--ghost,
.card.is-rag-amber .card-action-bar .btn--ghost {
  background: #fff;
  color: var(--brand-charcoal-dark);
}

/* Empty cell */
.cell-empty {
  height: 100%; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: 11px;
  opacity: 0;
  transition: opacity .15s;
}
.board-cell:hover .cell-empty { opacity: .5; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal__overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.modal__panel {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: rise .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.modal__panel--small  { max-width: 440px; }
.modal__panel--medium { max-width: 560px; }
.modal__panel--large  { max-width: 880px; }
.modal__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal__close {
  background: transparent; border: 0; font-size: 22px; line-height: 1;
  color: var(--text-muted); padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--surface-2);
}
.modal__panel form.modal__body .modal__footer {
  margin: 18px -20px -18px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Detail timeline ---------- */
.timeline {
  display: grid;
  gap: 0;
  margin: 14px 0;
}
.timeline__row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline__row:last-child { border-bottom: 0; }
.timeline__dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border-strong);
  margin: 0 auto;
  position: relative;
}
.timeline__row.is-done .timeline__dot { background: var(--rag-green); border-color: var(--rag-green); }
.timeline__row.is-current .timeline__dot {
  background: var(--brand-blue-deep); border-color: var(--brand-blue-deep);
  box-shadow: 0 0 0 4px rgba(74,144,217,.2);
}
.timeline__row.is-pending .timeline__dot { background: #fff; border-color: var(--border-strong); }
.timeline__stage { font-weight: 600; }
.timeline__time { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.timeline__actual { color: var(--text); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; font-weight: 600; }
.timeline__row.is-pending .timeline__actual { color: var(--text-soft); }
.timeline__status { font-size: 12px; min-width: 130px; text-align: right; }
.timeline__status.early { color: var(--rag-green); }
.timeline__status.late  { color: var(--rag-red); }
.timeline__status.now   { color: var(--brand-blue-deep); font-weight: 600; }

.note-list { display: grid; gap: 10px; margin-top: 14px; }
.note {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
}
.note.is-issue { background: var(--rag-red-tint); border-left-color: var(--rag-red); }
.note__meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--text-muted);
  margin-bottom: 4px; align-items: center;
}
.note__meta .stage-pill {
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
  color: var(--text);
}

/* ---------- Detail header ---------- */
.detail-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.summary-tile {
  background: var(--surface-2); border-radius: var(--radius-md);
  padding: 10px 12px; border: 1px solid var(--border);
}
.summary-tile strong { display: block; font-size: 16px; }
.summary-tile span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Section heading inside modal */
.section-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700;
  margin: 18px 0 8px;
}

/* ---------- Handover ---------- */
.handover-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin: 14px 0;
}
.handover-stats > div {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.handover-stats strong { display: block; font-size: 22px; font-weight: 700; }
.handover-stats span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.handover-stats .rag-red    { border-left: 4px solid var(--rag-red); }
.handover-stats .rag-amber  { border-left: 4px solid var(--rag-amber); }
.handover-stats .rag-green  { border-left: 4px solid var(--rag-green); }
.handover-note {
  background: var(--brand-blue-tint);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13.5px;
  border-left: 3px solid var(--brand-blue-deep);
  white-space: pre-wrap;
}
.handover-snapshot { margin-bottom: 12px; }
.handover-list-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.handover-list-table th, .handover-list-table td {
  padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.handover-list-table th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: grid; gap: 10px; z-index: 400;
}
.toast {
  background: var(--brand-charcoal-dark);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slideIn .25s ease;
  max-width: 300px;
}
.toast.is-ok    { border-left: 3px solid var(--rag-green); }
.toast.is-error { border-left: 3px solid var(--rag-red); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ---------- Equipment popover (status change) ---------- */
.eq-popover {
  position: fixed;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  width: 280px;
  z-index: 500;
  border: 1px solid var(--border);
  animation: rise .18s ease-out;
}
.eq-popover h4 { margin: 0 0 8px; font-size: 14px; }
.eq-popover .status-options {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 6px 0 10px;
}
.eq-popover .status-options button {
  padding: 10px 6px; border-radius: var(--radius-md); border: 2px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform .06s, box-shadow .15s, border-color .15s, background .15s;
  letter-spacing: .02em;
}
.eq-popover .status-options button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.eq-popover .status-options button:active { transform: translateY(0); }

/* Colour-coded status options — each button previews the state it applies */
.eq-popover .eq-opt--ok      { color: #1e7a35; border-color: var(--rag-green-tint); background: var(--rag-green-tint); }
.eq-popover .eq-opt--limited { color: #8a6500; border-color: var(--rag-amber-tint); background: var(--rag-amber-tint); }
.eq-popover .eq-opt--down    { color: #8a1a26; border-color: var(--rag-red-tint);   background: var(--rag-red-tint); }
.eq-popover .eq-opt--ok:hover      { background: #c9ecd3; }
.eq-popover .eq-opt--limited:hover { background: #ffe9a6; }
.eq-popover .eq-opt--down:hover    { background: #f8ccd1; }

/* Current-status indicator — the active button has a stronger border */
.eq-popover .eq-opt[data-active="true"] { box-shadow: inset 0 0 0 2px currentColor; }

.eq-popover textarea { width: 100%; resize: vertical; }
.eq-popover .actions { display: flex; gap: 6px; margin-top: 4px; }
.eq-popover .btn--block { width: 100%; }

/* ---------- Tablet ---------- */
@media (max-width: 1200px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 10px 12px; }
  .topbar__equipment { order: 4; grid-column: 1 / -1; padding-top: 4px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 4px; }
  .brand__logo { height: 36px; }
}

/* ---------- Phone ---------- */
@media (max-width: 768px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar__meta { display: none; }
  .brand__tag { display: none; }
  .topbar__equipment .eq-pill[data-status="ok"] { display: none; }
  .topbar__equipment:empty::before {
    content: "All equipment OK ✓";
    color: rgba(255,255,255,.55); font-size: 11px;
  }

  /* Phone board: tabs + vertical list per stage */
  .board-table { display: block; }
  .lane-tabs {
    display: flex; gap: 0; background: #fff; padding: 0; overflow-x: auto;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
  }
  .lane-tabs button {
    padding: 12px 16px; background: transparent; border: 0; border-bottom: 3px solid transparent;
    font-weight: 600; color: var(--text-muted); white-space: nowrap;
  }
  .lane-tabs button[aria-selected="true"] { color: var(--brand-blue-deep); border-bottom-color: var(--brand-blue-deep); }

  .stage-block {
    background: #fff; padding: 12px 12px; margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .stage-block__head {
    font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    font-size: 12px; color: var(--text); margin-bottom: 8px; display: flex; justify-content: space-between;
  }
  .stage-block__count { color: var(--text-muted); font-weight: 500; font-size: 11px; }
  .stage-block:empty { display: none; }
  .modal__panel { max-width: 100%; max-height: calc(100vh - 80px); }
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table th {
  background: var(--surface-2); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.data-table tr:hover td { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; background: var(--surface-2);
}
.badge.green { background: var(--rag-green-tint); color: #1e7a35; }
.badge.amber { background: var(--rag-amber-tint); color: #8a6500; }
.badge.red   { background: var(--rag-red-tint);   color: #8a1a26; }
.badge.grey  { background: var(--rag-grey-tint);  color: #4a5260; }

/* ---------- Page wrapper for non-board pages ---------- */
.main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

/* ---------- Filters ---------- */
.filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: #fff; padding: 12px 14px; border-radius: var(--radius-md);
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-bar .field { min-width: 140px; }

/* ---------- Stats overview ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-card {
  background: #fff; padding: 14px; border-radius: var(--radius-md);
  border-left: 4px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.stat-card strong { display: block; font-size: 26px; font-weight: 700; }
.stat-card span   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card.is-rag-red   { border-left-color: var(--rag-red); }
.stat-card.is-rag-amber { border-left-color: var(--rag-amber); }
.stat-card.is-rag-green { border-left-color: var(--rag-green); }
