/* ============================================================
   Unicap Workshop — design system
   Presentation layer only. 8px spacing scale, Inter (self-hosted),
   one badge component, one button component.
   ============================================================ */

/* ---- Self-hosted Inter (no CDN — must work offline on local WiFi) ---- */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* spacing — 8px scale */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-half: 4px;

  /* type scale */
  --fs-table: 13px;
  --fs-label: 14px;
  --fs-body: 14px;
  --fs-section: 20px;
  --fs-title: 28px;
  --fs-page-title: 32px; /* desktop internal-page h1 only — Floor keeps --fs-title */
  --fs-eyebrow: 11px;

  /* palette — "Precision Glass" (2026-07-17): monochrome industrial
     identity. Near-black ink is the ONE action color; warmth comes from
     the pearl canvas, not from hue. Semantic badge colors below are
     UNCHANGED — proven, high call-site count, status-only per the brief. */
  --color-bg: #f6f6f4;            /* canvas: warm near-white */
  --color-surface: #ffffff;       /* primary surface */
  --color-surface-2: #f0f0ee;     /* secondary surface: pale pearl */
  --color-text: #141414;          /* near-black ink */
  --color-text-muted: #5f5f66;    /* dark graphite */
  --color-text-faint: #86868b;    /* medium neutral grey */
  --color-border: #e4e4e1;        /* fine warm grey border */
  --color-hairline: #ececea;      /* hairline rules */
  --color-primary: #141414;       /* primary action: ink */
  --color-primary-dark: #3c3c40;  /* hover: softened graphite */
  --color-success: #16a34a;
  --color-success-dark: #15803d;
  --color-warning: #d97706;
  --color-danger: #dc2626;

  /* Precision Glass materials */
  --glass-nav: rgba(255, 255, 255, 0.82);
  --glass-panel: rgba(255, 255, 255, 0.7);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.65);

  /* motion — fast and purposeful; killed entirely under reduced-motion */
  --t-fast: 150ms;
  --t-panel: 220ms;
  --t-entrance: 320ms;
  --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);

  /* badge palette */
  --badge-green-bg: #dcfce7;
  --badge-green-fg: #166534;
  --badge-amber-bg: #fef3c7;
  --badge-amber-fg: #92400e;
  --badge-red-bg: #fee2e2;
  --badge-red-fg: #991b1b;
  --badge-gray-bg: #eef0f3;
  --badge-gray-fg: #4b5563;

  /* soft Apple-style radius hierarchy: controls 8-10, inputs/buttons
     10-12, cards/panels 14-18, editorial login composition 20-24 */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-hero: 22px;
  --shadow-card: 0 1px 2px rgba(20, 20, 20, 0.05);
  --shadow-raised: 0 8px 24px rgba(20, 20, 20, 0.07);
  --font: "Inter", -apple-system, "SF Pro Text", "Segoe UI", system-ui, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fs-body);
}

a {
  color: var(--color-primary);
}

/* ---- Icons (sprite <use>) ---- */
.icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  vertical-align: -3px;
}

.icon-sm {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

/* ============================================================
   Badge — ONE component. Color = meaning.
   green: complete/made · amber: in-progress/pending
   red: overdue/error · gray: neutral/locked
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-green,
.badge-complete {
  background: var(--badge-green-bg);
  color: var(--badge-green-fg);
}

.badge-amber,
.badge-in-progress {
  background: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
}

.badge-red,
.badge-danger {
  background: var(--badge-red-bg);
  color: var(--badge-red-fg);
}

.badge-gray,
.badge-not-started {
  background: var(--badge-gray-bg);
  color: var(--badge-gray-fg);
}

/* ============================================================
   Button — ONE component.
   .btn = filled primary · .btn-success = filled green
   .btn-link = text link secondary · .btn-link-danger = red text
   ============================================================ */
.btn,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: var(--fs-label);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover,
.button-link:hover {
  background: var(--color-primary-dark);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-success {
  background: var(--color-success);
}

.btn-success:hover {
  background: var(--color-success-dark);
}

.btn-neutral {
  background: var(--badge-gray-bg);
  color: var(--badge-gray-fg);
}

.btn-neutral:hover {
  background: #e0e3e8;
}

.btn-link,
.btn-link-danger,
.link-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: var(--fs-table);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
}

.btn-link {
  color: var(--color-primary);
}

.btn-link-danger,
.link-danger {
  color: var(--color-danger);
}

.btn-link:hover,
.btn-link-danger:hover,
.link-danger:hover {
  text-decoration: underline;
}

/* ============================================================
   Eyebrow + title-block signature strip — the app's ONE typographic
   signature. Structural, not decorative: states real facts (company,
   section, date), styled like the title-block line on an engineering
   drawing. Reused identically wherever it appears.
   ============================================================ */
.eyebrow {
  display: block;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.signature-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.signature-strip::before,
.signature-strip::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Icon tile — small squared token, like a stamped part tag. Shared by
   module cards and empty states so both read as one visual language. */
.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  flex: 0 0 auto;
}

.icon-tile .icon {
  width: 22px;
  height: 22px;
}

/* Tabular data — order codes, batch numbers, money. A quiet third voice
   distinct from prose, using the same Inter family (no new font). */
.data-figure {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* ============================================================
   Blueprint motif — the app's ONE decorative treatment.
   Faint grid + one dashed toolpath sweep, border-color ink.
   Hero zones only (login hero, home greeting band). Never behind
   tables, forms, or body text. No gradients, shadows, or blur.
   ============================================================ */
.motif-zone {
  position: relative;
  overflow: hidden;
}

.motif-zone > .motif-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.motif-zone > :not(.motif-bg) {
  position: relative;
}

.motif-bg .motif-grid-rect {
  /* #e2e4e9 hairlines at 0.65 ≈ 7-8% ink on white: genuinely faint */
  opacity: 0.65;
}

.motif-bg .motif-sweep {
  fill: none;
  stroke: #e2e4e9;
  stroke-width: 1.5;
  stroke-dasharray: 7 9;
}

/* ============================================================
   Empty state — shared block (icon + headline + description + Add)
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.empty-state .icon-tile {
  width: 52px;
  height: 52px;
  color: var(--color-text-muted);
}

.empty-state .icon-tile .icon {
  width: 26px;
  height: 26px;
}

.empty-state .empty-headline {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.empty-state .empty-desc {
  font-size: var(--fs-label);
  color: var(--color-text-muted);
  max-width: 420px;
  margin-top: -4px;
}

.empty-state .btn {
  margin-top: var(--sp-1);
}

/* ============================================================
   Top bar + desktop layout — floating pill nav
   ============================================================ */
body.admin .topbar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  margin: var(--sp-2) var(--sp-3) 0;
  padding: 0 var(--sp-3);
}

body.admin .topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  min-height: 56px;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--color-text);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.masters-nav {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.masters-nav a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 17px 1px 15px;
  border-bottom: 2px solid transparent;
}

.masters-nav a.active,
.masters-nav a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.logout-form {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.logged-in-as {
  font-size: var(--fs-table);
  color: var(--color-text-muted);
  font-weight: 500;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4) var(--sp-6);
}

.page h1 {
  font-size: var(--fs-page-title);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: var(--sp-half) 0 var(--sp-half);
}

.page-header {
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}

.subtitle {
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-label);
}

.page-header .subtitle {
  margin-bottom: 0;
}

.section-heading {
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--sp-4) 0 var(--sp-1);
}

.section-block {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
}

.section-block .section-heading {
  margin-top: 0;
}

.toolbar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--sp-3);
}

.toolbar-secondary {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  padding-left: var(--sp-2);
  margin-left: var(--sp-1);
  border-left: 1px solid var(--color-border);
}

/* ---- Skeleton home page ---- */
.wrap {
  max-width: 600px;
  margin: 60px auto;
  padding: var(--sp-3);
  text-align: center;
}

.wrap h1 {
  font-size: var(--fs-title);
  margin-bottom: var(--sp-1);
}

/* ============================================================
   Login / setup
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.auth-card h1 {
  font-size: var(--fs-section);
  font-weight: 800;
  margin: 0;
  text-align: center;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  font-size: var(--fs-table);
  font-weight: 500;
  color: var(--color-text-muted);
  gap: 6px;
}

.auth-card input {
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.auth-card button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  margin-top: var(--sp-1);
}

.auth-card button:hover {
  background: var(--color-primary-dark);
}

/* ============================================================
   Cards (masters index) + dashboard tiles
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-2);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-2);
  text-decoration: none;
  color: var(--color-text);
}

.card:hover {
  border-color: var(--color-primary);
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 var(--sp-half);
}

.card p {
  font-size: var(--fs-table);
  color: var(--color-text-muted);
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-2);
  text-align: center;
}

.stat-number {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: var(--fs-table);
  color: var(--color-text-muted);
  margin-top: var(--sp-half);
  font-weight: 500;
}

.stat-tile-danger .stat-number {
  color: var(--color-danger);
}

.stat-tile-ok .stat-number {
  color: var(--color-success);
}

/* ============================================================
   Forms (desktop)
   ============================================================ */
.master-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-2);
  margin-bottom: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: flex-end;
}

.master-form label {
  display: flex;
  flex-direction: column;
  font-size: var(--fs-table);
  font-weight: 500;
  color: var(--color-text-muted);
  gap: 6px;
}

.master-form input,
.master-form select {
  font-family: var(--font);
  font-size: var(--fs-label);
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 160px;
  background: var(--color-surface);
}

.master-form input:focus,
.master-form select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.form-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.master-form button[type="submit"] {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: var(--fs-label);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}

.master-form button[type="submit"]:hover {
  background: var(--color-primary-dark);
}

.cancel-link {
  font-size: var(--fs-table);
  text-decoration: none;
  color: var(--color-text-muted);
  font-weight: 500;
}

.form-vertical {
  flex-direction: column;
  align-items: stretch;
  max-width: 480px;
}

.error {
  background: var(--badge-red-bg);
  color: var(--badge-red-fg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: var(--fs-label);
  margin-bottom: var(--sp-2);
}

/* ============================================================
   Tables — dense desktop rows, sticky headers
   ============================================================ */
.table-scroll {
  /* Hotfix 2026-07-22: no max-height / vertical clip. The wrapper grows to
     the table's full height and the PAGE scrolls naturally; only horizontal
     overflow (wide tables) is contained inside the wrapper. This restores
     access to every row on Plan/Costing/History at 1366x768. */
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
}

.table-scroll .master-table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.master-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.master-table th,
.master-table td {
  text-align: left;
  padding: 9px 12px;
  font-size: var(--fs-table);
  border-bottom: 1px solid var(--color-border);
  line-height: 1.45;
}

.master-table th {
  background: #f8f9fb;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
}

.master-table tr:last-child td {
  border-bottom: none;
}

.master-table tbody tr:hover td {
  background: #fafbfc;
}

.cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
}

.row-actions form {
  display: inline;
  margin: 0;
}

.empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--sp-3);
}

/* ============================================================
   Costing — stats strip + inline machine breakdown
   ============================================================ */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.stats-strip .stat-tile {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
}

.stats-strip .stat-number {
  font-size: 26px;
}

.breakdown-row > td {
  background: #f8f9fb;
  padding: 0;
  border-bottom: 1px solid var(--color-border);
}

.breakdown-row details {
  margin: 0;
}

.breakdown-row summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  padding: 7px 12px 7px 28px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.breakdown-row summary::-webkit-details-marker {
  display: none;
}

.breakdown-row summary .icon {
  transition: transform 0.15s ease;
}

.breakdown-row details[open] summary .icon {
  transform: rotate(90deg);
}

.breakdown-inner {
  margin: 0 var(--sp-2) var(--sp-2) 28px;
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  border-top: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  max-width: 560px;
}

.breakdown-table {
  border-collapse: collapse;
  width: 100%;
}

.breakdown-table th,
.breakdown-table td {
  text-align: left;
  padding: 6px 14px;
  font-size: var(--fs-table);
}

