:root {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* An element's own display rule (e.g. .loading-overlay's `display: flex`)
   otherwise beats the browser's default `[hidden] { display: none }` UA
   style, since both are author-origin-equivalent specificity — without
   this, "hidden" elements like the loading overlay or toast would still
   render (and, worse, still intercept clicks) whenever they also carry a
   class that sets `display`. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.muted { color: var(--grey); font-size: 0.92em; }
.error-text { color: var(--red); font-size: 0.92em; }

/* ---------------- Buttons ---------------- */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 0.95em;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--grey-light); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-sm { padding: 5px 10px; font-size: 0.85em; }
.btn-block { width: 100%; }
/* Job Tracker's clickable Order ID (round 19) — a text-link look, not a
   boxed button, since it toggles an inline detail row rather than
   navigating or saving anything. */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--navy);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  font-size: 1em;
}
.btn-link:hover { color: var(--navy-dark); }

/* ---------------- Login screen ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-logo { max-width: 160px; max-height: 70px; margin-bottom: 12px; }
.login-card h1 { font-size: 1.1em; margin: 0 0 2px; color: var(--navy); }
.login-card h2 { margin: 18px 0 4px; color: var(--ink); }
#login-error { margin-top: 12px; }

/* Seventeenth round: the landing page (company/contract tile picker) reuses
   .login-screen/.login-card's centred, branded layout, just wider — a
   fixed 360px is too narrow once there's more than a couple of tiles. */
.landing-card { width: min(640px, 92vw); }
.landing-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.landing-tile {
  background: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 16px;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.landing-tile:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.12); transform: translateY(-1px); }

/* ---------------- Top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { max-height: 34px; }
.topbar-title { font-weight: 700; color: var(--navy); }
.topbar-subtitle { font-size: 0.8em; color: var(--grey); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 0.9em; color: var(--grey); }

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 0.95em;
  cursor: pointer;
  color: var(--grey);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--action); border-bottom-color: var(--action); font-weight: 600; }

/* ---------------- Content ---------------- */
.content { padding: 24px; max-width: 1100px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

.banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.92em;
}
.banner-warning { background: var(--amber-bg); color: var(--amber); }
.banner-info { background: var(--blue-light); color: var(--navy); }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { margin-top: 0; color: var(--navy); }
.card h4 { color: var(--navy); margin: 20px 0 8px; font-size: 1em; }

/* Engineer Portal Updates (Round 13) — a navy left accent border so this
   card is visually distinct from the plain Job Notes card right below
   it, at a glance, not just by its own heading text. */
.card-engineer-portal {
  border-left: 4px solid var(--navy);
  background: #fbfcfe;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value { font-size: 1.7em; font-weight: 700; color: var(--navy); }
.stat-card .stat-label { font-size: 0.82em; color: var(--grey); margin-top: 4px; }

/* ---------------- Forms ---------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.88em;
  color: #333;
  font-weight: 600;
}
.form-grid input, .form-grid select, .form-grid textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.95em;
  font-weight: 400;
  font-family: inherit;
}
.form-grid .full-width { grid-column: 1 / -1; }
/* Sixteenth round: an action button meant to sit INLINE beside a select in
   the same row (FX Job Status' Save, Workstack's Search) rather than below
   spanning the full width like every other form's submit button — without
   this, the button (a bare <div>, no label text above it) would sit at the
   top of its grid cell instead of level with the input boxes next to it. */
.form-grid .form-btn-cell { align-self: end; }
.field-hint { font-size: 0.82em; font-weight: 400; color: var(--grey); }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.days-preview { font-size: 0.9em; color: var(--navy); font-weight: 600; }

/* A wrapping grid of checkboxes for multi-selecting Job Statuses (Export
   Report, Billing) — an ordinary <select multiple> requires ctrl/cmd-click
   to pick more than one option, which isn't obvious to a first-time user;
   plain checkboxes need no explanation. */
.status-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 14px;
  margin-top: 8px;
}
.status-check {
  /* .form-grid label (above) sets flex-direction: column for every label
     in scope, including these, at equal-or-higher CSS specificity — same
     situation .checkbox-label already had to work around below. Without
     !important here the checkbox renders stacked above its own text
     instead of sitting beside it. */
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  font-size: 0.88em;
  font-weight: 400;
  color: #333;
}
.status-check input[type="checkbox"] { width: auto; }

