:root {
  --bg: #F2F5FB; --surface: #FFFFFF; --surface2: #E7ECF7; --ink: #0E1B3D; --muted: #55607A; --line: #DCE3F1;
  --brand: #2F5BFF; --brand-ink: #FFFFFF; --brand-soft: #E8EEFF; --brand-text: #2A50E6;
  --ok: #17603C; --ok-bg: #DDF3E8; --warn: #85470D; --warn-bg: #FBEBD3; --bad: #A32A1E; --bad-bg: #FCE3E0;
  --purple: #5A32B3; --purple-bg: #ECE4FA; --info: #1F4BB8; --info-bg: #E1EAFF; --gray-bg: #E9ECF3; --gray: #4A5470;
  --shadow: 0 1px 2px rgba(14,27,61,.08), 0 4px 14px rgba(14,27,61,.05);
  --radius: 18px; color-scheme: light;
  /* Pill colors: dedicated per-kind variables (not shared with banners/etc.) so Settings > Appearance
     can recolor one pill without touching anything else. Default to the matching semantic token. */
  --pill-new: var(--gray); --pill-assigned: var(--info); --pill-in_progress: var(--warn); --pill-light: var(--warn);
  --pill-qc_review: var(--purple); --pill-rework: var(--bad); --pill-approved: var(--ok); --pill-closed: var(--muted);
  --pill-bore: var(--purple); --pill-install: var(--info); --pill-bury: var(--gray); --pill-coax: #0E7C86; --pill-fiber: #B45309; --pill-warn: var(--warn); --pill-bad: var(--bad);
}
:root[data-theme="dark"] {
  --bg: #0A1020; --surface: #131B2F; --surface2: #1B2642; --ink: #E9EEFC; --muted: #9DA9C7; --line: #26314F;
  --brand: #7A97FF; --brand-ink: #0A1024; --brand-soft: #1D2A55; --brand-text: #A9BEFF;
  --ok: #7BE0AC; --ok-bg: #123526; --warn: #FFC680; --warn-bg: #3A2A0C; --bad: #FF9E94; --bad-bg: #421B1B;
  --purple: #C7B4FF; --purple-bg: #2B2350; --info: #9DB8FF; --info-bg: #1B2A55; --gray-bg: #222C47; --gray: #B6C0DB;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  --pill-new: var(--gray); --pill-assigned: var(--info); --pill-in_progress: var(--warn); --pill-light: var(--warn);
  --pill-qc_review: var(--purple); --pill-rework: var(--bad); --pill-approved: var(--ok); --pill-closed: var(--muted);
  --pill-bore: var(--purple); --pill-install: var(--info); --pill-bury: var(--gray); --pill-coax: #6FD6E0; --pill-fiber: #FBBF77; --pill-warn: var(--warn); --pill-bad: var(--bad);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--brand-text); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.7px; }
h2 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }
.center { text-align: center; }
.hide { display: none !important; }
svg { flex-shrink: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn-ok { color: #06210f; background: #5FD497; border-color: #5FD497; }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-lg { min-height: 54px; font-size: 16px; padding: 0 24px; width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
/* Routes: clicking a technician's name opens their day's route detail */
.tech-name-btn b { text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color .1s; }
.tech-name-btn:hover b, .tech-name-btn:focus-visible b { text-decoration-color: currentColor; }
/* Settings > Light test alert-sound picker: each preset is a plain button reset to look like a row */
.light-sound-row { all: unset; display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.light-sound-row:hover { background: var(--surface2); }
.light-sound-row.selected { background: var(--surface2); font-weight: 700; }
.light-sound-row.selected svg:last-child { color: var(--ok); }
.light-sound-row:disabled { opacity: .5; cursor: not-allowed; }
.light-sound-row svg:first-child { color: var(--muted); }
.light-sound-row:hover svg:first-child, .light-sound-row.selected svg:first-child { color: var(--brand); }
.notif-row { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 10px; border-radius: 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--surface2); }
.notif-row.unread { background: var(--bad-bg); }
.notif-row.unread:hover { background: var(--bad-bg); filter: brightness(0.97); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 500; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.input.big { font-size: 26px; font-weight: 800; min-height: 58px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* inline-block so width/height apply even outside a flex row (e.g. inside a table cell) — harmless
   inside .row's flex context too, since a flex child's own display is blockified for layout anyway */
.switch { display: inline-block; position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: var(--line); transition: .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(22px); }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface2); gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 0 16px; min-height: 38px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* surfaces */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.card h2 { margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--gray-bg); color: var(--gray); white-space: nowrap; }
.pill.hold { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); border: 1px dashed currentColor; }
.pill.new { background: color-mix(in srgb, var(--pill-new) 16%, var(--surface)); color: var(--pill-new); }
.pill.assigned { background: color-mix(in srgb, var(--pill-assigned) 16%, var(--surface)); color: var(--pill-assigned); }
.pill.in_progress { background: color-mix(in srgb, var(--pill-in_progress) 16%, var(--surface)); color: var(--pill-in_progress); }
.pill.light { background: color-mix(in srgb, var(--pill-light) 16%, var(--surface)); color: var(--pill-light); }
.pill.qc_review { background: color-mix(in srgb, var(--pill-qc_review) 16%, var(--surface)); color: var(--pill-qc_review); }
.pill.bore { background: color-mix(in srgb, var(--pill-bore) 16%, var(--surface)); color: var(--pill-bore); }
.pill.install { background: color-mix(in srgb, var(--pill-install) 16%, var(--surface)); color: var(--pill-install); }
.pill.bury { background: color-mix(in srgb, var(--pill-bury) 16%, var(--surface)); color: var(--pill-bury); }
.pill.fiber { background: color-mix(in srgb, var(--pill-fiber) 16%, var(--surface)); color: var(--pill-fiber); }
.pill.coax { background: color-mix(in srgb, var(--pill-coax) 16%, var(--surface)); color: var(--pill-coax); }
.pill.rework { background: color-mix(in srgb, var(--pill-rework) 16%, var(--surface)); color: var(--pill-rework); }
.pill.approved { background: color-mix(in srgb, var(--pill-approved) 16%, var(--surface)); color: var(--pill-approved); }
.pill.ok, .pill.paid { background: var(--ok-bg); color: var(--ok); }
.pill.closed { background: color-mix(in srgb, var(--pill-closed) 10%, var(--surface2)); color: var(--pill-closed); }
.pill.bad { background: color-mix(in srgb, var(--pill-bad) 16%, var(--surface)); color: var(--pill-bad); }
.pill.warn { background: color-mix(in srgb, var(--pill-warn) 16%, var(--surface)); color: var(--pill-warn); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .badge { background: #FF7A6E; color: #2a0805; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; transition: outline-color .15s; }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch.sm { width: 22px; height: 22px; }
.swatch.sm.on { outline-width: 2px; outline-offset: 1px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
img.avatar { object-fit: cover; background: var(--brand-soft); }
.banner { padding: 14px 16px; border-radius: 14px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.info { background: var(--info-bg); color: var(--info); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* office shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; letter-spacing: -.5px; color: var(--ink); flex-shrink: 0; }
.brand-img { display: block; object-fit: contain; flex-shrink: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; }
/* min-width: 0 is load-bearing here: a flex item sized by "flex: 1 1 auto" won't shrink below
   its content's natural width by default, so without this, a nav with more tabs than fit the
   window doesn't scroll within itself — it just forces the whole header (and page) wider than
   the viewport instead. overflow-x only actually kicks in once this lets the item shrink. */
.nav-wrap { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.nav a.on { background: var(--brand-soft); color: var(--brand-text); }
/* Hidden until updateNavArrows() (core.js) finds the strip actually overflowing — most windows are
   wide enough that these never show. Each arrow also only appears on the end that still has more to
   reveal, so a maxed-out scroll position doesn't leave a dead button sitting there. */
.nav-arrow { display: none; flex-shrink: 0; width: 28px; height: 28px; align-items: center; justify-content: center; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); cursor: pointer; }
.nav-wrap.can-scroll-l .nav-arrow-l, .nav-wrap.can-scroll-r .nav-arrow-r { display: flex; }
.page { max-width: 1400px; margin: 0 auto; padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 20px; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -.8px; }
.stat.alert { border-color: var(--warn); }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-padding-inline: 2px; align-items: start; }
.bcol { background: var(--surface2); border-radius: 20px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.bcol h3 { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.cnt { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 2px 9px; }
.kcard { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.kcard:hover { border-color: var(--brand); }
.kcard .num { font-weight: 800; font-size: 14px; white-space: nowrap; }

/* table */
.tablewrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
/* Settings lists (companies, projects, locations): headers stay on one line, the table scrolls sideways in its box */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 10px; white-space: nowrap; }
table.tbl td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
table.tbl td:first-child { min-width: 140px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 14px; background: var(--surface2); white-space: nowrap; }
table.t td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--brand-soft); }
table.t th.click { cursor: pointer; user-select: none; }
table.t th.click:hover { color: var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.detail.detail-even { align-items: stretch; }
.detail.detail-even > * { display: flex; flex-direction: column; }

/* routes dispatch console: draggable schedule bars */
.timeline-bar { cursor: grab; transition: box-shadow .1s, transform .1s; }
.timeline-bar:active { cursor: grabbing; }
.timeline-bar.dragging { opacity: .35; }
.timeline-bar .timeline-mini { opacity: 0; transition: opacity .12s; }
.timeline-bar:hover .timeline-mini, .timeline-bar:focus-within .timeline-mini { opacity: 1; }
/* Native drag-and-drop doesn't work on a touchscreen — a device with no hover capability (phone,
   tablet) gets the pin/remove/reorder buttons shown all the time instead of only on hover, since
   there's no hover gesture to reveal them with. */
@media (hover: none) { .timeline-bar .timeline-mini { opacity: 1; } }
.timeline-track.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.photogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ph { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface2); border: 2px solid var(--line); display: flex; flex-direction: column; }
.ph.flag { border-color: var(--bad); }
.ph.missing { border-style: dashed; }
.ph .img { aspect-ratio: 4 / 3; background: var(--surface2) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: zoom-in; }
.ph .cap { padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.ph .cap b { font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 6px; border-top: 2px solid var(--line); }
.total .n { font-size: 30px; font-weight: 800; letter-spacing: -.6px; }
.tl { display: flex; flex-direction: column; gap: 10px; }
.tl div { font-size: 13px; padding-left: 14px; border-left: 3px solid var(--line); }

/* modal, toast, tray */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(6,12,30,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border-radius: 22px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal.wide { max-width: 980px; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 12px; display: block; margin: 0 auto; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 460px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .toast.ok { color: #06210f; background: #5FD497; }
#tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; gap: 6px; padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 74px); pointer-events: none; }
#tray.notab { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
.tray-item { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: 560px; width: 100%; margin: 0 auto; }
.tray-item .thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface2) center / cover; flex-shrink: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); width: 0; transition: width .2s; }
.bar.done i { background: #1B9A62; }
.bar.err i { background: var(--bad); }

/* technician (mobile-first) */
.tshell { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.thead { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg); }
.tmain { padding: 4px 16px 140px; display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 6px); }
.tabbar, .submitbar, #tray { transform: translateY(var(--vv-shift, 0px)); }
body.kb-open .tabbar { display: none; }
.tabbar > div { display: flex; width: 100%; max-width: 560px; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.tabbar a.on { color: var(--brand-text); }
.jobcard { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); }
.paybar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); }
.paybar .n { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; min-height: 64px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); }
.step.todo { border-color: var(--brand); }
.step.flag { border-color: var(--bad); }
.step .mark { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #1B9A62; color: #fff; }
.step .mark.todo { background: transparent; border: 2px dashed var(--muted); }
.step .mark.busy { background: var(--brand-soft); color: var(--brand-text); }
.step .thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--surface2) center / cover; flex-shrink: 0; }
.submitbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(14,27,61,.08); }
.submitbar > div { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.segs { display: flex; gap: 6px; }
.segs i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.segs i.done { background: #1B9A62; }
.segs i.now { background: var(--brand); }
.camview { height: 250px; border-radius: 24px; background: #0E1B3D; color: #B8C4EC; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; position: relative; overflow: hidden; background-size: cover; background-position: center; }
.shutter { width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--brand); background: var(--surface); padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.shutter i { width: 62px; height: 62px; border-radius: 50%; background: var(--brand); display: block; }
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 900px 620px at 12% -8%, rgba(47,91,255,.16), transparent 60%),
    radial-gradient(ellipse 820px 620px at 108% 108%, rgba(23,184,132,.14), transparent 60%),
    var(--bg);
}
:root[data-theme="dark"] .login {
  background:
    radial-gradient(ellipse 900px 620px at 12% -8%, rgba(122,151,255,.24), transparent 60%),
    radial-gradient(ellipse 820px 620px at 108% 108%, rgba(52,211,153,.18), transparent 60%),
    var(--bg);
}
.login .card {
  width: 100%; max-width: 420px; padding: 36px 32px 28px; display: flex; flex-direction: column; gap: 18px;
  position: relative; z-index: 1; border-radius: 24px;
  box-shadow: 0 1px 2px rgba(14,27,61,.06), 0 28px 64px -16px rgba(14,27,61,.22);
}
:root[data-theme="dark"] .login .card {
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 28px 64px -16px rgba(0,0,0,.65);
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 2px; }
.login-mark { position: relative; width: 128px; height: 128px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.login-mark::before {
  content: ''; position: absolute; inset: -22px; border-radius: 40px; z-index: 0;
  background: radial-gradient(circle, rgba(47,91,255,.30) 0%, rgba(23,184,132,.22) 55%, transparent 75%);
  filter: blur(20px);
}
:root[data-theme="dark"] .login-mark::before {
  background: radial-gradient(circle, rgba(122,151,255,.34) 0%, rgba(52,211,153,.26) 55%, transparent 75%);
}
.login-mark .brand-img { position: relative; z-index: 1; box-shadow: 0 10px 26px rgba(14,27,61,.2); }
.login-logo-img { position: relative; z-index: 1; max-width: 280px; max-height: 128px; object-fit: contain; }
.login-sub { color: var(--muted); font-size: 14px; }
.login .field { gap: 7px; }
.login .input { background: var(--surface2); border-color: transparent; }
.login .input:focus { box-shadow: 0 0 0 4px rgba(47,91,255,.15); }
:root[data-theme="dark"] .login .input:focus { box-shadow: 0 0 0 4px rgba(122,151,255,.2); }
.login .btn-primary {
  background: linear-gradient(135deg, #2F5BFF 0%, #17B884 100%); border-color: transparent; color: #fff;
  box-shadow: 0 12px 26px -10px rgba(23,110,255,.55); transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.login .btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); }
:root[data-theme="dark"] .login .btn-primary { background: linear-gradient(135deg, #5A82FF 0%, #22D497 100%); color: #06120C; }
.login-links { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.pulse { animation: pl 1.6s ease-in-out infinite; }
@keyframes pl { 50% { opacity: .55; } }

@media (max-width: 1000px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 10px 14px; gap: 10px; }
  .page { padding: 16px 14px 60px; }
  .brand span.t { display: none; }
}
@media print {
  @page { size: Letter; margin: 12mm; }
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface2: #F2F5FB; --ink: #0E1B3D; --muted: #55607A; --line: #DCE3F1; --brand-text: #2A50E6; --ok: #17603C; --ok-bg: #DDF3E8; --warn: #85470D; --warn-bg: #FBEBD3; --bad: #A32A1E; --bad-bg: #FCE3E0; }
  body { background: #fff; color: #000; font-size: 12px; }
  .topbar, .tabbar, #tray, #toasts, .noprint { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .photogrid { grid-template-columns: repeat(3, 1fr); }
}

.lock { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ---- job report (screen and PDF) ---- */
.rpt { max-width: 900px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.rpt section { display: flex; flex-direction: column; gap: 8px; }
.rpt h2 { font-size: 15px; margin: 0; padding-bottom: 4px; border-bottom: 2px solid var(--line); letter-spacing: .2px; }
/* .kvg (label/value grid) is also used outside the report page, e.g. the People-tab profile modal. */
.kvg { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 14px; font-size: 13px; }
.kvg .k { color: var(--muted); font-weight: 700; }
.rpt .rph { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rpt .rp { break-inside: avoid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.rpt .rp img { width: 100%; display: block; }
.rpt .rp .c { padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.rpt table.t th, .rpt table.t td { padding: 6px 8px; font-size: 12px; }
.rpt tr { break-inside: avoid; }
.rpt .rhead { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--brand); }
@media print { .rpt { max-width: none; gap: 12px; } .rpt .rph { gap: 8px; } .rpt h2 { break-after: avoid; } }

/* ---- Google Maps InfoWindow popup (Routes tab) ---- */
/* Google's own close "x" on a map pin's popup is small and pale gray — easy to miss. Hide it and
   use the clearly-visible one drawn as part of the popup content instead (see drawMap in maps.js). */
.gm-ui-hover-effect { display: none !important; }

/* Office screens on a phone for someone who also does field work: the bottom tab bar replaces the top
   tab strip (see phoneFieldNav() in core.js), so leave room for it under the page. */
.page.with-tabbar { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
.more-sheet a.on { color: var(--brand-text); background: var(--surface2); }
/* Settings > Photo requirements: one row per photo */
.phr { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.phr.off { opacity: .55; }
.phr.off [data-k="title"], .phr.off [data-k="hint"] { text-decoration: line-through; }
@media (max-width: 560px) { .phr-tools { width: 100%; justify-content: flex-end; } }
.phr .input { width: 100%; box-sizing: border-box; }
.phr > .col { flex: 1 1 260px; }
/* Sign-in "light pulse" (js/loginfx.js): strands of light land in the logo's icon, the icon flashes,
   the rest of the logo wipes in, then the form rises in. Plays once per screen per page load. */
.login.lp-wait .card { opacity: 0; }
.lp-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2; overflow: visible; }
.lp-fx path { fill: none; stroke-linecap: round; opacity: 0; }
.lp-fx .lp-trail { stroke-width: 1.4; }
.lp-fx .lp-head { stroke-width: 3.2; filter: url(#lpGlow); }
.login.lp-play .lp-fx .lp-trail { animation: lp-trail 1.15s cubic-bezier(.5,.05,.3,1) both; }
.login.lp-play .lp-fx .lp-head { animation: lp-comet .9s cubic-bezier(.55,.05,.35,1) both; }
.login.lp-play .lp-fx path:nth-of-type(2), .login.lp-play .lp-fx path:nth-of-type(5) { animation-delay: .08s; }
.login.lp-play .lp-fx path:nth-of-type(3), .login.lp-play .lp-fx path:nth-of-type(6) { animation-delay: .16s; }
.login.lp-play .card { animation: lp-card .5s ease-out both; }
.login.lp-play .login-mark img { animation: lp-hit .7s ease-out .78s both, lp-wipe .55s cubic-bezier(.3,.7,.2,1) .98s both; }
.login.lp-play .lp-row { animation: lp-rise .45s ease-out both; }
@keyframes lp-trail { 0% { opacity: .55; stroke-dasharray: 1 1; stroke-dashoffset: 1; } 70% { opacity: .45; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dasharray: 1 1; stroke-dashoffset: 0; } }
@keyframes lp-comet { 0% { opacity: 1; stroke-dasharray: .22 1.3; stroke-dashoffset: .22; } 92% { opacity: 1; } 100% { opacity: 0; stroke-dasharray: .22 1.3; stroke-dashoffset: -1.02; } }
@keyframes lp-card { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes lp-hit { 0% { opacity: .35; filter: drop-shadow(0 0 0 rgba(0,204,250,0)); } 35% { opacity: 1; filter: drop-shadow(0 0 16px rgba(0,204,250,.95)) brightness(1.35); } 100% { opacity: 1; filter: drop-shadow(0 0 0 rgba(0,204,250,0)); } }
@keyframes lp-wipe { from { clip-path: inset(0 calc((1 - var(--lp-icon, 1)) * 100%) 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes lp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .login.lp-wait .card { opacity: 1; } }

/* FiberOps support session bar (shown the whole time a support session is open) */
#support-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 6px 12px; background: #b45309; color: #fff; font-size: 13px; }
#support-bar button { background: #fff; color: #7c2d12; border: 0; border-radius: 6px; padding: 3px 10px; font-weight: 600; cursor: pointer; }
body.has-support-bar { padding-top: 34px; }

/* support tickets */
.tk-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.tk-msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; background: var(--surface2, var(--surface)); font-size: 14px; line-height: 1.45; word-break: break-word; }
.tk-msg .tk-who { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 3px; }
.tk-msg.me { align-self: flex-end; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); border-bottom-right-radius: 5px; }
.tk-msg.us { align-self: flex-start; border-bottom-left-radius: 5px; }
.dot-new { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-right: 8px; vertical-align: middle; }
/* +/- button beside a number box that can be negative (iPhone's decimal keypad has no minus key) */
.negwrap { display: flex; gap: 8px; align-items: stretch; }
.negwrap > .input { flex: 1 1 auto; min-width: 0; }
.negwrap > .negbtn { flex: 0 0 auto; min-width: 48px; padding: 0 12px; font-size: 20px; font-weight: 700; }
/* Settings: group headings that sit between the collapsible sections */
.setgroup { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 2px 0; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.setgroup:first-of-type { margin-top: 4px; }
table.t tr.grouprow td { background: var(--brand-soft); }
.searchbox { position: relative; }
.searchbox .clearx { flex-shrink: 0; width: 28px; height: 28px; margin-right: -6px; border: 0; border-radius: 50%; background: var(--brand-soft); color: var(--muted, inherit); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.searchbox:has(input:placeholder-shown) .clearx { display: none; }
.lightbox .lbwrap { position: relative; }
.lightbox .lbnav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; z-index: 2; }
.lightbox .lbnav:hover { background: rgba(0,0,0,.75); }
.lightbox .lbnav.prev { left: 10px; }
.lightbox .lbnav.prev svg { transform: scaleX(-1); }
.lightbox .lbnav.next { right: 10px; }
.lightbox .lbwrap img { touch-action: pan-y; user-select: none; -webkit-user-drag: none; }

/* Terms and Privacy Policy agreement tick box on the first-time setup screen */
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; color: var(--muted); cursor: pointer; }
.agree input { width: 20px; height: 20px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--brand, #2F5BFF); }
.agree a { color: inherit; text-decoration: underline; }

/* ============================================================================================   FiberOps brand layer (UX v2): navy ground, the blue > cyan > green gradient on primary buttons, pill
   colors from the Command Deck design, a left icon rail for the office on desktop, and the Dispatch
   "Command Deck". An admin-chosen accent color (Settings > Appearance) still wins for buttons.
   =================================================================================================== */
:root {
  --grad: linear-gradient(90deg, #3aa0ff 0%, #3df0e0 50%, #7be04a 100%);
  --btn-bg: var(--grad); --btn-ink: #04101f;
  --pill-new: #85470D; --pill-assigned: #1F4BB8; --pill-in_progress: #0B6FD0; --pill-qc_review: #0E7C86; --pill-approved: #17603C; --pill-rework: #A32A1E;
}
:root[data-theme="dark"] {
  --bg: #050a18; --surface: #0a1330; --surface2: #0e1a3d; --line: #1b2a57; --ink: #eaf1ff; --muted: #9db0d3;
  --brand: #4fb2ff; --brand-ink: #04101f; --brand-soft: #0f2a52; --brand-text: #7cc0ff;
  --pill-new: #ffc971; --pill-assigned: #9db8ff; --pill-in_progress: #7cc0ff; --pill-qc_review: #5ff3e6; --pill-approved: #97ee66; --pill-rework: #ff9e94;
}
:root[data-theme="dark"] body { background: radial-gradient(900px 500px at 85% -10%, rgba(58,160,255,.14), transparent 60%), radial-gradient(700px 400px at 0% 110%, rgba(123,224,74,.07), transparent 60%), var(--bg); background-attachment: fixed; }
.btn-primary { background: var(--btn-bg); border-color: transparent; color: var(--btn-ink); font-weight: 800; }
.btn-primary:hover { border-color: transparent; box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 22%, transparent); }
.btn-primary.disabled, .btn-primary:disabled { box-shadow: none; }

/* left icon rail (office, desktop) */
.deck-body { display: flex; align-items: flex-start; }
.deck-body > .page { flex: 1 1 auto; min-width: 0; }
.rail { position: sticky; top: 61px; flex: 0 0 84px; height: calc(100vh - 61px); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0 20px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; scrollbar-width: none; z-index: 15; }
.rail::-webkit-scrollbar { display: none; }
.rail a { position: relative; width: 68px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 7px; border-radius: 12px; border: 1px solid transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center; }
.rail a:hover { color: var(--ink); background: var(--surface2); }
.rail a.on { color: var(--brand-text); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.rail a .badge { position: absolute; top: 2px; right: 6px; }
/* Narrow screens without the phone bottom bar (a dispatcher on a phone): the rail becomes a scrolling strip. */
@media (max-width: 820px) {
  .deck-body { flex-direction: column; align-items: stretch; width: 100%; max-width: 100vw; overflow-x: clip; }
  .deck-body > .page { width: 100%; max-width: 100%; box-sizing: border-box; }
  .deck-body:has(.rail.vertical) { flex-direction: row; align-items: flex-start; }
  .rail.vertical { flex: 0 0 64px; width: 64px; top: 61px; height: calc(100dvh - 61px); padding: 8px 0 16px; }
  .rail.vertical a { width: 56px; font-size: 9.5px; padding: 8px 1px 6px; }
  .deck-body:has(.rail.vertical) > .page { width: auto; flex: 1 1 auto; min-width: 0; padding-left: 12px; padding-right: 12px; }
  .rail.strip { position: static; flex: none; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; height: auto; flex-direction: row; justify-content: flex-start; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .rail.strip a { flex: 0 0 auto; width: auto; min-width: 66px; padding: 7px 10px 5px; }
  .dpanel { position: static; }
}

/* Command Deck (Dispatch) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.kpi.alert { border-color: var(--warn); }
.kpi .n { font-size: 30px; font-weight: 800; letter-spacing: -.8px; margin-top: 2px; }
.kpi .bar { height: 4px; border-radius: 2px; background: var(--surface2); margin-top: 8px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; border-radius: 2px; background: var(--grad); }
.deck { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .deck { grid-template-columns: minmax(0, 1fr); } }
.deck-list { padding: 0; overflow: hidden; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.deck-list .chips { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chip { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--ink); }
.chip.on { color: var(--brand-text); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.chip .cnt { margin: 0; }
table.t tr.sel td { background: color-mix(in srgb, var(--brand) 9%, transparent); }
.dpanel { position: sticky; top: 77px; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.dpanel .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dpanel .fact { padding: 12px; border-radius: 10px; background: var(--surface2); }
.dpanel .fact .v { font-size: 20px; font-weight: 800; }
.seg.deck-seg button { min-height: 34px; }

/* Columns board: each column carries its status colour (dot, title, accent bar). */
.bcol { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.bcol h3 { color: var(--col, var(--ink)); font-weight: 800; font-size: 14px; }
.bcol .dot { background: var(--col, var(--muted)); }
.bcol .bar { height: 3px; border-radius: 2px; background: var(--col, var(--line)); }
.bcol .kcard { background: var(--surface2); box-shadow: none; border-radius: 14px; }
.bcol .kcard:hover { border-color: color-mix(in srgb, var(--col) 70%, transparent); }
#msg-alerts { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 20px)); z-index: 900; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.msg-alert { pointer-events: auto; background: var(--surface); color: var(--ink); border: 2px solid var(--brand); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 36px rgba(0,0,0,.4); font-size: 14px; }

/* Dispatch card: the message button sits over the card's bottom-right corner. */
.kwrap { position: relative; }
.kwrap .kmsg { position: absolute; right: 10px; bottom: 10px; width: 32px; height: 32px; min-height: 32px; padding: 0; }

/* Segmented controls stay one tidy row and scroll sideways when they don't fit (the Reports tabs
   used to wrap into a lumpy pill on a phone). */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap !important; box-sizing: border-box; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; white-space: nowrap; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-list { padding: 8px; max-height: calc(100dvh - 200px); overflow-y: auto; }
.chat-row { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; color: inherit; border: 1px solid transparent; }
.chat-row:hover { background: var(--surface2); }
.chat-row.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.chat-row.unread b { color: var(--ink); }
.chat-thread { display: flex; flex-direction: column; gap: 10px; min-height: 420px; height: calc(100dvh - 200px); }
.chat-empty { justify-content: center; }
.chat-msgs { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; max-width: 80%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-bubble { padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--surface2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.chat-msg.mine .chat-bubble { border-radius: 16px 16px 4px 16px; background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.chat-photo { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.chat-job { font-size: 12px; font-weight: 800; color: var(--brand-text); display: inline-flex; gap: 4px; align-items: center; }
.chat-compose { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.chat-compose textarea { resize: vertical; min-height: 52px; }
.chat-back { display: none; }
@media (max-width: 820px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-layout.has-open .chat-list { display: none; }
  .chat-layout:not(.has-open) .chat-empty { display: none; }
  .chat-back { display: inline-flex; }
  .chat-thread { height: calc(100dvh - 230px); }
}
.tmain .chat-thread { height: calc(100dvh - 200px); }

/* Menu order editor (Settings > Appearance, Me page) */
.nav-order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-width: 420px; }
.nav-order-list li { padding: 4px 6px 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.nav-order-list .btn { padding: 4px 8px; min-height: 34px; min-width: 34px; justify-content: center; }
.nav-order-list .btn:disabled { opacity: .3; }

/* ---- printing and PDF export: always black on white, whatever the theme ----
   Kept at the very end so it wins over the theme colors above (the 4.0 dark tokens come after the
   older print block, which is why dark-mode PDFs printed navy). */
@media print {
  :root, :root[data-theme], :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface2: #F2F5FB; --ink: #0E1B3D; --muted: #4A5570; --line: #D5DCEB;
    --brand: #2A50E6; --brand-ink: #fff; --brand-soft: #E8EEFF; --brand-text: #2A50E6;
    --ok: #17603C; --ok-bg: #DDF3E8; --warn: #85470D; --warn-bg: #FBEBD3; --bad: #A32A1E; --bad-bg: #FCE3E0;
    --pill-new: #85470D; --pill-assigned: #1F4BB8; --pill-in_progress: #0B6FD0; --pill-qc_review: #0E7C86; --pill-approved: #17603C; --pill-rework: #A32A1E;
  }
  html, body, :root[data-theme="dark"] body { background: #fff !important; color: #0E1B3D; }
  .card, .kpi, table, th, td, .rp { background: #fff !important; box-shadow: none !important; }
  th { background: #F2F5FB !important; }
  img.logo-on-dark { background: #050a18 !important; padding: 8px 12px; border-radius: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Money tab: the section bar (Overview, Money in, Money out, Profit, Books) on top of each of its pages */
.moneybar { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.moneybar::-webkit-scrollbar { display: none; }
.moneybar a { flex: none; padding: 10px 14px; font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.moneybar a:hover { color: var(--ink); }
.moneybar a.on { color: var(--ink); border-bottom-color: var(--brand); }