.breakdown-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.breakdown-table th.cell-num,
.breakdown-table td.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown-total td {
  border-top: 1px solid var(--color-border);
  font-weight: 700;
}

/* ============================================================
   Floor — tablet-first. 56px+ tap targets everywhere.
   ============================================================ */
body.floor {
  background: var(--color-bg);
}

.floor-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-2) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.floor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-1) var(--sp-half);
}

.floor-header h1 {
  font-size: var(--fs-title);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.floor-exit {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  padding: 14px 22px;
  min-height: 56px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--color-text-muted);
  cursor: pointer;
}

.floor-exit-link {
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.floor-banner {
  border-radius: var(--radius-lg);
  padding: var(--sp-2) var(--sp-3);
  font-size: 19px;
  font-weight: 700;
  text-align: center;
}

.floor-banner-ok {
  background: var(--badge-green-bg);
  color: var(--badge-green-fg);
}

.floor-banner-warn {
  background: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
}

/* Two visually separate cards: entry form vs recent entries */
.floor-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.floor-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-2) 0;
  font-size: var(--fs-section);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.floor-card-body {
  padding: var(--sp-2);
}

.floor-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.floor-form > label,
.floor-times label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  /* Let the two time-input columns shrink to their grid track on a phone.
     Without this, the native time control's intrinsic min-width forces the
     1fr 1fr tracks wider than the card, pushing End Time off-screen. */
  min-width: 0;
}

.floor-form input[type="date"],
.floor-form input[type="time"],
.floor-form input[type="number"] {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 600;
  padding: 0 var(--sp-2);
  min-height: 60px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  width: 100%;
  min-width: 0;
  color: var(--color-text);
}

.floor-form input:focus,
.floor-picker-btn:focus,
.stepper button:focus {
  outline: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.1);
}

.floor-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

/* On a narrow phone the two half-width time boxes can't fit the 22px value
   plus the AM/PM marker, so the browser drops AM/PM — ambiguous for
   operators. Trim the time value's type and side padding just enough at
   phone width to keep "09:00 AM" visible, staying side by side. */
@media (max-width: 480px) {
  .floor-times input[type="time"] {
    font-size: 19px;
    padding: 0 var(--sp-1);
  }
}

/* Picker trigger buttons (replace visible selects) */
.floor-picker-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  width: 100%;
  min-height: 60px;
  padding: 0 var(--sp-2);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
}

.floor-picker-btn .placeholder {
  color: var(--color-text-muted);
  font-weight: 500;
}

.floor-picker-btn .icon {
  width: 22px;
  height: 22px;
  color: var(--color-text-muted);
}

/* Qty stepper */
.stepper {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: var(--sp-1);
  align-items: stretch;
}

.stepper button {
  min-height: 60px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.stepper button:active {
  background: var(--badge-gray-bg);
}

.stepper input {
  text-align: center;
  font-size: 28px !important;
  font-weight: 800 !important;
}

/* remove native number spinners inside stepper */
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.batch-info {
  border-radius: var(--radius-lg);
  padding: 14px var(--sp-2);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.batch-info-ok {
  background: #dbeafe;
  color: #1e40af;
}

.batch-info-warn {
  background: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
}

.floor-save {
  background: var(--color-success);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--sp-2);
  min-height: 68px;
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: 0.06em;
}

.floor-save:active {
  background: var(--color-success-dark);
}

/* Recent entries as cards */
.entry-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.entry-card {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-2);
  background: var(--color-surface);
}

.entry-card-badges {
  position: absolute;
  top: var(--sp-1);
  right: var(--sp-1);
  display: flex;
  gap: 6px;
}

.entry-card-primary {
  font-size: 18px;
  font-weight: 700;
  padding-right: 96px;
}

.entry-card-primary .entry-machine {
  color: var(--color-text-muted);
  font-weight: 600;
}

.entry-card-secondary {
  margin-top: 6px;
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.entry-card-qty {
  color: var(--color-text);
  font-weight: 700;
}

.entry-card-actions {
  margin-top: var(--sp-1);
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.entry-card-actions form {
  display: inline;
  margin: 0;
}

/* ---- Full-screen tap picker (bottom sheet) ---- */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.picker-overlay[hidden] {
  display: none;
}

.picker-sheet {
  background: var(--color-surface);
  width: 100%;
  max-width: 680px;
  max-height: 86vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-head {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
}

.picker-title {
  font-size: 18px;
  font-weight: 800;
  flex: 1;
}

.picker-close {
  min-width: 56px;
  min-height: 56px;
  border: none;
  background: var(--badge-gray-bg);
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.picker-search {
  position: relative;
  padding: 0 var(--sp-2) var(--sp-2);
  border-bottom: 1px solid var(--color-border);
}

.picker-search .icon {
  position: absolute;
  left: calc(var(--sp-2) + 14px);
  top: 50%;
  transform: translateY(-70%);
  color: var(--color-text-muted);
  width: 20px;
  height: 20px;
}

.picker-search input {
  width: 100%;
  min-height: 56px;
  font-family: var(--font);
  font-size: 18px;
  padding: 0 var(--sp-2) 0 48px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.picker-search input:focus {
  outline: 3px solid var(--color-primary);
  border-color: var(--color-primary);
}

.picker-list {
  overflow-y: auto;
  padding: var(--sp-1);
  -webkit-overflow-scrolling: touch;
}

.picker-item {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 60px;
  padding: var(--sp-2);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.picker-item:last-child {
  border-bottom: none;
}

.picker-item:active,
.picker-item:hover {
  background: #eff4ff;
}

.picker-empty {
  padding: var(--sp-3);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 16px;
}

/* ---- Operator name picker ---- */
.floor-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
  gap: var(--sp-4);
  text-align: center;
}

.floor-page h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-2);
  width: 100%;
  max-width: 700px;
}

.operator-btn {
  width: 100%;
  padding: var(--sp-5) var(--sp-2);
  min-height: 120px;
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.operator-btn:active {
  background: var(--color-primary-dark);
}

.operator-btn-small {
  max-width: 320px;
  min-height: 64px;
  padding: var(--sp-2);
  font-size: 18px;
}

/* ---- Legacy floor table (kept harmless if referenced) ---- */
.floor-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.floor-table td {
  padding: 12px 10px;
  font-size: 15px;
  border-bottom: 1px solid var(--color-border);
}

.floor-table tr:last-child td {
  border-bottom: none;
}

.floor-row-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  white-space: nowrap;
}

.floor-row-actions form {
  display: inline;
  margin: 0;
}

/* ============================================================
   Login — hero type, whitespace-led (no imagery, offline-safe)
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4) var(--sp-3);
  gap: var(--sp-5);
  background: var(--color-surface);
}

.login-hero-zone {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
}

.login-hero-zone .eyebrow {
  text-align: center;
}

.login-hero {
  text-align: center;
  line-height: 1.05;
}

.login-hero .hero-light {
  display: block;
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.login-hero .hero-bold {
  display: block;
  font-size: clamp(44px, 7.5vw, 84px);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--color-text);
  margin-top: var(--sp-half);
}

.login-hero .hero-sub {
  display: block;
  margin-top: var(--sp-2);
  font-size: 15px;
  color: var(--color-text-muted);
  font-weight: 400;
}

.login-hero-zone .signature-strip {
  width: 100%;
  max-width: 480px;
  margin-top: var(--sp-1);
}

.login-form-frame {
  width: 100%;
  max-width: 400px;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
}

.login-form {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--color-text);
}

.login-form input {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 500;
  padding: 0 var(--sp-2);
  min-height: 56px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  width: 100%;
}

.login-form input:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.login-form button {
  background: var(--color-text);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  min-height: 56px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: var(--sp-1);
}

.login-form button:hover {
  background: #000;
}

/* ============================================================
   Home — role-based module cards
   ============================================================ */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
}

.home-topbar .brand {
  font-size: 15px;
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-3) var(--sp-6);
}

.home-hero-band {
  margin-bottom: var(--sp-5);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.home-hero-band .eyebrow {
  order: -1;
}

.home-greeting {
  margin-bottom: 0;
}

.home-greeting .hello {
  display: block;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 300;
  letter-spacing: -0.01em;
}

.home-greeting .name {
  display: block;
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-top: 2px;
}

.home-hero-band .signature-strip {
  max-width: 560px;
}

.home-modules-label {
  margin-bottom: var(--sp-2);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--sp-2);
}

.home-grid.home-grid-few {
  grid-template-columns: repeat(auto-fit, minmax(210px, 280px));
}

.module-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-card);
}

.module-card:hover {
  border-color: var(--color-primary);
}

.module-card:hover .icon-tile {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.module-card h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.module-card p {
  font-size: var(--fs-table);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ---- Small screens ---- */
@media (max-width: 820px) {
  .page {
    padding: var(--sp-2);
  }

  body.admin .topbar {
    padding: 0 var(--sp-2);
  }
}

/* ============================================================
   PRECISION GLASS PASS (2026-07-17) — presentation only.
   Appended so equal-specificity rules here win over earlier ones.
   Monochrome industrial identity; glass only where useful (nav,
   login panel); motion fast, purposeful, and fully disabled under
   prefers-reduced-motion.
   ============================================================ */

/* ---- glass navigation (admin top bar pill) ---- */
body.admin .topbar {
  background: var(--glass-nav);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
  box-shadow: var(--glass-highlight), var(--shadow-card);
}

/* active route: pale surface + ink text, no border-per-item */
.masters-nav a {
  border-radius: var(--radius);
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.masters-nav a:hover {
  background: var(--color-surface-2);
}
.masters-nav a.active {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ---- brand component (temporary text wordmark) ---- */
.brand {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  text-decoration: none;
  gap: 1px;
}
.brand .brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.brand .brand-co {
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ---- button system: hierarchy, focus, press ---- */
.btn,
.button-link {
  transition: background-color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.btn:active,
.button-link:active,
.floor-save:active,
.login-form button:active {
  transform: translateY(1px);
}
/* One clear ring for click-targets; fields get a border + soft halo
   instead (no doubled black outline on top of their own border). */
:is(a, button, summary):focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
  border-radius: var(--radius);
}
:is(input, select, textarea):focus-visible {
  outline: none;
}
:is(input, select, textarea):focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.1);
}

/* ---- tables: quiet dividers, hover, tabular numerals ---- */
table tbody tr {
  transition: background-color var(--t-fast) var(--ease-out);
}
table tbody tr:hover {
  background: var(--color-surface-2);
}
.cell-num,
.data-figure,
.metric-value {
  font-variant-numeric: tabular-nums;
}

/* ---- login: refined editorial glass composition ---- */
.login-page {
  animation: none;
}
.login-hero-zone {
  border-radius: var(--radius-hero);
}
.login-form-frame {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-hero);
  box-shadow: var(--glass-highlight), var(--shadow-raised);
  padding: var(--sp-3);
  margin-top: var(--sp-3);
}
.login-form input {
  border-radius: 12px;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.login-form input:focus {
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.12);
}
.login-form button {
  border-radius: 12px;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.login-form button[disabled] {
  opacity: 0.75;
  cursor: default;
}

/* password field with visibility control */
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  padding-right: 74px;
  width: 100%;
}
/* scoped tighter than `.login-form button` so the toggle never inherits
   the primary pill treatment */
.login-form .password-wrap .password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  min-height: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 10px 8px; /* comfortable touch target */
}
.login-form .password-wrap .password-toggle:hover {
  color: var(--color-text);
  background: none;
}

/* stable message area — errors/hints never shift the layout */
.login-msg-area {
  min-height: 22px;
  margin: 0 0 var(--sp-1);
}
.login-msg-area .error {
  margin: 0;
}
.capslock-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-warning);
  margin: 0;
}

/* quiet supporting line */
.login-secure-note {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-faint);
  margin: var(--sp-2) 0 0;
}