/* Compact inputs/selects placed directly inside a table cell (the Synth
   Code lines' Amount Completed / Gang columns in Job Lookup) — the
   .form-grid input/select rules above assume a labelled form layout with
   room to breathe, which is too wide for a table cell. */
.cell-input {
  width: 100%;
  min-width: 90px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 0.92em;
  font-family: inherit;
}

/* ---------------- Tables ---------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}
.data-table th {
  text-align: left;
  background: var(--grey-light);
  padding: 8px 10px;
  color: #444;
  font-weight: 600;
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }

/* ---------------- Status badges ---------------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 600;
}
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-rejected { background: var(--red-bg); color: var(--red); }
.badge-cancelled { background: var(--grey-light); color: var(--grey); }

/* Reinstatement status badges (Engineer Portal Updates, Round 13) — the
   same white/green/orange/red mapping as Engineer Portal's own
   REINSTATEMENT_TONES. White gets a border since it has no fill. */
.badge-reinstatement-white { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.badge-reinstatement-green { background: var(--green-bg); color: var(--green); }
.badge-reinstatement-orange { background: var(--orange-bg); color: var(--orange); }
.badge-reinstatement-red { background: var(--red-bg); color: var(--red); }

/* ---------------- Toast / loading ---------------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.92em;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: 320px;
  z-index: 50;
}
.toast.toast-error { background: var(--red); }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
.spinner {
  width: 34px; height: 34px;
  border: 4px solid var(--blue-light);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .content { padding: 14px; }
  .topbar { padding: 10px 14px; }
}

/* ---------------- BT Job Console additions ---------------- */
.danger-heading { color: var(--red); }

input[type="file"] { display: block; margin-bottom: 10px; }

.import-progress { margin-top: 12px; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--grey-light);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--navy);
  width: 0%;
  transition: width 0.2s ease;
}

.badge-new { background: var(--green-bg); color: var(--green); }
.badge-moved { background: var(--amber-bg); color: var(--amber); }
.badge-dropped { background: var(--red-bg); color: var(--red); }

.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }
.delta-flat { color: var(--grey); }

.data-table.dense td, .data-table.dense th { padding: 5px 8px; font-size: 0.9em; }

/* ---------------- Gang member roster (Gangs tab) ---------------- */
.member-chip-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Round 25: each member's chip grew a status row (In Work / Absent /
   Annual Leave + date range + Save + History) underneath the name, so the
   old pill-shaped .member-chip became a small card instead. */
.member-chip-row {
  background: var(--grey-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85em;
}
.member-chip-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.member-chip-name { font-weight: 600; }
.member-chip-remove {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--grey);
  font-size: 1em;
  line-height: 1;
  padding: 2px 4px;
  margin-left: auto;
}
.member-chip-remove:hover { color: var(--red); }
.member-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.member-status-row select.cell-input { width: auto; }
.member-status-dates { display: flex; align-items: center; gap: 4px; }
.member-status-dates input[type="date"] { width: auto; }
.member-status-history {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px dashed var(--border);
  font-size: 0.9em;
  color: var(--grey);
}
.member-status-history li { padding: 1px 0; }
.member-status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.82em;
  font-weight: 600;
  color: #fff;
}
.badge-member-absent { background: var(--red); }
.badge-member-leave { background: #b8860b; }
.member-add-row { display: flex; gap: 6px; }
.member-add-row input { flex: 1; min-width: 120px; }

/* ---------------- Synth Code line completion history (Job Lookup) ---------------- */
.completion-cell { min-width: 320px; }
.completion-total {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
  display: block;
}
.completion-history {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  font-size: 0.85em;
}
.completion-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px dashed var(--border);
}
.completion-history li:last-child { border-bottom: none; }
.completion-history .legacy-tag { color: var(--grey); font-style: italic; }
/* Super-user-only "delete this entry" button — same visual treatment as
   the Gangs member-chip remove button, reused here for a different list. */
.entry-delete-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--grey);
  font-size: 1em;
  line-height: 1;
  padding: 2px 4px;
  flex: none;
}
.entry-delete-btn:hover { color: var(--red); }
.completion-add-row { display: flex; gap: 4px; align-items: center; }
.completion-add-row input[type="number"] { width: 70px; flex: none; }
.completion-add-row select { flex: 1; min-width: 90px; }

