/* Workshop Board — Active Hydraulics */
:root {
  --navy: #061f30;
  --navy-2: #087eb8;
  --ink: #102b3b;
  --muted: #557083;
  --line: #dce7ed;
  --bg: #f2f7fa;
  --card: #ffffff;
  --band: #edf5f9;
  --red: #b42318;
  --red-bg: #fde8e7;
  --amber-bg: #fff4d6;
  --ok-bg: #e6f4ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.4 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
a { color: var(--navy-2); }
code { font-family: var(--mono); background: #eef0f3; padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: #b8c0cc; background: #f8f9fb; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, .handle:focus-visible {
  outline: 2px solid var(--navy-2); outline-offset: 2px;
}
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #f1b5b0; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .6; cursor: wait; }
input, select, textarea {
  font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fff; width: 100%;
}
textarea { resize: vertical; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
label.inline { white-space: nowrap; }

/* ---------- Auth ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #1f3864, #142645); }
.auth-card { background: #fff; width: min(420px, 100%); padding: 32px; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
.alert { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 6px; font-weight: 600; }
.notice { background: var(--ok-bg); color: #1e6b35; padding: 10px 12px; border-radius: 6px; font-weight: 600; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 24px; background: var(--navy); color: #fff; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #d6deec; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; color: #d6deec; }
.who form { margin: 0; }
.who .btn { color: #fff; border-color: rgba(255,255,255,.3); }
.who .btn:hover { background: rgba(255,255,255,.1); }

/* ---------- Board ---------- */
.board { padding: 20px; max-width: 1760px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; border-left: 4px solid var(--navy); }
.stat-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.stat.warn { border-left-color: var(--red); background: var(--red-bg); }
.stat.warn .stat-num { color: var(--red); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: #b8c0cc; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-right select { width: 170px; }
.toolbar-right input[type=search] { width: 240px; }
.hint { color: var(--muted); margin: 6px 0 10px; font-size: 13px; }
.grip-demo { font-weight: 700; letter-spacing: -2px; color: var(--navy); }

.jobs { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: grid; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid #e8ebf0;
  grid-template-columns: 26px 34px minmax(110px, 1fr) minmax(200px, 2.4fr) minmax(120px, 1.1fr) 108px 186px minmax(100px, 1fr) 82px minmax(120px, 1.4fr) 52px;
  background: #fff;
}
#jobList .row:nth-child(even) { background: var(--band); }
.row.head { background: var(--navy); color: #fff; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; padding-top: 10px; padding-bottom: 10px; border: 0; }
.row.closed { color: var(--muted); }
.row.closed .desc strong { text-decoration: line-through; text-decoration-color: #9aa3b0; }
.row.overdue { box-shadow: inset 4px 0 0 var(--red); }
.handle { border: 0; background: transparent; cursor: grab; color: #8a94a3; font-weight: 700; letter-spacing: -2px; font-size: 16px; padding: 4px 2px; border-radius: 4px; touch-action: none; }
.handle:hover { color: var(--navy); background: #e3e9f3; }
.num { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--navy); text-align: center; }
.cust { font-weight: 600; }
.desc { display: flex; flex-direction: column; min-width: 0; }
.desc strong { font-weight: 600; }
.ref { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.po { display: flex; flex-direction: column; font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.contact { color: var(--muted); }
.tech { display: flex; flex-direction: column; font-size: 13px; }
.lead { font-weight: 600; }
.support { color: var(--muted); }
.unassigned { color: #9a6700; background: var(--amber-bg); padding: 1px 6px; border-radius: 4px; font-weight: 600; justify-self: start; width: max-content; }
.stage-pill { border: 1px solid rgba(0,0,0,.08); border-radius: 999px; padding: 5px 26px 5px 12px; font-weight: 600; font-size: 13px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #49505c 50%), linear-gradient(135deg, #49505c 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 8px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.wait { font-size: 13px; }
.due { font-variant-numeric: tabular-nums; font-size: 13px; }
.due.late { color: var(--red); font-weight: 700; background: var(--red-bg); padding: 2px 6px; border-radius: 4px; justify-self: start; }
.notes { font-size: 13px; color: #3c4553; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.drag-ghost { opacity: .35; }
.drag-chosen { box-shadow: 0 8px 24px rgba(16,24,40,.18); }
.sortable-fallback { opacity: .95 !important; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100% - 24px)); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
#jobForm { padding: 22px 24px; }
.dlg-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.dlg-head h2 { margin: 0; font-size: 1.25rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.span2 { grid-column: span 2; }
.dlg-foot { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.spacer { flex: 1; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: #1b2330; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red); }

/* ---------- Settings ---------- */
.settings { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .card form { display: grid; gap: 12px; }
.copy-row { display: flex; gap: 8px; margin: 10px 0 6px; }
.copy-row input { font-family: var(--mono); font-size: 12.5px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 8px 0 0; }
.inline-form input { width: auto; flex: 1; min-width: 140px; }
.add-user { margin-top: 14px; }
table.simple { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.simple th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.simple td { padding: 8px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
table.simple td .inline-form { margin: 0; }
table.simple tbody tr:nth-child(even) { background: var(--band); }

/* ---------- Narrow screens: rows become cards ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row.head { display: none; }
  .row {
    grid-template-columns: 26px 34px 1fr auto;
    grid-template-areas: "h n desc edit" "h n cust stage" "h n po due" "h n tech tech" "h n wait wait" "h n notes notes";
    row-gap: 4px; padding: 12px;
  }
  .row .handle { grid-area: h; align-self: start; }
  .row .num { grid-area: n; align-self: start; }
  .row .desc { grid-area: desc; }
  .row .edit { grid-area: edit; }
  .row .cust { grid-area: cust; }
  .row .stage-cell { grid-area: stage; justify-self: end; }
  .row .po { grid-area: po; flex-direction: row; gap: 8px; }
  .row .due { grid-area: due; justify-self: end; }
  .row .tech { grid-area: tech; flex-direction: row; gap: 6px; }
  .row .wait { grid-area: wait; }
  .row .wait:empty, .row .notes:empty, .row .po:empty { display: none; }
  .row .notes { grid-area: notes; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .brand { flex: 1; }
  .topbar nav { order: 3; flex: 1 1 100%; overflow-x: auto; }
  .row { grid-template-columns: 22px 26px 1fr auto; grid-template-areas: "h n desc desc" "h n cust cust" "h n stage due" "h n po po" "h n tech tech" "h n wait wait" "h n notes notes" "h n edit edit"; }
  .row .stage-cell { justify-self: start; }
  .row .edit { justify-self: start; margin-top: 4px; }
  .who span { display: none; }
  .board { padding: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .toolbar-right, .toolbar-right select, .toolbar-right input[type=search] { width: 100%; }
  .toolbar-right .btn.primary { width: 100%; justify-content: center; }
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .inline-form { flex-wrap: wrap; }
  table.simple th:nth-child(2), table.simple td:nth-child(2) { display: none; }
}

/* ---------- Workshop TV screen ---------- */
body.tv { background: #0f1b33; color: #fff; height: 100vh; overflow: hidden; display: flex; flex-direction: column; font-size: clamp(15px, 1.05vw, 28px); }
.tv-head { display: flex; align-items: center; gap: 2em; padding: .8em 1.4em; background: var(--navy); }
.tv-head h1 { font-size: 1.5em; margin: 0; }
.tv-head p { margin: 0; color: #b9c6dd; font-weight: 600; }
.tv-head > div:first-child { flex: 1; }
.tv-stats { display: flex; gap: .8em; }
.tv-stat { background: rgba(255,255,255,.08); border-radius: 8px; padding: .3em .9em; text-align: center; min-width: 5.5em; }
.tv-stat b { display: block; font-size: 1.6em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tv-stat span { font-size: .75em; color: #b9c6dd; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tv-stat.warn { background: #b42318; }
.tv-stat.warn span { color: #ffe1de; }
.tv-clock { text-align: right; display: flex; flex-direction: column; }
.tv-clock span:first-child { font-size: 1.8em; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.tv-clock span:last-child { color: #b9c6dd; font-size: .85em; }
.tv-main { flex: 1; overflow: hidden; padding: 0 1.4em; background: #fff; color: var(--ink); }
.tv-row { display: grid; grid-template-columns: 2.6em minmax(7em, 1fr) minmax(12em, 2.6fr) minmax(6em, .9fr) 12.5em 4.6em minmax(8em, 1.8fr); gap: .8em; align-items: center; padding: .45em .6em; border-bottom: 1px solid #e3e7ee; }
.tv-headrow { background: #fff; color: var(--muted); font-size: .7em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding-top: .9em; border-bottom: 2px solid var(--navy); }
#tvList .tv-row:nth-child(even) { background: var(--band); }
.tv-row.overdue { box-shadow: inset .3em 0 0 var(--red); }
.tv-num { font-weight: 800; font-size: 1.25em; color: var(--navy); text-align: center; font-variant-numeric: tabular-nums; }
.tv-cust { font-weight: 700; }
.tv-desc { font-weight: 500; }
.tv-tech { font-weight: 700; }
.tv-tech small { font-weight: 500; color: var(--muted); font-size: .85em; }
.tv-stage { display: inline-block; white-space: nowrap; padding: .2em .7em; border-radius: 999px; font-weight: 700; font-size: .9em; color: #1b2330; }
.tv-due { font-variant-numeric: tabular-nums; font-weight: 600; }
.tv-due.late { color: #fff; background: var(--red); border-radius: 4px; padding: .1em .35em; justify-self: start; }
.tv-wait { color: #3c4553; font-size: .9em; }
.tv-empty { text-align: center; font-size: 1.5em; color: var(--muted); padding: 2em; }
.tv-foot { display: flex; justify-content: space-between; padding: .4em 1.4em; background: #0f1b33; color: #b9c6dd; font-size: .8em; font-weight: 600; }
.tv-foot .stale { color: #ffb4ab; }

/* Active Hydraulics — Website-aligned visual system (brand overlay, 2026-10-27)
   Presentation only: the original application JS, routes and data logic remain intact. */
:root { --ah-blue:#069fdf; --ah-blue-deep:#087eb8; --ah-dark:#061d2c; --ah-ink:#102b3b; --ah-orange:#f68b21; }
body { line-height:1.48; }
h1,h2,.brand,.auth-brand-name { letter-spacing:-.035em; }
.btn { min-height:38px; font-weight:700; transition:background .18s, border-color .18s, transform .18s; }
.btn.primary { background:var(--ah-blue); border-color:var(--ah-blue); color:#fff; }
.btn.primary:hover { background:var(--ah-blue-deep); border-color:var(--ah-blue-deep); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline:3px solid var(--ah-blue); outline-offset:2px; }
a { color:var(--ah-blue-deep); }
body.auth { background:radial-gradient(circle at 84% 18%, rgba(0,155,222,.24), transparent 38%), linear-gradient(135deg,#061a28 0%,#092e44 55%,#071a29 100%); padding:28px 16px; }
.auth-shell { width:min(1060px,100%); display:grid; grid-template-columns:minmax(0,1fr) minmax(350px,440px); gap:clamp(24px,6vw,90px); align-items:center; }
.auth-intro { color:#fff; max-width:530px; }
.auth-intro .eyebrow { color:#55c5f5; text-transform:uppercase; font-size:12px; font-weight:800; letter-spacing:.16em; margin-bottom:14px; }
.auth-intro h2 { font-size:clamp(36px,4.3vw,61px); line-height:1.07; font-weight:780; margin:0 0 20px; }
.auth-intro h2 em { color:#17aee9; font-style:normal; }
.auth-intro p { max-width:420px; color:#bcd0dc; font-size:15px; line-height:1.7; }
.auth-strap { display:inline-flex; align-items:center; gap:8px; padding-top:20px; font-weight:700; color:#d9edf5; font-size:12px; letter-spacing:.02em; }
.auth-strap::before { content:''; width:24px; height:3px; background:var(--ah-orange); }
.auth-card { width:100%; max-width:none; padding:clamp(26px,3vw,42px); border-radius:16px; box-shadow:0 25px 75px rgba(0,0,0,.3); }
.auth-brand-name { display:block; color:var(--ah-dark); text-transform:uppercase; font-size:15px; font-weight:900; letter-spacing:.012em; }
.auth-brand-name b { color:var(--ah-blue-deep); }
.auth-kicker { margin:6px 0 26px; text-transform:uppercase; color:#6a8494; font-size:10px; letter-spacing:.16em; font-weight:800; }
.auth-card h1 { font-size:28px; letter-spacing:-.045em; margin-bottom:6px; }
.auth-card .muted { margin:0; }
.auth-card form { margin-top:26px; gap:16px; }
.auth-card label { font-size:13px; }
.auth-card input:not([type=checkbox]) { min-height:44px; }
.auth-card .btn.wide { min-height:46px; }
.auth-foot { color:#8098a7; font-size:11px; margin:25px 0 0; text-align:center; }
.topbar { background:var(--ah-dark); border-bottom:3px solid var(--ah-blue); min-height:64px; height:auto; padding-top:8px; padding-bottom:8px; gap:28px; box-shadow:0 3px 16px rgba(2,21,34,.1); }
.brand { display:flex; flex-direction:column; line-height:1.03; text-transform:uppercase; font-size:17px; font-weight:850; }
.brand small { color:#66c9f1; font-size:9px; font-weight:700; letter-spacing:.13em; margin-top:4px; }
.topbar nav a.active { color:#fff; background:rgba(0,159,223,.22); box-shadow:inset 0 -2px 0 var(--ah-blue); }
.topbar nav a:hover { background:rgba(0,159,223,.15); }
.board { padding-top:26px; }
.stat { border:1px solid var(--line); border-left:4px solid var(--ah-blue); box-shadow:0 3px 14px rgba(7,42,60,.045); padding:16px; }
.stat-num { color:var(--ah-dark); }
.jobs,.card { border:1px solid var(--line); box-shadow:0 4px 20px rgba(7,42,60,.055); }
.row.head { background:var(--ah-dark); }
.chip.on { background:var(--ah-dark); border-color:var(--ah-dark); }
.num,.grip-demo { color:var(--ah-blue-deep); }
.tv-head { background:var(--ah-dark); border-bottom:4px solid var(--ah-blue); }
body.tv { background:var(--ah-dark); }
.tv-head h1 { letter-spacing:-.035em; }
.tv-headrow { color:#4a6677; border-bottom-color:var(--ah-blue); }
.tv-num { color:var(--ah-blue-deep); }
.tv-foot { background:var(--ah-dark); }
@media(max-width:760px) { .auth-shell { display:block; max-width:460px; } .auth-intro { margin:0 0 22px; } .auth-intro h2 { font-size:31px; margin-bottom:8px; } .auth-intro p,.auth-strap { display:none; } .auth-intro .eyebrow { margin-bottom:7px; } }
@media(prefers-reduced-motion:reduce) { .btn { transition:none; } }

.tv-brand-accent { color:#61c7ef; font-weight:600; }

/* Actual Active Hydraulics supplied vector artwork — brand identity */
.auth-logo { display:block; width:min(285px,100%); height:auto; margin:0 0 9px; }
.auth-kicker { margin-top:0; margin-bottom:25px; }
.brand { min-width:180px; align-items:flex-start; text-transform:none; }
.brand-logo { width:185px; max-width:100%; height:auto; display:block; filter:brightness(0) invert(1); }
.brand small { margin-top:5px; letter-spacing:.12em; text-transform:uppercase; }
.tv-identity { display:flex; align-items:center; gap:1.1em; }
.tv-logo { width:clamp(180px,15vw,300px); height:auto; object-fit:contain; filter:brightness(0) invert(1); }
.tv-identity h1 { font-size:1.1em; border-left:2px solid rgba(255,255,255,.35); padding-left:1em; white-space:nowrap; }
@media(max-width:860px) { .brand { min-width:145px; } .brand-logo { width:155px; } .tv-identity { gap:.5em; } .tv-logo { width:160px; } }