/* entrance: grid appears, heading rises a few px, form follows */
@media (prefers-reduced-motion: no-preference) {
  .login-hero-zone .motif-bg {
    animation: pg-fade var(--t-entrance) var(--ease-out) both;
  }
  .login-hero {
    animation: pg-rise var(--t-entrance) var(--ease-out) both;
  }
  .login-form-frame {
    animation: pg-fade var(--t-entrance) var(--ease-out) 120ms both;
  }
}
@keyframes pg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pg-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- home: compact operational header + metrics ---- */
.home-hero-band {
  padding: var(--sp-3) var(--sp-3);
}
.home-greeting .hello {
  font-size: 15px;
  font-weight: 400;
}
.home-greeting .name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.metrics-strip {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--sp-1);
  margin: var(--sp-2) 0 var(--sp-3);
}
.metric {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-2);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.metric:hover {
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
}
.metric-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.metric-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.metric-primary {
  background: var(--color-text);
  border-color: var(--color-text);
}
.metric-primary .metric-value,
.metric-primary .metric-label {
  color: #ffffff;
}
.metric-primary .metric-label {
  opacity: 0.7;
}
.metric-alert .metric-value {
  color: var(--color-danger);
}
@media (max-width: 640px) {
  .metrics-strip {
    grid-template-columns: 1fr 1fr;
  }
}

/* module cards: quiet hover response */
.module-card {
  transition: border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.module-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

/* ---- phone: login composition is its own layout, not shrunk ---- */
@media (max-width: 480px) {
  .login-page {
    justify-content: flex-start;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
  }
  .login-hero .hero-light {
    font-size: 22px;
  }
  .login-hero .hero-bold {
    font-size: 40px;
  }
  .login-hero-zone {
    gap: var(--sp-2);
    padding-top: var(--sp-3);
    padding-bottom: var(--sp-2);
  }
  .login-form-frame {
    padding: var(--sp-2);
  }
  .login-form-frame .login-msg-area {
    min-height: 18px;
  }
}

/* ---- accessibility: kill all motion on request ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   STAGE A — RESPONSIVE NAVIGATION SHELL (2026-07-18)
   Soft-white frosted sidebar (desktop) → slide-over drawer
   (tablet portrait / phone) → plus phone bottom navigation.
   Presentation only; permission logic lives in the templates,
   mirroring the exact conditions the old top bar used.
   ============================================================ */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--color-text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

.shell {
  min-height: 100vh;
}

/* ---- sidebar (desktop default) ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  background: var(--glass-nav);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--color-border);
  z-index: 40;
  transition: width var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border-bottom: 1px solid var(--color-hairline);
  min-height: 64px;
}
.sidebar-brand-mono {
  display: none;
}
.brand-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-surface);
}
.sidebar-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-panel) var(--ease-out);
}
.sidebar-collapse:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  min-height: 40px;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.side-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.side-item.active {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.side-item .icon {
  width: 18px;
  height: 18px;
}
.side-group-label {
  display: block;
  padding: var(--sp-2) 12px 4px;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  white-space: nowrap;
}

.sidebar-user {
  border-top: 1px solid var(--color-hairline);
  padding: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
}
.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-user-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-faint);
}
.sidebar-logout-icon {
  display: none;
}

/* content sits beside the fixed sidebar */
.shell-main {
  margin-left: 248px;
  transition: margin-left var(--t-panel) var(--ease-out);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.shell-main .page {
  width: 100%;
}

/* ---- collapsed icon rail ---- */
body.nav-collapsed .sidebar {
  width: 76px;
}
body.nav-collapsed .shell-main {
  margin-left: 76px;
}
body.nav-collapsed .side-label,
body.nav-collapsed .sidebar-brand,
body.nav-collapsed .sidebar-user-meta {
  display: none;
}
body.nav-collapsed .sidebar-brand-mono {
  display: inline-flex;
}
body.nav-collapsed .sidebar-top {
  flex-direction: column;
  gap: var(--sp-1);
}
body.nav-collapsed .sidebar-collapse {
  transform: rotate(180deg);
}
body.nav-collapsed .side-item {
  justify-content: center;
  padding: 9px 0;
}
body.nav-collapsed .side-group-label {
  padding: var(--sp-1) 0 2px;
  text-align: center;
}
body.nav-collapsed .side-group-label .side-label {
  display: none;
}
body.nav-collapsed .side-group-label::after {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--color-border);
  margin: 0 auto;
}
body.nav-collapsed .sidebar-user {
  justify-content: center;
}
body.nav-collapsed .sidebar-logout .side-label {
  display: none;
}
body.nav-collapsed .sidebar-logout-icon {
  display: inline-block;
}

/* ---- mobile topbar + backdrop + bottom nav (hidden on desktop) ---- */
.mobile-topbar,
.bottom-nav,
.nav-backdrop {
  display: none;
}

/* ---- tablet portrait and phone: drawer mode ---- */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    width: 272px;
    box-shadow: none;
  }
  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-raised);
  }
  /* drawer always shows full labels, never the rail */
  body.nav-collapsed .sidebar {
    width: 272px;
  }
  body.nav-collapsed .side-label,
  body.nav-collapsed .sidebar-brand,
  body.nav-collapsed .sidebar-user-meta {
    display: initial;
  }
  body.nav-collapsed .sidebar-brand-mono {
    display: none;
  }
  body.nav-collapsed .side-item {
    justify-content: flex-start;
    padding: 9px 12px;
  }
  /* drawer always shows group labels as text, never as rail dividers */
  body.nav-collapsed .side-group-label {
    padding: var(--sp-2) 12px 4px;
    text-align: left;
  }
  body.nav-collapsed .side-group-label .side-label {
    display: initial;
  }
  body.nav-collapsed .side-group-label::after {
    display: none;
  }
  body.nav-collapsed .sidebar-user {
    justify-content: space-between;
  }
  body.nav-collapsed .sidebar-logout .side-label {
    display: initial;
  }
  body.nav-collapsed .sidebar-logout-icon {
    display: none;
  }
  .sidebar-collapse {
    display: none;
  }
  .shell-main,
  body.nav-collapsed .shell-main {
    margin-left: 0;
  }
  body.drawer-open {
    overflow: hidden;
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.32);
    z-index: 35;
  }
  .nav-backdrop[hidden] {
    display: none;
  }
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--glass-nav);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    padding: 10px var(--sp-2);
    min-height: 56px;
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--color-text);
    cursor: pointer;
  }
  .mobile-menu-btn:hover {
    background: var(--color-surface-2);
  }
  .mobile-topbar .brand {
    flex: 1;
  }
  .mobile-topbar-user {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-text);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
  }
}

/* ---- phone: bottom navigation ---- */
@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--glass-nav);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--color-border);
    padding: 6px var(--sp-1);
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: pointer;
  }
  .bottom-item .icon {
    width: 20px;
    height: 20px;
  }
  .bottom-item.active {
    color: var(--color-text);
  }
  /* content must never hide behind the bottom bar */
  .shell-main .page {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

/* ---- print: never print application chrome ---- */
@media print {
  .sidebar,
  .mobile-topbar,
  .bottom-nav,
  .nav-backdrop,
  .skip-link {
    display: none !important;
  }
  .shell-main {
    margin-left: 0 !important;
  }
}

/* ============================================================
   STAGE B (2026-07-18) — Home/Dashboard merge, sidebar polish,
   quiet destructive actions, master-title eyebrows, floor strip.
   ============================================================ */

/* ---- sidebar refinement ---- */
.sidebar {
  border-right: 1px solid var(--color-border);
  box-shadow: 1px 0 0 rgba(20, 20, 20, 0.02);
}
.brand .brand-name {
  font-size: 16px;
}
.side-item.active {
  background: #e9e9e5;
  color: var(--color-text);
  font-weight: 700;
}
.side-item.active .icon {
  color: var(--color-text);
}
.side-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.sidebar-collapse {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.sidebar-collapse:hover {
  border-color: var(--color-text-muted);
}

/* logout: neutral graphite, restrained red only on hover/focus */
.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--fs-table);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.sidebar-logout-btn:hover,
.sidebar-logout-btn:focus-visible {
  color: var(--color-danger);
  background: var(--color-surface-2);
}
body.nav-collapsed .sidebar-logout-btn .side-label {
  display: none;
}
@media (max-width: 1023px) {
  body.nav-collapsed .sidebar-logout-btn .side-label {
    display: initial;
  }
}

/* ---- destructive links: quiet until intent is shown ---- */
.btn-link-danger,
.link-danger {
  color: var(--color-text-muted);
  transition: color var(--t-fast) var(--ease-out);
}
.btn-link-danger:hover,
.btn-link-danger:focus-visible,
.link-danger:hover,
.link-danger:focus-visible {
  color: var(--color-danger);
  text-decoration: underline;
}

/* ---- page eyebrow above cleaned-up master titles ---- */
.page-eyebrow {
  margin-bottom: 2px;
}
.page-eyebrow + h1 {
  margin-top: 0;
}

/* ---- home: compact hero + overview sections ---- */
.home-hero-compact {
  padding: var(--sp-2) var(--sp-3);
  gap: var(--sp-1);
}
.home-hero-compact .home-greeting .name {
  font-size: 24px;
}
.home-section {
  margin-top: var(--sp-3);
}
.home-section .section-heading {
  margin-bottom: var(--sp-1);
}
.home-empty {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-2) var(--sp-3);
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.7;
}
.home-empty span {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* quick actions: small and secondary, not module cards */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.quick-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  min-height: 40px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.quick-action:hover {
  border-color: var(--color-text-muted);
  background: var(--color-surface-2);
}

/* ---- floor: brand strip above the operator header ---- */
.floor-brand-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-1) 0;
  margin-bottom: var(--sp-1);
  border-bottom: 1px solid var(--color-hairline);
}

/* ============================================================
   DEVICE-QUALITY PASS (2026-07-18) — width caps + touch feedback
   ============================================================ */

/* vertical entry forms (Add/Edit Order etc.) shouldn't stretch across
   the full 1400px content column on a MacBook */
.master-form.form-vertical {
  max-width: 860px;
}

/* SAVE feedback while a floor submission is in flight */
.floor-save[disabled] {
  opacity: 0.75;
  cursor: default;
}

/* ============================================================
   GRAPHITE COMMAND SYSTEM (2026-07-18) — the product's visual
   signature: deep graphite navigation against a warm ivory
   workspace. Presentation only; appended last so it wins ties.
   ============================================================ */

:root {
  /* warm ivory workspace canvas */
  --color-bg: #f3f1ec;
  --color-hairline: #eae7e0;
  /* graphite navigation material */
  --graphite-bg-top: #232326;
  --graphite-bg-bottom: #1a1a1d;
  --graphite-active: #333338;
  --graphite-hover: rgba(255, 255, 255, 0.06);
  --graphite-text: #e9e9e7;
  --graphite-icon: #b9b9bd;
  --graphite-muted: #808088;
  --shadow-card: 0 1px 2px rgba(30, 26, 18, 0.05);
  --shadow-raised: 0 10px 28px rgba(30, 26, 18, 0.09);
}

/* ---- 1. graphite sidebar (expanded, rail, and drawer) ---- */
.sidebar {
  background: linear-gradient(180deg, var(--graphite-bg-top), var(--graphite-bg-bottom));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}
