/* Carlson Production Tracker — single stylesheet
 * Base (auth, layout, nav, cards, tables, forms, modal, timeline, toast) is the
 * RMA portal stylesheet so the two tools look like one family.
 * Brand: primary #005495, secondary #0099CC, accent #FF9F55
 */
:root {
  --c-primary:#005495;
  --c-primary-dark:#003e6f;
  --c-secondary:#0099CC;
  --c-accent:#FF9F55;
  --c-ok:#16a34a;
  --c-warn:#f59e0b;
  --c-bad:#dc2626;
  --c-bg:#f1f5f9;
  --c-card:#ffffff;
  --c-line:#e2e8f0;
  --c-text:#0f172a;
  --c-muted:#64748b;
  --c-soon:#fef3c7;
  --c-over:#fee2e2;
  --shadow-sm:0 1px 3px rgba(15,23,42,.08);
  --shadow-md:0 4px 12px rgba(15,23,42,.10);
  --radius:8px;
}
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  font-family:'Segoe UI', Arial, sans-serif;
  font-size:14px;
  color:var(--c-text);
  background:var(--c-bg);
  -webkit-font-smoothing:antialiased;
}

/* ---------- AUTH ---------- */
.auth-body {
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
}
.auth-card {
  background:#fff; padding:36px 32px; border-radius:12px;
  box-shadow:var(--shadow-md); width:380px;
}
.auth-brand { text-align:center; margin-bottom:24px; }
.auth-logo {
  font-weight:800; letter-spacing:3px; color:var(--c-primary);
  font-size:22px; margin-bottom:8px;
}
.auth-logo-img {
  display:block; max-width:230px; max-height:90px;
  margin:0 auto 14px; object-fit:contain;
}
.auth-brand h1 { font-size:18px; margin:0 0 4px; color:var(--c-text); }
.auth-brand p { color:var(--c-muted); margin:0; font-size:13px; }
.auth-card form label {
  display:block; margin:14px 0; color:var(--c-muted); font-size:12px;
  text-transform:uppercase; letter-spacing:.5px;
}
.auth-card form input {
  margin-top:4px; padding:10px 12px; width:100%;
  border:1px solid var(--c-line); border-radius:6px; font-size:14px;
}
.auth-card form input:focus {
  outline:none; border-color:var(--c-primary);
  box-shadow:0 0 0 3px rgba(0,84,149,.15);
}
.auth-error { color:var(--c-bad); margin:8px 0 0; min-height:18px; font-size:13px; }
.auth-footer { text-align:center; color:var(--c-muted); margin-top:24px; font-size:11px; }

/* ---------- LAYOUT ---------- */
#app { display:grid; grid-template-columns:230px 1fr; min-height:100vh; }
.sidebar {
  background:var(--c-primary-dark);
  color:#cbd5e1;
  display:flex; flex-direction:column;
  padding:18px 0;
}
.brand {
  padding:0 20px 18px;
  border-bottom:1px solid rgba(255,255,255,.08);
  margin-bottom:8px;
}
.brand-logo { color:#fff; font-weight:800; letter-spacing:3px; font-size:18px; }
.brand-sub { color:#94a3b8; font-size:11px; letter-spacing:1px; margin-top:2px; }

#nav { flex:1; }
#nav button {
  display:flex; align-items:center; gap:10px;
  width:100%; padding:11px 20px;
  background:none; border:0; color:#cbd5e1;
  font-size:14px; cursor:pointer; text-align:left;
}
#nav button .ico { width:14px; opacity:.7; }
#nav button:hover { background:rgba(255,255,255,.06); color:#fff; }
#nav button.active {
  background:var(--c-primary); color:#fff;
  border-left:3px solid var(--c-accent); padding-left:17px;
}
.sidebar-bottom {
  padding:18px 20px;
  border-top:1px solid rgba(255,255,255,.08);
  font-size:12px;
}
.me { color:#cbd5e1; margin-bottom:6px; line-height:1.4; }
.me .role { display:block; color:#94a3b8; font-size:11px; text-transform:uppercase; }
.link-btn {
  background:none; border:0; color:var(--c-accent);
  cursor:pointer; padding:0; font-size:12px;
}
.link-btn:hover { text-decoration:underline; }
a.link-btn { color:var(--c-primary); font-weight:600; font-size:inherit; }

.content { padding:24px 28px; overflow:auto; min-width:0; }
.page-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:18px; gap:12px; flex-wrap:wrap;
}
.page-header h2 { margin:0; font-size:22px; color:var(--c-primary-dark); }

/* ---------- FILTERS BAR ---------- */
.filters-bar {
  display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end;
}
.filters-bar > label {
  display:flex; flex-direction:column;
  font-size:10px; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.5px;
  font-weight:600;
}
.filters-bar > label > input,
.filters-bar > label > select { margin-top:3px; }
.filters-bar input,
.filters-bar select {
  padding:7px 10px; border:1px solid var(--c-line); border-radius:6px;
  font-size:13px; background:#fff; font-family:inherit; min-width:130px;
  color:var(--c-text); letter-spacing:0; text-transform:none; font-weight:normal;
}
.filters-bar input:focus, .filters-bar select:focus {
  outline:none; border-color:var(--c-primary);
}
.filters-bar > label.chk {
  flex-direction:row; align-items:center; gap:6px;
  font-size:13px; color:var(--c-text);
  text-transform:none; letter-spacing:0; font-weight:normal;
}
.filters-bar > label.chk input { width:auto; margin-top:0; min-width:0; }
.filters-bar input[type=color] { min-width:0; width:38px; height:34px; padding:2px; }

/* ---------- KPIs ---------- */
.kpis {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:12px; margin-bottom:18px;
}
.kpi {
  background:var(--c-card); border:1px solid var(--c-line);
  border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow-sm);
}
.kpi .v { font-size:28px; font-weight:700; color:var(--c-primary-dark); }
.kpi .l { font-size:11px; color:var(--c-muted); text-transform:uppercase; letter-spacing:.5px; margin-top:2px; }
.kpi.bad .v  { color:var(--c-bad); }
.kpi.warn .v { color:var(--c-warn); }
.kpi.ok .v   { color:var(--c-ok); }