/* A card that deliberately breaks out of .content's normal 1100px
   max-width — used for the Job Lookup Synth Code lines card, whose
   Completed/Gang cell (history list + add row) needs more breathing room
   than the standard card width gives it. The margin-left:50% +
   translateX(-50%) pair re-centers a wider box regardless of the parent's
   own max-width, without affecting sibling cards. table-scroll is a
   fallback for narrow viewports so the wider table doesn't force the
   whole page to scroll sideways. */
.wide-card {
  max-width: 1500px;
  width: 100%;
  margin-left: 50%;
  transform: translateX(-50%);
}
.table-scroll { overflow-x: auto; }

/* ---------------- Job Tracker (round 19: inline FX Job Status edit +
   expandable per-order detail row) ---------------- */
.inline-fx-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-fx-status select { max-width: 160px; }
.job-tracker-detail-row td {
  background: var(--grey-light);
  padding: 14px 16px;
}
.job-tracker-detail-row h4:first-child { margin-top: 0; }
.job-tracker-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.job-tracker-detail-grid > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .job-tracker-detail-grid { grid-template-columns: 1fr; }
}

/* ---------------- DFE Required flag (Job Lookup Synth Code lines) ---------------- */
.completion-total-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dfe-required-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 700;
  background: var(--red-bg);
  color: var(--red);
}
.dfe-required-badge.done { opacity: 0.55; }
.dfe-done-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  font-weight: 400;
  color: #333;
}
.dfe-done-check input { width: auto; }

/* ---------------- Whereabouts (weekly team job grid) ---------------- */
.whereabouts-week-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.whereabouts-week-controls input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.95em;
  font-family: inherit;
}
#whereabouts-week-label {
  font-weight: 700;
  color: var(--navy);
  font-size: 1.05em;
  margin: 4px 0 0;
}
.whereabouts-team-card { margin-bottom: 24px; }
.whereabouts-team-card h3 { margin-bottom: 2px; }
.whereabouts-skills { margin-top: 0; }
.whereabouts-slot { margin: 14px 0; }
.whereabouts-table .wa-field-label {
  background: var(--grey-light);
  min-width: 130px;
  white-space: nowrap;
}
.whereabouts-table th { font-size: 0.82em; }

/* Round 27: the job-slot table and the day-status-row table (below) are
   two separate <table> elements, each rendered with its own <colgroup> —
   see renderWhereaboutsSlotTable()/renderWhereaboutsDayStatusRow() in
   app.js. Without forcing both to the SAME fixed column widths, each
   table auto-sizes its own columns from its own content, so the
   day-status row's tick-boxes/notes can end up visually a column or two
   off from the date they actually belong to even though the underlying
   data is correctly keyed to that date either way. table-layout: fixed
   plus matching .wa-label-col/.wa-day-col widths keeps every date column,
   across every table in a gang's card, pinned to the same pixel position. */
.whereabouts-table,
.wa-day-status-row {
  table-layout: fixed;
}
.wa-label-col { width: 130px; }
.wa-day-col { width: 150px; }
.wa-cell {
  width: 100%;
  min-width: 110px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 6px;
  font-size: 0.88em;
  font-family: inherit;
  resize: vertical;
}
.whereabouts-slot-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.wa-add-slot-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Round 25 (generalized Round 26): greys out a whole day's cell, across
   every job-slot table, on any gang whose EVERY member is Absent/Annual
   Leave that day (see isGangClosedOnDate() in app.js — no longer only
   single-member gangs) — the already-saved value (if any) stays visible,
   it's just no longer editable. */
.wa-day-closed {
  background: var(--grey-light) !important;
  opacity: 0.65;
}
.wa-cell:disabled { cursor: not-allowed; }

/* Round 25: the per-gang "who's out this week" strip shown once above the
   job-slot tables, one column per day — see renderWhereaboutsDayStatusRow()
   in app.js. */