.sidebar-top {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar .brand .brand-name {
  color: #ffffff;
}
.sidebar .brand .brand-co {
  color: var(--graphite-muted);
}
.sidebar .brand-mono {
  background: var(--graphite-active);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.sidebar .sidebar-collapse {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--graphite-icon);
}
.sidebar .sidebar-collapse:hover {
  background: var(--graphite-hover);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}
.sidebar .side-item {
  color: var(--graphite-icon);
}
.sidebar .side-item:hover {
  background: var(--graphite-hover);
  color: var(--graphite-text);
}
.sidebar .side-item.active {
  background: var(--graphite-active);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sidebar .side-group-label {
  color: var(--graphite-muted);
}
body.nav-collapsed .side-group-label::after {
  background: rgba(255, 255, 255, 0.14);
}
.sidebar .sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar .sidebar-user-name {
  color: var(--graphite-text);
}
.sidebar .sidebar-user-role {
  color: var(--graphite-muted);
}
.sidebar .sidebar-logout-btn {
  color: var(--graphite-icon);
}
.sidebar .sidebar-logout-btn:hover,
.sidebar .sidebar-logout-btn:focus-visible {
  color: #ff6b64;
  background: var(--graphite-hover);
}
/* keyboard focus must stay visible on the dark surface */
.sidebar :is(a, button):focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ---- 2. warm workspace: contained white surfaces ---- */
.table-scroll {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  /* horizontal containment only — never clip vertically (see base rule) */
  overflow-x: auto;
  overflow-y: visible;
}

/* the sticky header relied on the removed inner scroll; disable it so it can
   never sit on top of rows during natural page scroll */
.master-table thead th {
  position: static;
}

/* ---- 3. page-header system ---- */
.page-header {
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--color-hairline);
}
.page-header .eyebrow {
  margin-bottom: 4px;
}
.page-header h1,
.page-eyebrow + h1 {
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-header .subtitle {
  margin: 0;
}

/* ---- 4. tables: stop looking like a spreadsheet ---- */
.master-table thead th {
  background: #efede7;
  color: #55524b;
  font-size: 11px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--color-border);
}
.master-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}
.master-table tbody tr:hover {
  background: #faf9f6;
}
/* quiet row actions: soft pill on hover instead of underlined links */
.btn-link:hover {
  text-decoration: none;
  background: var(--color-surface-2);
}
.btn-link,
.btn-link-danger,
.link-danger {
  padding: 5px 8px;
  border-radius: var(--radius);
}
.btn-link-danger:hover,
.link-danger:hover {
  text-decoration: none;
  background: #fbeeed;
}

/* ---- 5. toolbar hierarchy: prints are quiet utilities ---- */
.toolbar-secondary .btn-neutral {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.toolbar-secondary .btn-neutral:hover {
  background: var(--color-surface);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* ---- 6. designed empty states ---- */
.empty-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5) var(--sp-3);
}
.empty-state .icon-tile {
  width: 44px;
  height: 44px;
  background: var(--color-surface-2);
}
.empty-state .icon-tile .icon {
  width: 20px;
  height: 20px;
}

/* ---- 7. masters landing: premium setup directory ---- */
.card-grid .card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-height: 132px;
  transition: border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.card-grid .card:hover {
  transform: translateY(-1px);
  border-color: var(--color-text-muted);
  box-shadow: var(--shadow-card);
}
.card-grid .card h2 {
  margin: 0;
}
.card-grid .card p {
  margin: 0;
  color: var(--color-text-muted);
}

/* ---- 8. floor: compact graphite brand strip ---- */
.floor-brand-strip {
  background: linear-gradient(180deg, var(--graphite-bg-top), var(--graphite-bg-bottom));
  border: 0;
  border-radius: var(--radius);
  padding: 10px var(--sp-2);
  margin-bottom: var(--sp-2);
}
.floor-brand-strip .brand-name {
  color: #ffffff;
}
.floor-brand-strip .brand-co {
  color: var(--graphite-muted);
}
.floor-brand-strip .sidebar-logout-btn {
  color: var(--graphite-icon);
}
.floor-brand-strip .sidebar-logout-btn:hover,
.floor-brand-strip .sidebar-logout-btn:focus-visible {
  color: #ff6b64;
}

/* ---- 9. login: hero/form relationship only ---- */
.login-page {
  gap: var(--sp-4);
}
.login-form-frame {
  box-shadow: var(--glass-highlight), var(--shadow-raised);
}

/* ---- 10. home section headings sit with their content ---- */
.home-section .section-heading {
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* ---- Graphite pass 2 (post-screenshot critique) ---- */

/* rail collapse control was nearly invisible on graphite */
.sidebar .sidebar-collapse {
  border-color: rgba(255, 255, 255, 0.22);
  color: #d6d6da;
}

/* Home's dashed empties clashed with the new solid empty-state
   surfaces — one system, one look */
.home-empty {
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   TRIAL COSTING MODEL (2026-07-20) — Floor order summary,
   12-hour time controls, duration preview, completion page.
   ============================================================ */

.floor-today {
  float: right;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* read-only order summary (derived, never typed) */
.floor-summary {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-1) var(--sp-2);
}
.floor-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  padding: 7px 0;
  border-bottom: 1px solid var(--color-hairline);
  font-size: 15px;
}
.floor-summary-row:last-child {
  border-bottom: 0;
}
.floor-summary-row span {
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.floor-summary-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

/* explicit 12-hour time controls: hour / minute / AM-PM selects */
.time-12h {
  display: flex;
  gap: 6px;
}
.time-12h select {
  flex: 1;
  min-height: 60px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 4px;
}
.floor-times .time-12h select {
  min-width: 0;
}

/* live duration preview / plain-language time errors */
.duration-preview {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  padding: 10px var(--sp-2);
  border-radius: var(--radius);
  background: var(--badge-green-bg);
  color: var(--badge-green-fg);
}
.duration-preview.duration-error {
  background: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
}

/* completion confirmation page */
.complete-summary {
  max-width: 720px;
}
.complete-summary .floor-summary {
  margin-bottom: var(--sp-3);
}
.complete-summary .section-heading {
  margin-bottom: var(--sp-1);
}
.complete-summary .form-actions {
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* phone: Start and End stack vertically so each 12h control row gets
   the full width — six side-by-side selects are too cramped at 390px */
@media (max-width: 480px) {
  .floor-times {
    grid-template-columns: 1fr;
  }
  .time-12h select {
    font-size: 18px;
  }
}

/* ============================================================
   HOTFIX (2026-07-22) — Floor Work Date + Qty, compact entries,
   Floor History, tablet card, device-recovery, 1366x768 density.
   ============================================================ */

/* ---- Floor: quantity progress summary ---- */
.floor-progress {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-1) var(--sp-2);
}
.floor-progress-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 6px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--color-hairline);
}
.floor-progress-row:last-child { border-bottom: 0; }
.floor-progress-row span { color: var(--color-text-muted); font-weight: 600; }
.floor-progress-total strong { font-size: 17px; }
.floor-progress-warn {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
  font-size: 13px;
  font-weight: 600;
}

/* ---- Floor: compact Recent Entries rows (52-64px) ---- */
.floor-card-header .floor-viewall {
  float: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}
.floor-card-header .floor-viewall:hover { color: var(--color-text); }
.entry-rows { list-style: none; margin: 0; padding: 0; }
.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  min-height: 54px;
  padding: 8px var(--sp-1);
  border-bottom: 1px solid var(--color-hairline);
}
.entry-row:last-child { border-bottom: 0; }
.entry-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.entry-row-machine { font-weight: 700; font-size: 15px; }
.entry-row-part { font-size: 15px; color: var(--color-text); }
.entry-row-code { font-size: 12px; color: var(--color-text-faint); font-variant-numeric: tabular-nums; }
.entry-row-lock { color: var(--color-text-faint); }
.entry-row-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.entry-row-edit,
.entry-row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
}
.entry-row-edit:hover { background: var(--color-surface-2); color: var(--color-text); }
.entry-row-delete:hover { background: #fbeeed; color: var(--color-danger); }

/* ---- Floor: operator-tablet card (admin/manager) ---- */
.floor-tablet-note { margin: 0 0 var(--sp-1); font-size: 14px; color: var(--color-text-muted); }
.floor-tablet-actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); }

/* ---- Floor History filter bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}
.filter-bar input,
.filter-bar select {
  font-family: var(--font);
  font-size: 14px;
  padding: 7px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  min-height: 38px;
}
.filter-actions { display: flex; align-items: center; gap: var(--sp-1); }

/* ---- login device self-recovery ---- */
.login-recover-note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-2);
}

/* ---- 1366x768 density: rail default, tighter margins/headings ---- */
@media (max-width: 1440px) {
  body.admin .page { padding: var(--sp-2) var(--sp-3) var(--sp-5); }
  .page-header { margin-bottom: var(--sp-1); padding-bottom: var(--sp-1); }
  .page-header h1, .page-eyebrow + h1 { font-size: 24px; }
  .home-hero-compact { padding: var(--sp-1) var(--sp-2); }
  .home-section { margin-top: var(--sp-2); }
}

/* ============================================================
   PLAN/FLOOR REDESIGN (2026-07-22) — party code, compact Plan,
   days-left, priority badges, row actions menu, part-first floor.
   ============================================================ */

/* two-line compact cells: strong value + muted sub-line */
.cell-strong { display: block; font-weight: 700; }
.cell-sub { display: block; font-size: 11px; color: var(--color-text-faint); margin-top: 1px; }
.nowrap { white-space: nowrap; }
.cell-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* party code chip (full name via title/tap) */
.party-code {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: help;
  border-bottom: 1px dotted var(--color-text-faint);
}

