/* Band Tracker — warehouse-optimised palette
   Designed for: bright overhead lighting, off-angle viewing, quick glance reads
   Key principles: higher contrast, larger touch targets, saturated status colours */

:root {
  /* Page canvas — neutral cool-gray base avoids warm-yellow washout under
     fluorescent/LED overheads. Slightly darker than pure white to reduce glare. */
  --bg:        #eaebee;
  --surface:   #ffffff;

  /* Text — true near-black at all distances and angles */
  --ink:       #0d1117;
  --muted:     #374151;      /* raised from #4b5563 — secondary text stays legible at 30° */
  --border:    #c0c2c9;
  --rule:      #b0b2b8;

  /* Status — fully saturated so they're distinguishable with glare or at angle */
  --pass:      #15803d;      /* green  — deep enough to read on white */
  --fail:      #b91c1c;      /* red    */
  --pending:   #b45309;      /* amber  */
  --ready:     #1d4ed8;      /* blue   */

  /* Action button color — amber-orange so Submit stands out from the dark header */
  --action:    #d97706;
  --action-hover: #b45309;

  --accent:    #1e293b;      /* header / dark elements */

  --shadow:    0 1px 0 rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.10);
  --radius:    6px;          /* slightly more rounding — easier to target in motion */

  /* Band colour system — shop floor convention */
  --band-t1: #94a3b8;
  --band-t2: #ca8a04;
  --band-t3: #2563eb;
  --band-rx: #16a34a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;           /* raised from 15px — 1px makes a real difference at arm's length */
  line-height: 1.6;
}