.wa-day-status-row .wa-field-label {
  background: var(--grey-light);
  min-width: 90px;
  white-space: nowrap;
}
.wa-day-status-cell { font-size: 0.85em; vertical-align: top; }
.wa-day-status-cell.wa-day-status-out { background: #fff6e0; }
.wa-day-status-note { color: var(--red); font-weight: 600; margin-bottom: 4px; }
.wa-day-status-closed-note { color: var(--grey); font-weight: 400; font-style: italic; }
.wa-day-status-incoming { color: #1a6e3c; font-weight: 600; }
.wa-reassign-row { margin-bottom: 6px; }
.wa-reassign-row:last-child { margin-bottom: 0; }
.wa-reassign-check { display: flex; align-items: center; gap: 4px; font-weight: 400; white-space: nowrap; }
.wa-reassign-select { display: block; margin-top: 4px; width: 100%; min-width: 120px; }
.wa-reassign-job-preview { font-size: 0.92em; color: var(--grey); margin-top: 2px; }

/* Round 26: a small badge above the date on a day header that's an
   England & Wales bank holiday — see englandWalesBankHolidayFor() in
   config.js and renderWhereaboutsSlotTable() in app.js. */
.wa-bank-holiday-badge {
  display: inline-block;
  background: #1a6e3c;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.75em;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
}

/* Round 26: incoming-reassignment sticker (distinct colour from the
   absence badges — see .badge-member-absent/.badge-member-leave). */
.badge-member-incoming { background: #1a6e3c; }

/* Round 26: each gang's whole Whereabouts card can be collapsed — starts
   expanded, so the caret starts pointing down; collapsing it hides
   everything except the header line (name + stickers) — see
   toggleWhereaboutsTeamCollapsed() in app.js. */
.whereabouts-team-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}
.wa-team-title { margin: 0; }
.wa-team-title .wa-caret { transform: rotate(90deg); }
.whereabouts-team-card.wa-team-collapsed .wa-team-title .wa-caret { transform: rotate(0deg); }
.whereabouts-team-card.wa-team-collapsed .whereabouts-team-card-body { display: none; }

/* Round 26: the "Weekly Whereabouts" and "Show gangs" cards' own
   collapse toggle — same caret idea, but simpler (no per-item state, see
   toggleWhereaboutsStaticCardCollapsed() in app.js). Starts expanded. */
.wa-collapse-toggle .wa-caret { transform: rotate(90deg); }
.wa-collapse-toggle.wa-collapse-toggle-collapsed .wa-caret { transform: rotate(0deg); }

/* Each job's table starts collapsed to just its Order ID row — clicking
   the "Job N" toggle adds .wa-expanded to the .whereabouts-slot container,
   which is all that's needed to reveal the rest (see
   toggleWhereaboutsSlotExpanded() in app.js). Purely visual: every field
   stays in the DOM and still gets saved whether or not it's visible. */
.whereabouts-slot .wa-detail-row { display: none; }
.whereabouts-slot.wa-expanded .wa-detail-row { display: table-row; }
.wa-slot-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.wa-slot-toggle:hover { text-decoration: underline; }
.wa-caret {
  display: inline-block;
  font-size: 0.8em;
  transition: transform 0.15s ease;
}
.whereabouts-slot.wa-expanded .wa-caret { transform: rotate(90deg); }

/* Job Lookup's "Job details" card (fifteenth round) — starts collapsed so
   the raw job fields are hidden until clicked, reusing the same
   toggle/caret look as the Whereabouts job-slot collapse above. Clicking
   the heading adds .expanded to #lookup-details-card (see
   toggleJobDetailsExpanded() in app.js); the table itself never leaves the
   DOM, so renderLookup() can keep refreshing its rows regardless of
   whether they're currently visible. */
#lookup-details-card .job-details-table { display: none; }
#lookup-details-card.expanded .job-details-table { display: table; }
#lookup-details-card.expanded .wa-caret { transform: rotate(90deg); }

/* A day that's been soft-deleted shows a plain placeholder in its column
   instead of live inputs — the underlying values are still there in
   Graph (see deleteWhereaboutsDay), just not editable from this table. */
.wa-day-deleted-cell {
  text-align: center;
  color: var(--grey);
  background: var(--grey-light);
  font-size: 0.85em;
  font-style: italic;
}
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-deleted { background: var(--red-bg); color: var(--red); }
.wa-history-deleted td { color: var(--grey); }
/* An Outcome other than N/A, shown on Job Lookup's Whereabouts history —
   deliberately a neutral highlight colour rather than red, since these
   outcomes range from good news (Job Completed) to bad (Gang Did Not
   Attend); the point is just to draw the eye, not imply a verdict. */
.badge-outcome-flag { background: var(--amber-bg); color: var(--amber); }
/* Job Tracker's computed "Type" column (round 20) — Flex/Civils worked out
   purely from a job's Synth Code line(s)' prefix, see
   synthCodeTypeLabel()/jobTrackerTypeCellHtml() in app.js. Two neutral,
   distinct colours (reusing tokens already used elsewhere for other
   badges) so the two types are easy to tell apart at a glance, without
   implying either one is "good" or "bad". */
.badge-type-flex { background: var(--blue-light); color: var(--navy); }
.badge-type-civils { background: var(--grey-light); color: var(--grey); }

/* Round 21: Job Lookup's "In Whereabouts" / "Not Programmed" sticker, next
   to the FX Job Status heading — see renderLookupWhereaboutsPresenceBadge()
   in app.js. Own classes rather than reusing .badge-active/.badge-deleted
   (same colour values, but a distinct name keeps intent clear at each call
   site — same reasoning as .badge-replanned above). Red for "Not
   Programmed" is deliberate, not a neutral colour, since the point of this
   sticker is to flag at a glance that a job hasn't been scheduled into
   Whereabouts yet. */
.badge-in-whereabouts { background: var(--green-bg); color: var(--green); }
.badge-not-programmed { background: var(--red-bg); color: var(--red); }

/* ---------------- Grand total box (Billing tab) ---------------- */
.grand-total-box {
  text-align: center;
  background: var(--blue-light);
  border: 2px solid var(--navy);
}
.grand-total-box h3 { margin-top: 0; }
.grand-total-value {
  font-size: 2.4em;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

/* ---------------- Whereabouts: gang filter (thirteenth round) ---------------- */
/* Reuses .status-check-grid/.status-check (defined above, for Export
   Report/Billing's status checkboxes) rather than a near-duplicate set of
   rules — visually it's the exact same "wrapping grid of checkboxes" shape. */
#whereabouts-gang-filter-card, .card:has(#whereabouts-gang-filter-body) h3 { display: flex; }

/* ---------------- Whereabouts: Permit colouring (thirteenth round) ---------------- */
/* Applied to a day's Order ID cell (always visible, even collapsed) based
   on that same day's Permit dropdown — see permitCellClass()/
   updateWhereaboutsPermitColor() in app.js and
   WHEREABOUTS_PERMIT_CLASS_BY_VALUE in config.js. Plain named-ish colours
   with black text, exactly as asked for — deliberately not reusing the
   --green/--amber/--red *_bg tokens used elsewhere for badges, since
   those are pale backgrounds meant to sit behind dark text in a small
   pill, not fill an entire table cell. */
.wa-permit-granted { background: #4caf50; color: #000; }
.wa-permit-submitted { background: #ff9800; color: #000; }
.wa-permit-refused { background: #e53935; color: #000; }

/* A day's status badge on Job Lookup's Whereabouts history, once it's
   been Cancelled or Replanned via the Replan pop-up (thirteenth round) —
   .badge-cancelled already existed (reused from the leave system's
   status badges); .badge-replanned is new here. */
.badge-replanned { background: var(--blue-light); color: var(--navy); }

/* ---------------- Replan / Cancel pop-up (thirteenth round) ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-box h3 { margin-top: 0; color: var(--navy); }
.replan-type-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 10px 0 16px;
}
#replan-cancelled-fields, #replan-newdate-fields, #replan-deleted-fields {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
#replan-cancelled-fields label, #replan-newdate-fields label, #replan-deleted-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.88em;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}
#replan-cancelled-fields textarea, #replan-newdate-fields textarea, #replan-deleted-fields textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 400;
  resize: vertical;
}
#replan-modal-close-btn { margin-top: 12px; }

/* ---------------- Bulk import ---------------- */
.import-counts { margin: 6px 0 10px; padding-left: 20px; }
.import-counts li { font-size: 0.92em; color: var(--grey); margin-bottom: 2px; }
#import-file { display: block; margin: 10px 0; font-size: 0.92em; }
#import-preview-wrap { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
#import-problems-wrap { margin-top: 12px; }
