/* Refine ERP shop-floor styles. Plain CSS, no framework. Readable at 1.5 m, big touch targets.
   Shared classes other screens may reuse: .page, .btn (.btn-primary .btn-warn .btn-danger
   .btn-quiet), .table (.num .nowrap), .banner (.banner-ok .banner-error .banner-warn),
   .badge (.badge-late .badge-paused .badge-tier), .muted, .late, .field, .pin-fields,
   .action-bar, .section, .count-grid, .card, .check-cell, .empty, .check-field, .component-of,
   .artwork-link, .depth-1 to .depth-3. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1b1b1b;
  --muted: #5a5a5a;
  --line: #c9c6bf;
  --accent: #1d5e3a;
  --accent-text: #ffffff;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --danger: #8b1e1e;
  --danger-bg: #fbe3e3;
  --ok-bg: #e6f2ea;
  --row-hover: #eef4f0;
  --focus: #1f5fbf;
  --radius: 6px;
  --tap: 3.25rem;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Header and navigation */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
  padding: .5rem 16px;
  background: var(--text);
  color: #fff;
}
.site-header .brand { font-weight: 700; font-size: 1.2rem; color: #fff; text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 .9rem;
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.site-nav a[aria-current="page"] { background: var(--accent); }
.site-nav a:hover { background: #333; }
.site-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .95rem; }
.site-user form { margin: 0; }
.site-user button {
  background: transparent; color: #fff; border: 1px solid #888; border-radius: var(--radius);
  min-height: 2.5rem; padding: 0 .75rem; font-size: .95rem; cursor: pointer;
}
.site-user a.operator-change {
  display: inline-flex; align-items: center; color: #fff; border: 1px solid #888; border-radius: var(--radius);
  min-height: 2.5rem; padding: 0 .75rem; font-weight: 600; text-decoration: none;
}
.operator-page form { display: flex; flex-direction: column; gap: 1rem; max-width: 24rem; margin-bottom: 1rem; }

.page { padding: 1rem 16px 7rem; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 1.9rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.4rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); }
.late { color: var(--danger); font-weight: 700; }
.empty { color: var(--muted); padding: .75rem 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: 7rem;
  padding: .6rem 1.3rem;
  font-size: 1.2rem;
  font-weight: 700;
  border: 2px solid var(--text);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-quiet { border-color: var(--line); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.field { display: flex; flex-direction: column; gap: .2rem; font-weight: 700; }
.field input, .field select, input.input {
  font-size: 1.25rem;
  min-height: var(--tap);
  padding: .4rem .6rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.pin-fields { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.pin-fields input { width: 9rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td {
  padding: .6rem .5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.table th {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  background: var(--bg);
}
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table tbody tr:hover { background: var(--row-hover); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.check-cell { width: 3.5rem; }
.check-cell label { display: flex; align-items: center; justify-content: center; min-height: var(--tap); cursor: pointer; }
.check-cell input[type=checkbox] { width: 2rem; height: 2rem; cursor: pointer; }
.unit-text { font-weight: 700; font-size: 1.15rem; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-late { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.badge-paused { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.badge-tier { background: var(--surface); }
.badge-ok { background: var(--ok-bg); border-color: var(--accent); color: var(--accent); }

/* Banners */
.banner { padding: .75rem 1rem; margin: 1rem 0; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.banner-ok { background: var(--ok-bg); border-color: var(--accent); }
.banner-error { background: var(--danger-bg); border-color: var(--danger); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn); }
.banner ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.banner li { margin: .2rem 0; }

/* Sections and cards */
.section { margin: 1.25rem 0 2rem; }
.section-title { display: flex; align-items: baseline; gap: .75rem; }
.section-title .count { font-size: 1.1rem; color: var(--muted); }
.count-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.card {
  display: block;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card .card-title { font-size: 1.4rem; font-weight: 700; }
.card .card-counts { display: flex; gap: 1.5rem; margin-top: .5rem; font-size: 1.1rem; }
.card .card-counts strong { font-size: 1.6rem; display: block; }

/* Sticky action bar at the bottom of a station */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: .75rem 16px;
  margin: 0 -16px;
  background: var(--surface);
  border-top: 3px solid var(--text);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
}
.action-bar .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.check-field { display: flex; align-items: center; gap: .5rem; min-height: var(--tap); font-weight: 700; cursor: pointer; }
.check-field input[type=checkbox] { width: 2rem; height: 2rem; flex: 0 0 auto; cursor: pointer; }

/* Components, artwork and skip-ahead */
.component-of { font-size: .9rem; font-weight: 400; white-space: normal; }
.artwork-link { font-weight: 700; }
.closed-ops { font-size: .95rem; color: var(--warn); font-weight: 700; }
.depth-1 { padding-left: 1.5rem !important; }
.depth-2 { padding-left: 3rem !important; }
.depth-3 { padding-left: 4.5rem !important; }

/* Order progress */
.op-list { margin: 0; padding: 0; list-style: none; }
.op-list li { padding: .2rem 0; }
.status-complete { color: var(--accent); font-weight: 700; }
.status-active, .status-paused { color: var(--warn); font-weight: 700; }
.pager { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }

@media (max-width: 700px) {
  html { font-size: 16px; }
  .btn { min-width: 0; flex: 1 1 auto; }
  .action-bar .actions { width: 100%; }
  .site-user { margin-left: 0; }
}

/* Environment banner: staging and development copies (D4) */
.env-banner {
  width: 100%;
  padding: .3rem 16px;
  font-size: .85rem;
  font-weight: 700;
  border-bottom: 2px solid #000;
}
.env-banner-staging { background: #ffb000; color: #000; }
.env-banner-development { background: #5a5a5a; color: #fff; }
.env-banner-production { background: var(--warn-bg); color: var(--warn); border-bottom-color: var(--warn); }

@media print {
  .site-header, .action-bar, .env-banner { display: none; }
  body { background: #fff; }
}
