/* PitCrewly staff app — "Race day" (style A).
   Black sidebar, orange accent, light work area. System fonts only. */

:root {
  --ink: #111111;
  --accent: #FF5A1F;
  --accent-hover: #ff7440;
  --accent-soft: #ffe3d6;
  --accent-text: #a33a12;     /* orange-family text that passes contrast on white */
  --side: #111111;
  --side-2: #1c1c1c;
  --side-ink: #c9c9c4;
  --work: #f4f4f2;
  --lane: #e7e7e3;
  --card: #ffffff;
  --line: #dcdcd6;
  --line-soft: #ebebe7;
  --muted: #5d5d58;
  --danger: #c62828;
  --ok-bg: #e1f5e4;
  --ok-ink: #1d6b2c;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4e00;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .10), 0 1px 1px rgba(0, 0, 0, .04);
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, .20), 0 2px 6px rgba(0, 0, 0, .08);
  --tb: 0px;                  /* test bar height */
  --topbar: 56px;
  --tabs-h: 0px;              /* pinned recent-order tabs strip (desktop, when shown) */
  --sidebar: 220px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
body.has-test-bar { --tb: 32px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.45 var(--font); color: var(--ink); background: var(--work);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; font-weight: 800; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; font-weight: 750; }
code, kbd { font-family: var(--mono); font-size: .9em; }
code { background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: .05rem .35rem; }
.muted { color: var(--muted); font-size: .9rem; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Test bar ---------- */
.test-bar {
  position: sticky; top: 0; z-index: 80;
  min-height: var(--tb); display: flex; align-items: center; justify-content: center;
  padding: 0 12px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--accent) repeating-linear-gradient(-45deg, transparent 0 14px, rgba(0, 0, 0, .07) 14px 28px);
  color: #111; font-weight: 800; font-size: 12.5px; letter-spacing: .02em; line-height: 1.2;
  border-bottom: 2px solid #111;
}

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--tb)); }
.sidebar {
  position: sticky; top: var(--tb); height: calc(100vh - var(--tb));
  display: flex; flex-direction: column; gap: 4px;
  background: var(--side); color: var(--side-ink); overflow-y: auto;
  padding: 0 12px 12px;
}
.brand, .auth-brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: #fff; font-size: 1.15rem; letter-spacing: -.01em;
}
.brand { height: var(--topbar); padding: 0 6px; margin-bottom: 8px; border-bottom: 1px solid #262626; }
.brand:hover { color: #fff; }
.brand-name { font-weight: 600; }
.brand-name b { color: var(--accent); font-weight: 900; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #111; font-weight: 900; font-size: 1rem;
  transform: skewX(-8deg); box-shadow: 3px 3px 0 #fff2;
}
.side-nav { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a8a85; }
.nav-item {
  display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 10px;
  border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 550;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.is-active { background: var(--accent); color: #111; font-weight: 800; }
.nav-item.is-active .ico { stroke-width: 2.2; }
.nav-item.is-disabled { color: #77776f; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: #77776f; }
.chip {
  margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; background: #262626; color: var(--accent);
}
.side-foot {
  display: flex; align-items: center; gap: 10px; padding: 12px 6px 4px; border-top: 1px solid #262626;
  font-size: .85rem; line-height: 1.25; color: #fff; overflow: hidden;
}
.side-foot strong { font-weight: 650; display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.side-role { color: #8a8a85; font-size: .8rem; }

.work { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: var(--tb); z-index: 40;
  height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(244, 244, 242, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.page-actions:empty { display: none; }
.page-actions:empty + .bell { margin-left: auto; }
main { width: 100%; max-width: 1180px; padding: 24px 28px 48px; }

/* Quick search */
.quick { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; margin: 0; }
.quick > .ico { position: absolute; left: 12px; color: #77776f; pointer-events: none; width: 18px; height: 18px; }
.quick input[type=search] {
  width: 100%; height: 40px; min-height: 0; padding: 0 64px 0 38px; margin: 0;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .02);
}
.quick input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 90, 31, .28); }
.quick input::-webkit-search-cancel-button { display: none; }
.kbd {
  position: absolute; right: 9px; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--work);
  font-size: 11px; color: var(--muted); pointer-events: none;
}
.quick input:focus ~ .kbd { opacity: 0; }
.quick-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  max-height: min(70vh, 520px); overflow-y: auto; padding: 6px 6px 8px;
}
.quick-results[data-open] { display: block; }
.quick-results h2 {
  margin: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.quick-results ul.list li { border: 0; box-shadow: none; margin: 0; padding: 8px 10px; border-radius: 8px; border-left: 0; }
.quick-results ul.list li:hover, .quick-results ul.list li:focus-within { background: var(--work); }
.quick-results > p.muted { margin: 10px; }

/* User menu */
.usermenu { position: relative; }
.usermenu > summary {
  list-style: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
  min-height: 40px; min-width: 40px; padding: 3px; border-radius: 999px; font-weight: 600;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover, .usermenu[open] > summary { background: #e9e9e5; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--ink); color: var(--accent); font-weight: 800; font-size: .8rem; letter-spacing: .02em;
}
.avatar-sm { width: 30px; height: 30px; background: var(--accent); color: #111; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 220px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px;
}
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.menu-head span { color: var(--muted); font-size: .85rem; }
.menu form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--work); }
.menu-field { display: grid; gap: 4px; padding: 6px 10px 8px; font-size: .85rem; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.menu-field input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; padding: 0;
}
.menu-btn { display: none; }
.scrim { display: none; }

/* ---------- Page furniture ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin: .2rem 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 .35rem; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--ink); }
.back { display: inline-flex; align-items: center; gap: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .92rem; margin-top: .35rem; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px 18px; margin: 0 0 16px; }
.panel > h2:first-child { margin-top: 0; }
.panel-accent { border-left: 4px solid var(--accent); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.empty { padding: 18px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

.pill, .tag {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; white-space: nowrap;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: #ebebe7; color: #333;
}
.tag { border-radius: 4px; background: var(--ink); color: var(--accent); }
.pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }
.pill-danger { background: var(--danger); color: #fff; }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
/* Signatures (order panel) and the red "Waiver not signed" badge (order header, board card). */
.waiver-badge { background: var(--danger); color: #fff; font-weight: 700; }
.c-waiver { display: inline-block; margin: 6px 0 0; padding: 2px 8px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.sig-rows { list-style: none; padding: 0; }
.sig-row { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.sig-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sig-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sig-actions .inline-form { margin: 0; }
.sig-void .menu { padding: 10px; display: grid; gap: 8px; min-width: 240px; }
.auth-kiosk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.auth-inperson { margin: 4px 0 8px; font-size: .85rem; }
.waiver-text { color: var(--danger); }
.doc-edit { font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 320px; }
.doc-pre { white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--work); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }
.doc-history { margin-top: 10px; }
.urgent { display: inline-block; vertical-align: middle; background: var(--danger); color: #fff; border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.banner {
  display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 9px 12px;
  background: var(--warn-bg); border: 1px solid #ecd58c; border-radius: 8px; color: var(--warn-ink); font-size: .9rem;
}
.banner::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #d39b00; flex: none; }

/* Lists */
ul.list { list-style: none; padding: 0; margin: 0; }
ul.list li {
  background: var(--card); border-radius: var(--radius-sm); margin: 0 0 8px; padding: 11px 14px;
  box-shadow: var(--shadow-card);
}
ul.list li > a { font-weight: 750; color: var(--ink); text-decoration: none; }
ul.list li > a:hover { color: var(--accent-text); text-decoration: underline; }
.row-end { float: right; font-weight: 750; font-variant-numeric: tabular-nums; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; background: transparent; font-size: .93rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th {
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  background: #fafaf8; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbf9; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total { font-weight: 700; }

/* Forms */
label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .92rem; }
label > input:not([type=checkbox]):not([type=radio]), label > select { margin-top: 6px; }
input[type=search], input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 0 12px; font: inherit; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid #c9c9c3; border-radius: 9px;
}
textarea { padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 90, 31, .28); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink); text-decoration: none;
  background: #fff; border: 1px solid #c9c9c3; transition: background .12s, border-color .12s, transform .05s;
}
button:hover, .btn:hover { border-color: var(--ink); color: var(--ink); }
button:active, .btn:active { transform: translateY(1px); }
.btn-primary, button[type=submit].btn-primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-block { width: 100%; min-height: 46px; font-size: 1rem; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { min-height: 34px; width: auto; }
.stack { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.stack form { margin: 0; }
.stack button, .inline-form button { white-space: nowrap; }
[role=alert] {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-weight: 600;
  background: #fdecec; border: 1px solid #f2b8b8; color: #8f1d1d;
}

/* ---------- Board ---------- */
main:has(#board) {
  max-width: none; padding: 16px 0 0 24px; display: flex; flex-direction: column; overflow: hidden;
  height: calc(100vh - var(--tb) - var(--topbar) - var(--tabs-h)); height: calc(100dvh - var(--tb) - var(--topbar) - var(--tabs-h));
}
.board { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; padding-right: 24px; margin-bottom: 6px; }
.board-title h1 { margin: 0; }
.board-title .meta { margin-top: 2px; font-size: .85rem; }
.board-filters { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; flex: 1 1 520px; }
.board-filters label.bf { margin: 0; }
.board-filters .bf input, .board-filters .bf select { margin: 0; width: auto; min-height: 36px; height: 36px; padding: 0 10px; font-size: .88rem; border-radius: 8px; }
.board-filters .bf-q input { width: 270px; }
.board-filters .bf-tag input { width: 120px; }
.board-filters label.check.bf-check { margin: 0; min-height: 36px; gap: 6px; font-size: .86rem; white-space: nowrap; }
.board-filters label.check.bf-check input { width: 17px; height: 17px; }
.js-board .bf-go { display: none; }
.bf-clear { font-size: .86rem; font-weight: 700; }
.bf-hint { flex-basis: 100%; text-align: right; font-size: .78rem; color: var(--muted); }
.board-note { margin: 0 24px 10px 0; font-size: .78rem; color: var(--muted); }
.board-lanes { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lane-jump { display: none; }
.lanes {
  flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 12px;
  overflow-x: auto; overflow-y: hidden; padding: 0 24px 14px 0; overscroll-behavior-x: contain;
}
.lane {
  flex: 0 0 296px; min-height: 0; display: flex; flex-direction: column;
  background: var(--lane); border-radius: var(--radius); border-top: 4px solid var(--lane-color, var(--ink));
  transition: background .12s, opacity .12s;
}
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px 8px; }
.lane-head h2 {
  margin: 0; min-width: 0; font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lane-meta { display: flex; align-items: center; gap: 7px; flex: none; }
.lane-total { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.count {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--ink); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0;
}
.lane-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 10px; overscroll-behavior-y: contain; }
.lane-empty { margin: 4px 0; padding: 18px 8px; text-align: center; font-size: .85rem; color: var(--muted); border: 1px dashed #c8c8c2; border-radius: var(--radius-sm); }
.lane-body:has(.card) .lane-empty { display: none; }
.board-empty { margin: 0 24px 0 0; flex: 1; }
button.lane-more { width: 100%; min-height: 36px; margin-top: 2px; background: transparent; border: 1px dashed #b4b4ad; font-size: .85rem; }
button.lane-more:hover { background: #fff; }

.card {
  position: relative; display: block; margin: 0 0 8px; padding: 9px 10px 8px;
  background: var(--card); color: var(--ink); border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card); font-size: 12.5px; line-height: 1.35;
  transition: box-shadow .12s, opacity .12s;
}
.card:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.card.is-late { border-left-color: var(--danger); }
.card[data-draggable] { cursor: grab; }
.c-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.c-top { align-items: flex-start; }
.c-title { margin: 0; min-width: 0; font-size: 12.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.c-num { font-weight: 900; }
.c-link { color: inherit; text-decoration: none; }
.c-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.c-link:hover { color: inherit; }
.c-link:hover .c-job { text-decoration: underline; text-underline-offset: 2px; }
.c-link:focus-visible { outline: none; }
.c-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-due { flex: none; font-size: 10.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.c-due.is-late { color: var(--danger); }
.c-cust { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 13.5px; font-weight: 750; }
.c-src { font-size: 9px; font-weight: 800; letter-spacing: .05em; padding: 0 4px; border-radius: 3px; background: var(--line-soft); color: var(--muted); }
.c-phone, .c-move, .av, .ic > span[title] { position: relative; z-index: 1; }
.c-phone { margin-top: 1px; }
.c-phone > a { color: #1a5fb4; font-size: 12px; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.c-phone > a:hover { text-decoration: underline; }
.c-acts { display: flex; gap: 4px; }
.c-ic { display: inline-grid; place-items: center; width: 28px; height: 26px; border-radius: 6px; background: var(--line-soft); color: var(--ink); }
.c-ic:hover { background: var(--accent-soft); color: var(--accent-text); }
.bi { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.c-veh { margin-top: 2px; }
.c-color { color: var(--muted); }
.c-ids { margin-top: 1px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.c-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  --tag: #7a7a74; padding: 1px 6px; border-radius: 3px; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: color-mix(in srgb, var(--tag) 16%, #fff); color: color-mix(in srgb, var(--tag) 72%, #000);
  border: 1px solid color-mix(in srgb, var(--tag) 30%, #fff);
}
.tag.tag-auto { background: #111; color: var(--accent); border-color: #111; }
.tag.tag-auto.is-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.tag.tag-auto.is-wait { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.c-prog { margin-top: 7px; }
.bar { height: 6px; overflow: hidden; border-radius: 3px; background: #ececea; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.hrs { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.hrs b { color: var(--ink); }
.hrs .live { color: var(--accent-text); font-weight: 800; }
.c-icons { margin-top: 6px; }
.ic { display: flex; flex-wrap: wrap; gap: 3px 9px; font-size: 11px; color: #444; }
.ic > span { display: inline-flex; align-items: center; gap: 3px; }
.ic .on { color: var(--accent-text); font-weight: 800; }
.ic .ok { color: var(--ok-ink); }
.ic .wait { color: var(--warn-ink); font-weight: 700; }
.ic .due-bal { font-weight: 700; }
.av { display: flex; flex: none; padding-left: 5px; }
.av span {
  width: 22px; height: 22px; margin-left: -5px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid #fff; background: #111; color: #fff; font-size: 8.5px; font-weight: 800; letter-spacing: 0;
}
.av .av-writer { background: var(--accent-soft); color: var(--accent-text); }
.av .av-tech[class*="av-t"] { background: var(--av-bg); color: var(--av-ink); }
.av .av-more { background: var(--line-soft); color: var(--ink); }
.c-foot { margin-top: 6px; }
.c-days { font-size: 10.5px; color: var(--muted); }
.c-total { font-size: 13px; font-weight: 850; font-variant-numeric: tabular-nums; }
.c-move { display: flex; gap: 6px; margin: 7px 0 0; }
.c-move select { min-height: 30px; height: 30px; padding: 0 8px; font-size: 12px; border-radius: 7px; background-color: var(--work); cursor: pointer; }
.c-move .c-move-go { min-height: 30px; padding: 0 10px; font-size: 12px; }
.js-board .c-move-go { display: none; }
.js-board .card.move-armed .c-move-go { display: inline-flex; background: var(--accent); border-color: var(--accent); color: #111; }

/* Drag and drop */
body.is-dragging, body.is-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
body.is-dragging .lanes { scroll-snap-type: none; }  /* let auto-scroll move freely; snaps again on drop */
.card.is-drag-src { opacity: .35; box-shadow: none; outline: 2px dashed #a9a9a2; outline-offset: -2px; }
.card.is-lifting { box-shadow: 0 0 0 2px var(--accent), var(--shadow-card); }
.drag-ghost {
  position: fixed !important; left: 0; top: 0; z-index: 200; margin: 0 !important; pointer-events: none;
  box-shadow: var(--shadow-pop) !important; opacity: .96; will-change: transform;
}
.drag-ghost.is-blocked { outline: 2px solid var(--danger); }
.lane.drop-ok { outline: 2px dashed rgba(17, 17, 17, .22); outline-offset: -2px; }
.lane.drop-no { opacity: .5; }
.lane.drop-over.drop-ok { background: var(--accent-soft); outline: 2px solid var(--accent); }
.lane.drop-over.drop-no { opacity: .7; outline: 2px solid var(--danger); outline-offset: -2px; }
.card.is-saving { opacity: .65; }
.card.just-moved { animation: card-flash 1.4s ease-out; }
@keyframes card-flash { 0%, 35% { box-shadow: 0 0 0 3px var(--accent), var(--shadow-card); } 100% { box-shadow: var(--shadow-card); } }
@media (pointer: coarse) {
  .card[data-draggable], .card[data-draggable] a { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* Toasts */
.toasts {
  position: fixed; left: 50%; bottom: 18px; z-index: 210; transform: translateX(-50%);
  width: min(480px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  max-width: 100%; padding: 10px 14px; border-radius: 9px; border-left: 4px solid var(--accent);
  background: #111; color: #fff; box-shadow: var(--shadow-pop); font-size: .9rem; font-weight: 600; line-height: 1.35;
  pointer-events: auto; animation: toast-in .16s ease-out;
}
.toast.is-error { border-left-color: #ff6b6b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Order ---------- */
.svc { background: var(--card); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-card); margin: 0 0 14px; overflow: hidden; }
.svc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 16px; margin: 0; font-size: 1rem; }
.svc-head .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.svc .table-wrap { box-shadow: none; border-radius: 0; margin: 0; border-top: 1px solid var(--line-soft); }
.totals {
  display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: flex-end; align-items: baseline;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 14px 18px; margin-top: 18px;
}
.totals span { color: #a9a9a3; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin-right: 6px; }
.totals b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.totals .bal b { color: var(--accent); font-size: 1.25rem; }
.note { margin: 0 0 10px; }
.note strong { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* ---------- Customer ---------- */
.contact { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: .4rem; }
.vehicles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.vehicle { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-card); padding: 12px 14px; border-top: 3px solid var(--ink); }
.vehicle .vname { font-weight: 750; }
.vin { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

/* ---------- Calls ---------- */
.transcript { white-space: pre-wrap; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 16px; font-size: .93rem; max-height: 60vh; overflow: auto; }
.msg { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-card); padding: 10px 14px; margin: 0 0 8px; }
.msgbody { white-space: pre-wrap; margin-top: 4px; }
.pager { display: flex; gap: 10px; justify-content: space-between; }

/* ---------- Search page ---------- */
.search-big { position: relative; max-width: 720px; margin-bottom: 18px; }
.search-big .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #77776f; }
.search-big input { min-height: 52px; padding-left: 44px; font-size: 1.05rem; border-radius: 12px; }

/* ---------- Team / setup ---------- */
.invite-link { display: flex; gap: 8px; }
.invite-link input { font-family: var(--mono); font-size: .85rem; }
.form-card { max-width: 520px; }
.qr { width: 200px; max-width: 100%; background: #fff; padding: 10px; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0 10px; }
.qr svg { display: block; width: 100%; height: auto; }

/* ---------- Auth (login, setup) ---------- */
body.auth {
  background: var(--side) radial-gradient(1200px 500px at 85% -10%, rgba(255, 90, 31, .22), transparent 60%);
  color: var(--ink);
}
.auth-wrap { min-height: calc(100vh - var(--tb)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 18px; }
.auth-brand { font-size: 1.5rem; }
.auth-brand .brand-mark { width: 38px; height: 38px; font-size: 1.2rem; }
.auth-card {
  width: 100%; max-width: 420px; padding: 28px 26px; background: #fff; border-radius: 16px;
  border-top: 5px solid var(--accent); box-shadow: 0 30px 60px rgba(0, 0, 0, .45);
}
.auth-card h1 { font-size: 1.35rem; }
.auth-card .lede { margin: 0 0 20px; color: var(--muted); }
.auth-card:has(.qr) { max-width: 520px; }
.auth-foot { margin: 0; color: #8a8a85; font-size: .85rem; }

/* ---------- Phone ---------- */
@media (max-width: 767.98px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(280px, 84vw); height: auto;
    transform: translateX(-102%); box-shadow: var(--shadow-pop);
    /* Closed drawer is off-screen AND hidden, so keyboard and screen-reader
       users cannot reach its links. Visibility flips after the slide-out. */
    visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s linear 0s; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, .5); }
  body.nav-open { overflow: hidden; }
  .nav-item { min-height: 48px; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 10px; gap: 8px; }
  .icon-btn { width: 44px; height: 44px; }
  .quick input[type=search] { height: 44px; padding-right: 12px; }
  .kbd { display: none; }
  .usermenu > summary { padding: 0; min-height: 44px; min-width: 44px; justify-content: center; }
  .avatar { width: 38px; height: 38px; }
  .quick-results { position: fixed; top: calc(var(--tb) + var(--topbar) + 4px); left: 8px; right: 8px; max-height: calc(100vh - var(--tb) - var(--topbar) - 20px); }
  main { padding: 16px 16px 40px; }
  h1 { font-size: 1.35rem; }
  button, .btn, .btn-sm, .menu-item { min-height: 44px; }
  .inline-form select { min-height: 44px; }
  th, td { padding: 9px 10px; }
  .test-bar { font-size: 11.5px; letter-spacing: 0; padding: 4px 8px; }
  .totals { flex-direction: column; align-items: stretch; gap: 6px; }
  .totals > div { display: flex; justify-content: space-between; align-items: baseline; }
  /* Tables marked .table-stack become one card per row on a phone. */
  .table-stack { background: none; box-shadow: none; overflow: visible; }
  .table-stack table, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { display: none; }
  .table-stack tr { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 10px 14px; margin: 0 0 10px; }
  .table-stack td { border: 0; padding: 5px 0; text-align: left; }
  .table-stack td.num { text-align: left; }
  .table-stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 800; letter-spacing: .07em;
    text-transform: uppercase; color: var(--muted);
  }
  .table-stack tbody tr:hover td { background: none; }
  .table-stack .stack { flex-direction: row; flex-wrap: wrap; }
  .auth-card { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Shop settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 16px; align-items: start; }
.form-error { background: #fdecea; color: #8a1c10; border-left: 4px solid #c0392b; padding: 10px 14px; border-radius: var(--radius); }
.form-ok { background: #e8f5ec; color: #1d5c32; border-left: 4px solid #2e8b57; padding: 10px 14px; border-radius: var(--radius); }
.check-set { border: 0; padding: 0; margin: 0 0 14px; }
.check-set legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: 6px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.tier-table input[type=text] { width: 100%; min-width: 90px; }

/* Orders list and native order/customer forms */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { flex: 0 1 160px; }
.orders-table th.num, .orders-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.orders-table td, .orders-table th { white-space: nowrap; }
.pill.stage-estimate { background: var(--accent-soft); color: var(--accent-text); }
.pill.stage-repair_order { background: #e3edf9; color: #1b4a80; }
.pill.stage-invoice { background: var(--ok-bg); color: var(--ok-ink); }
.pager { display: flex; gap: 8px; }
.head-actions, .vactions { display: flex; flex-wrap: wrap; gap: 8px; }
.vactions { margin-top: 8px; }
.form-card input[type=text], .form-card input[type=email], .form-card input[type=search], .form-card select, .form-card textarea { width: 100%; }

/* ---------- Order screen v2 (Tier 1 orders, Task 5) ---------- */
main:has(.order-layout) { max-width: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Order header: sticky under the top bar; once scrolled (.is-compact) the eyebrow and the customer /
   vehicle strip fold away and the title shrinks (orders.js). */
.order-head {
  position: sticky; top: calc(var(--tb) + var(--topbar)); z-index: 30;
  margin: -10px 0 14px; padding: 10px 0 8px; background: var(--work);
}
/* Focus / scrollIntoView keep fields clear of the sticky header (and the phone's bottom bars). */
html:has(.order-head) { scroll-padding-top: calc(var(--tb) + var(--topbar) + 64px); }
.order-head.is-compact { box-shadow: 0 8px 10px -10px rgba(0, 0, 0, .35); padding: 8px 0 6px; }
.order-head.is-compact .eyebrow, .order-head.is-compact .oh-strip { display: none; }
.order-head.is-compact h1 { font-size: 1.12rem; }
.order-head.is-compact .order-id { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.order-head.is-compact .oh-pills { margin-top: 0; }
.oh-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.order-id { min-width: 0; }
.order-head h1 { margin: 0; overflow-wrap: anywhere; }
.order-head h1 .job { font-weight: 650; color: #3a3a36; }
.oh-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 8px; font-size: .92rem; color: var(--muted); }
.oh-strip:not(:has(*)) { display: none; }
.oh-jump {
  min-height: 30px; padding: 0 6px; margin: 0 -6px; border: 0; border-radius: 6px; background: none;
  font-weight: 750; color: var(--ink); text-decoration: underline dotted var(--line); text-underline-offset: 4px;
}
.oh-jump:hover { background: #fff; color: var(--accent-text); border: 0; }
.oh-name { font-weight: 750; color: var(--ink); }
.oh-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.oh-item a { color: inherit; }
.oh-item .vin { overflow-wrap: anywhere; }
.copy-btn { min-height: 26px; padding: 0 8px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.order-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.op-toggle { display: none; }
.op-toggle .ico { width: 16px; height: 16px; }
.dropdown { position: relative; }
.dropdown > summary, .pop > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker, .pop > summary::-webkit-details-marker { display: none; }
a.menu-item { text-decoration: none; }
/* Page + right panel: docked at >= 1280 px; slid in by the header's Details button at 768-1279 (it
   pushes the main column); a full-screen sheet from the bottom tabs on a phone (.panel-open, orders.js). */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 1280px) { .order-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; } }
@media (min-width: 768px) and (max-width: 1279.98px) {
  .op-toggle { display: inline-flex; }
  .op-toggle[aria-expanded=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
  .order-layout .order-panel { display: none; }
  .order-layout.panel-open { grid-template-columns: minmax(0, 1fr) 340px; }
  .order-layout.panel-open .order-panel { display: flex; animation: op-slide .2s ease-out; }
}
@keyframes op-slide { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes op-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Tabs */
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 0 0 14px; overflow-x: auto; }
.tab {
  background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  padding: 8px 2px 6px; min-height: 40px; font-weight: 650; color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--ink); border-color: transparent; border-bottom-color: var(--line); }
.tab[aria-selected=true], .tab[aria-selected=true]:hover { color: var(--ink); border-bottom-color: var(--accent); font-weight: 800; }
.tab .count { margin-left: 4px; }
.tab:active { transform: none; }

.concern { background: #fff; border-left: 4px solid var(--ink); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; box-shadow: var(--shadow-card); }
.concern strong { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.services-list:has(.svc) .svc-empty { display: none; }

/* Service card */
.order-page .svc { position: relative; overflow: visible; padding: 12px 16px 14px; }
.svc.svc-approved { border-left-color: #2e9e4a; }
.svc.svc-declined { border-left-color: #b9b9b2; }
.svc.svc-declined .lines { opacity: .62; }
.svc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.svc-title h3 { margin: 0; font-size: 1.04rem; font-weight: 800; line-height: 1.3; }
.svc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.pill.auth-approved { background: var(--ok-bg); color: var(--ok-ink); }
.pill.auth-pending { background: var(--warn-bg); color: var(--warn-ink); }
.pill.auth-declined { background: #ebebe7; color: #6b6b66; }
.svc-note { margin: 6px 0 0; font-size: .9rem; color: #3a3a36; }
.toggle.is-on { background: var(--ok-bg); border-color: #9fd3ab; color: var(--ok-ink); }
.pop[open] { flex-basis: 100%; order: 5; }
.pop[open] > summary { background: var(--ink); color: #fff; border-color: var(--ink); }
.pop-form {
  margin-top: 8px; padding: 12px; background: #fafaf8; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}
.pop-form label { margin: 0; font-size: .85rem; }
.pop-form .span2 { grid-column: 1 / -1; }
.pop-form textarea { width: 100%; margin-top: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; grid-column: 1 / -1; }
.combo { display: flex; gap: 6px; margin-top: 6px; }
.order-page .combo select { width: 88px; flex: none; margin: 0; }
.combo input { margin: 0; }

/* Card header: inline name, approval pill (opens approve / decline), tech "+", ⋯ menu */
.svc-title { flex: 1; min-width: 0; }
.svc-name { margin: 0; }
.order-page .svc-name input {
  min-height: 34px; height: 34px; margin: 0 0 0 -8px; padding: 0 8px; width: calc(100% + 8px);
  font-size: 1.04rem; font-weight: 800; border-color: transparent; background: transparent; text-overflow: ellipsis;
}
.order-page .svc-name input:hover { border-color: var(--line); background: #fff; }
.order-page .svc-name input:focus { border-color: var(--ink); background: #fff; }
.svc-name.is-dirty input { background: #fffaf0; }
.pill-btn { cursor: pointer; user-select: none; }
.pill-btn:hover { box-shadow: inset 0 0 0 1px currentColor; }
.svc-tags .pop[open] { flex-basis: auto; order: 0; }
.auth-pop .pop-form {
  position: absolute; z-index: 40; left: 12px; right: 12px; max-width: 460px;
  background: #fff; border-color: var(--line); box-shadow: var(--shadow-pop);
}
.svc-more { width: 34px; padding: 0; font-size: 1.1rem; letter-spacing: 0; }
.svc-menu .menu { min-width: 210px; }
.menu-item[disabled] { color: var(--muted); opacity: .55; cursor: default; }
.menu-item[disabled]:hover { background: none; }
.menu-danger { color: var(--danger); }
.svc-edit[open] { margin-top: 8px; }

/* Lines: one typed section per kind; each row is a grid whose columns come from the section (--cols). */
.lines { margin-top: 10px; container: lines / inline-size; }
.lsec { --cols: minmax(0, 1fr) 64px; border-top: 1px solid var(--line-soft); }
.lsec + .lsec { margin-top: 4px; }
.line {
  display: grid; grid-template-columns: var(--cols); gap: 6px; align-items: center;
  padding: 5px 0; margin: 0; border-bottom: 1px solid var(--line-soft); font-size: .92rem;
}
.lsec > .line:last-child { border-bottom: 0; }
.line[hidden] { display: none !important; }
.line.lh { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 8px 0 3px; }
.line.lh .ld { color: var(--ink); font-size: 11px; }
.line .lq, .line .lc, .line .lp, .line .lt { text-align: right; font-variant-numeric: tabular-nums; }
.line .lt { font-weight: 750; }
.line .lt .lbl { font-weight: 800; }
.line label { margin: 0; font-weight: 400; font-size: inherit; }
.order-page .line input[type=text] {
  min-height: 34px; height: 34px; padding: 0 8px; margin: 0; font-size: .92rem; border-radius: 7px;
  border-color: transparent; background: transparent;
}
.order-page .line input[type=text]:hover { border-color: var(--line); background: #fff; }
.order-page .line input[type=text]:focus { background: #fff; border-color: var(--ink); }
.order-page .line :is(.lq, .lc, .lp) input[type=text] { text-align: right; font-variant-numeric: tabular-nums; padding: 0 6px; }
.line .ld { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.order-page .line .ld .pn { min-height: 24px; height: 24px; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.line .ltech { min-width: 0; }
.line.ro .ld { display: block; }
.line.ro .ld small { display: block; color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.hidden-note { font-size: .72rem; color: var(--muted); padding-left: 8px; }
.lbl { display: none; }
.kind {
  display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 4px; border-radius: 4px; background: #ebebe7; color: #333;
}
.kind-labor { background: #e3edf9; color: #1b4a80; }
.kind-part, .kind-tire { background: var(--accent-soft); color: var(--accent-text); }
.kind-sublet { background: #efe6f7; color: #5b2d82; }
.src { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-right: 8px; }
.la { display: flex; gap: 4px; justify-content: flex-end; }
.line-save { visibility: hidden; width: 34px; padding: 0; }
.line.is-dirty .line-save, .line:focus-within .line-save { visibility: visible; }
.line.is-dirty { background: #fffaf0; }
.line.is-dirty .line-save { background: var(--accent); border-color: var(--accent); }
.line-more { width: 34px; padding: 0; font-size: 1.05rem; letter-spacing: 0; }
.line-del, .nl-cancel { width: 34px; padding: 0; font-size: 1.15rem; color: var(--muted); }
.line-del:hover { color: var(--danger); border-color: var(--danger); }
.line.is-editing { background: #eef4fc; box-shadow: inset 3px 0 0 #1b4a80; }
.line.nl { background: #fafaf8; border: 1px dashed #d4d4ce; border-radius: var(--radius-sm); padding: 6px; margin: 4px 0 2px; }
.lsec > .line.nl:last-child { border-bottom: 1px dashed #d4d4ce; }
.order-page .line.nl input[type=text] { border-color: var(--line); background: #fff; }
.nl-add { width: 34px; padding: 0; }
.lines-empty { margin: 10px 0 0; }

/* Narrow cards (phones, and tablets without room for the columns): lines become stacked cards -
   description, then hours/qty · rate/price · total, then tech chip and ⋯. */
@container lines (max-width: 600px) {
  .lsec { border-top: 0; }
  .lsec + .lsec { margin-top: 0; }
  .line.lh { display: block; padding: 10px 0 4px; }
  .line.lh > :not(.ld) { display: none; }
  .lsec > .line:not(.lh), .lsec > .line:not(.lh):last-child {
    display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end;
    padding: 10px; margin: 0 0 8px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fff;
  }
  .lsec > .line.nl { border: 1px dashed #d4d4ce; background: #fafaf8; }
  .line .ld { flex: 1 1 100%; }
  .order-page .line .ld .pn { min-height: 44px; height: 44px; margin-top: 4px; }
  .line .lq, .line .lc, .line .lp { flex: 1 1 0; min-width: 0; text-align: left; }
  .line .lt { flex: 0 0 auto; margin-left: auto; padding-bottom: 11px; text-align: right; }
  .line .lt .lbl { text-align: right; }
  .line.ro { align-items: baseline; }
  .line.ro .lq, .line.ro .lp { flex: 0 1 auto; }
  .line.ro .lt { padding-bottom: 0; }
  .line .ltech { order: 5; flex: 1 1 calc(100% - 64px); min-width: 0; align-self: center; }
  .line .ltech:empty { display: none; }
  .line .la { order: 6; flex: 0 0 auto; margin-left: auto; align-self: center; }
  .lbl { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .order-page .line input[type=text] { min-height: 44px; height: 44px; border-color: var(--line); background: #fff; font-size: 16px; }
  .order-page .line :is(.lq, .lc, .lp) input[type=text] { text-align: left; }
  .line-save { display: none; width: 44px; }
  .line.is-dirty .line-save { display: inline-flex; visibility: visible; }
  .line-del { display: none; }  /* delete from the ⋯ editor on a phone */
  .line-more, .nl-add, .nl-cancel { width: 44px; }
}

/* Card footer: + Labor · + Part · + Tire · + Fee · + Sublet, discount / set price, service total */
.svc-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.svc-add { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-add .btn { color: var(--accent-text); }
.svc-sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; margin-left: auto; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); font-weight: 650; }
.btn-quiet:hover { border-color: var(--line); background: #fff; }
.btn-quiet.is-on { color: var(--accent-text); }
.svc-subtotal { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-total { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.svc-total-l { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.svc-total b { font-size: 1.12rem; font-variant-numeric: tabular-nums; }

/* Line detail editor ("Enter labor / part information"): replaces the right panel's tabs while open */
.op-editor { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 16px; }
.order-panel.is-editing > .op-head, .order-panel.is-editing > .op-body { display: none; }
.le-head { display: flex; align-items: center; gap: 10px; }
.le-title { margin: 0; font-size: 1rem; font-weight: 800; }
.le-title:focus { outline: none; }
.le-svc { margin: 4px 0 10px; }
.le-field { margin: 0 0 10px; font-size: .85rem; }
.le-field textarea { width: 100%; margin-top: 6px; }
.le-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.le-lbl { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.le-tech { margin-bottom: 12px; }
.le-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 6px; }
.le-presets .btn[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.le-presets .btn[disabled] { opacity: .45; cursor: not-allowed; }
.le-help { margin: 0 0 10px; font-size: .8rem; }
.le-total { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 6px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.le-total b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.le-toggles { border: 0; padding: 0; margin: 0 0 10px; }
.le-toggles label.check { margin: 0; min-height: 36px; font-size: .9rem; }
.le-toggles .le-help { margin: 2px 0 0 30px; }
.le-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.le-actions .le-del { margin-left: auto; }
.le-page .panel { max-width: 520px; }

/* Add a service: toolbar above the cards opens the Search services dialog */
.svc-toolbar { display: flex; gap: 10px; margin: 0 0 12px; }
.ss-trigger {
  display: flex; flex: 1; align-items: center; gap: 9px; min-width: 0; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--muted);
  font-weight: 600; text-decoration: none;
}
.ss-trigger:hover { border-color: var(--ink); color: var(--ink); }
.ss-icon { position: relative; flex: none; width: 12px; height: 12px; margin: -3px 3px 0 0; border: 2px solid currentColor; border-radius: 50%; }
.ss-icon::after { content: ""; position: absolute; right: -5px; bottom: -4px; width: 6px; height: 2px; background: currentColor; transform: rotate(45deg); }
.svc-toolbar .btn { flex: none; }
.ro-note { margin: 4px 0 16px; }

/* Summary and key/value lists */
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 32px; }
dl.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); flex: none; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv .grand, .kv .grand dt { font-weight: 800; color: var(--ink); }
.kv .rule { border-top: 1px solid var(--line); }
.notes-form textarea { width: 100%; margin-top: 6px; }

/* Right panel */
.order-panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 768px) {
  .order-panel { position: sticky; top: calc(var(--tb) + var(--topbar) + 16px); max-height: calc(100vh - var(--tb) - var(--topbar) - 32px); max-height: calc(100dvh - var(--tb) - var(--topbar) - 32px); margin-top: -8px; }
}
.order-panel.is-flash { animation: op-flash 1s ease-out; }
@keyframes op-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent), var(--shadow-card); } 100% { box-shadow: var(--shadow-card); } }
.op-head { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); flex: none; }
.op-tabs { display: flex; flex: 1; min-width: 0; padding: 0 6px; }
.op-close { display: none; flex: none; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 1.5rem; font-weight: 500; color: var(--muted); }
.op-close:hover { color: var(--ink); background: var(--work); border: 0; }
@media (max-width: 1279.98px) { .op-close { display: inline-flex; } }
.op-tabs .tab { flex: 1; padding: 10px 0 7px; }
.op-body { padding: 12px 16px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.op-sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.op-sec h3 { margin: 0 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chip-owner { font-size: 9.5px; padding: 1px 5px; border-radius: 4px; background: var(--ink); color: var(--accent); letter-spacing: .05em; }
.op-list { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.op-list li { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.op-list li:last-child { border-bottom: 0; }
.op-items { display: block; font-size: .8rem; color: var(--muted); }
.op-amt { float: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.op-name { margin: 0 0 4px; font-size: 1rem; }
.op-name a { color: var(--ink); }
.op-fold > summary { cursor: pointer; list-style: none; }
.op-fold > summary::-webkit-details-marker { display: none; }
.op-fold > summary h3 { margin: 0; }
.op-fold > summary h3::after { content: "▸"; margin-left: auto; font-size: 12px; }
.op-fold[open] > summary h3::after { content: "▾"; }
.op-fold[open] > summary { margin-bottom: 6px; }
.op-edit { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.op-edit summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--accent-text); }
.op-form { margin-top: 10px; }
.op-form label { margin-bottom: 10px; font-size: .85rem; }
.order-page .op-form input { min-height: 38px; }
.order-page input[type=date] { width: 100%; min-height: 38px; padding: 0 10px; font: inherit; border: 1px solid #c9c9c3; border-radius: 9px; background: #fff; margin-top: 6px; }
.op-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-list { list-style: none; padding: 0; margin: 8px 0; }
.contact-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.contact-list li > a { overflow-wrap: anywhere; }
.contact-acts { display: flex; gap: 4px; flex: none; }

/* Sticky totals footer: Grand total / Remaining balance (a button that expands the breakdown upwards) */
.order-foot { flex: none; background: var(--ink); color: #fff; }
.of-main { padding: 6px 16px 12px; }
.of-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: #fff; text-align: left; font-weight: 400;
}
.of-toggle:hover { color: #fff; border: 0; }
.of-total, .of-bal { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.of-total > span, .of-bal > span { color: #a9a9a3; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; white-space: nowrap; }
.of-total b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.of-bal b { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.of-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.of-pay { flex: none; white-space: nowrap; }
.of-pay[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.of-chev { flex: none; width: 9px; height: 9px; margin: 4px 6px 0 auto; border: solid #a9a9a3; border-width: 2px 2px 0 0; transform: rotate(-45deg); transition: transform .15s; }
.of-toggle[aria-expanded=true] .of-chev { transform: rotate(135deg); }
.of-break { padding: 10px 16px 4px; border-bottom: 1px solid #2c2c2a; max-height: 46vh; overflow-y: auto; }
.of-break .kv > div { border-bottom-color: #2c2c2a; }
.of-break .kv dt { color: #b9b9b3; }
.of-note { margin: 6px 0 4px; font-size: .8rem; color: #b9b9b3; }

/* Save errors */
.order-flash:empty { display: none; }
.order-flash { position: fixed; z-index: 100; top: calc(var(--tb) + var(--topbar) + 10px); left: 50%; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); }
.order-flash [role=alert] { margin: 0; box-shadow: var(--shadow-pop); }

@media (max-width: 767.98px) {
  .order-actions { width: 100%; }
  .order-page .svc { padding: 12px; }
  /* Lines become stacked cards: description, then hours/qty · rate/price · total, then tech chip and ⋯ */
  .order-page .svc-name input { min-height: 44px; height: 44px; font-size: 1.05rem; }
  .svc-more { width: 44px; }
  .tchip-x { width: 36px; min-height: 36px; }
  .svc-foot { gap: 10px; }
  .svc-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .svc-add .btn { padding: 0 6px; }
  .svc-sum { width: 100%; margin-left: 0; justify-content: flex-start; }
  .svc-total { margin-left: auto; }
  .le-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .op-editor { padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); }
  .le-field input, .le-field select, .le-field textarea { font-size: 16px; }
  .le-presets .btn { flex: 1 1 64px; }
  .auth-pop .pop-form { left: 8px; right: 8px; }
  .pill-btn { position: relative; padding: 4px 10px; }
  .pill-btn::after { content: ""; position: absolute; inset: -10px -6px; }  /* 44 px tap target */
  /* The panel is a full-screen sheet (bottom tabs, header names, the bar's total open it). */
  .order-layout .order-panel { display: none; }
  .order-layout.panel-open .order-panel {
    /* It stops at the bottom tabs, which stay usable as the sheet's navigation. */
    display: flex; position: fixed; z-index: 95; inset: var(--tb) 0 calc(57px + env(safe-area-inset-bottom)) 0;
    border-radius: 0; max-height: none; margin: 0;
    animation: op-rise .18s ease-out;
  }
  body.op-sheet { overflow: hidden; }
  .op-tabs .tab { min-height: 48px; }
  .op-body { padding-bottom: 20px; }
  .order-panel.is-editing .order-foot { display: none; }
  .order-head { margin-top: -6px; padding-top: 6px; }
  .order-head.is-compact .order-actions { display: none; }  /* the bar at the bottom has the next step */
  .oh-strip { gap: 2px 14px; }
  .oh-jump { min-height: 44px; }
  .copy-btn { min-width: 64px; min-height: 44px; }
  main:has(.order-tabbar) { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  main:has(.order-bar) { padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
  html:has(.order-tabbar) { scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  html:has(.order-bar) { scroll-padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
}

/* Phone: bottom tabs (Order · Customer · Vehicle · Messages) and the slim total + next-step bar above them */
.order-tabbar, .order-bar { display: none; }
@media (max-width: 767.98px) {
  .order-tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line);
  }
  .otb-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 4px 2px; border: 0; border-radius: 0; background: none;
    font-size: 11.5px; font-weight: 700; color: var(--muted); text-decoration: none;
  }
  .otb-item:hover { border: 0; color: var(--ink); }
  .otb-item.is-active { color: var(--accent-text); }
  .otb-item .ico { width: 22px; height: 22px; }
  .order-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); z-index: 59;
    min-height: 60px; padding: 8px 12px 8px 16px; background: var(--ink); color: #fff;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .18);
  }
  .ob-total {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; padding: 0;
    border: 0; background: none; color: #fff; font-weight: 400; line-height: 1.15;
  }
  .ob-total:hover { color: #fff; border: 0; }
  .ob-total span { color: #a9a9a3; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
  .ob-total b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
  .order-bar > :last-child:not(.ob-total) { margin-left: auto; }
  .order-bar .btn[disabled] { opacity: .5; cursor: not-allowed; }
  .ob-send .menu { top: auto; bottom: calc(100% + 8px); right: 0; }
}

/* Lifecycle + recommendations (Task 6) */
.invoice-confirm { margin: 12px 0; border-color: var(--accent, currentColor); }
.invoice-confirm ul { margin: 6px 0 12px 18px; }
.op-life { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
/* Suggestions strip above the service cards: open recommendations for this vehicle */
.sugg { margin: 0 0 12px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: var(--radius-sm); }
.sugg-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; cursor: pointer; list-style: none; }
.sugg-head::-webkit-details-marker { display: none; }
.sugg-title { font-weight: 800; }
.sugg-head .count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--accent); font-size: 11px; font-weight: 800; }
.sugg-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-total { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.sugg-chev { flex: none; width: 8px; height: 8px; margin: 0 4px 3px 4px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.sugg-head .muted + .sugg-chev { margin-left: auto; }
.sugg[open] .sugg-chev { transform: rotate(-135deg); margin-bottom: -3px; }
.sugg > .recs { padding: 0 12px 8px; border-top: 1px solid var(--line-soft); }
@media (max-width: 767.98px) { .sugg-sub { display: none; } }
.recs li { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- Customer pages (/e/, /i/) — Task 7 ---------- */
body.pub { background: var(--work); }
.pub-wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px; }
.pub-head { background: var(--ink); color: #fff; border-bottom: 3px solid var(--accent); }
.pub-head .pub-wrap { padding-top: 14px; padding-bottom: 14px; }
.pub-shop { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.pub-contact { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: #c9c9c4; font-size: .88rem; }
.pub-contact a { color: #fff; }
.pub-main { padding-top: 18px; padding-bottom: 8px; }
.pub-test {
  margin: 0 0 16px; padding: 12px 14px; border: 2px dashed #111; border-radius: var(--radius);
  background: var(--accent-soft); color: #111; font-size: .95rem;
}
.pub-intro h1 { font-size: 1.5rem; margin: 0 0 6px; }
.pub-eyebrow { margin: 0 0 2px; color: var(--muted); font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pub-lead { margin: 0 0 16px; color: var(--muted); }
.pub-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px; margin: 0 0 12px; }
.pub-card h2 { margin: 0; font-size: 1.05rem; }
.pub-state p, .pub-dead p { margin: 8px 0 0; }
.pub-dead { margin-top: 8px; text-align: center; padding: 28px 18px; }
.pub-dead h1 { font-size: 1.3rem; }
.pub-ok { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-ink); }
.pub-error { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: #fde8e8; color: #8e1c1c; border: 1px solid #f2b8b8; font-weight: 600; }
.pub-error[hidden] { display: none; }
.pub-warn { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: #fff4d6; color: #6b4a00; border: 1px solid #f0d58a; font-weight: 600; }
.pub-warn[hidden] { display: none; }
.pub-services { list-style: none; margin: 0; padding: 0; }
.pub-svc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pub-price { font-weight: 800; font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pub-note { margin: 6px 0 0; color: #333; white-space: pre-line; }
.pub-lines { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line-soft); font-size: .92rem; }
.pub-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.pub-desc { min-width: 0; overflow-wrap: anywhere; }
.pub-qty { color: var(--muted); font-size: .85em; white-space: nowrap; }
.pub-lnote { display: block; color: var(--muted); font-size: .85em; }
.pub-amt { white-space: nowrap; font-variant-numeric: tabular-nums; color: #333; }
.pub-disc .pub-desc, .pub-disc .pub-amt { color: var(--ok-ink); }
.pub-svc[data-status="declined"] .pub-price { color: var(--muted); text-decoration: line-through; }
.pub-status { margin: 10px 0 0; }
.pub-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.pub-opt { position: relative; display: block; cursor: pointer; }
.pub-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pub-opt span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 10px;
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-weight: 700;
}
.pub-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-opt-yes input:checked + span { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.pub-opt-yes input:checked + span::before { content: "\2713"; }
.pub-opt-no input:checked + span { background: #ebebe7; border-color: #6b6b66; color: #333; }
.pub-totals dl, .pub-meta { margin: 0; }
.pub-totals dl > div, .pub-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.pub-totals dt, .pub-meta dt { color: var(--muted); }
.pub-totals dd, .pub-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.pub-grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px !important; font-weight: 800; font-size: 1.1rem; }
.pub-grand dt { color: var(--ink); }
.pub-meta { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .9rem; }
.pub-small { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.pub-selection { margin: 6px 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--work); font-weight: 600; }
.pub-sign h2 { margin-bottom: 4px; }
.pub-field { display: block; margin: 0 0 14px; font-weight: 700; font-size: .92rem; }
.pub-field input[type=text] {
  display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 0 12px;
  font: inherit; font-size: 16px; font-weight: 400; /* 16px stops iOS zooming in */
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
.sig-box { position: relative; margin-top: 6px; }
.sig-pad {
  display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair;
  background: #fff; border: 2px dashed #9a9a94; border-radius: var(--radius-sm);
  -webkit-user-select: none; user-select: none;
}
.sig-hint {
  position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; pointer-events: none;
  color: #8a8a84; font-weight: 400; font-size: .9rem;
}
.sig-hint[hidden] { display: none; }
.sig-tools { display: flex; justify-content: flex-end; margin-top: 6px; }
/* Signed documents (waiver, estimate / invoice consent) and the shop-iPad kiosk. */
.pub-doc { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; background: #fff; }
.pub-doc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-doc h3 { margin: 0 0 6px; font-size: .95rem; }
.pub-doc-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.5; color: #222; }
.pub-card.pub-doc { padding: 16px; }
.pub-consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--work); font-size: .88rem; line-height: 1.4; cursor: pointer; }
.pub-consent input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: #111; }
.pub-kiosk-note { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: #111; color: #fff; font-weight: 600; }
.pub-kiosk { font-size: 19px; }
.pub-kiosk .pub-wrap { max-width: 900px; }
.pub-kiosk .pub-intro h1 { font-size: 2rem; }
.pub-kiosk .pub-doc-text { font-size: 1.02rem; }
.pub-kiosk .sig-pad { height: 260px; }
.pub-kiosk .pub-consent input { width: 30px; height: 30px; }
.pub-kiosk .btn-block { min-height: 60px; font-size: 1.15rem; }
.pub-kiosk-done { text-align: center; padding: 48px 20px; margin-top: 10vh; }
.pub-kiosk-done h1 { font-size: 2rem; margin: 0 0 10px; }
.pub-kiosk-check { margin: 0 auto 12px; width: 84px; height: 84px; line-height: 84px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-ink); font-size: 46px; font-weight: 800; }
.pub-kiosk-staff { text-align: center; }
.pub-kiosk-wait { margin: 0 auto 16px; width: 56px; height: 56px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--accent); animation: kiosk-spin 1.2s linear infinite; }
@keyframes kiosk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pub-kiosk-wait { animation: none; } }
.sig-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; color: var(--warn-ink); }
.send-ipad select { min-height: 32px; }
.kiosk-code-num { font-size: 2rem; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
.pub-due { display: grid; gap: 10px; }
.pub-due > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pub-due b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.pub-due .btn[disabled] { opacity: .55; cursor: not-allowed; }
.pub-due form { margin: 0; }
.pub-due h2 { margin: 0; font-size: 1.1rem; }
.pub-deposit { margin-bottom: 14px; }
.pay-link-row { margin: 10px 0; }
.pub-footer-note { white-space: pre-line; }
.pub-foot { padding-top: 6px; padding-bottom: 28px; color: var(--muted); font-size: .88rem; text-align: center; }
.pub-foot p { margin: 4px 0; }
.pub-secure { font-size: .8rem; }

/* Staff side: customer links in the order panel */
.link-notice { margin: 0 0 12px; }
.link-notice p { margin: 0 0 8px; }
.link-row { display: flex; gap: 6px; align-items: center; }
.link-row input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: .82rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--work); }
.op-links li { display: grid; gap: 6px; }
.sig-thumb { display: block; max-width: 180px; max-height: 60px; margin-top: 4px; background: #fff; border: 1px solid var(--line-soft); border-radius: 4px; }
.send-menu .menu-item { width: 100%; text-align: left; }

/* ---------- Board on a phone: one lane per screen, swipe between them ---------- */
@media (max-width: 767.98px) {
  main:has(#board) { padding: 10px 0 0; }
  .board-top { padding: 0 12px; gap: 8px; margin-bottom: 8px; }
  .board-title { display: flex; align-items: baseline; gap: 10px; }
  .board-title .meta { margin: 0; }
  .board-title .meta span + span { display: none; }
  .board-filters { flex: 1 1 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .board-filters::-webkit-scrollbar { display: none; }
  .board-filters > * { flex: none; }
  .board-filters .bf input, .board-filters .bf select { min-height: 40px; height: 40px; font-size: 16px; }
  .board-filters .bf-q input { width: 200px; }
  .board-filters .bf-tag input { width: 110px; }
  .board-filters label.check.bf-check { min-height: 40px; }
  .bf-hint { flex-basis: auto; white-space: nowrap; }
  .board-note { display: none; }
  .lane-jump { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
  .lane-jump::-webkit-scrollbar { display: none; }
  .lane-jump a {
    flex: none; padding: 5px 10px; border-radius: 999px; background: var(--lane); color: var(--ink);
    font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap;
  }
  .lane-jump a b { color: var(--accent-text); margin-left: 2px; }
  .lane-jump a.is-current { background: var(--ink); color: #fff; }
  .lane-jump a.is-current b { color: var(--accent); }
  .lanes { gap: 10px; padding: 0 12px 10px; scroll-snap-type: x mandatory; scroll-padding: 0 12px; }
  .lane { flex: 0 0 calc(100vw - 36px); scroll-snap-align: start; }
  .card { font-size: 13.5px; }
  .c-title { font-size: 13.5px; }
  .c-ids, .hrs, .c-days { font-size: 11.5px; }
  .c-ic { width: 40px; height: 36px; }
  .c-phone > a { font-size: 13.5px; }
  .c-move select, .c-move .c-move-go { min-height: 40px; height: 40px; font-size: 16px; }
  button.lane-more { min-height: 44px; }
}

/* ---------- Board: view tabs, list and parts ---------- */
.view-tabs { display: inline-flex; gap: 4px; margin-top: 6px; }
.view-tabs a { padding: 5px 12px; border-radius: 8px; font-size: .88rem; font-weight: 600; color: var(--muted, inherit); text-decoration: none; border: 1px solid var(--line-soft); }
.view-tabs a.is-on { background: var(--ink); color: var(--accent); border-color: var(--ink); }
.board-lanes.view-list, .board-lanes.view-parts { padding-right: 24px; }
.v-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.v-scroll { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.v-table { font-size: .88rem; }
.v-table thead th { position: sticky; top: 0; background: var(--paper, #fff); z-index: 1; white-space: nowrap; }
.v-table th a { color: inherit; text-decoration: none; }
.v-table th a:hover { text-decoration: underline; }
.v-table td.num, .v-table th.num { text-align: right; white-space: nowrap; }
.v-table tr.is-late .c-due { color: #d64545; font-weight: 600; }
.v-num { font-weight: 700; white-space: nowrap; }
.v-pager { display: flex; align-items: center; gap: 10px; padding: 8px 0 10px; font-size: .86rem; }
.v-pager span { margin-right: auto; }

/* Board settings and order tag editor */
.bs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0; }
.bs-row .bs-name { flex: 1 1 200px; margin: 0; }
.bs-row .bs-name input { width: 100%; }
.bs-actions { margin: 0 0 10px; }
.op-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.op-tagrow .tag form { display: inline; margin-left: 4px; }
.tag-x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; font-size: 1rem; line-height: 1; }

/* ---------- Tech app (/my): dark phone screen, big orange buttons ---------- */
main:has(> .tech) { max-width: 680px; }
.tech {
  --t-bg: #111111; --t-tile: #1f1f1f; --t-line: #333330; --t-ink: #f2f2ee; --t-muted: #a9a9a3;
  background: var(--t-bg); color: var(--t-ink); border-radius: 18px; padding: 18px 16px 28px;
}
.tech a { color: var(--t-ink); }
.tech h1 { font-size: 1.4rem; margin: 0; }
.tech h2 { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--t-muted); margin: 0 0 8px; }
.tech .muted { color: var(--t-muted); }
.tech .btn { background: var(--t-tile); color: var(--t-ink); border-color: #4a4a46; min-height: 48px; }
.tech .btn:hover { border-color: var(--accent); color: var(--t-ink); }
.my-flash:empty { display: none; }
.my-flash { position: sticky; top: calc(var(--tb) + var(--topbar) + 8px); z-index: 60; margin-bottom: 10px; }
.my-flash [role=alert] { margin: 0; box-shadow: var(--shadow-pop); }

.my-clock { background: var(--t-tile); border-radius: 14px; padding: 14px; margin-bottom: 20px; border-top: 4px solid #4a4a46; }
.my-clock.is-in { border-top-color: var(--accent); }
.my-hi { margin: 0; font-weight: 800; font-size: 1.1rem; }
.my-since { margin: 2px 0 12px; color: var(--t-muted); }
.my-since strong { color: var(--t-ink); }
.my-idle { margin: 0 0 12px; color: var(--t-muted); }
.my-clock form { margin: 0; }
.my-clock-btn, .my-big {
  width: 100%; min-height: 64px; border-radius: 12px; border: 0;
  background: var(--accent); color: #111; font-size: 1.25rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
}
.my-clock-btn:hover, .my-big:hover { background: var(--accent-hover); color: #111; }
.my-clock-btn.is-out { min-height: 52px; font-size: 1rem; background: transparent; color: var(--t-ink); border: 2px solid #4a4a46; }
.my-clock-btn.is-out:hover { border-color: var(--accent); color: var(--t-ink); background: transparent; }
.my-big.is-stop { background: #2b2b2b; color: var(--t-ink); border: 2px solid var(--accent); justify-content: space-between; padding: 0 18px; }
.my-big.is-stop:hover { background: #333; color: var(--t-ink); }
.my-big .my-timer { font-size: 1.35rem; color: var(--accent); }
.my-running {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; margin: 0 0 12px;
  background: #2a1a12; border: 1px solid #5a2d17; border-radius: 10px; text-decoration: none; font-weight: 700;
}
.my-stop-btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 2px solid var(--accent); background: #2b2b2b; color: var(--t-ink); font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.my-running-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; animation: my-pulse 1.6s ease-in-out infinite; }
@keyframes my-pulse { 50% { opacity: .35; } }
.my-timer { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }

.tech .my-h { margin: 0 0 12px; }
.my-empty { color: var(--t-muted); padding: 18px 0; }
.my-order { margin: 0 0 18px; }
.tech .my-order-head { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--t-ink); margin: 0; }
.my-num { color: var(--accent); font-weight: 900; margin-right: 4px; }
.my-car-sub { margin: 2px 0 8px; color: var(--t-muted); font-size: .9rem; }
.my-plate { font-family: var(--mono); letter-spacing: .04em; }
.my-job {
  display: flex; align-items: stretch; gap: 8px; margin: 8px 0 0; background: var(--t-tile);
  border-left: 4px solid #4a4a46; border-radius: 12px; overflow: hidden;
}
.my-job.is-running { border-left-color: var(--accent); background: #26190f; }
.my-job.is-paused { border-left-color: #d9a400; }
.my-job.is-done { border-left-color: #2e8b45; opacity: .8; }
.my-job-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 4px 12px 14px; text-decoration: none; min-height: 64px; }
.my-job-order { font-size: .82rem; color: var(--t-muted); }
.my-job-name { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.my-job-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; color: var(--t-muted); }
.my-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: #333330; color: #d6d6d0; }
.my-st.st-running { background: var(--accent); color: #111; }
.my-st.st-paused { background: #4a3b00; color: #ffd64d; }
.my-st.st-done { background: #183d22; color: #8fe0a3; }
.my-job form { margin: 0; display: flex; align-items: center; padding-right: 10px; }
.my-go { width: 56px; height: 56px; min-height: 56px; padding: 0; border-radius: 50%; border: 0; background: var(--accent); color: #111; }
.my-go:hover { background: var(--accent-hover); color: #111; }
.my-go.is-stop { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.my-go svg { width: 24px; height: 24px; fill: currentColor; }
.my-done { margin-top: 22px; border-top: 1px solid var(--t-line); padding-top: 10px; }
.my-done > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 800; color: var(--t-muted); }

.tech .my-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-decoration: none; color: var(--accent); }
.my-task-head { margin: 4px 0 14px; }
.my-task-order { margin: 0 0 2px; color: var(--t-muted); font-weight: 700; }
.tech .my-task-head h1 { margin-bottom: 8px; }
.my-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.my-actions form { margin: 0; }
.my-done-note { margin: 0; color: #8fe0a3; font-weight: 700; }
.my-hours { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.my-hours div { background: var(--t-tile); border-radius: 12px; padding: 10px 14px; }
.my-hours dt { font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--t-muted); }
.my-hours dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.my-card { background: var(--t-tile); border-radius: 12px; padding: 14px; margin: 0 0 12px; }
.my-vname { margin: 0 0 8px; font-weight: 800; font-size: 1.05rem; }
.my-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.my-facts .wide { grid-column: 1 / -1; }
.my-facts dt { font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--t-muted); }
.my-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.tech .my-facts .vin { font-family: var(--mono); font-size: .95rem; color: var(--t-ink); letter-spacing: .03em; }
.my-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.my-lines { list-style: none; margin: 0; padding: 0; }
.my-lines li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--t-line); }
.my-lines li:first-child { border-top: 0; padding-top: 0; }
.my-kind { font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--t-muted); min-width: 3.4em; }
.my-ldesc { overflow-wrap: anywhere; }
.my-pn { font-family: var(--mono); font-size: .85rem; color: var(--t-muted); }
.my-lqty { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.my-note-form { display: grid; gap: 8px; margin: 0 0 12px; }
.my-note-form textarea { min-height: 88px; font-size: 16px; }
.my-note { border-top: 1px solid var(--t-line); padding: 10px 0 0; margin-top: 10px; }
.my-note-meta { margin: 0 0 2px; font-size: .85rem; color: var(--t-muted); }
.my-note-meta strong { color: var(--t-ink); }
.my-photo-form { display: grid; gap: 8px; margin: 0 0 12px; }
.my-photo-pick { display: flex; align-items: center; justify-content: center; min-height: 48px; cursor: pointer; }
.my-photo-form input[type=file]:focus-visible + .btn, .my-photo-pick:focus-within { outline: 2px solid currentColor; }
.ph-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ph { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: rgba(127,127,127,.18); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-file { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; font-size: .8rem; font-weight: 700; min-height: 44px; text-decoration: none; color: inherit; }
.order-photos .ph-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

@media (max-width: 767.98px) {
  main:has(> .tech) { padding: 0; }
  .tech { border-radius: 0; min-height: calc(100vh - var(--tb) - var(--topbar)); padding: 14px 16px 40px; }
}

/* Time tab and Timesheets */
.time-add, .te-form { display: grid; gap: 8px; }
.time-add label, .te-form label { display: grid; gap: 4px; font-size: 14px; }
.time-add input, .time-add select, .te-form input, .te-form select { min-height: 44px; font-size: 16px; }
.te-row > summary { cursor: pointer; list-style: none; min-height: 44px; display: inline-flex; align-items: center; }
.te-row { margin: 0 0 8px; }
.te-row .te-form { margin: 8px 0; }
.week-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.week-pick { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; flex-wrap: wrap; }

/* ---------- Tech avatars + picker (tech assignment) ---------- */
/* Avatar tones: picked by app.web.format.avatar_tone(user id), so a person keeps one colour everywhere. */
.av-t0 { --av-bg: #ffd9c7; --av-ink: #7a2e0e; }
.av-t1 { --av-bg: #d6e8ff; --av-ink: #123f73; }
.av-t2 { --av-bg: #d7f2dc; --av-ink: #1d5a2a; }
.av-t3 { --av-bg: #efe0fb; --av-ink: #55267a; }
.av-t4 { --av-bg: #fff0b8; --av-ink: #5e4700; }
.av-t5 { --av-bg: #d3f1f0; --av-ink: #11524f; }
.av-t6 { --av-bg: #fbdbe6; --av-ink: #7a1f42; }
.av-t7 { --av-bg: #e4e4dd; --av-ink: #33332f; }
.tav {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  font-size: 10px; font-weight: 800; letter-spacing: 0; line-height: 1;
  background: var(--av-bg, #111); color: var(--av-ink, #fff);
}
.tav-add { background: transparent; color: var(--muted); border: 1.5px dashed #a9a9a3; font-size: 15px; font-weight: 600; }
.tav-none { background: var(--line-soft); color: var(--muted); font-size: 14px; }

.tchip { position: relative; display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-width: 0; }
.tchip.is-ro { gap: 6px; font-size: .82rem; font-weight: 650; }
.tp { position: relative; min-width: 0; max-width: 100%; }
.tp > summary { list-style: none; cursor: pointer; }
.tp > summary::-webkit-details-marker { display: none; }
.tp-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 2px 10px 2px 2px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink);
  font-size: .82rem; font-weight: 650; line-height: 1.2;
}
.tp-btn:hover, .tp[open] > .tp-btn { border-color: var(--ink); }
.tchip.is-empty .tp-btn { border-style: dashed; color: var(--muted); font-weight: 600; }
.tchip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tchip-avatar .tp-btn { padding: 2px; border-color: transparent; background: transparent; }
.tchip-avatar .tav, .tchip-avatar.is-ro .tav { width: 32px; height: 32px; font-size: 11.5px; }
.tchip-avatar.is-empty .tp-btn:hover .tav-add { border-color: var(--ink); color: var(--ink); }
.tchip-link .tp-btn { border-color: transparent; background: transparent; }
.tchip-link .tp-btn:hover, .tchip-link .tp[open] > .tp-btn { border-color: var(--line); }
.tchip-link.is-empty .tp-btn { border-style: solid; color: var(--accent-text); }
.tchip-x {
  width: 26px; min-height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 1.05rem; font-weight: 600; line-height: 1;
}
.tchip-x:hover { background: var(--line-soft); color: var(--danger); }
.tp-pop {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; width: min(280px, calc(100vw - 32px)); padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.tchip-avatar .tp-pop, .tchip-link .tp-pop { left: auto; right: 0; }
.tp .tp-q { width: 100%; min-height: 36px; height: 36px; margin: 0 0 6px; padding: 0 10px; font-size: .9rem; }
.tp-list { display: flex; flex-direction: column; gap: 1px; max-height: 264px; overflow-y: auto; overscroll-behavior: contain; }
.tp .tp-opt {
  justify-content: flex-start; gap: 8px; width: 100%; min-height: 36px; padding: 4px 8px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; font-size: .9rem; font-weight: 500;
}
.tp .tp-opt:hover, .tp .tp-opt:focus-visible { background: var(--line-soft); outline-offset: -2px; }
.tp .tp-opt.is-current { background: var(--accent-soft); font-weight: 750; }
.tp .tp-opt[hidden] { display: none; }
.tp-empty { margin: 4px 8px; color: var(--muted); font-size: .85rem; }
.svc-side { display: flex; align-items: flex-start; gap: 10px; flex: none; }
.line .ld .tchip { align-self: flex-start; margin-top: 2px; }
.line.ro .ld .tchip { display: flex; width: max-content; }
.as-link { font-size: .9rem; font-weight: 650; }

/* Assignments dialog (and its no-JS page) */
dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0;
  border-radius: var(--radius); background: #fff; color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .45); }
.assign-body { padding: 16px 18px 20px; }
.assign-page .assign-body { padding: 0; }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.as-head h2 { margin: 0; font-size: 1.15rem; }
.as-head form { margin: 0; }
.as-count { margin-left: 6px; color: var(--muted); font-size: .9rem; font-weight: 650; }
.as-close { width: 36px; padding: 0; font-size: 1.25rem; }
.assign-flash:empty { display: none; }
.assign-flash .flash { margin: 10px 0 0; }
.as-sec h3 { margin: 14px 0 2px; font-size: .95rem; }
.as-sec > .muted { margin: 0; font-size: .85rem; }
.as-tree, .as-lines { list-style: none; margin: 0; padding: 0; }
.as-tree { margin-top: 10px; border-top: 1px solid var(--line-soft); }
.as-svc { padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.as-lines { margin: 0 0 4px 14px; padding-left: 10px; border-left: 2px solid var(--line-soft); }
.as-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.as-line { font-size: .92rem; }
.as-name { min-width: 0; overflow-wrap: anywhere; }
.as-row > .tchip { flex: none; }
.as-all { margin-top: 10px; padding: 4px 4px 4px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fafaf8; font-weight: 650; }
.as-nolabor { margin: 0 0 6px 14px; font-size: .82rem; }
@media (max-width: 767.98px) {
  .tp-btn { min-height: 36px; }
  .tchip-avatar .tp-btn { min-height: 0; }
  .tchip-x { width: 36px; min-height: 36px; }
  .tp .tp-q { min-height: 44px; height: 44px; }
  .tp .tp-opt { min-height: 44px; }
  .as-lines { margin-left: 6px; }
  .assign-body { padding: 14px 14px 18px; }
}

/* Search services dialog (order.html #ss-dialog; results _service_search.html) */
dialog.ss-modal { width: min(820px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px)); }
.ss-body { display: flex; flex-direction: column; height: 100%; padding: 16px 18px 0; }
.ss-search { display: flex; gap: 8px; margin-top: 10px; }
.ss-search input { flex: 1; min-width: 0; min-height: 44px; font-size: 1rem; }
.ss-help { margin: 6px 0 0; font-size: .8rem; }
.ss-results { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 6px -18px 0; padding: 0 18px 18px; }
.ss-page .ss-results { margin: 6px 0 0; padding: 0; }
.ss-new {
  display: block; width: 100%; min-height: 44px; margin: 8px 0 2px; padding: 6px 12px; border: 1px dashed #b9b9b2;
  border-radius: var(--radius-sm); background: #fafaf8; color: var(--ink); font: inherit; font-weight: 700;
  text-align: left; overflow-wrap: anywhere; cursor: pointer;
}
.ss-new:hover, .ss-new.is-active { border-color: var(--accent); background: var(--accent-soft); }
.ss-group h3 { margin: 16px 0 4px; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.ss-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.ss-row { border-bottom: 1px solid var(--line-soft); }
.ss-line { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 2px 0; }
.ss-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ss-name { font-weight: 650; overflow-wrap: anywhere; }
.ss-sub { color: var(--muted); font-size: .8rem; }
.ss-amt { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.ss-form { flex: none; margin: 0; }
.ss-add.is-active { outline: 2px solid var(--accent); outline-offset: 1px; }
.ss-none { margin: 6px 0; font-size: .9rem; }
.ss-exp {
  display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; min-height: 44px; margin-left: -6px; padding: 2px 6px;
  border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.ss-exp:hover { background: var(--line-soft); }
.ss-chev { flex: none; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 6px solid var(--muted); transition: transform .12s; }
.ss-exp[aria-expanded="true"] .ss-chev { transform: rotate(90deg); }
.ss-preview { margin: 0 0 10px 20px; }
.ss-preview > .muted { margin: 4px 0; font-size: .85rem; }
.ss-pv { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.ss-pv-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 64px max-content; align-items: center; gap: 8px;
  min-height: 40px; padding: 3px 0; border-top: 1px solid var(--line-soft);
}
.ss-pv.m-money .ss-pv-row { grid-template-columns: 52px minmax(0, 1fr) 64px 80px 84px max-content; }
.ss-pv-head { min-height: 0; border-top: 0; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ss-pv .num { text-align: right; font-variant-numeric: tabular-nums; }
.ss-pv-kind { color: var(--muted); font-size: .78rem; font-weight: 750; }
.ss-pv-name { overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
  dialog.ss-modal { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .ss-body { padding: 12px 14px 0; }
  .ss-results { margin: 6px -14px 0; padding: 0 14px calc(18px + env(safe-area-inset-bottom)); }
  .ss-line { flex-wrap: wrap; }
  .ss-preview { margin-left: 0; }
  .ss-help { display: none; }
  .ss-pv-row, .ss-pv.m-money .ss-pv-row { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 6px 0; }
  .ss-pv .ss-pv-row.ss-pv-head { display: none; }
  .ss-pv-name { flex: 1 1 calc(100% - 64px); }
  .ss-pv .ss-form { margin-left: auto; }
  .svc-toolbar .ss-trigger { min-height: 44px; }
}

/* ---------- Board: lane "⋯" column menu, hidden-for-me columns, inactive clock ---------- */
.lane-menu {
  display: inline-grid; place-items: center; width: 28px; height: 24px; border-radius: 6px;
  color: var(--ink); font-size: 17px; font-weight: 900; line-height: 1; text-decoration: none;
}
.lane-menu:hover, .lane-menu[aria-expanded="true"] { background: var(--ink); color: var(--accent); }
.col-menu {
  position: fixed; z-index: 220; width: 340px; max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.col-menu[hidden] { display: none; }
.cm-head { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 14px; background: var(--ink); color: #fff; border-top: 4px solid var(--accent); }
.cm-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-saved { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); animation: cm-fade 2.4s ease-in forwards; }
@keyframes cm-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.cm-x { width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.cm-x:hover { background: #2a2a2a; }
.cm-opts { margin: 0; padding: 2px 14px 0; }
.cm-opt { padding: 10px 0; }
.cm-sw { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin: 0; cursor: pointer; }
.cm-label { font-size: .92rem; font-weight: 750; }
.cm-sw input { position: absolute; right: 0; width: 38px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.sw { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: #cfcfc9; transition: background .12s; }
.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .12s;
}
.cm-sw input:checked + .sw { background: var(--accent); }
.cm-sw input:checked + .sw::after { transform: translateX(16px); }
.cm-sw input:focus-visible + .sw { outline: 2px solid var(--ink); outline-offset: 2px; }
.cm-help { margin: 3px 0 0; font-size: .8rem; line-height: 1.35; color: var(--muted); }
.cm-num { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: .85rem; font-weight: 650; }
.cm-num input { width: 84px; min-height: 32px; height: 32px; padding: 0 8px; }
.cm-num select { min-height: 32px; height: 32px; }
.cm hr { margin: 0; border: 0; border-top: 1px solid var(--line-soft); }
.cm-opts hr { margin: 2px -14px; }
.cm-save { margin: 4px 0 12px; }
.js-board .cm-save { display: none; }
.cm-acts { padding: 6px; }
.cm-acts form, .my-hidden-pop form { margin: 0; }
.cm-item {
  display: block; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink); font: inherit; font-size: .92rem; font-weight: 650; text-align: left; cursor: pointer;
}
.cm-item:hover:not(:disabled), .cm-item:focus-visible { background: var(--line-soft); }
.cm-item:disabled { color: #9a9a94; cursor: not-allowed; }
.cm-item.cm-danger { color: var(--danger); }
.cm-item.cm-danger:disabled { color: #d9a3a3; }
.cm-strong { font-weight: 800; }
.cm-why { margin: 0 10px 6px; }
.cm-error { margin: 10px 14px 0; padding: 8px 10px; border-radius: 6px; background: #fdecea; color: var(--danger); font-size: .85rem; font-weight: 650; }
.cm-foot { margin: 0; padding: 8px 14px 12px; border-top: 1px solid var(--line-soft); font-size: .75rem; color: var(--muted); }
.cm-page { max-width: 420px; }
.cm-page .cm { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.cm-page .cm-x { display: none; }
.my-hidden { position: relative; align-self: flex-end; margin: -6px 24px 6px 0; font-size: .82rem; }
.my-hidden > summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--accent-text); }
.my-hidden > summary::-webkit-details-marker { display: none; }
.my-hidden-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; width: 250px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.my-hidden-pop .muted { margin: 4px 10px 6px; font-size: .78rem; }
.c-foot-l { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.c-idle { display: inline-flex; align-items: center; color: var(--danger); }
.c-idle .bi { width: 15px; height: 15px; }
.pill-archived { background: var(--ink); color: #fff; }
@media (max-width: 767.98px) {
  .col-menu {
    top: auto !important; left: 0 !important; right: 0; bottom: 0; width: auto; max-height: 85vh;
    border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .lane-menu { width: 36px; height: 30px; }
  .cm-x { width: 44px; min-height: 44px; }
  .cm-item { min-height: 44px; }
  .cm-sw { min-height: 44px; }
  .cm-num input, .cm-num select { min-height: 40px; height: 40px; font-size: 16px; }
  .my-hidden { align-self: flex-start; margin: 0 12px 8px; }
  .my-hidden-pop { left: 0; right: auto; }
}
@media (max-width: 767.98px) {
  /* The order's "⋯" menu wraps to the start of a row on a phone: open it rightwards, not off-screen. */
  .order-actions > .dropdown:last-of-type .menu { left: 0; right: auto; }
}
.menu button.menu-item { justify-content: flex-start; }

/* ---------- Notifications bell ---------- */
.bell { position: relative; text-decoration: none; }
.bell[aria-expanded="true"] { background: #e9e9e5; }
.bell-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #111; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--work);
}
.bell-badge[hidden] { display: none; }
.notif-panel {
  position: fixed; z-index: 75; top: calc(var(--tb) + var(--topbar) + 6px); right: 16px; width: 380px;
  max-height: min(78vh, 640px); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; }
.notif-head strong { flex: 1; font-size: 1rem; }
.notif-all { font-size: .85rem; color: var(--muted); }
.notif-close { display: none; }
.notif-panel .notif-body, .notif-panel .recent-body { overflow-y: auto; flex: 1; min-height: 0; }
.notif-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; }
.notif-tools form { margin: 0; }
.notif-tabs { display: inline-flex; gap: 4px; padding: 3px; background: var(--work); border-radius: 9px; }
.notif-tab { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 7px; font-size: .88rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.notif-tab.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-card); }
.notif-n { background: var(--accent); color: #111; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 800; }
.notif-list { list-style: none; margin: 0; padding: 0 6px 8px; }
.notif { margin: 0; }
.notif form { margin: 0; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 8px; border: 0; border-radius: 9px;
  background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 0;
}
.notif-item:hover, .notif-item:focus-visible { background: var(--work); }
.notif-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--lane); color: #33332f; }
.notif-estimate_approved { background: var(--ok-bg); color: var(--ok-ink); }
.notif-estimate_declined { background: #fbe0e0; color: var(--danger); }
.notif-call { background: #d6e8ff; color: #123f73; }
.notif-task_done { background: #d7f2dc; color: #1d5a2a; }
.notif-writeback_off, .notif-import_failure { background: var(--warn-bg); color: var(--warn-ink); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-weight: 600; overflow-wrap: anywhere; }
.notif.is-unread .notif-title { font-weight: 750; }
.notif-sub { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; white-space: pre-line; }
.notif-time { color: var(--muted); font-size: .8rem; }
.notif-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.notif-empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); }
.notif-page { max-width: 640px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 4px 8px 8px; }
@media (max-width: 767.98px) {
  .notif-panel { inset: 0; top: 0; right: 0; width: auto; max-height: none; border: 0; border-radius: 0; z-index: 95; }
  .notif-head { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); min-height: calc(var(--topbar)); }
  .notif-all { display: none; }
  .notif-close { display: inline-grid; }
  .notif-tab { min-height: 40px; }
  .notif-item { min-height: 56px; padding: 12px 8px; }
  .notif-tools .btn { min-height: 44px; }
}

/* ---------- Messages drawer ---------- */
.msgs-btn[aria-expanded="true"] { background: #e9e9e5; }
.msg-drawer {
  position: fixed; z-index: 76; top: calc(var(--tb) + var(--topbar)); right: 0; bottom: 0; width: 420px;
  display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.msg-drawer[hidden] { display: none; }
.msgs-root { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.msgs-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.msgs-title { flex: 1; margin: 0; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs-title:focus { outline: none; }
.msgs-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgs-sub { color: var(--muted); font-size: .82rem; }
.msgs-link { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.msgs-back, .msgs-close { flex: none; }
.msgs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; }
.msgs-search { flex: 1; min-width: 160px; margin: 0; }
.msgs-search input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.msg-convs { list-style: none; margin: 0; padding: 0 6px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.msg-conv { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.msg-conv:hover, .msg-conv:focus-visible { background: var(--work); color: var(--ink); }
.msg-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--av-bg, var(--lane)); color: var(--av-ink, #33332f); }
.mc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mc-top { display: flex; align-items: baseline; gap: 8px; }
.mc-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-conv.is-unread .mc-name { font-weight: 800; }
.mc-time { flex: none; color: var(--muted); font-size: .78rem; }
.mc-snip { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-conv.is-unread .mc-snip { color: var(--ink); }
.mc-n { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #111; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }
.msgs-scope { padding: 8px 12px 0; }
.mt-num { color: var(--muted); font-weight: 500; }
.mt-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--work); }
.mt-item { display: flex; flex-direction: column; max-width: 85%; }
.mt-in { align-self: flex-start; align-items: flex-start; }
.mt-out { align-self: flex-end; align-items: flex-end; }
.mt-bubble { padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow-card); }
.mt-in .mt-bubble { background: #fff; border-bottom-left-radius: 4px; }
.mt-out .mt-bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.mt-out.is-failed .mt-bubble { background: #fff; color: var(--ink); border: 1px dashed var(--danger); box-shadow: none; }
.mt-meta { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.mt-tag { font-weight: 700; }
.mt-state { color: var(--danger); font-weight: 600; }
.mt-state.is-test { color: var(--warn-ink); }
.mt-call { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .9rem; }
.mt-call.is-urgent { border-color: var(--danger); }
.mt-call-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #d6e8ff; color: #123f73; }
.mt-call-ico .ico { width: 16px; height: 16px; }
.mt-call-text { min-width: 0; }
.mt-call-text p { margin: 2px 0 0; overflow-wrap: anywhere; }
.mt-compose { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: #fff; margin: 0; }
.mt-compose textarea { width: 100%; resize: vertical; min-height: 64px; max-height: 40vh; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.mt-tpl select { width: 100%; }
.mt-foot { display: flex; align-items: center; gap: 8px; }
.mt-chan { flex: 1; font-size: .8rem; }
.mt-result { margin: 0; padding: 7px 10px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-ink); font-size: .88rem; font-weight: 600; }
.mt-result.is-bad { background: #fdecea; color: #8a1c10; }
.msgs-page { max-width: 760px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.msgs-page .msgs-root { min-height: 60vh; }
.msgs-page .mt-list { max-height: 62vh; }
.tpl-row { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.tpl-row summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tpl-snip { overflow-wrap: anywhere; }
.tpl-form { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; max-width: 620px; }
.tpl-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.tpl-form textarea { font: inherit; }
@media (min-width: 768px) and (max-width: 1279.98px) {
  .msg-drawer { width: min(420px, 60vw); }
}
@media (max-width: 767.98px) {
  .msg-drawer { inset: 0; top: 0; width: auto; border: 0; box-shadow: none; z-index: 110; }
  body.msgs-open { overflow: hidden; }
  .msgs-head { min-height: var(--topbar); }
  .msgs-full { display: none; }
  .msgs-search input { height: 44px; }
  .msg-conv { min-height: 60px; }
  .mt-item { max-width: 92%; }
  .mt-tpl select { min-height: 44px; }
  .msgs-page { margin: -16px -16px 0; border-radius: 0; box-shadow: none; }
}

/* ---------- Top bar: recently viewed, sync status, pinned order tabs ---------- */
.recent-btn { text-decoration: none; }
.recent-btn[aria-expanded="true"] { background: #e9e9e5; }
.sync { position: relative; color: #8a8a85; text-decoration: none; cursor: default; }
a.sync { cursor: pointer; }
.sync-dot { position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-radius: 50%; background: #b9b9b3; box-shadow: 0 0 0 2px #fff; }
.sync-ok { color: var(--ok-ink); }
.sync-ok .sync-dot { background: #2e9d48; }
.sync-stale { color: var(--warn-ink); }
.sync-stale .sync-dot { background: #e0a100; }
.sync-failed { color: var(--danger); }
.sync-failed .sync-dot { background: var(--danger); }
.menu-phone { display: none; }
.menu-sync { position: relative; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px 4px 32px; font-size: .9rem; color: var(--ink); }
.menu-sync .sync-dot { left: 12px; right: auto; top: 13px; bottom: auto; box-shadow: none; }
.menu-sync small { display: block; color: var(--muted); font-size: .78rem; }
@media (min-width: 768px) { .recent-panel { right: 120px; } }
.recent-list { list-style: none; margin: 0; padding: 4px 6px 8px; }
.recent-item {
  display: flex; flex-direction: column; gap: 1px; padding: 9px 10px; border-radius: 9px; color: var(--ink); text-decoration: none;
}
.recent-item:hover, .recent-item:focus-visible { background: var(--work); }
.recent-top { display: flex; align-items: center; gap: 6px; }
.recent-time { margin-left: auto; color: var(--muted); font-size: .8rem; }
.recent-sub { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-tabs { display: none; }
@media (min-width: 1280px) {
  body:has(.recent-tabs:not([hidden])) { --tabs-h: 37px; }
  .recent-tabs:not([hidden]) {
    display: flex; gap: 6px; align-items: flex-end; height: var(--tabs-h); padding: 0 24px; overflow: hidden;
    border-bottom: 1px solid var(--line); background: var(--work);
  }
  .rtab {
    display: inline-flex; align-items: center; max-width: 220px; height: 30px; padding-left: 10px;
    border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: #fff; font-size: .85rem;
  }
  .rtab[hidden] { display: none; }
  .rtab.is-current { border-color: var(--ink); box-shadow: inset 0 2px 0 var(--accent); }
  .rtab-link { display: inline-flex; gap: 6px; min-width: 0; color: var(--ink); text-decoration: none; white-space: nowrap; }
  .rtab-sub { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
  .rtab-x {
    flex: none; width: 26px; height: 26px; min-height: 0; margin: 0 2px; padding: 0; border: 0; border-radius: 6px;
    background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
  }
  .rtab-x:hover, .rtab-x:focus-visible { background: var(--work); color: var(--ink); }
}

/* Service history (order panel Vehicle / Customer tabs, customer page) */
.hist-list { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.hist { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.hist:last-child { border-bottom: 0; }
.hist-veh { display: block; color: var(--muted); font-size: .78rem; }
.hist-row { display: flex; gap: 10px; align-items: flex-start; }
.hist-main { flex: 1; min-width: 0; }
.hist-name { font-weight: 650; overflow-wrap: anywhere; }
.hist-meta { display: flex; gap: 8px; align-items: baseline; margin-top: 1px; }
.hist-meta .op-amt { float: none; color: var(--muted); }
.hist-when { flex: none; display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: .8rem; }
.hist-more { padding: 8px 0 2px; border-bottom: 0; }
.hist-page { max-width: 720px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 4px 14px; margin-bottom: 24px; }
@media (max-width: 767.98px) {
  .recent-btn, .sync { display: none; }
  .menu-phone { display: flex; }
  .menu-sync { min-height: 44px; }
  .hist-more .btn { min-height: 44px; }
}

/* + Payment dialog (and its no-JS page), Order panel payments list */
.flash-ok { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-weight: 600;
  background: var(--ok-bg); border: 1px solid #a9d8b1; color: var(--ok-ink); }
.order-flash .flash-ok { margin: 0; box-shadow: var(--shadow-pop); }
dialog.pay-modal { width: min(520px, calc(100vw - 24px)); }
.pay-body { padding: 16px 18px 18px; }
.pay-page .pay-body { padding: 0; }
.pay-sum { margin: 12px 0 14px; padding: 6px 12px; border-radius: var(--radius-sm); background: #fafaf8; border: 1px solid var(--line-soft); }
.pay-form [role=alert] { margin-bottom: 12px; }
.pay-form [hidden] { display: none !important; }
.pay-grid > label, .pay-grid > fieldset { margin: 0 0 12px; }
.pay-amount { margin-bottom: 2px !important; }
.pay-money { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 1.15rem; font-weight: 700; }
.pay-money input { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#pay-amount-help { margin: 0 0 12px; font-size: .84rem; }
.pay-grid fieldset { border: 0; padding: 0; min-width: 0; }
.pay-grid legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: .92rem; }
.pay-seg, .pay-methods { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-seg label, .pay-method { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; padding: 0 12px;
  border: 1px solid #c9c9c3; border-radius: 9px; font-weight: 600; cursor: pointer; }
.pay-seg label:has(input:checked), .pay-method:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pay-seg input, .pay-method input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.pay-method.is-off { color: var(--muted); border-style: dashed; cursor: not-allowed; }
.pay-off-note { flex-basis: 100%; margin: 0; font-size: .84rem; }
.pay-over { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.pay-over input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.pay-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pay-past h3 { margin: 16px 0 4px; font-size: .95rem; }
.pay-list .pay-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.pay-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; flex: 1 1 auto; min-width: 0; }
.pay-amt { font-variant-numeric: tabular-nums; }
.pay-meta { flex-basis: 100%; font-size: .82rem; overflow-wrap: anywhere; }
.pay-actions { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; padding-top: 4px; }
.pay-actions form { margin: 0; }
.is-void .pay-amt, li.is-void > b { text-decoration: line-through; color: var(--muted); }
.pay-status { font-size: .72rem; }
.pay-refund { position: relative; }
.pay-refund-form { min-width: 240px; padding: 10px 12px; display: grid; gap: 8px; }
.pay-refund-form label { margin: 0; font-size: .85rem; }
/* Card at counter (step 2: _payment_card.html) and the hosted form's return page */
.pay-steps { margin: 4px 0 14px; padding-left: 1.25rem; line-height: 1.45; }
.pay-steps li { margin-bottom: 4px; }
.pay-card-open { margin: 0 0 12px; }
.pay-card-open .btn { min-height: 44px; }
.pay-card-status { min-height: 1.5rem; margin-bottom: 8px; }
.pay-card-status p { margin: 0; }
.pay-card-note { margin: 10px 0 0; font-size: .82rem; }
.pay-foot .inline-form { margin: 0; }
.pay-return .panel { max-width: 560px; }
.pay-return h1 { margin-top: 0; font-size: 1.35rem; }
@media (max-width: 767.98px) {
  dialog.pay-modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .pay-body { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
  .pay-foot { position: sticky; bottom: 0; background: #fff; padding-bottom: 4px; }
  .pay-foot .btn { flex: 1; }
}

/* ---------- Reports ---------- */
.rep-group { margin: 0 0 24px; }
.rep-group h2 { font-size: 1rem; margin: 0 0 10px; }
.rep-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rep-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; background: var(--card); color: var(--ink); text-decoration: none; border-radius: var(--radius); box-shadow: var(--shadow-card); border-left: 4px solid var(--accent); }
.rep-card:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.rep-card span { color: var(--muted); font-size: .86rem; line-height: 1.35; }
.rep-filters { align-items: flex-end; }
.rep-field { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.rep-field select, .rep-field input { flex: none; min-height: 38px; }
.rep-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 18px; }
.rep-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); min-width: 0; }
.rep-tile-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.rep-tile strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rep-tile small { color: var(--muted); font-size: .76rem; }
.rep-table { margin: 0 0 20px; }
.rep-table h2 { font-size: 1rem; margin: 0 0 8px; }
.rep-table tfoot td { border-top: 2px solid var(--line); }
.rep-table tr.muted td { color: var(--muted); text-decoration: line-through; }
.rep-notes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.rep-rates { max-width: 640px; margin-top: 8px; }
@media (max-width: 767.98px) {
  .rep-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-field { flex: 1 1 140px; }
  .rep-filters .btn { flex: 1 1 100%; }
  .rep-table tfoot, .rep-table tfoot tr { display: block; }
  .rep-table tfoot tr { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 10px 14px; }
  .rep-table tfoot td { display: block; border: 0; padding: 3px 0; text-align: left; }
  .rep-table tfoot td:empty { display: none; }
  .rep-table tfoot td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; }
/* ---------- Customer & vehicle forms, vehicle search, wizard, top-bar + menu ---------- */
.new-menu .menu { min-width: 230px; }
.new-menu > summary { cursor: pointer; white-space: nowrap; }
.cv-form fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.cv-form legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { width: 100%; }
.seg label {
  position: relative; flex: 1 1 0; display: flex; align-items: center; justify-content: center; margin: 0;
  min-height: 40px; padding: 0 12px; border: 1px solid #c9c9c3; border-radius: 9px; background: #fff;
  cursor: pointer; font-weight: 650;
}
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.cv-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.cv-line { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.cv-line select { width: 110px; flex: none; }
.cv-line input { flex: 1; min-width: 0; }
.cv-x { flex: none; width: 40px; padding: 0; font-size: 1.2rem; }
.cv-form .cv-req-fleet { display: none; }
.cv-form.is-fleet .cv-req-fleet { display: inline; }
.cv-form.is-fleet .cv-req-ind { display: none; }
.cv-more { border-top: 1px solid var(--line-soft); padding: 4px 0; margin: 0 0 10px; }
.cv-more > summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.cv-more[open] > summary { margin-bottom: 8px; }
.cv-fees[disabled] { opacity: .7; }
.cv-odo { align-self: end; margin-bottom: 14px; }
.cv-plate { grid-template-columns: 110px 1fr; }
.cv-photo { display: block; max-width: 220px; border-radius: var(--radius-sm); margin: 6px 0; }
.cv-warn { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.cv-dupe-list { margin: 8px 0 0; padding-left: 18px; }
.cv-dupe-list li { margin: 4px 0; }
.cv-dupe-list .btn { margin-left: 6px; }
.cv-lookup label { margin-bottom: 6px; }
.cv-results:empty { display: none; }
.cv-results { margin-top: 10px; }
.cv-note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--work); font-size: .92rem; }
.cv-hint { margin: 8px 0 0; }
.cv-pick { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.cv-pick li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cv-use {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px;
  padding: 8px 12px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  color: var(--ink); text-decoration: none; font-weight: 400;
}
.cv-use:hover { border-color: var(--ink); }
.cv-use.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cv-existing li { padding: 8px 12px; border: 1px dashed var(--line); border-radius: 9px; background: #fafaf8; }
.cv-matches-head { margin: 12px 0 4px; }
.cust-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 20px; margin: 0; }
.cust-info dt { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cust-info dd { margin: 0 0 8px; }
.v-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; float: right; margin-left: 8px; }
.wz { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; max-width: 960px; }
.wz-card h2 { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.wz-step {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--lane); font-size: .9rem; font-weight: 800;
}
.wz-card.is-done .wz-step { background: var(--accent); }
.wz-card.is-off { opacity: .6; }
.wz-pick { display: flex; flex-direction: column; gap: 2px; margin: 0 0 6px; font-size: 1.05rem; }
.wz-search { margin-top: 14px; }
.wz-or { margin: 14px 0 4px; font-weight: 600; font-size: .92rem; }
.wz-foot { display: flex; gap: 10px; justify-content: flex-end; max-width: 960px; margin-top: 4px; }
.wz-foot .btn, .wz-foot button { min-height: 46px; padding: 0 20px; }
@media (max-width: 767.98px) {
  .new-menu .menu { position: fixed; left: 12px; right: 12px; top: calc(var(--tb) + var(--topbar) - 4px); min-width: 0; }
  .new-menu .menu-item { min-height: 48px; }
  .wz { grid-template-columns: 1fr; }
  .cv-row-3 { grid-template-columns: 1fr 1fr; }
  .wz-foot { position: sticky; bottom: 0; padding: 10px 0; background: var(--work); }
  .wz-foot > * { flex: 1; }
  .wz-foot button { width: 100%; }
}
@media (max-width: 420px) {
  .cv-row, .cv-row-3 { grid-template-columns: 1fr; }
  .cv-line select { width: 92px; padding: 0 6px; }
  .cv-plate { grid-template-columns: 110px 1fr; }
}