/* days-left coloured number (number only, not the row) */
.days-left { font-weight: 700; font-variant-numeric: tabular-nums; }
.days-left.days-normal { color: var(--color-text); }
.days-left.days-warn { color: var(--color-danger); }
.days-left.days-zero { color: #b91c1c; font-weight: 800; }
.days-left.days-over { color: #b91c1c; font-weight: 800; }
.days-left.days-over::before { content: "▼ "; font-size: 10px; }

/* compact priority badges (text-only colour, not the row) */
.prio {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.prio-urgent { background: var(--badge-red-bg); color: var(--badge-red-fg); }
.prio-high { background: var(--badge-amber-bg); color: var(--badge-amber-fg); }
.prio-mid { background: #e2e8f0; color: #475569; }
.prio-low { background: var(--badge-gray-bg); color: var(--badge-gray-fg); }

/* Plan table density at all widths */
.plan-table th, .plan-table td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* row actions ⋯ menu (portalled to body when open so it's never clipped) */
.rowmenu { position: relative; display: inline-block; }
.rowmenu-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 18px; line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
}
.rowmenu-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.rowmenu-list {
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: 6px;
  z-index: 60;
}
.rowmenu-list a,
.rowmenu-list button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0; background: none;
  border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.rowmenu-list a:hover,
.rowmenu-list button:hover { background: var(--color-surface-2); }
.rowmenu-list form { margin: 0; }
.rowmenu-danger { color: var(--color-danger); }
.rowmenu-danger:hover { background: #fbeeed !important; }
.rowmenu-disabled { color: var(--color-text-faint); cursor: not-allowed; }
.rowmenu-disabled:hover { background: none !important; }

/* order-history header block */
.order-hist-head { max-width: 720px; margin-bottom: var(--sp-3); }

/* floor: disabled picker (before a part is chosen) */
.floor-picker-btn.floor-picker-disabled { opacity: 0.55; cursor: not-allowed; }

/* keep the filter bar compact at 1366 and wrap cleanly */
@media (max-width: 1440px) {
  .filter-bar { padding: var(--sp-1) var(--sp-2); gap: 8px var(--sp-1); }
  .filter-bar input, .filter-bar select { min-height: 34px; font-size: 13px; }
  .plan-table th, .plan-table td { padding-left: 8px; padding-right: 8px; }
  .cell-truncate { max-width: 160px; }
}

/* ============================================================
   Urgent batch 2026-07-24: searchable Part combobox,
   invoice-number Mark-Made, Costing party code, banners.
   Appended last so these rules win where needed.
   ============================================================ */

/* success banner (mirrors .error styling, green) */
.banner-ok {
  background: var(--color-success, #1f7a3d);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius, 8px);
  margin: 0 0 14px;
  font-weight: 600;
}

/* --- searchable Part combobox (Add Order) --- */
.combobox { position: relative; }
.combo-input {
  width: 100%;
  box-sizing: border-box;
}
.combo-list {
  position: absolute;
  z-index: 40;
  left: 0; right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #d9d7d0);
  border-radius: var(--radius, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.combo-item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
}
.combo-item.active,
.combo-item:hover {
  background: var(--color-bg, #f3f1ec);
}
.combo-empty {
  padding: 9px 10px;
  color: var(--color-text-muted, #6b6a66);
  font-size: 14px;
}
.combo-hint {
  display: block;
  margin-top: 4px;
  color: var(--color-danger, #b3261e);
  font-size: 12px;
}

/* --- invoice number / Mark Made (Costing) --- */
.invoice-cell { white-space: normal; }
.invoice-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-left: 2px;
}
.invoice-num-legacy {
  font-weight: 400;
  font-style: italic;
  color: var(--color-text-muted, #6b6a66);
}
details.invoice-made { display: inline-block; }
details.invoice-made > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
details.invoice-made > summary::-webkit-details-marker { display: none; }
.invoice-made-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--color-bg, #f3f1ec);
  border: 1px solid var(--color-border, #d9d7d0);
  border-radius: var(--radius, 8px);
  min-width: 200px;
}
.invoice-made-label {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.invoice-made-form input {
  padding: 7px 9px;
  border: 1px solid var(--color-border, #d9d7d0);
  border-radius: 6px;
  font-size: 14px;
}

/* ============================================================
   UI/workflow batch 2026-07-24: urgent pulse, INV status lights,
   integrated Costing/History breakdown drawer.
   ============================================================ */

/* --- 1. Continuous but professional Urgent pulse (badge only) --- */
@keyframes urgent-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(179, 38, 30, 0.55); }
  70%  { box-shadow: 0 0 0 5px rgba(179, 38, 30, 0); }
  100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, 0); }
}
.prio-urgent {
  animation: urgent-pulse 1.6s ease-in-out infinite;
  /* text/contrast unchanged — only the ring animates, so it stays readable */
}
@media (prefers-reduced-motion: reduce) {
  /* No motion: a strong static red badge with a solid ring instead. */
  .prio-urgent {
    animation: none;
    box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.6);
    font-weight: 800;
  }
}
@media print {
  .prio-urgent { animation: none !important; box-shadow: none !important; font-weight: 800; }
}

/* --- 2. Invoice status LED lights --- */
.inv-legend { font-size: 12px; color: var(--color-text-muted, #6b6a66); margin: 0 0 10px; display: flex; align-items: center; gap: 4px; }
.inv-led {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  flex: 0 0 auto;
}
.inv-led-red   { background: #d64545; box-shadow: 0 0 0 2px rgba(214,69,69,0.18); }
.inv-led-green { background: #1f9d55; box-shadow: 0 0 0 2px rgba(31,157,85,0.18); }
.inv-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  cursor: default;
  border-radius: 6px;
  outline-offset: 2px;
}
.inv-status:focus-visible { outline: 2px solid var(--color-primary, #232326); }
.inv-detail { font-variant-numeric: tabular-nums; color: var(--color-text, #232326); }
.inv-warn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--badge-amber-bg, #fdecc8); color: #8a5a00;
  font-size: 11px; font-weight: 800;
}
.invoice-cell { white-space: normal; }

/* --- 3. Integrated breakdown drawer (Costing + History) --- */
.col-chevron { width: 34px; text-align: center; padding-left: 4px !important; padding-right: 4px !important; }
.drawer-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: none; background: transparent; cursor: pointer;
  border-radius: 6px; color: var(--color-text-muted, #6b6a66);
}
.drawer-toggle:hover { background: var(--color-bg, #f3f1ec); }
.drawer-toggle:focus-visible { outline: 2px solid var(--color-primary, #232326); }
.drawer-toggle .chevron { transition: transform 0.18s ease; }
.drawer-toggle.is-open .chevron { transform: rotate(90deg); }
/* Drawer visibility is a CSS class toggle (Safari-reliable) — not the `hidden`
   property, which is flaky on <tr> in some engines. */
.cdrawer-row { display: none; }
.cdrawer-row.is-open { display: table-row; }
.cdrawer-row > td { background: var(--color-bg, #f6f6f4); padding: 0 !important; }
.drawer-inner {
  display: flex; flex-wrap: wrap; gap: 20px;
  padding: 14px 18px;
  border-left: 3px solid var(--color-primary, #232326);
}
.drawer-legacy { color: var(--color-text-muted, #6b6a66); font-style: italic; font-size: 13px; }
.drawer-inner .breakdown-table { flex: 1 1 340px; margin: 0; }
.drawer-summary { flex: 0 1 240px; align-self: flex-start; }
.drawer-sum-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 5px 0; border-bottom: 1px solid var(--color-hairline, #eceae4);
  font-size: 13px;
}
.drawer-sum-row:last-child { border-bottom: none; }
.drawer-sum-row span { color: var(--color-text-muted, #6b6a66); }
.drawer-sum-row strong { font-variant-numeric: tabular-nums; }

/* touch: keep the toggle a comfortable target on tablet/mobile */
@media (max-width: 1023px) {
  .drawer-toggle { width: 44px; height: 44px; }
  .col-chevron { width: 48px; }
  .inv-status { min-height: 44px; }
}

@media print {
  .drawer-toggle, .col-chevron, .inv-legend { display: none !important; }
}

/* ============================================================
   REDESIGN 2026-07-31 — "Instrument Panel"
   Unicap Engineering Workstation. Monochrome graphite/ivory with
   status colour only; hairline-divided panels instead of floating
   cards; tabular figures on all operational data.
   ============================================================ */

/* ---------- shared primitives ---------- */
.data-num { font-variant-numeric: tabular-nums; }

/* micro-label: uppercase, tracked, used for column heads + eyebrows */
.ui-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ---------- LOGIN: split identity / sign-in ---------- */
.login-body {
  background: var(--color-bg);
  min-height: 100dvh;
}
.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-identity {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-3);
  padding: clamp(28px, 4.5vw, 68px);
  background: linear-gradient(158deg, #26262a 0%, #191919 62%, #141416 100%);
  color: #fff;
}
/* understated technical grid — engineering linework, never decoration */
.login-motif {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(120% 90% at 12% 30%, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 85%);
  mask-image: radial-gradient(120% 90% at 12% 30%, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 85%);
  pointer-events: none;
}
.login-identity-inner { position: relative; max-width: 30rem; }
.login-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: var(--sp-2);
}
.login-title {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 54px);
  line-height: 1.03;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: #fff;
}
.login-product {
  margin: var(--sp-2) 0 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  padding-top: var(--sp-2);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.login-lede {
  margin: var(--sp-1) 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.68);
  max-width: 34ch;
}
/* capability list as measurement ticks — reads like a spec callout */
.login-caps {
  list-style: none;
  margin: var(--sp-3) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px var(--sp-2);
}
.login-caps li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}
.login-caps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
}
.login-locale {
  position: relative;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 56px);
  background: var(--color-bg);
}
/* brand lockup anchored top-left of the sign-in column */
.login-panel-brand {
  position: absolute;
  top: clamp(24px, 3.4vw, 44px);
  left: clamp(24px, 4vw, 56px);
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-panel-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-panel-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.login-panel-brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.login-panel-brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.login-card {
  width: 100%;
  max-width: 23rem;
}
.login-card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.login-card-sub {
  margin: 6px 0 var(--sp-3);
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.login-card .login-form { display: flex; flex-direction: column; gap: var(--sp-2); }
.login-card .field { display: flex; flex-direction: column; gap: 6px; }
.login-card .field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 14px;
  font-size: 16px; /* 16px avoids iOS zoom-on-focus */
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.login-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.12);
}
.login-card .password-wrap { position: relative; display: block; }
.login-card .password-wrap input { padding-right: 66px; }
.login-card .password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 8px;
}
.login-card .password-toggle:hover { background: var(--color-surface-2); color: var(--color-text); }
.login-card .password-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.login-submit {
  min-height: 48px;
  margin-top: 2px;
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.login-submit:hover { background: var(--color-primary-dark); }
.login-submit:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.login-submit:disabled { opacity: 0.55; cursor: default; }
/* reserved message area keeps the form from jumping when an error appears */
.login-card .login-msg-area { min-height: 20px; }
.login-card .login-msg-area .error {
  margin: 0 0 var(--sp-1);
  padding: 10px 12px;
  font-size: 13px;
  border-radius: var(--radius);
  background: var(--badge-red-bg);
  color: var(--badge-red-fg);
  border: none;
}
.login-card .capslock-hint {
  margin: 0 0 var(--sp-1);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-warning);
}
.login-card .login-secure-note {
  margin: var(--sp-1) 0 0;
  font-size: 11.5px;
  color: var(--color-text-faint);
  text-align: center;
}
.login-card .login-recover-note {
  margin: 0 0 var(--sp-1);
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* login responsive: identity compresses, form stays above the fold */
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; min-height: 100dvh; }
  .login-identity {
    justify-content: flex-start;
    gap: var(--sp-2);
    padding: clamp(20px, 5vw, 32px);
  }
  .login-title { font-size: clamp(28px, 7vw, 38px); }
  .login-caps { display: none; }
  .login-lede { display: none; }
  .login-locale { display: none; }
  .login-panel { padding: var(--sp-3) clamp(20px, 5vw, 32px) var(--sp-4); justify-content: flex-start; }
  .login-panel-brand { display: none; }
  .login-card { max-width: 26rem; margin: 0 auto; }
}
@media (max-width: 420px) {
  .login-identity { padding: 20px; }
  .login-title { font-size: 27px; }
  .login-product { font-size: 13px; }
}

/* ---------- HOME: operations dashboard ---------- */
.cmd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}
.page h1.cmd-title,
.cmd-title {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-text);
}
.cmd-status {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.cmd-status strong { color: var(--color-text); font-weight: 700; }
.cmd-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.act:hover { border-color: var(--color-text-faint); background: var(--color-surface-2); }
.act:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.act .icon { width: 15px; height: 15px; }
.act-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.act-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

/* the signature: ONE instrument panel, hairline-divided — not floating cards */
.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}
.gauge {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px 13px;
  text-decoration: none;
  color: inherit;
  border-left: 1px solid var(--color-hairline);
  transition: background var(--t-fast) var(--ease-out);
}
.gauge:first-child { border-left: none; }
.gauge:hover { background: var(--color-surface-2); }
.gauge:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.gauge-val {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--color-text);
}
.gauge-val-sm { font-size: 19px; }
.gauge-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
}
/* status is carried by a top rule + value colour, never colour alone */
.gauge.is-warn::before,
.gauge.is-alert::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.gauge.is-warn::before { background: var(--color-warning); }
.gauge.is-alert::before { background: var(--color-danger); }
.gauge.is-warn .gauge-val { color: var(--color-warning); }
.gauge.is-alert .gauge-val { color: var(--color-danger); }
.gauge-wide { grid-column: span 2; }

/* dashboard panels */
.dash-grid { display: flex; flex-direction: column; gap: var(--sp-3); }
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--sp-2);
  border-bottom: 1px solid var(--color-hairline);
}
.panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
}
.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--badge-red-bg);
  color: var(--badge-red-fg);
  font-size: 11.5px;
  font-weight: 700;
}
.panel-link, .panel-more {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}
.panel-link:hover, .panel-more:hover { color: var(--color-text); }
.panel-more { display: block; margin: 0; padding: 10px var(--sp-2); border-top: 1px solid var(--color-hairline); }
.panel-empty {
  margin: 0;
  padding: 18px var(--sp-2);
  font-size: 13px;
  color: var(--color-text-faint);
}
.panel-attention .panel-title { color: var(--color-text); }

/* compact order row — scannable, not a spreadsheet */
.ord-list { list-style: none; margin: 0; padding: 0; }
.ord {
  display: grid;
  grid-template-columns: minmax(140px, 0.85fr) minmax(160px, 1.5fr) minmax(150px, 1.1fr) auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-2);
  border-top: 1px solid var(--color-hairline);
}
.ord:first-child { border-top: none; }
.ord:hover { background: var(--color-surface-2); }
.ord-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ord-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}
a.ord-code:hover { text-decoration: underline; }
.ord-party { font-size: 12px; }
.ord-part { display: flex; flex-direction: column; min-width: 0; }
.ord-part-no { font-size: 13px; font-weight: 600; color: var(--color-text); }
.ord-part-desc {
  font-size: 11.5px;
  color: var(--color-text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ord-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; }
.ord-chip { white-space: nowrap; }
.ord-chip { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--color-text); white-space: nowrap; }
.ord-chip-k {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
/* fixed slots so priority chips and due dates align down the column */
.ord-right { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.ord-right .prio { min-width: 56px; text-align: center; }
.ord-due { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; min-width: 72px; }
.ord-due-date { font-size: 12.5px; font-weight: 600; color: var(--color-text); }
.ord-days { font-size: 10.5px; font-weight: 600; color: var(--color-text-faint); }
.ord-days.is-warn { color: var(--color-warning); }
.ord-days.is-zero, .ord-days.is-over { color: var(--color-danger); }

@media (max-width: 1100px) {
  .ord { grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.4fr) auto; }
  .ord-meta { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .cmd-head { align-items: flex-start; }
  .cmd-head-actions { width: 100%; }
  .act { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .gauges { grid-template-columns: repeat(2, 1fr); }
  .gauge { border-left: 1px solid var(--color-hairline); border-top: 1px solid var(--color-hairline); }
  .gauge:nth-child(-n+2) { border-top: none; }
  .gauge:nth-child(odd) { border-left: none; }
  /* full-width gauges would orphan an empty cell in the 2-up grid */
  .gauge-wide { grid-column: span 1; }
  .gauge-val { font-size: 24px; }
  .gauge-val-sm { font-size: 17px; }
  .page h1.cmd-title, .cmd-title { font-size: 22px; }
  .ord { grid-template-columns: 1fr auto; gap: 6px var(--sp-1); }
  .ord-part { grid-column: 1 / -1; }
  .ord-meta { grid-column: 1 / -1; }
  .ord-right { grid-row: 1; grid-column: 2; }
}

/* ---------- COSTING / HISTORY: refined rows + cohesive drawer ---------- */
.costing-table { border-collapse: separate; border-spacing: 0; }
.costing-table thead th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  padding: 9px 12px;
  white-space: nowrap;
}
.costing-table tbody td { padding: 11px 12px; vertical-align: middle; }
.costing-table .corder-row { transition: background var(--t-fast) var(--ease-out); }
.costing-table .corder-row:hover { background: var(--color-surface-2); }
/* the expanded order stays visually joined to its drawer */
.costing-table .corder-row.is-expanded { background: var(--color-surface-2); }
.costing-table .corder-row.is-expanded > td { border-bottom-color: transparent; }
.costing-table .data-figure { font-variant-numeric: tabular-nums; }

/* prominent-but-quiet expansion control */
.drawer-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-muted);
}
.drawer-toggle:hover { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.drawer-toggle.is-open { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* one designed component: 65/35 machine table + summary, no floating edge */
.drawer-inner {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(240px, 35fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
}
.drawer-col { padding: 14px 16px 16px; min-width: 0; }
.drawer-col-sum {
  border-left: 1px solid var(--color-hairline);
  background: var(--color-surface-2);
}
.drawer-h {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.drawer-inner .breakdown-table { width: 100%; margin: 0; }
.drawer-inner .breakdown-table th {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 700;
  padding: 0 10px 7px;
  border-bottom: 1px solid var(--color-hairline);
  background: none;
}
.drawer-inner .breakdown-table td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-hairline);
}
.drawer-inner .breakdown-table tr:last-child td { border-bottom: none; }

.drawer-summary { margin: 0; }
.drawer-sum-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-hairline);
  font-size: 13px;
}
.drawer-sum-row:last-child { border-bottom: none; }
.drawer-sum-row dt { color: var(--color-text-muted); margin: 0; }
.drawer-sum-row dd { margin: 0; font-weight: 650; color: var(--color-text); text-align: right; }
/* the number that matters most on this panel */
.drawer-sum-key dt { color: var(--color-text); font-weight: 600; }
.drawer-sum-key dd { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

/* legacy state: informational, never an error */
.drawer-legacy {
  display: block;
  padding: 16px;
  border-left: 3px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 13px;
  font-style: normal;
}

/* invoice controls must never truncate */
.invoice-cell { white-space: normal; }
.invoice-made > summary { white-space: nowrap; }
.inv-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 10px;
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 11.5px;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  /* stack the summary under the machine table on narrow screens */
  .drawer-inner { grid-template-columns: 1fr; }
  .drawer-col-sum { border-left: none; border-top: 1px solid var(--color-border); }
}

/* ---------- Costing / History: phone card transformation ----------
   Below 760px a wide financial table would push values off-screen, so each
   row becomes a labelled card. Every figure stays visible; nothing is
   hidden, and the expand control keeps a 44px touch target. */
@media (max-width: 760px) {
  .costing-table .table-scroll,
  .table-scroll:has(.costing-table) { overflow-x: visible; }

  .costing-table,
  .costing-table tbody,
  .costing-table tr,
  .costing-table td { display: block; width: auto; }
  .costing-table thead { display: none; }

  .costing-table tr.corder-row {
    position: relative;
    padding: 12px 14px 12px 56px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
  }
  .costing-table tr.corder-row.is-expanded { background: var(--color-surface-2); }

  /* chevron pinned to the card's left gutter */
  .costing-table tr.corder-row > td.col-chevron {
    position: absolute;
    left: 8px;
    top: 10px;
    width: 44px;
    padding: 0;
  }
  .costing-table .drawer-toggle { width: 40px; height: 40px; }

  .costing-table tr.corder-row > td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0;
    border: none;
    text-align: left;
  }
  .costing-table tr.corder-row > td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-faint);
  }
  /* order code leads the card */
  .costing-table tr.corder-row > td[data-label="Order"] { padding-bottom: 6px; }
  .costing-table tr.corder-row > td[data-label="Order"]::before { display: none; }
  .costing-table tr.corder-row > td[data-label="Order"] .cell-strong { font-size: 15px; }
  .costing-table tr.corder-row > td[data-label="Part"] { flex-direction: column; align-items: flex-start; gap: 0; }
  .costing-table tr.corder-row > td[data-label="Part"]::before { margin-bottom: 2px; }
  .costing-table .cell-truncate { max-width: none; white-space: normal; }
  .costing-table tr.corder-row > td.cell-num { text-align: left; }

  /* drawer spans the card, stacked, full width — no sideways scroll */
  .costing-table tr.cdrawer-row > td { padding: 0; }
  .drawer-inner { grid-template-columns: 1fr; }
  .drawer-inner .breakdown-table,
  .drawer-inner .breakdown-table tbody,
  .drawer-inner .breakdown-table tr,
  .drawer-inner .breakdown-table td { display: block; width: auto; }
  .drawer-inner .breakdown-table thead { display: none; }
  .drawer-inner .breakdown-table tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-hairline);
  }
  .drawer-inner .breakdown-table tr:last-child { border-bottom: none; }
  .drawer-inner .breakdown-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: none;
    text-align: left;
  }
  .drawer-inner .breakdown-table td:first-child { font-weight: 650; }
  .invoice-made-form { min-width: 0; width: 100%; }
}
@media (max-width: 760px) {
  .drawer-inner .breakdown-table td[data-label]::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-faint);
  }
}