.page {
  max-width: 100%;
  margin: 0;
  padding: 1.25rem 0.75rem 4rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.9rem 2rem;
  background: var(--accent);
  color: #f4f3ee;
  border-bottom: 3px solid #0f172a;
  width: 100%;
  box-sizing: border-box;
}
header.bar .brand {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.88rem;
}
/* Primary nav — section links (left zone) */
header.bar .bar-nav-left {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
/* Secondary nav — cross-app + utility links (right zone) */
header.bar .bar-nav-right {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  flex-shrink: 0;
}
header.bar nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  margin-right: 1rem;
}
header.bar nav a:hover { color: #ffffff; }
/* Right nav links are dimmed to distinguish them from primary nav */
header.bar .bar-nav-right a {
  color: #64748b;
}
header.bar .bar-nav-right a:hover { color: #94a3b8; }
header.bar .user {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: #94a3b8;
  flex: 1;
  text-align: center;
  min-width: 0; /* prevent overflow on long usernames */
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}
h1 .meta { color: var(--muted); font-weight: 400; font-size: 1rem; }
h2 {
  font-size: 0.82rem;        /* was 0.78 */
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #374151;            /* was var(--muted) — darker, more visible section label */
  margin: 2rem 0 0.75rem;
  font-weight: 600;          /* was 500 */
}
.subtitle { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.92rem; }

.mono { font-family: "IBM Plex Mono", monospace; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-end;
  pointer-events: none;   /* let clicks pass through the gap between toasts */
}
.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.10);
  font-size: 0.88rem;
  max-width: 360px;
  min-width: 220px;
  line-height: 1.45;
  border-left: 4px solid transparent;
  animation: toast-in 0.2s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.toast-ok      { background: #f0fdf4; border-color: #16a34a; color: #14532d; }
.toast.toast-error   { background: #fef2f2; border-color: #dc2626; color: #7f1d1d; }
.toast.toast-warning { background: #fefce8; border-color: #ca8a04; color: #713f12; }
.toast.toast-info    { background: #eef2ff; border-color: #1e40af; color: #1e3a8a; }
.toast .toast-msg    { flex: 1; }
.toast .toast-close  {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: inherit;
  opacity: 0.55;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  font-weight: 400;
}
.toast .toast-close:hover { opacity: 1; background: transparent; }
.toast.toast-hiding {
  opacity: 0;
  transform: translateX(1rem);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Compact pill variant used in tracker table status cells */
.pill-tracker {
  font-size: 0.62rem;
}
.flash {
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--ready);
  background: #eef2ff;
  font-size: 0.92rem;
}
.flash.error   { background: #fef2f2; border-color: var(--fail); color: #7f1d1d; }
.flash.ok      { background: #f0fdf4; border-color: var(--pass); color: #14532d; }
.flash.warning { background: #fefce8; border-color: #ca8a04;     color: #713f12; }

/* ── Cards / counts ──────────────────────────────────────────────────────── */
.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.count .label {
  font-size: 0.78rem;        /* was 0.72 — raised floor */
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.count .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.7rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: #d8dade;       /* noticeably darker header band — snaps rows apart at a glance */
  font-weight: 700;
  font-size: 0.8rem;         /* raised from 0.78 */
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1e293b;            /* near-black on header — max contrast */
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #e8eaed; }

td.serial, td.sector, .mono-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;         /* was 0.88 */
}

/* Sector group rule */
tr.sector-group-start td {
  border-top: 2px solid var(--rule);
}

/* ── Status pills ────────────────────────────────────────────────────────── */
/* Solid saturated backgrounds — clearly distinguishable under glare or at angle.
   White text on solid color is readable at far greater distances than dark-on-pastel. */
.status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
}
.status.pass     { background: #15803d; color: #ffffff; }
.status.fail     { background: #b91c1c; color: #ffffff; }
.status.ready    { background: #1d4ed8; color: #ffffff; }
.status.assigned { background: #475569; color: #ffffff; }
.status.untested,
.status.empty    { background: #6b7280; color: #ffffff; }
.status.failed   { background: #b91c1c; color: #ffffff; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
form.stack { display: flex; flex-direction: column; gap: 0.9rem; max-width: 480px; }
form.inline { display: inline-flex; gap: 0.35rem; align-items: center; }
label {
  display: block;
  font-size: 0.8rem;         /* raised from 0.78 */
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
  font-weight: 600;
}
input[type="text"], input[type="search"], select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
/* High-visibility focus ring — critical for the scan input in bright environments */
input[type="text"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: 3px solid #1d4ed8;
  outline-offset: 1px;
  border-color: #1d4ed8;
}
input.mono { font-family: "IBM Plex Mono", monospace; }
textarea { min-height: 80px; resize: vertical; }
button, .btn {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;          /* bolder — easier to read on screen in motion */
  padding: 0.55rem 1.2rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #0f172a; }

/* Primary action button — amber so it pops off the dark header/page */
button.primary, .btn-primary {
  background: var(--action);
  color: #ffffff;
}
button.primary:hover, .btn-primary:hover { background: var(--action-hover); }

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
}
button.ghost:hover { background: #d8dade; color: var(--ink); }
button.danger { background: var(--fail); }

/* Inline assign form inside table cells */
td .inline input { width: 130px; padding: 0.3rem 0.4rem; font-size: 0.88rem; }
td .inline button { padding: 0.3rem 0.6rem; font-size: 0.82rem; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}
.toolbar .search { flex: 1; max-width: 360px; }

/* Progress dot for batch fill */
.progress {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;        /* was 0.78 */
  color: var(--muted);
  margin-left: 0.5rem;
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

/* Small divider line above sector type groups */
.sector-label {
  display: inline-block;
  padding: 0 0.4rem;
  background: #dbeafe;
  color: #1e3a8a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;        /* was 0.72 */
  font-weight: 600;
  border-radius: 2px;
}

/* ── Utility classes ─────────────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 0.82rem; }
.text-xs     { font-size: 0.72rem; }
.text-mono   { font-family: "IBM Plex Mono", monospace; }
.uppercase   { text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Band dot component ──────────────────────────────────────────────────── */
.band-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.band-dot.T1 { background: var(--band-t1); }
.band-dot.T2 { background: var(--band-t2); }
.band-dot.T3 { background: var(--band-t3); }
.band-dot.RX { background: var(--band-rx); }

/* ── Pill component (shared across pages) ────────────────────────────────── */
/* Solid-color pills — saturated enough to distinguish at arm's length with glare */
.pill {
  display: inline-block;
  padding: 0.18rem 0.5rem;   /* tighter — reduces column width without losing readability */
  border-radius: 3px;
  font-size: 0.78rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.pill-wip      { background: #d97706; color: #ffffff; }
.pill-done     { background: #15803d; color: #ffffff; }
.pill-pass     { background: #15803d; color: #ffffff; }
.pill-fail     { background: #b91c1c; color: #ffffff; }
.pill-failed   { background: #b91c1c; color: #ffffff; }
.pill-pending  { background: #6b7280; color: #ffffff; }
.pill-rework   { background: #d97706; color: #ffffff; }
.pill-deferred { background: #7c3aed; color: #ffffff; }
.pill-active   { background: #15803d; color: #ffffff; }
.pill-removed  { background: #b91c1c; color: #ffffff; }
.pill-delivered { background: #1d4ed8; color: #ffffff; }
.pill-retest   { background: #d97706; color: #ffffff; }

/* ── Rework badge ────────────────────────────────────────────────────────── */
.rw-badge {
  display: inline-block;
  font-size: 0.62rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 2px;
  padding: 0 0.3rem;
  margin-left: 0.3rem;
  font-family: "IBM Plex Mono", monospace;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Truncation notice ───────────────────────────────────────────────────── */
.truncation-notice {
  margin: 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: #713f12;
}