/* ---------- CARDS / GRID ---------- */
/* minmax(0,1fr), not 1fr: a wide table in one card must scroll inside it, not
   squeeze the other card down to a sliver (Settings looked like that once). */
.grid-2 { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; margin-bottom:14px; align-items:start; }
.grid-2 > .card { min-width:0; }
.card {
  background:var(--c-card); border:1px solid var(--c-line);
  border-radius:var(--radius); box-shadow:var(--shadow-sm);
  padding:16px; margin-bottom:14px;
}
.card h3 {
  margin:0 0 12px; font-size:13px;
  color:var(--c-muted); text-transform:uppercase; letter-spacing:.6px;
}
.card.no-pad { padding:0; }

/* Dashboard stage tiles */
.kanban {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:8px;
}
.kanban .kcol {
  background:#f8fafc; border:1px solid var(--c-line);
  border-radius:6px; padding:8px 10px;
  border-left:3px solid #e2e8f0; cursor:pointer;
}
.kanban .kcol:hover { background:#f1f5f9; }
.kanban .kcol h4 {
  margin:0 0 4px; font-size:10.5px; color:var(--c-muted);
  text-transform:uppercase; font-weight:600; line-height:1.2;
}
.kanban .kcol .n { font-size:20px; font-weight:700; color:var(--c-text); }
.kanban .kcol .d { font-size:10.5px; color:var(--c-muted); }
.kanban .kcol .d.warn { color:#92400e; font-weight:600; }

/* ---------- BARS ---------- */
.bar-row { margin:6px 0; }
.bar-row .lbl {
  display:flex; justify-content:space-between;
  font-size:12px; color:var(--c-text); margin-bottom:3px;
}
.bar { background:#e2e8f0; height:8px; border-radius:3px; overflow:hidden; }
.bar > div { background:var(--c-primary); height:100%; }
.row-link { cursor:pointer; }
.row-link:hover td { background:#f1f5f9; }

.wk-bars { display:flex; align-items:flex-end; gap:6px; height:130px; padding-top:6px; }
.wk-bar {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end;
  height:100%; font-size:10px; color:var(--c-muted); min-width:0;
}
.wk-bar > i { display:block; width:100%; background:var(--c-primary); border-radius:3px 3px 0 0; min-height:2px; }
.wk-bar b { color:var(--c-text); font-size:11px; margin-bottom:2px; }
.wk-bar span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }

/* Sortable table headers */
th.sortable { cursor:pointer; user-select:none; white-space:nowrap; }
th.sortable:hover { color:var(--c-primary); }

/* ---------- TABLES ---------- */
.data-table { width:100%; border-collapse:collapse; }
.data-table th, .data-table td {
  padding:10px 12px; text-align:left; border-bottom:1px solid var(--c-line);
  font-size:13px; vertical-align:top;
}
.data-table th {
  background:#f8fafc; color:var(--c-muted); font-weight:600;
  text-transform:uppercase; font-size:11px; letter-spacing:.5px;
  position:sticky; top:0; z-index:2;
}
/* Inside a scrolling box a collapsed-border table loses the header's bottom
   border as it sticks; separate borders keep the rule under the header. */
.scroll-200 .data-table { border-collapse:separate; border-spacing:0; }
.data-table tr:hover { background:#f1f5f9; }
.data-table tbody tr.row-link { cursor:pointer; }
.data-table.compact th, .data-table.compact td { padding:6px 10px; }
.data-table td .progress { width:110px; display:inline-block; vertical-align:middle; margin-right:6px; }

/* ---------- PILLS / STAGES / BADGES ---------- */
.pill {
  display:inline-block; padding:2px 9px;
  border-radius:12px; font-size:11px; font-weight:600;
}
.pill.open      { background:#dbeafe; color:#1e40af; }
.pill.complete  { background:#dcfce7; color:#15803d; }
.pill.cancelled { background:#f1f5f9; color:#64748b; }

.stage {
  display:inline-block; padding:2px 9px; border-radius:4px;
  color:#fff; font-size:11px; font-weight:600;
  background:#94a3b8; white-space:nowrap;
}
.stage-chips { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:4px; }
.stage-chips .stage { font-size:10.5px; }
.stage.stage-done { background:#16a34a; }   /* finished unit, whatever column it ended in */

/* Completed units register at the foot of the dashboard */
.done-filters { margin:6px 0 10px; }
.done-pager { display:flex; gap:8px; align-items:center; justify-content:flex-end; padding:8px 0 12px; font-size:12.5px; color:var(--c-muted); }
.done-pager:empty { display:none; }

.badge {
  display:inline-block; font-size:9.5px; font-weight:700; padding:1px 5px;
  border-radius:3px; letter-spacing:.3px; text-transform:uppercase; white-space:nowrap;
}
.badge.production { background:#e0f2fe; color:#075985; }
.badge.rework { background:#fef3c7; color:#92400e; }
.badge.rma    { background:#fee2e2; color:#991b1b; }
.badge.test   { background:#e0e7ff; color:#3730a3; }
.badge.short  { background:var(--c-bad); color:#fff; }
.badge.done   { background:#dcfce7; color:#15803d; }
.badge.days   { background:#f1f5f9; color:var(--c-muted); }
.badge.days.warn { background:#fef3c7; color:#92400e; }
.badge.days.bad  { background:#fee2e2; color:#991b1b; }
.badge.cmt    { background:#f1f5f9; color:var(--c-muted); text-transform:none; }

.avatar {
  width:20px; height:20px; border-radius:50%; background:var(--c-primary); color:#fff;
  font-size:9px; font-weight:700; display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 20px; letter-spacing:.2px;
}
.avatar.none { background:#cbd5e1; color:#475569; }

/* ---------- FORMS ---------- */
.form-grid {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px 14px;
}
.form-grid label {
  display:flex; flex-direction:column; font-size:11px; min-width:0;
  color:var(--c-muted); text-transform:uppercase; letter-spacing:.5px;
}
.form-grid label.span-2, .form-grid .span-2 { grid-column:span 2; }
/* A label-styled block that is NOT a <label> — for groups of radios, where a
   wrapping <label> would nest labels and mis-target clicks. */
.form-grid .fg-label {
  display:flex; flex-direction:column; font-size:11px; min-width:0;
  color:var(--c-muted); text-transform:uppercase; letter-spacing:.5px;
}
.form-grid input, .form-grid select, .form-grid textarea {
  margin-top:5px; padding:8px 10px;
  border:1px solid var(--c-line); border-radius:6px;
  font-size:14px; font-family:inherit; background:#fff;
  text-transform:none; letter-spacing:0; color:var(--c-text);
  width:100%; min-width:0; max-width:100%; box-sizing:border-box;
}
.form-grid textarea { min-height:70px; resize:vertical; }
/* A checkbox with its sentence beside it, inside a form grid or a table cell. */
label.chk-inline, .form-grid label.chk-inline {
  flex-direction:row; align-items:center; gap:8px; display:flex;
  text-transform:none; letter-spacing:0; font-size:13px; color:var(--c-text); cursor:pointer;
}
.form-grid label.chk-inline input[type=checkbox], label.chk-inline input[type=checkbox] {
  width:auto; min-width:0; margin:0; padding:0; flex:none;
}
td.extra-roles label.chk-inline { display:inline-flex; margin-right:10px; font-size:12px; }
/* Settings → Email notifications: the editable wording and its preview */
.et-intro .sub-h { margin-top:6px; }
.et-intro .hint code { font-size:11.5px; background:#eef2f7; padding:0 4px; border-radius:3px; }
.et-block .muted { text-transform:none; letter-spacing:0; }
.et-actions { display:flex; gap:12px; align-items:center; margin-top:6px; }
.email-preview { margin-top:12px; border:1px solid var(--c-line); border-radius:8px; padding:10px 12px; background:#f8fafc; }
.email-preview .ep-head { display:flex; gap:8px; align-items:center; font-size:13px; }
.email-preview .ep-head .modal-close { margin-left:auto; }
.email-preview iframe { display:block; width:100%; height:380px; border:1px solid var(--c-line); border-radius:6px; background:#fff; margin-top:8px; }
.form-grid .hint { text-transform:none; letter-spacing:0; }
.form-actions { margin-top:6px; }
.radio-row { display:flex; gap:18px; flex-wrap:wrap; margin-top:8px; }
.radio-row label {
  flex-direction:row; align-items:center; gap:6px;
  text-transform:none; letter-spacing:0; color:var(--c-text); font-size:13px;
}
.radio-row label input { width:auto; margin:0; }
.hint { font-size:12px; color:var(--c-muted); margin-top:4px; line-height:1.4; }
.hint b { color:var(--c-primary-dark); }
.muted { color:var(--c-muted); }

.inline-form { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:8px; }
.inline-form input, .inline-form select, .inline-form textarea {
  padding:7px 10px; border:1px solid var(--c-line); border-radius:6px;
  font-size:13px; font-family:inherit; background:#fff;
}
.inline-form textarea { resize:vertical; }

/* ---------- BUTTONS ---------- */
.btn-primary {
  background:var(--c-primary); color:#fff; border:0;
  padding:9px 18px; border-radius:6px; font-size:14px;
  font-weight:600; cursor:pointer;
}
.btn-primary:hover { background:var(--c-primary-dark); }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; }
.btn-ghost {
  background:#fff; color:var(--c-text);
  border:1px solid var(--c-line);
  padding:8px 14px; border-radius:6px; font-size:13px; cursor:pointer;
}
.btn-ghost:hover { background:#f1f5f9; }
.btn-ghost:disabled { opacity:.5; cursor:not-allowed; }
.btn-sm { padding:4px 9px; font-size:12px; }

/* ---------- MODAL ---------- */
.modal-bg {
  position:fixed; inset:0; background:rgba(15,23,42,.65);
  display:flex; align-items:center; justify-content:center;
  z-index:50; padding:20px;
}
.modal-bg.stacked { z-index:60; background:rgba(15,23,42,.55); }
.modal {
  background:#fff; border-radius:10px; width:680px; max-width:100%;
  max-height:92vh; display:flex; flex-direction:column;
  box-shadow:var(--shadow-md);
}
.modal-wide { width:920px; }
.modal-header {
  padding:16px 20px; border-bottom:1px solid var(--c-line);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.modal-header h3 { margin:0; color:var(--c-primary-dark); }
.modal-header .hint { margin-top:3px; }
.modal-close {
  background:none; border:0; font-size:24px;
  color:var(--c-muted); cursor:pointer;
}
.modal-body { padding:20px; overflow:auto; flex:1; }
.modal-body h4 {
  margin:22px 0 10px; font-size:13px; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.6px;
  border-top:1px solid var(--c-line); padding-top:14px;
}
.modal-body h4:first-of-type { border-top:0; padding-top:0; }
.modal-footer {
  padding:14px 20px; border-top:1px solid var(--c-line);
  display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap;
}

/* ---------- TIMELINE / HISTORY ---------- */
.timeline { list-style:none; padding:0 0 0 16px; border-left:2px solid var(--c-line); margin:0; }
.timeline li { position:relative; padding:0 0 12px 14px; font-size:13px; }
.timeline li::before {
  content:''; position:absolute; left:-22px; top:5px;
  width:10px; height:10px; border-radius:50%;
  background:var(--c-primary); border:2px solid #fff;
  box-shadow:0 0 0 1px var(--c-line);
}
.timeline .ts { color:var(--c-muted); font-size:11px; }
.timeline .who { color:var(--c-primary-dark); font-weight:600; }

/* ---------- COMMENTS ---------- */
.comments { display:flex; flex-direction:column; gap:8px; margin-bottom:8px; }
.comment {
  background:#f8fafc; border-left:3px solid var(--c-secondary);
  padding:8px 12px; border-radius:4px; font-size:13px;
}
.comment .meta { font-size:11px; color:var(--c-muted); margin-bottom:3px; }
.comment .cm-body { white-space:pre-wrap; overflow-wrap:anywhere; }
.comment.build-level { border-left-color:var(--c-accent); }
/* A question or action stands out from the notes around it; its border colour is set inline by type. */
.comment.flagged { background:#fff; box-shadow:var(--shadow-sm); }
.comment .type-badge {
  font-size:9.5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px;
  border-radius:3px; padding:1px 5px; margin-left:4px;
}
.comment-tagged { font-size:11px; color:var(--c-muted); margin-top:5px; }
.mention-tag { color:#1d4ed8; background:#eff6ff; border-radius:3px; padding:0 4px; font-weight:600; white-space:nowrap; }

/* ---------- DISCUSSION COMPOSER (@mentions) ---------- */
.comment-composer { display:flex; flex-direction:column; gap:6px; margin-bottom:6px; }
.cc-typebox { position:relative; }   /* anchors the @ menu to the textarea */
.cc-typebox textarea {
  width:100%; box-sizing:border-box; font:inherit; font-size:13px; padding:8px 10px;
  resize:vertical; border:1px solid var(--c-line); border-radius:6px; min-height:56px;
}
.cc-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.cc-type { font-size:11px; color:var(--c-muted); display:flex; align-items:center; gap:6px; }
.cc-type select { max-width:250px; font-size:12px; }
.cc-chips { display:flex; gap:6px; flex-wrap:wrap; flex:1; min-width:0; }
.chip.mention-chip {
  display:inline-flex; align-items:center; gap:5px; border-radius:12px; padding:3px 10px;
  font-size:12px; background:#eff6ff; color:#1d4ed8; font-weight:600;
}
.chip.mention-chip a { cursor:pointer; color:inherit; text-decoration:none; }
.cc-note { font-size:11px; color:var(--c-muted); }
/* Sits over the modal rather than pushing it about as it filters. */
.mention-menu {
  position:absolute; z-index:50; left:0; right:0; top:100%; margin-top:2px;
  background:#fff; border:1px solid var(--c-line); border-radius:6px;
  box-shadow:var(--shadow-md); max-height:220px; overflow-y:auto;
}
.mention-opt { padding:6px 10px; font-size:12px; cursor:pointer; display:flex; justify-content:space-between; gap:10px; align-items:baseline; }
.mention-opt span { color:var(--c-muted); font-size:11px; }
.mention-opt.sel, .mention-opt:hover { background:#eff6ff; }

/* ---------- TOAST ---------- */
#toast {
  position:fixed; bottom:22px; right:22px;
  background:var(--c-primary-dark); color:#fff;
  padding:11px 18px; border-radius:6px; font-size:13px;
  box-shadow:var(--shadow-md); z-index:100; max-width:420px;
}

/* ---------- MISC ---------- */
.scroll-200 { max-height:340px; overflow:auto; }
.empty { color:var(--c-muted); padding:20px; text-align:center; }
.section-title { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.section-title h3 { margin-bottom:0; }
.color-dot { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:middle; margin-right:5px; }

.settings-table input[type=text], .settings-table input[type=number], .settings-table select {
  padding:5px 7px; border:1px solid var(--c-line); border-radius:5px; font-size:12px; font-family:inherit;
}
.settings-table input[type=text] { min-width:120px; }
.settings-table input[type=number] { width:60px; }
.settings-table input[type=color] { width:32px; height:24px; padding:0; border:1px solid var(--c-line); border-radius:4px; background:none; }
.settings-table tr.off { opacity:.55; }
/* Settings → Checklist & columns: drag the ⠿ handle, or ▲ ▼, to reorder */
.settings-table .ord-cell { white-space:nowrap; }
.settings-table .drag-handle { cursor:grab; color:var(--c-muted); font-size:16px; padding:0 6px 0 2px; user-select:none; vertical-align:middle; }
.settings-table .ord-n { display:inline-block; min-width:18px; text-align:right; font-weight:600; margin-right:4px; }
.settings-table .ord-btn {
  border:1px solid var(--c-line); background:#fff; color:var(--c-muted); border-radius:4px;
  font-size:9px; line-height:1; padding:3px 5px; margin-left:2px; cursor:pointer;
}
.settings-table .ord-btn:disabled { opacity:.3; cursor:default; }
.settings-table tr.dragging { opacity:.45; }
.settings-table tr.dragging td { background:#eff6ff; }

/* ---------- HELP PAGE ---------- */
.help-quickstart { border-top:3px solid var(--c-primary); }
#tab-help ul, #tab-help ol { margin:6px 0 10px; padding-left:20px; }
#tab-help li { margin:5px 0; font-size:13px; line-height:1.45; }
#tab-help p { margin:6px 0; }

/* ============================================================
   BOARD (the Trello replacement)
   ============================================================ */
/* Columns wrap onto further rows rather than scrolling sideways, and stretch
   to share the width they have (200-320px each). */
.board {
  display:flex; flex-wrap:wrap; gap:10px; padding-bottom:12px;
  align-items:flex-start; min-height:40vh;
}
.bcol {
  flex:1 1 220px; min-width:200px; max-width:320px;
  background:#e9eef4; border-radius:8px;
  border-top:4px solid #94a3b8; display:flex; flex-direction:column;
  max-height:min(72vh, 760px);
}
/* An empty column collapses to a 38px sliver with its name running up the
   side (Trello's collapsed-list treatment). It remains a drop target. */
/* State class is "is-empty", not "empty": .empty is the padded, centred,
   muted utility used for "nothing to show" table rows and would restyle the
   whole column. */
.bcol.is-empty .bcol-h { cursor:pointer; }
.bcol.is-empty .bcol-h:hover { color:var(--c-primary); }
.bcol.collapsed { --sliver:38px; flex:0 0 var(--sliver); min-width:var(--sliver); max-width:var(--sliver); }
/* The header stays a normal horizontal box (the column stretches it to the
   sliver width); only the label inside is rotated. */
.bcol.collapsed .bcol-h {
  display:block; position:relative; height:180px; padding:0; overflow:hidden;
}
.bcol.collapsed .bcol-h span:first-child {
  position:absolute; left:50%; top:50%; width:168px;
  transform:translate(-50%, -50%) rotate(-90deg);
  text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  font-size:10.5px; letter-spacing:.3px; line-height:1;
}
.bcol.collapsed .bcol-n, .bcol.collapsed .bcol-body { display:none; }
.bcol-h {
  display:flex; justify-content:space-between; align-items:center; gap:6px;
  padding:9px 10px 6px; font-size:11px; font-weight:700; color:var(--c-primary-dark);
  text-transform:uppercase; letter-spacing:.4px; line-height:1.2;
}
.bcol-n { background:#fff; border-radius:10px; padding:0 7px; font-size:11px; color:var(--c-muted); flex:0 0 auto; }
.bcol-body {
  padding:0 8px 8px; overflow-y:auto; flex:1; min-height:48px;
  display:flex; flex-direction:column; gap:6px;
}
.bcol.over { outline:2px dashed var(--c-primary); outline-offset:-2px; }
.bcol.over .bcol-body { background:rgba(0,84,149,.06); border-radius:6px; }

.ucard {
  background:#fff; border-radius:6px; padding:8px 9px; box-shadow:var(--shadow-sm);
  cursor:pointer; border-left:3px solid transparent; font-size:12px;
}
.ucard:hover { box-shadow:var(--shadow-md); }
.ucard.dragging { opacity:.45; }
.ucard.short { border-left-color:var(--c-bad); }
.ucard.done  { border-left-color:var(--c-ok); opacity:.8; }
.ucard.stale { border-left-color:var(--c-warn); }
.uc-top { display:flex; justify-content:space-between; gap:6px; font-size:10.5px; color:var(--c-muted); }
.uc-prod { font-weight:600; color:var(--c-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.uc-build { font-weight:600; color:var(--c-primary); flex:0 0 auto; }
.uc-serial { font-size:15px; font-weight:700; color:var(--c-text); margin:2px 0 0; letter-spacing:.3px; }
.uc-pn { font-size:10.5px; color:var(--c-muted); margin-bottom:6px; }
.uc-foot { display:flex; align-items:center; gap:4px; margin-top:6px; flex-wrap:wrap; }
.uc-pct { font-size:10.5px; color:var(--c-muted); margin-right:auto; }

.progress { background:#e2e8f0; height:6px; border-radius:3px; overflow:hidden; }
.progress > i { display:block; height:100%; background:var(--c-secondary); border-radius:3px; transition:width .2s; }
.progress.full > i { background:var(--c-ok); }
.big-progress { display:flex; align-items:center; gap:12px; margin:12px 0 6px; }
.big-progress .progress { flex:1; height:10px; }
.big-progress b { font-size:14px; color:var(--c-primary-dark); min-width:96px; text-align:right; white-space:nowrap; }

/* Unit modal */
.unit-top { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.unit-top label {
  display:flex; flex-direction:column; font-size:11px; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.5px;
}
.unit-top select {
  margin-top:5px; padding:8px 10px; border:1px solid var(--c-line); border-radius:6px;
  font-size:14px; font-family:inherit; background:#fff; color:var(--c-text);
  text-transform:none; letter-spacing:0;
}

.checklist { display:flex; flex-direction:column; gap:4px; }
.check-row {
  display:grid; grid-template-columns:auto 1fr auto auto; gap:10px; align-items:center;
  padding:7px 10px; background:#f8fafc; border-radius:6px; font-size:13px;
}
.check-row.done .cr-name { text-decoration:line-through; color:var(--c-muted); }
.check-row input[type=checkbox] { width:16px; height:16px; cursor:pointer; }
.check-row input[type=checkbox]:disabled { cursor:not-allowed; }
.cr-name { font-weight:600; }
.cr-role { font-size:10px; color:var(--c-muted); text-transform:uppercase; letter-spacing:.4px; }
.cr-meta { font-size:11px; color:var(--c-muted); white-space:nowrap; min-width:120px; text-align:right; }
.cr-target { font-size:10.5px; color:var(--c-primary); }
/* "on every open unit in this build" — offered on per-build steps (Pick, PIC Keyed). */
.cr-all { display:flex; align-items:center; gap:6px; margin-top:4px; font-size:11.5px; color:var(--c-primary-dark); cursor:pointer; }
.check-row .cr-all input[type=checkbox] { width:13px; height:13px; margin:0; }

.shortage-row {
  display:grid; grid-template-columns:auto 1fr auto auto; gap:10px; align-items:center;
  padding:7px 10px; background:#fff7ed; border:1px solid #fed7aa; border-radius:6px;
  font-size:13px; margin-bottom:4px;
}
.shortage-row.resolved { background:#f0fdf4; border-color:#bbf7d0; opacity:.85; }
.shortage-row.resolved .sr-desc { text-decoration:line-through; color:var(--c-muted); }
.sr-meta { font-size:11px; color:var(--c-muted); }
.sr-scope { font-size:9.5px; font-weight:700; text-transform:uppercase; color:#9a3412; background:#ffedd5; padding:1px 5px; border-radius:3px; }

/* Print: drop the chrome */
@media print {
  .sidebar, .page-header button, .filters-bar { display:none !important; }
  #app { display:block; }
  .content { padding:0; }
  .card { box-shadow:none; break-inside:avoid; }
}

/* hidden attribute must win over our .modal-bg { display:flex } and similar rules */
[hidden] { display: none !important; }

@media (max-width:900px) {
  #app { grid-template-columns:60px 1fr; }
  .sidebar { padding:10px 0; }
  .brand { padding:0 10px 12px; }
  .brand-sub { display:none; }
  #nav button { padding:11px; justify-content:center; font-size:0; }
  #nav button .ico { font-size:16px; opacity:1; }
  .grid-2 { grid-template-columns:minmax(0,1fr); }
  .form-grid { grid-template-columns:minmax(0,1fr); }
  .form-grid label.span-2 { grid-column:span 1; }
  .unit-top { grid-template-columns:minmax(0,1fr); }
  .bcol { flex-basis:200px; }
}

/* ---------- BOARDS (per product family) ---------- */
.board-group { margin-bottom:12px; }
.board-group-h {
  font-size:12px; font-weight:700; color:var(--c-primary-dark);
  margin:4px 0 6px; padding-top:6px; border-top:1px dashed var(--c-line);
}
.board-group:first-child .board-group-h { border-top:0; padding-top:0; }
.card .sub-h {
  margin:16px 0 6px; font-size:11px; font-weight:700; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.5px;
}

/* ============================================================
   FEEDBACK ROUND 1 (Oct 2026): notifications, builds view,
   build-level builder, pick sheets, in-order checklist
   ============================================================ */

/* Notifications thread */
.feed { display:flex; flex-direction:column; }
.feed-item {
  display:grid; grid-template-columns:28px 1fr auto; gap:10px; align-items:start;
  padding:10px 14px; border-bottom:1px solid var(--c-line); font-size:13px; line-height:1.4;
}
.feed-item:last-child { border-bottom:0; }
.feed-item.unread { background:#eff6ff; box-shadow:inset 3px 0 0 var(--c-primary); }
.feed-item .fi-when { color:var(--c-muted); font-size:11px; white-space:nowrap; }
.feed-item .fi-who { font-weight:700; color:var(--c-primary-dark); }
.feed-item .fi-ctx { color:var(--c-muted); }
.feed-item .fi-ctx a { color:var(--c-primary); font-weight:600; cursor:pointer; text-decoration:none; }
.feed-item .fi-ctx a:hover { text-decoration:underline; }
.feed-day {
  padding:6px 14px; background:#f8fafc; font-size:11px; font-weight:700; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.5px; border-bottom:1px solid var(--c-line);
  position:sticky; top:0;
}
.feed-more { padding:12px; text-align:center; }

/* Builds view: column picker + wide table */
.table-wrap { overflow-x:auto; }
.col-picker { position:relative; }
.col-menu {
  position:absolute; right:0; top:calc(100% + 4px); z-index:40;
  background:#fff; border:1px solid var(--c-line); border-radius:8px; box-shadow:var(--shadow-md);
  padding:8px 6px; min-width:200px;
}
.col-menu label {
  display:flex; align-items:center; gap:8px; padding:5px 8px; border-radius:5px;
  font-size:13px; color:var(--c-text); text-transform:none; letter-spacing:0; font-weight:normal; cursor:pointer;
}
.col-menu label:hover { background:#f1f5f9; }
.col-menu label input { width:auto; min-width:0; margin:0; }
#tbl-builds th.sortable { cursor:pointer; }
.data-table td.nowrap, .data-table th.nowrap { white-space:nowrap; }
/* Inside a table a long column name wraps within its pill; a no-wrap pill would
   force the whole column wide and squeeze the serial next to it into pieces. */
#stuck td .stage, #bm-units td .stage, #tbl-units td .stage { white-space:normal; line-height:1.3; }
/* The side-by-side dashboard cards get cramped once a browser side panel eats the width. */
@media (max-width:1100px) {
  #tab-dashboard .grid-2 { grid-template-columns:minmax(0,1fr); }
}
#tbl-builds td.col-product { min-width:200px; }
#tbl-builds td.col-stages  { min-width:220px; max-width:480px; }

/* Build modal: builder row + pick sheet list */
.build-top { display:grid; grid-template-columns:minmax(220px, 320px) 1fr; gap:12px; align-items:end; margin:12px 0 4px; }
.build-top label {
  display:flex; flex-direction:column; font-size:11px; color:var(--c-muted);
  text-transform:uppercase; letter-spacing:.5px;
}
.build-top select {
  margin-top:5px; padding:8px 10px; border:1px solid var(--c-line); border-radius:6px;
  font-size:14px; font-family:inherit; background:#fff; color:var(--c-text);
  text-transform:none; letter-spacing:0;
}
.file-row {
  display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center;
  padding:8px 10px; background:#f8fafc; border:1px solid var(--c-line); border-radius:6px;
  font-size:13px; margin-bottom:4px;
}
.file-row .fr-ico { font-size:20px; }
.file-row .fr-meta { font-size:11px; color:var(--c-muted); }
.file-row .fr-actions { display:flex; gap:6px; flex-wrap:wrap; }
#bm-file { max-width:260px; font-size:12px; }

/* Checklist: next step highlighted, the rest locked until it's their turn */
.check-row.is-next { background:#eff6ff; box-shadow:inset 3px 0 0 var(--c-primary); }
.check-row.locked { opacity:.55; }
.check-row.locked input[type=checkbox] { cursor:not-allowed; }
.check-row .cr-lock { font-size:10px; color:var(--c-muted); white-space:nowrap; }

/* Pick sheet viewer */
.modal-bg.stacked2 { z-index:70; background:rgba(15,23,42,.6); }
.modal-bg.stacked3 { z-index:80; }
.pick-modal { width:min(1180px, 100%); height:94vh; max-height:94vh; }
.pick-toolbar {
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  padding:8px 14px; border-bottom:1px solid var(--c-line); background:#f8fafc;
}
.pick-toolbar .tool {
  background:#fff; border:1px solid var(--c-line); border-radius:6px;
  padding:6px 10px; font-size:13px; cursor:pointer; font-family:inherit;
}
.pick-toolbar .tool.active { background:var(--c-primary); color:#fff; border-color:var(--c-primary); }
.pick-toolbar .tool:disabled { opacity:.45; cursor:not-allowed; }
.pk-status { margin-left:6px; }
.pick-body { flex:1; overflow:auto; background:#cbd5e1; padding:16px; }
.pk-page {
  position:relative; margin:0 auto 16px; background:#fff; box-shadow:0 2px 10px rgba(15,23,42,.25);
  user-select:none;
}
.pk-page canvas { display:block; }
.pk-page .pk-layer { position:absolute; inset:0; }
.pk-page .pk-layer.tool-text, .pk-page .pk-layer.tool-tick, .pk-page .pk-layer.tool-date, .pk-page .pk-layer.tool-place { cursor:crosshair; }
.pk-anno {
  position:absolute; box-sizing:border-box; border:1px dashed transparent;
  font-family:'Segoe UI', Arial, sans-serif; color:#1d4ed8; line-height:1.15; white-space:pre-wrap;
  overflow:hidden;
}
.pk-anno.mine { cursor:move; }
.pk-anno.mine:hover, .pk-anno.selected { border-color:var(--c-primary); background:rgba(0,84,149,.05); }
.pk-anno.theirs { cursor:default; }
.pk-anno.signature img { width:100%; height:100%; object-fit:contain; display:block; pointer-events:none; }
.pk-anno.tick { color:#15803d; font-weight:800; display:flex; align-items:center; justify-content:center; }
.pk-anno.date, .pk-anno.text { padding:1px 2px; }
.pk-anno .pk-by {
  position:absolute; right:-2px; bottom:-14px; font-size:9px; color:var(--c-muted); white-space:nowrap;
  background:rgba(255,255,255,.85); padding:0 3px; border-radius:2px; pointer-events:none; display:none;
}
.pk-anno.selected .pk-by, .pk-anno:hover .pk-by { display:block; }
.pk-anno .pk-del {
  position:absolute; top:-9px; right:-9px; width:18px; height:18px; border-radius:50%;
  background:var(--c-bad); color:#fff; border:0; font-size:12px; line-height:18px; text-align:center;
  cursor:pointer; display:none; padding:0;
}
.pk-anno.selected .pk-del { display:block; }
.pk-anno .pk-edit {
  width:100%; height:100%; border:0; background:transparent; resize:none; font:inherit; color:inherit;
  outline:none; padding:0; white-space:pre-wrap;
}
.pk-pagenum { position:absolute; left:6px; top:-18px; font-size:11px; color:#334155; }

/* Signature pad */
.sig-modal { width:620px; }
.sig-canvas {
  display:block; width:100%; height:200px; border:1px solid var(--c-line); border-radius:8px;
  background:#fff; touch-action:none; cursor:crosshair;
  background-image:linear-gradient(transparent 70%, #e2e8f0 70%, #e2e8f0 71%, transparent 71%);
}

/* Permissions table on Help */
.perm-table td:first-child { font-weight:600; }
.perm-table td { text-align:center; font-size:12px; }
.perm-table td:first-child { text-align:left; }
/* Role headers sit over their ticks (the cells are centred; .data-table th is left-aligned) */
.perm-table th { text-align:center; }
.perm-table th:first-child { text-align:left; }
/* A long list of steps wraps inside its cell instead of stretching that role's column */
.perm-steps { display:inline-block; max-width:170px; line-height:1.4; }

@media (max-width:900px) {
  .build-top { grid-template-columns:minmax(0,1fr); }
  .pick-modal { height:100vh; max-height:100vh; border-radius:0; }
}