/* ============================================================
   GRAPHITE VISION + B4 — FINAL THEME (2026-08)
   Unicap Engineering Workstation. Dark industrial workstation:
   the B4 "Silver CAD Lab" plate is the Level-1 ambient canvas,
   the UI above it is a disciplined glass hierarchy, and every
   dense table sits on a near-solid sheet so no linework ever
   passes behind a figure.

   This section is APPENDED deliberately: it re-points the
   existing design tokens so the whole system shifts together,
   then adds the background layer, glass levels, sidebar and
   per-page treatments. Nothing above is rewritten.

   Presentation only. No business logic, permissions, routes or
   schema are touched anywhere in this file.
   ============================================================ */

/* ---------- 1. TOKENS — the whole system pivots here ---------- */
:root {
  /* canvas */
  --color-bg: #0f1113;
  --color-bg-2: #16191c;

  /* surfaces: near-solid sheets. Slightly translucent so the plate
     reads as depth, never enough for linework to reach a figure. */
  --color-surface: rgba(28, 31, 35, 0.9);
  --color-surface-2: rgba(44, 49, 56, 0.94);
  --sheet-solid: #1b1e22;        /* opaque equivalent, for fallbacks */

  /* ink */
  --color-text: #eef1f3;
  --color-text-muted: #b3bbc3;
  --color-text-faint: #a0a9b1;   /* small uppercase labels — measured ≥ 4.5:1 */

  /* rules */
  --color-border: rgba(255, 255, 255, 0.14);
  --color-hairline: rgba(255, 255, 255, 0.08);

  /* action: restrained steel-blue. Dark ink on accent, never white. */
  --color-primary: #6fc3dc;
  --color-primary-dark: #8ad3ea;
  --color-on-primary: #08191f;
  --accent-soft: rgba(111, 195, 220, 0.14);
  --focus-ring: rgba(120, 200, 225, 0.55);

  /* semantic status */
  --color-success: #63c08d;
  --color-success-dark: #7ed0a4;
  --color-warning: #e0a24e;
  --color-danger: #e2695c;

  /* badges — tinted glass chips, foregrounds measured on the sheet */
  --badge-green-bg: rgba(99, 192, 141, 0.16);
  --badge-green-fg: #86d7ac;
  --badge-amber-bg: rgba(224, 162, 78, 0.16);
  --badge-amber-fg: #edbb7d;
  --badge-red-bg: rgba(226, 105, 92, 0.18);
  --badge-red-fg: #f2978d;
  --badge-gray-bg: rgba(255, 255, 255, 0.08);
  --badge-gray-fg: #b3bbc3;

  /* glass hierarchy (see §3) */
  --l2-bg: rgba(38, 42, 47, 0.68);
  --l2-blur: 20px;
  --l3-bg: rgba(46, 51, 57, 0.55);
  --l3-blur: 24px;
  --l4-bg: rgba(255, 255, 255, 0.07);
  --row-hover: rgba(255, 255, 255, 0.045);
  --row-open: rgba(111, 195, 220, 0.08);

  /* graphite navigation → smoked graphite glass */
  --graphite-bg-top: rgba(24, 27, 30, 0.86);
  --graphite-bg-bottom: rgba(15, 17, 20, 0.9);
  --graphite-active: rgba(111, 195, 220, 0.16);
  --graphite-hover: rgba(255, 255, 255, 0.06);
  --graphite-text: #ffffff;
  --graphite-icon: rgba(255, 255, 255, 0.72);
  --graphite-muted: #949da5;

  /* form */
  --radius: 12px;
  --radius-lg: 18px;
  --radius-hero: 22px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-raised: 0 14px 40px rgba(0, 0, 0, 0.45);
  --glass-nav: var(--graphite-bg-top);
  --glass-panel: var(--l2-bg);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html { background: var(--color-bg); }
body {
  background: transparent;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- 2. LEVEL 1 — the ambient B4 canvas ---------- */
/* Fixed, so the plate stays still while work scrolls over it: it reads as
   a lit bench under the instruments, and the blur never re-rasterises. */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}
.bg-layer picture { display: contents; }
.bg-img {
  position: absolute;
  /* blur samples outside the box — oversize so no pale edge shows */
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: 50% 38%;   /* portrait original → landscape working band */
  filter: var(--bg-filter, none);
}
/* Directional scrim, not a flat wash: the plate stays readable on one side
   while the side carrying text is guaranteed contrast. */
.bg-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(102deg,
      rgba(9, 12, 17, calc(var(--bg-scrim, 0.9) * 1.05)) 0%,
      rgba(9, 12, 17, calc(var(--bg-scrim, 0.9) * 0.74)) 38%,
      rgba(9, 12, 17, calc(var(--bg-scrim, 0.9) * 0.56)) 66%,
      rgba(9, 12, 17, calc(var(--bg-scrim, 0.9) * 0.9)) 100%),
    radial-gradient(70% 60% at 76% 14%, rgba(140, 190, 220, 0.12) 0%, transparent 72%);
}

/* the three approved treatments */
.bg-cinematic   { --bg-filter: saturate(1.05); --bg-scrim: 0.58; }
.bg-frosted     { --bg-filter: blur(17px) saturate(0.95) brightness(0.92); --bg-scrim: 0.7; }
.bg-operational { --bg-filter: blur(28px) saturate(0.85) brightness(0.78); --bg-scrim: 0.9; }

/* every content shell sits above the canvas */
.shell,
.login-shell,
.floor-wrap,
.floor-page,
.auth-page,
.mobile-topbar,
.bottom-nav { position: relative; z-index: 1; }

/* ---------- 3. GLASS HIERARCHY ----------
   L2 workspace glass  — KPI strip, login column
   L3 floating control — sidebar, command header, legend
   L4 active/focus     — inputs, secondary buttons
   sheet               — every dense table + drawer (NO blur)
   Target ≈4 blurred surfaces per page; dense data never blurs. */
.glass-l2 {
  background: var(--l2-bg);
  border: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(var(--l2-blur)) saturate(1.1);
  backdrop-filter: blur(var(--l2-blur)) saturate(1.1);
  box-shadow: var(--shadow-card), var(--glass-highlight);
}
.glass-l3 {
  background: var(--l3-bg);
  border: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
  backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
  box-shadow: var(--shadow-card), var(--glass-highlight);
}

/* ---------- 4. SIDEBAR — smoked graphite glass ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--graphite-bg-top) 0%, var(--graphite-bg-bottom) 100%);
  -webkit-backdrop-filter: blur(var(--l3-blur)) saturate(1.2);
  backdrop-filter: blur(var(--l3-blur)) saturate(1.2);
  border-right: 1px solid var(--color-hairline);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 1px 0 30px rgba(0, 0, 0, 0.35);
}
.sidebar-top { border-bottom: 1px solid var(--color-hairline); }
.sidebar .side-item { color: var(--graphite-icon); border-radius: 10px; }
.sidebar .side-item:hover { background: var(--graphite-hover); color: #fff; }
/* active state carries an accent rail as well as a tint — never colour alone */
.sidebar .side-item.active {
  position: relative;
  background: var(--graphite-active);
  color: #fff;
  box-shadow: none;
}
.sidebar .side-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
}
.sidebar .side-item.active .icon { color: var(--color-primary); }
.sidebar .brand-mono {
  background: var(--l4-bg);
  border-color: var(--color-border);
  color: #fff;
}
.sidebar .sidebar-user { border-top: 1px solid var(--color-hairline); }
.sidebar :is(a, button):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.nav-backdrop { background: rgba(6, 8, 11, 0.6); }
.mobile-topbar {
  background: var(--graphite-bg-top);
  -webkit-backdrop-filter: blur(var(--l3-blur)) saturate(1.2);
  backdrop-filter: blur(var(--l3-blur)) saturate(1.2);
  border-bottom: 1px solid var(--color-hairline);
  color: var(--color-text);
}

/* ---------- 5. CONTROLS ----------
   Primary action = accent with dark ink (measured 9.0:1). White-on-accent
   would fail; every historical `color:#fff` on a primary is corrected here. */
.btn,
.button-link,
.auth-card button,
.master-form button[type="submit"],
.operator-btn,
.login-submit,
.act-primary,
.login-panel-brand-mark,
.drawer-toggle.is-open {
  color: var(--color-on-primary);
}
.btn,
.button-link,
.auth-card button,
.master-form button[type="submit"],
.operator-btn,
.login-submit { font-weight: 700; }
.btn:hover,
.button-link:hover,
.auth-card button:hover,
.master-form button[type="submit"]:hover,
.operator-btn:active,
.login-submit:hover { color: var(--color-on-primary); }
.btn-success { color: var(--color-on-primary); }
.btn-neutral { background: var(--l4-bg); color: var(--color-text); }
.btn-neutral:hover { background: rgba(255, 255, 255, 0.12); }
.btn-link { color: var(--color-primary); }
a { color: var(--color-primary); }

/* focus is one ring everywhere, always visible on dark */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.skip-link { background: var(--color-primary); color: var(--color-on-primary); }

/* inputs — L4 glass, 16px so iOS never zooms */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
  background: var(--l4-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius);
}
input::placeholder, textarea::placeholder { color: var(--color-text-faint); }
:is(input, select, textarea):focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* native pickers/spinners must be light on a dark field */
input[type="date"], input[type="time"], input[type="number"] { color-scheme: dark; }
select option { background: var(--sheet-solid); color: var(--color-text); }

/* ---------- 6. SURFACES INHERITED FROM EARLIER PASSES ----------
   Historic hardcoded light fills, re-pointed to the dark system. */
.master-table th,
.master-table thead th {
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
}
.master-table tbody tr:hover,
.master-table tbody tr:hover td { background: var(--row-hover); }
.master-table td { border-bottom: 1px solid var(--color-hairline); }
.breakdown-row > td { background: var(--color-surface-2); }
.picker-item:active,
.picker-item:hover { background: var(--accent-soft); }
.side-item.active { background: var(--graphite-active); color: #fff; }
.btn-link-danger:hover,
.link-danger:hover,
.entry-row-delete:hover,
.rowmenu-danger:hover { background: rgba(226, 105, 92, 0.14) !important; }
.prio-mid { background: var(--badge-gray-bg); color: var(--badge-gray-fg); }

/* card / panel family */
.card, .tile, .auth-card, .table-scroll, .panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.stats-strip, .stat-box { background: var(--color-surface); border-color: var(--color-border); }

/* ---------- 7. LOGIN — Cinematic ----------
   One composition: the plate runs full width, the copy sits on the artwork,
   and the sign-in half is a brighter glass column joined by a single lit
   edge. No detached card, no dead space. */
.login-body { background: transparent; }
.login-shell { position: relative; z-index: 1; }
.login-identity {
  background: none;
  color: #fff;
}
/* copy sits directly on the photograph — a local shadow keeps it legible
   without darkening the whole plate */
.login-title,
.login-product { text-shadow: 0 1px 26px rgba(0, 0, 0, 0.55); }
.login-eyebrow { color: rgba(255, 255, 255, 0.72); }
.login-lede { color: rgba(255, 255, 255, 0.78); }
.login-caps li { color: rgba(255, 255, 255, 0.86); }
.login-caps li::before { background: var(--color-primary); }
.login-locale { color: rgba(255, 255, 255, 0.5); }

.login-panel {
  background: rgba(20, 23, 27, 0.72);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
}
.login-panel-brand-mark { background: var(--color-primary); }
.login-panel-brand-name { color: var(--color-text); }
.login-panel-brand-sub { color: var(--color-text-faint); }
.login-card-title { color: var(--color-text); }
.login-card-sub { color: var(--color-text-muted); }
.login-card .field-label { color: var(--color-text-muted); }
.login-card input[type="text"],
.login-card input[type="password"] {
  background: var(--l4-bg);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--color-text);
}
.login-card input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card .password-toggle { color: var(--color-text-muted); }
.login-card .password-toggle:hover { background: var(--l4-bg); color: var(--color-text); }
.login-submit { background: var(--color-primary); }
.login-submit:hover { background: var(--color-primary-dark); }
.login-card .login-msg-area .error {
  background: var(--badge-red-bg);
  color: var(--badge-red-fg);
  border: 1px solid rgba(226, 105, 92, 0.32);
}
.login-card .capslock-hint { color: var(--color-warning); }
.login-card .login-secure-note { color: var(--color-text-faint); }
.login-card .login-recover-note { color: var(--color-text-muted); }

@media (max-width: 900px) {
  /* stacked: the plate becomes a compressed header band, the form owns the
     rest of the screen and stays above the fold */
  .login-identity { background: rgba(12, 15, 19, 0.42); }
  .login-panel { border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.18); }
}

/* ---------- 8. HOME — Frosted ----------
   Shallow atmosphere; the dashboard dominates. The command header is the
   L3 floating control, the KPI strip is the L2 instrument bezel, and the
   data panels below are near-solid sheets. */
.app-home .cmd-head {
  padding: 16px 18px;
  margin-bottom: var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--l3-bg);
  -webkit-backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
  backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
  box-shadow: var(--shadow-card), var(--glass-highlight);
}
.cmd-title { color: var(--color-text); }
.cmd-status { color: var(--color-text-muted); }
.cmd-status strong { color: var(--color-text); }
.act {
  background: var(--l4-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}
.act:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--color-primary); }
.act-primary { background: var(--color-primary); border-color: var(--color-primary); }
.act-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

/* the signature: one machined instrument bezel, hairline-divided */
.gauges {
  background: var(--l2-bg);
  border: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(var(--l2-blur)) saturate(1.1);
  backdrop-filter: blur(var(--l2-blur)) saturate(1.1);
  box-shadow: var(--shadow-card), var(--glass-highlight);
}
.gauge { border-left: 1px solid var(--color-hairline); }
.gauge:hover { background: rgba(255, 255, 255, 0.05); }
.gauge-val { color: var(--color-text); }
.gauge-label { color: var(--color-text-faint); }
.gauge:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

/* data panels: near-solid, never blurred — figures must stay crisp */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.panel-head {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-hairline);
}
.panel-title { color: var(--color-text); }
.panel-count { background: var(--badge-red-bg); color: var(--badge-red-fg); }
.panel-link, .panel-more { color: var(--color-text-muted); }
.panel-link:hover, .panel-more:hover { color: var(--color-primary); }
.panel-more { border-top: 1px solid var(--color-hairline); }
.panel-empty { color: var(--color-text-faint); }
.ord { border-top: 1px solid var(--color-hairline); }
.ord:hover { background: var(--row-hover); }
.ord-code { color: var(--color-text); }
.ord-part-no { color: var(--color-text); }
.ord-part-desc { color: var(--color-text-faint); }
.ord-chip { color: var(--color-text-muted); }
.ord-chip-k { color: var(--color-text-faint); }
.ord-due-date { color: var(--color-text); }
.ord-days { color: var(--color-text-faint); }

/* ---------- 9. COSTING / HISTORY — Operational Dark ----------
   The plate is barely visible here; figures rule. Rows and drawers are
   near-solid sheets with NO backdrop blur. */
.costing-table thead th {
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
}
.costing-table tbody td { border-bottom: 1px solid var(--color-hairline); }
.costing-table .corder-row:hover { background: var(--row-hover); }
.costing-table .corder-row.is-expanded { background: var(--row-open); }
.cell-strong { color: var(--color-text); }
.cell-sub { color: var(--color-text-faint); }

.drawer-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
}
.drawer-toggle:hover {
  background: var(--l4-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}
.drawer-toggle.is-open {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.drawer-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* the drawer is one instrument panel, clearly attached to its row */
.drawer-inner {
  background: rgba(24, 27, 31, 0.96);
  border-left: 3px solid var(--color-primary);
}
.drawer-col-sum {
  background: rgba(34, 38, 44, 0.97);
  border-left: 1px solid var(--color-hairline);
}
.drawer-h { color: var(--color-text-faint); }
.drawer-inner .breakdown-table th {
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-hairline);
}
.drawer-inner .breakdown-table td {
  color: var(--color-text);
  border-bottom: 1px solid var(--color-hairline);
}
.drawer-sum-row { border-bottom: 1px solid var(--color-hairline); }
.drawer-sum-row dt { color: var(--color-text-muted); }
.drawer-sum-row dd { color: var(--color-text); }
.drawer-sum-key dt { color: var(--color-text); }
.drawer-sum-key dd { color: var(--color-text); }
.drawer-legacy {
  background: rgba(34, 38, 44, 0.97);
  border-left: 3px solid var(--color-border);
  color: var(--color-text-muted);
}

/* invoice status: LED + label + legend. Colour is never the only signal. */
.inv-legend {
  background: var(--l3-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  -webkit-backdrop-filter: blur(var(--l3-blur));
  backdrop-filter: blur(var(--l3-blur));
}
.inv-led-red { background: var(--color-danger); box-shadow: 0 0 0 3px rgba(226, 105, 92, 0.22); }
.inv-led-green { background: var(--color-success); box-shadow: 0 0 0 3px rgba(99, 192, 141, 0.22); }
.inv-detail { color: var(--color-text); }
.inv-warn { background: var(--badge-amber-bg); color: var(--badge-amber-fg); }
.inv-status:focus-visible { outline: 2px solid var(--color-primary); }

/* ---------- 10. PLAN / FLOOR / MASTERS — same system ---------- */
.filter-bar, .plan-toolbar {
  background: var(--l3-bg);
  border: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
  backdrop-filter: blur(var(--l3-blur)) saturate(1.15);
}
.plan-table thead th {
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
}
.plan-table tbody tr:hover { background: var(--row-hover); }
.plan-table td { border-bottom: 1px solid var(--color-hairline); }
.party-code { color: var(--color-text-muted); border-bottom-color: var(--color-text-faint); }
.rowmenu, .rowmenu-panel {
  background: var(--sheet-solid);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-raised);
}
.rowmenu-item { color: var(--color-text); }
.rowmenu-item:hover { background: var(--row-hover); }
.page-header { border-bottom-color: var(--color-border); }
.page-header .eyebrow, .eyebrow, .ui-eyebrow { color: var(--color-text-faint); }
.empty-state { color: var(--color-text-muted); }
.empty-state-title { color: var(--color-text); }

/* Floor is mission-critical on the shared tablet: maximum legibility,
   large targets, and a sheet dense enough that the plate never intrudes. */
.floor-wrap, .floor-page { position: relative; z-index: 1; }
.floor-card, .floor-panel, .floor-form, .entry-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.floor-brand-strip { border-bottom: 1px solid var(--color-hairline); }
.operator-btn { background: var(--color-primary); }
.operator-btn:active { background: var(--color-primary-dark); }

/* ---------- 11. FALLBACKS AND PREFERENCES ---------- */
/* No backdrop-filter (older Safari, some Android WebViews): every glass
   surface becomes opaque so nothing is ever unreadable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bg-scrim { background: rgba(9, 12, 17, 0.94); }
  .sidebar { background: #16191c; }
  .mobile-topbar { background: #16191c; }
  .login-panel { background: #14181d; }
  .app-home .cmd-head,
  .gauges,
  .filter-bar,
  .plan-toolbar,
  .inv-legend { background: #23272c; }
  .card, .tile, .auth-card, .table-scroll, .panel { background: var(--sheet-solid); }
  .drawer-inner { background: #181b1f; }
  .drawer-col-sum, .drawer-legacy { background: #22262c; }
}

@media (prefers-reduced-motion: reduce) {
  /* nothing here animates, but drop the heaviest compositing work too */
  .bg-img { filter: saturate(0.9) brightness(0.8); }
  .bg-cinematic .bg-img { filter: saturate(1); }
}

/* Phones: never composite a 4K plate behind a card list. */
@media (max-width: 760px) {
  .bg-img { filter: blur(8px) saturate(0.6) brightness(0.6); }
  .bg-scrim { background: rgba(9, 12, 17, 0.93); }
  .bg-cinematic .bg-img { filter: saturate(1.02) brightness(0.9); }
  .bg-cinematic .bg-scrim {
    background: linear-gradient(180deg, rgba(9, 12, 17, 0.62) 0%, rgba(9, 12, 17, 0.9) 62%, rgba(9, 12, 17, 0.96) 100%);
  }
}

/* ---------- 12. PRINT — stays light and ink-friendly ----------
   The meeting sheet must never inherit the dark theme, on screen or on
   paper. Tokens are reset to ink-on-white for both. */
body.print-sheet,
body.print-sheet .page {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-2: #f4f4f2;
  --sheet-solid: #ffffff;
  --color-text: #111111;
  --color-text-muted: #444444;
  --color-text-faint: #666666;
  --color-border: #cccccc;
  --color-hairline: #e2e2e2;
  --color-primary: #111111;
  --color-on-primary: #ffffff;
  --l4-bg: #ffffff;
  --l3-bg: #ffffff;
  --l2-bg: #ffffff;
  --row-hover: #f7f7f5;
  --row-open: #f2f2f0;
  background: #ffffff;
  color: #111111;
}
body.print-sheet .bg-layer { display: none; }

@media print {
  :root {
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-2: #f4f4f2;
    --sheet-solid: #ffffff;
    --color-text: #111111;
    --color-text-muted: #444444;
    --color-text-faint: #666666;
    --color-border: #cccccc;
    --color-hairline: #e2e2e2;
    --color-primary: #111111;
    --color-on-primary: #ffffff;
    --l2-bg: #ffffff;
    --l3-bg: #ffffff;
    --l4-bg: #ffffff;
    --row-hover: #ffffff;
    --row-open: #ffffff;
  }
  html, body { background: #ffffff !important; color: #111111 !important; }
  .bg-layer { display: none !important; }
  .sidebar, .mobile-topbar, .bottom-nav, .nav-backdrop { display: none !important; }
  .table-scroll, .panel, .card, .gauges, .cmd-head, .drawer-inner, .drawer-col-sum {
    background: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
  }
}

/* ---------- 13. SPECIFICITY CORRECTIONS ----------
   Historic rules that out-rank a bare class and would otherwise repaint a
   control in the old light palette. Each is raised just enough to win, and
   no further. Found by auditing computed styles on the running app, not by
   reading the file. */

/* `.login-form button` (0-1-1) beat `.login-submit` (0-1-0) and repainted the
   sign-in key near-white with white text — 1.8:1. */
.login-form button.login-submit {
  background: var(--color-primary);
  color: var(--color-on-primary);
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 15px;
  min-height: 48px;
  border-radius: var(--radius);
}
.login-form button.login-submit:hover { background: var(--color-primary-dark); }
.login-form button.login-submit:disabled { opacity: 0.55; }

/* `.act` (0-1-0, later in source) beat `.act-primary` (0-1-0) on colour. */
.act.act-primary {
  color: var(--color-on-primary);
  font-weight: 700;
}
.act.act-primary:hover { color: var(--color-on-primary); }

/* mobile top-bar avatar chip was a light pill on the graphite bar */
.mobile-topbar-user {
  background: var(--l4-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.mobile-topbar .brand-name { color: var(--color-text); }
.mobile-topbar .brand-co { color: var(--color-text-faint); }
.mobile-menu-btn { color: var(--color-text); background: transparent; }

/* phone bottom navigation rides the same smoked graphite material */
.bottom-nav {
  background: var(--graphite-bg-top);
  border-top: 1px solid var(--color-hairline);
}
.bottom-nav a { color: var(--graphite-icon); }
.bottom-nav a.active { color: var(--color-primary); }

/* ---------- 14. ACCENT RESTRAINT ----------
   The accent is the page's single loudest note. A row-level trigger repeated
   down a column is not that note — it competes with the figures the screen
   exists to show. So the "Mark Done" trigger is a quiet control, and the
   accent is spent on the commit action once the disclosure is open. */
.invoice-made > summary.btn {
  background: var(--l4-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
}
.invoice-made > summary.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--color-primary);
  color: var(--color-text);
}
.invoice-made[open] > summary.btn {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
/* the commit action inside the disclosure keeps the accent */
.invoice-made-form button[type="submit"] {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.invoice-made-form button[type="submit"]:disabled { opacity: 0.6; }

/* ---------- 15. STATUS INK ON DARK ----------
   Overdue/due-today used a light-theme dark red (#b91c1c) that measured
   2.6:1 on the sheet. The escalation order (normal → warn → zero/over) is
   preserved, now with ink that is actually legible. */
.days-left.days-normal { color: var(--color-text); }
.days-left.days-warn { color: var(--color-warning); }
.days-left.days-zero,
.days-left.days-over { color: #f2897c; font-weight: 800; }

/* Floor SAVE is the single most-pressed control in the workshop. On the dark
   theme its green key needs dark ink, not white — white measured 2.2:1. */
.floor-save {
  background: var(--color-success);
  color: var(--color-on-primary);
}
.floor-save:active { background: var(--color-success-dark); color: var(--color-on-primary); }

/* ---------- 16. COMPOSITION FIXES FROM SCREENSHOT REVIEW ---------- */

/* Phone login: the stacked grid gave both halves an equal share, leaving a
   tall empty band under the wordmark. The identity band should be exactly as
   tall as its content; the form takes the rest. */
@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .login-identity {
    padding-top: clamp(28px, 7vw, 44px);
    padding-bottom: clamp(22px, 5vw, 32px);
  }
  .login-panel { justify-content: flex-start; padding-top: clamp(26px, 6vw, 40px); }
}

/* The invoice disclosure grows its row; without this the LED and trigger
   drift to the vertical centre of a suddenly tall cell, away from the panel
   they belong to. Progressive: browsers without :has simply keep the old
   alignment. */
.costing-table td.invoice-cell:has(.invoice-made[open]) { vertical-align: top; }
.invoice-made[open] > summary.btn { margin-bottom: 8px; }
.invoice-made-panel,
.invoice-made > div {
  background: var(--sheet-solid);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
}

/* ---------- 17. TOUCH TARGETS ----------
   Measured on the running app: several controls sat between 16px and 40px.
   Floor is the shared shop-floor tablet, so it gets the 44px floor at every
   width; the rest of the app gets it on touch/narrow devices only, which
   keeps the approved desktop density unchanged. */
body.floor :is(a, button, summary):not(.brand):not(.skip-link),
body.floor .floor-exit-link,
body.floor .floor-viewall {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.floor .entry-row-edit,
body.floor .entry-row-delete { min-height: 44px; min-width: 44px; justify-content: center; }
body.floor .floor-brand-logout .sidebar-logout-btn { min-height: 44px; min-width: 44px; justify-content: center; }

@media (max-width: 1024px), (pointer: coarse) {
  :is(.btn, .button-link, .act, .side-item, .rowmenu-item, .panel-more, .panel-link) {
    min-height: 44px;
  }
  .btn, .button-link, .act { display: inline-flex; align-items: center; justify-content: center; }
  .invoice-made > summary.btn { min-height: 44px; }
  .drawer-toggle { width: 44px; height: 44px; }
  .sidebar-logout-btn { min-height: 44px; }
  .sidebar .brand { min-height: 44px; display: inline-flex; align-items: center; }
  .skip-link { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ---------- 18. FINAL A11Y CORRECTIONS ----------
   Each of these was measured on the running app with real Tab key events and
   real element boxes, not estimated. */

/* Floor fields drew their focus halo in near-black at 10% opacity — invisible
   on a dark field, leaving the shop-floor form with no visible focus at all. */
.floor-form input:focus,
.floor-picker-btn:focus,
.stepper button:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.floor-form input:focus-visible,
.floor-picker-btn:focus-visible,
.stepper button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* remaining sub-44px controls on touch/narrow devices */
@media (max-width: 1024px), (pointer: coarse) {
  .costing-table .drawer-toggle { width: 44px; height: 44px; }
  .rowmenu-btn { min-height: 44px; min-width: 44px; }
  .brand,
  .sidebar .brand,
  .mobile-topbar .brand,
  .floor-brand-strip .brand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
body.floor .brand { min-height: 44px; display: inline-flex; align-items: center; }

/* Every Floor field — including the part-picker search inside the overlay —
   gets a real outline, not only a halo. On the shared tablet the operator
   must always be able to see where they are. */
body.floor :is(input, select, textarea):focus,
.picker-sheet :is(input, select):focus,
.picker-search input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* A native date/time input delegates focus to its internal day/month/year
   segments, so `:focus` stops matching the host as you tab through them and
   the field silently loses its ring mid-edit. `:focus-within` keeps it. */
body.floor :is(input, select, textarea):focus-within,
input[type="date"]:focus-within,
input[type="time"]:focus-within,
.picker-sheet :is(input, select):focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
