/* Comphero FieldOps — design system.
   Mobile-first base; desktop enhancements in the min-width query at the bottom.
   One disciplined accent, neutral surfaces, semantic status colors used only for state. */

:root {
    --accent: #0f6feb;
    --accent-soft: rgba(15,111,235,.12);
    --accent-strong: #0b5cd0;

    --green: #0aa66b;
    --green-soft: rgba(10,166,107,.13);
    --amber: #d97706;
    --amber-soft: rgba(217,119,6,.13);
    --red: #dc2626;
    --red-soft: rgba(220,38,38,.13);
    --violet: #7c5cfc;
    --violet-soft: rgba(124,92,252,.13);

    --surface: #ffffff;
    --surface2: #f4f6f9;
    --surface3: #eceff3;
    --border: #e2e6ec;
    --border-subtle: #edf0f4;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --shadow-1: 0 1px 2px rgba(15,23,42,.05);
    --shadow-2: 0 6px 20px rgba(15,23,42,.08);

    /* spacing scale */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
    --safe-b: env(safe-area-inset-bottom);
}

@media (prefers-color-scheme: dark) {
    :root {
        --surface: #131c2e;
        --surface2: #0d1420;
        --surface3: #182238;
        --border: rgba(255,255,255,.09);
        --border-subtle: rgba(255,255,255,.06);
        --text: #e2e8f4;
        --text-muted: rgba(224,232,255,.58);
        --text-faint: rgba(224,232,255,.38);
        --shadow-1: 0 1px 2px rgba(0,0,0,.35);
        --shadow-2: 0 12px 32px rgba(0,0,0,.45);
    }
}
:root[data-theme="dark"] {
    --surface: #131c2e; --surface2: #0d1420; --surface3: #182238;
    --border: rgba(255,255,255,.09); --border-subtle: rgba(255,255,255,.06);
    --text: #e2e8f4; --text-muted: rgba(224,232,255,.58); --text-faint: rgba(224,232,255,.38);
    --shadow-1: 0 1px 2px rgba(0,0,0,.35); --shadow-2: 0 12px 32px rgba(0,0,0,.45);
}
:root[data-theme="light"] {
    --surface: #ffffff; --surface2: #f4f6f9; --surface3: #eceff3;
    --border: #e2e6ec; --border-subtle: #edf0f4;
    --text: #0f172a; --text-muted: #64748b; --text-faint: #94a3b8;
    --shadow-1: 0 1px 2px rgba(15,23,42,.05); --shadow-2: 0 6px 20px rgba(15,23,42,.08);
}

/* Cross-document view transitions: opts every top-level navigation (link
   clicks, form-POST redirects — including the redirect after Save) into a
   soft crossfade instead of the default hard white-flash reload. Pure
   progressive enhancement — no-ops silently in browsers that don't support
   it yet, nothing else about the page changes. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

* { box-sizing: border-box; }
/* Form controls don't inherit the page font by default — browsers draw them
   in the OS UI font instead, which is why every input/select/button looked
   subtly (or not so subtly) off from the rest of the type system. */
input, select, textarea, button { font-family: inherit; }
/* The `hidden` attribute must always win, even over classes (.btn, .tag, etc.)
   that set `display` explicitly — otherwise an element author-styled with
   display:inline-flex/flex stays visible despite `hidden` being set on it. */
[hidden] { display: none !important; }
html, body {
    margin: 0; padding: 0;
    background: var(--surface2);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    font-size: 15px;
    line-height: 1.5;
}
body { padding-bottom: calc(64px + var(--safe-b)); }
/* .next-action-bar is position:fixed, stacked above the tabbar — it doesn't
   push page content and body's own clearance above only accounts for the
   tabbar itself, so any page that adds a next-action-bar had its last field
   (or two) sitting underneath it, unreachable without extra scroll. Give the
   page that extra clearance whenever one is actually present.
   Mobile-only: :has() matches on DOM presence, not visibility, and
   .next-action-bar is display:none (not removed) at the desktop breakpoint —
   an unscoped rule here fought the desktop `body{padding-bottom:0}` reset
   (higher specificity wins regardless of source order) and left a dead
   ~130px gap of empty scroll room under every page with a next-action-bar. */
@media (max-width: 859px) {
    body:has(.next-action-bar) { padding-bottom: calc(64px + 68px + var(--safe-b)); }
}
a { color: inherit; }
h1,h2,h3 { margin: 0 0 .5rem; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 1.4rem 0 .6rem;
}
.section-head h2 { margin: 0; }
.section-head:first-child { margin-top: 0; }

/* ---- Page header (one true H1 per screen) ---- */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    margin: 0 0 1.15rem;
}
.page-header-text { flex: 1; min-width: 0; }
.page-header-text h1 { margin: 0; overflow-wrap: break-word; }
.page-header-sub { margin: .2rem 0 0; color: var(--text-muted); font-size: .85rem; font-weight: 500; }
.page-header-action { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.page-header-action .btn, .page-header-action { width: auto; flex-shrink: 0; }
@media (min-width: 860px) {
    .page-header-text h1 { font-size: 1.75rem; }
}

/* ---- Top bar ---- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    /* Pad past the notch / Dynamic Island on installed PWAs (viewport-fit=cover). */
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 1rem 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1rem; }
.topbar .brand img { width: 28px; height: 28px; border-radius: 8px; display: block; }
.topbar .user-chip {
    display: flex; align-items: center; gap: .5rem; text-decoration: none;
    padding: .3rem; border-radius: 10px; color: var(--text);
}
.icon-btn {
    background: none; border: none; color: var(--text); font-size: 1.15rem; line-height: 1;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface2); }

/* ---- Global search (topbar 🔍) ---- */
.gsearch-modal .modal-card { max-width: 560px; }
.gsearch-input-wrap { position: relative; margin-bottom: .25rem; }
.gsearch-input-wrap input[type=search] { padding-left: 2.6rem; }
.gsearch-input-wrap .gsearch-icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); opacity: .5; pointer-events: none; }
.gsearch-results { max-height: min(60vh, 480px); overflow-y: auto; margin-top: .75rem; }
.gsearch-group-label {
    font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
    color: var(--text-faint); margin: 1rem 0 .35rem; padding: 0 .1rem;
}
.gsearch-group-label:first-child { margin-top: 0; }
.gsearch-row {
    display: flex; align-items: center; gap: .65rem; padding: .6rem .5rem; border-radius: var(--radius-md);
    text-decoration: none; color: var(--text);
}
.gsearch-row:hover, .gsearch-row:focus { background: var(--surface2); }
.gsearch-row .gsearch-icon-badge { font-size: 1.15rem; flex-shrink: 0; width: 28px; text-align: center; }
.gsearch-row-text { min-width: 0; flex: 1; }
.gsearch-row-title { display: block; font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch-row-sub { display: block; margin-top: 2px; font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch-empty, .gsearch-hint { color: var(--text-muted); font-size: .85rem; padding: 1.25rem .5rem; text-align: center; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem;
    flex-shrink: 0; border: 1.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
    object-fit: cover;
}
.avatar-sm { width: 24px; height: 24px; font-size: .65rem; }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: calc(100vh - 56px); }
.app-sidebar { display: none; }
.app-main { flex: 1; min-width: 0; padding: 1rem; padding-bottom: 2rem; max-width: 1040px; margin: 0 auto; width: 100%; }

/* ---- Bottom tab bar (mobile primary nav) ---- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b);
    /* iOS Safari can visually detach a fixed element from the viewport
       mid-scroll when a transform fires elsewhere on the page (e.g. the
       a.card:active tap-scale below) — worst on long, unpaginated card
       lists like Accounts, where a scroll gesture often starts with a
       finger landing on a card. Pinning the tab bar to its own compositing
       layer makes it immune to that interference. */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem; padding: .5rem 0 .4rem; text-decoration: none; color: var(--text-muted);
    font-size: .66rem; font-weight: 600; min-height: 56px;
}
.tabbar a .icon { font-size: 1.3rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }

/* ---- Sticky next-action bar (mobile work-order primary CTA) ---- */
.next-action-bar {
    position: fixed; left: 0; right: 0; bottom: calc(64px + var(--safe-b)); z-index: 25;
    padding: .6rem .8rem; background: var(--surface);
    border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15,23,42,.06);
}
.next-action-bar .btn { margin: 0; }

/* ---- Collapsible card sections (e.g. admin.php user rows) ---- */
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.chevron { color: var(--text-faint); font-size: .7rem; }
details[open] .chevron { transform: rotate(180deg); display: inline-block; }

/* ---- Cards ---- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1rem 1.1rem; margin-bottom: .85rem; box-shadow: var(--shadow-1);
}
.card-title {
    font-size: .72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .06em; margin-bottom: .5rem; display: flex; align-items: center; gap: .4rem;
}

/* ---- Stat tiles v2 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-bottom: 1.25rem; }
.stat-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: .9rem 1rem; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat-tile::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border);
}
.stat-tile .num { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-tile .label { font-size: .74rem; color: var(--text-muted); font-weight: 600; margin-top: .2rem; }
.stat-tile.accent-red::before { background: var(--red); }
.stat-tile.accent-red .num { color: var(--red); }
.stat-tile.accent-green::before { background: var(--green); }
.stat-tile.accent-green .num { color: var(--green); }
.stat-tile.accent-blue::before { background: var(--accent); }
.stat-tile.accent-blue .num { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 48px; padding: .7rem 1.25rem; border-radius: var(--radius-md);
    font-size: .93rem; font-weight: 700; border: none; cursor: pointer;
    text-decoration: none; color: #fff; background: var(--accent);
    width: 100%; transition: opacity .12s, transform .12s;
}
.btn:active { opacity: .82; transform: scale(.99); }
.btn.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.btn-danger { background: var(--red); }
.btn.btn-sm { min-height: 38px; padding: .45rem .9rem; font-size: .84rem; width: auto; }
.btn:disabled { opacity: .5; cursor: default; }
/* A secondary bit of text INSIDE a solid-color button (status, count) needs
   its own faded-white treatment — var(--text-muted) is tuned for muted text
   on the page background and is nearly invisible on a solid accent/red fill. */
.btn-suffix { opacity: .78; margin: 0; }
.btn.btn-ghost .btn-suffix { opacity: .7; }
@media (hover: hover) {
    .btn:hover { opacity: .92; }
    .btn.btn-ghost:hover { background: var(--surface3); }
}
a:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---- Forms ---- */
label { display: block; font-size: .8rem; font-weight: 700; color: var(--text-muted); margin: 0 0 .35rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
    width: 100%; font-size: 16px;
    padding: .78rem .9rem; border-radius: var(--radius-md); border: 1.5px solid var(--border);
    background: var(--surface); color: var(--text); min-height: 48px;
    transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=date]:focus, input[type=time]:focus, input[type=datetime-local]:focus {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Native date/time pickers default to light-mode browser chrome no matter
   the page theme — color-scheme is what tells the browser to draw the
   calendar/clock dropdown and spinner icons in a dark-appropriate palette. */
input[type=date], input[type=time], input[type=datetime-local] { color-scheme: light; cursor: text; }
:root[data-theme="dark"] input[type=date], :root[data-theme="dark"] input[type=time], :root[data-theme="dark"] input[type=datetime-local] {
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    input[type=date], input[type=time], input[type=datetime-local] { color-scheme: dark; }
    :root[data-theme="light"] input[type=date], :root[data-theme="light"] input[type=time], :root[data-theme="light"] input[type=datetime-local] {
        color-scheme: light;
    }
}
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator, input[type=datetime-local]::-webkit-calendar-picker-indicator {
    padding: 4px; margin-left: 4px; border-radius: 5px; cursor: pointer;
    opacity: .75; transition: opacity .12s, background .12s;
}
input[type=date]::-webkit-calendar-picker-indicator:hover, input[type=time]::-webkit-calendar-picker-indicator:hover, input[type=datetime-local]::-webkit-calendar-picker-indicator:hover {
    opacity: 1; background: var(--surface3);
}
input[type=date]::-webkit-datetime-edit, input[type=time]::-webkit-datetime-edit { color: var(--text); }
input[type=date]::-webkit-datetime-edit-fields-wrapper, input[type=time]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type=date]::-webkit-datetime-edit-text, input[type=time]::-webkit-datetime-edit-text { color: var(--text-muted); padding: 0 .2rem; }

/* ---- Rich text editor (progressive enhancement over textarea[data-rte]) ---- */
.rte-wrap { border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; transition: border-color .12s; }
.rte-wrap:focus-within { border-color: var(--accent); }
.rte-toolbar { display: flex; gap: .2rem; padding: .35rem; border-bottom: 1px solid var(--border); background: var(--surface2); }
.rte-btn {
    width: 32px; height: 32px; border-radius: 6px; border: none; background: transparent;
    color: var(--text); font-size: .85rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.rte-btn:hover { background: var(--surface3); }
.rte-editor {
    min-height: 100px; padding: .78rem .9rem; font-size: 16px; color: var(--text);
    line-height: 1.5; outline: none; overflow-wrap: break-word;
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.rte-editor ul, .rte-editor ol { padding-left: 1.3rem; margin: .4rem 0; }
.help-text { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
/* A one-line caption right under a page_header() heading, where the caption
   needs a real <a> link (page_header()'s own $subtitle is HTML-escaped) —
   pulls up against the header's 1.15rem bottom margin instead of stacking
   both gaps on top of each other. */
.lede { color: var(--text-muted); font-size: .85rem; margin: -.35rem 0 .6rem; }
/* Same idea, under .auth-logo's larger 1.75rem bottom margin. */
.auth-caption { text-align: center; color: var(--text-muted); font-size: .78rem; margin: -1.2rem 0 1.5rem; }
/* A compact field label (e.g. side-by-side date/time pickers) — its own
   class instead of borrowing the unrelated .help-text component. */
.field-label-compact { display: block; font-size: .78rem; color: var(--text-muted); margin: 0 0 .2rem; }
.search-field { position: relative; }
.search-field input[type=search] { padding-left: 2.4rem; }
.search-field .search-icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); opacity: .5; pointer-events: none; }

/* ---- Badges v2 ---- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 20px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: var(--surface3); color: var(--text-muted); }
.badge-scheduled { background: var(--accent-soft); color: var(--accent); }
.badge-in_progress { background: var(--amber-soft); color: var(--amber); }
.badge-completed { background: var(--green-soft); color: var(--green); }
.badge-closed { background: var(--surface3); color: var(--text-muted); }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-cancelled { background: var(--surface3); color: var(--text-muted); text-decoration: line-through; }

/* ---- Job status stepper (replaces the plain badge for on-track jobs) ---- */
.status-track { display: flex; align-items: flex-start; margin: .15rem 0 .85rem; }
.status-track .st-seg { display: flex; align-items: center; flex: 1; }
.status-track .st-seg:last-child { flex: 0 0 auto; }
.status-track .st-node { display: flex; flex-direction: column; align-items: center; gap: .3rem; flex-shrink: 0; }
.status-track .st-dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--border);
    box-shadow: 0 0 0 3px var(--surface); transition: background .2s ease;
}
.status-track .st-label { font-size: .64rem; font-weight: 600; color: var(--text-faint); white-space: nowrap; }
.status-track .st-line { flex: 1; height: 2px; background: var(--border); margin: 0 -1px; align-self: flex-start; margin-top: 4px; transition: background .2s ease; }
.status-track .st-seg.is-done .st-dot { background: var(--accent); }
.status-track .st-seg.is-done .st-label { color: var(--text-muted); }
.status-track .st-line.is-done { background: var(--accent); }
.status-track .st-seg.is-current .st-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent-soft); }
.status-track .st-seg.is-current .st-label { color: var(--accent); font-weight: 800; }
@media (max-width: 480px) {
    .status-track .st-label { font-size: .58rem; }
}
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 6px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tag-internal { background: var(--violet-soft); color: var(--violet); }
.tag-priority-high { background: var(--amber-soft); color: var(--amber); }
.tag-priority-urgent { background: var(--red-soft); color: var(--red); }
.tag-priority-normal { background: var(--surface3); color: var(--text-muted); }
/* The already-booked list under a tech row on the job form — full-width so
   it drops to its own line under the name + availability chip. */
.tech-day-jobs {
    flex-basis: 100%; margin: .1rem 0 0; padding-left: 1.7rem;
    font-size: .74rem; font-weight: 500; color: var(--text-muted);
}
.tag-avail-ok { background: var(--green-soft); color: var(--green); }
.tag-avail-busy { background: var(--amber-soft); color: var(--amber); }
.tag-avail-no { background: var(--red-soft); color: var(--red); }
.tag-avail-unset { background: var(--surface3); color: var(--text-muted); }

/* ---- Work order list rows ---- */
.wo-row { display: block; text-decoration: none; color: var(--text); }
a.card { transition: border-color .12s, box-shadow .12s, transform .12s; }
@media (hover: hover) {
    a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-2); }
}
a.card:active { transform: scale(.99); }

/* Ranked list rows on report.php (top customers/vendors/techs, service types) —
   plain <a> wrapping a stat row, not a .card, so it needs its own hover cue. */
.report-rank-row { border-radius: 6px; margin-left: -.35rem; margin-right: -.35rem; padding-left: .35rem; padding-right: .35rem; transition: background-color .12s; }
@media (hover: hover) {
    .report-rank-row:hover { background-color: var(--surface2); }
}
.wo-row .wo-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.wo-row .wo-title { font-weight: 700; font-size: .95rem; }
.wo-row .wo-meta { font-size: .82rem; color: var(--text-muted); display: flex; align-items: center; gap: .35rem; margin-top: .2rem; }
.wo-row .wo-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; }

/* ---- Work order detail page: top card meta lines + section grouping ---- */
#wo-root .wo-meta { font-size: .85rem; color: var(--text-muted); margin-top: .35rem; line-height: 1.4; }
#wo-root .wo-meta a { color: inherit; }
.wo-group-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--border-subtle); }
.wo-group-label:first-of-type { margin-top: .6rem; }

/* ---- Timeline (history / activity) ---- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 1rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.5rem; top: 3px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--surface); border: 2.5px solid var(--accent);
}
.timeline-item.dim::before { border-color: var(--text-faint); }
.timeline-item .tl-title { font-weight: 700; font-size: .88rem; }
.timeline-item .tl-meta { font-size: .76rem; color: var(--text-muted); margin-top: .1rem; }

/* ---- Notes ---- */
.note { border-left: 3px solid var(--border); padding: .5rem 0 .5rem .8rem; margin-bottom: .6rem; }
.note.note-internal { border-left-color: var(--violet); }
.note .note-head { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-muted); margin-bottom: .2rem; flex-wrap: wrap; }
.note .note-author { color: var(--text); font-weight: 700; }
.note .note-body { font-size: .9rem; }

/* ---- Attachments ---- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px,1fr)); gap: .5rem; margin-bottom: .85rem; }
/* A handful of imported jobs carry hundreds of attachments (one archive
   bucket-job runs to nearly 1,000), which rendered as an uncapped grid and
   stretched the page past 11,000px — the tech's actual notes and time log
   for the job ended up buried a dozen screens down. Past ~24 files the grid
   caps its own height and scrolls internally instead of the whole page. */
.attach-grid-scroll { max-height: 21rem; overflow-y: auto; padding-right: .25rem; }
.card-title-count { font-weight: 500; color: var(--text-muted); font-size: .82em; }
.attach-thumb {
    aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; background: var(--surface2); position: relative;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dropzone {
    border: 1.5px dashed var(--border); border-radius: var(--radius-md); padding: 1.1rem; text-align: center;
    color: var(--text-muted); font-size: .85rem; font-weight: 600; cursor: pointer; position: relative;
}
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .icon { font-size: 1.4rem; display: block; margin-bottom: .25rem; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* ---- Empty states ---- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .5rem; display: block; }

/* ---- Toasts ---- */
.toast-stack {
    position: fixed; left: 1rem; right: 1rem; bottom: calc(76px + var(--safe-b)); z-index: 60;
    display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
    background: var(--text); color: var(--surface); padding: .7rem 1rem; border-radius: var(--radius-md);
    font-size: .85rem; font-weight: 600; box-shadow: var(--shadow-2);
    display: flex; align-items: center; gap: .5rem; pointer-events: auto;
    animation: toast-in .18s ease;
}
.toast.toast-error { background: var(--red); color: #fff; }
.toast.toast-success { background: var(--green); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Modals ---- */
body.modal-open { overflow: hidden; }
.modal {
    position: fixed; inset: 0; z-index: 80;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(9,14,24,.55); padding: 0;
    animation: modal-fade .15s ease;
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-card {
    background: var(--surface); width: 100%; max-width: 520px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh; overflow-y: auto;
    padding: 1.1rem 1.15rem calc(1.15rem + var(--safe-b));
    box-shadow: var(--shadow-2); animation: modal-rise .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close { background: var(--surface2); border: none; color: var(--text-muted); width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--surface3); }

/* Combined date+time picker — a single trigger button replaces the raw
   native <input type=date>+<input type=time> pair; see initDateTimeCombo()
   in app.js. The native inputs stay in the DOM as the real form fields
   (progressive enhancement, same pattern as the rich-text editor) — this is
   purely the click-to-open experience layered on top. */
.dt-trigger {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .78rem .9rem; border-radius: var(--radius-md); border: 1.5px solid var(--border);
    background: var(--surface); color: var(--text); min-height: 48px;
    font: inherit; font-size: 16px; text-align: left; cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
}
.dt-trigger:hover { border-color: var(--accent); }
.dt-trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dt-trigger-icon { font-size: 1.05rem; flex-shrink: 0; }
.dt-trigger-text { flex: 1; font-weight: 600; }
.dt-trigger-text.dt-trigger-empty { font-weight: 500; color: var(--text-muted); }
.dt-trigger-sep { color: var(--text-faint); }
.dt-trigger-edit { font-size: .78rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }

.dt-modal-card { max-width: 400px; }
.dt-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.dt-cal-label { font-weight: 700; font-size: .95rem; }
.dt-cal-nav {
    width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--surface2);
    color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.dt-cal-nav:hover { background: var(--surface3); }
.dt-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .72rem; font-weight: 700; color: var(--text-muted); margin-bottom: .3rem; }
.dt-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dt-day {
    aspect-ratio: 1; border: none; background: none; border-radius: 50%; color: var(--text);
    font: inherit; font-size: .88rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.dt-day:hover { background: var(--surface3); }
.dt-day-today { font-weight: 800; color: var(--accent); }
.dt-day-selected, .dt-day-selected:hover { background: var(--accent); color: #fff; font-weight: 700; }

.dt-time-section { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.dt-time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; max-height: 168px; overflow-y: auto; margin-top: .4rem; }
.dt-time-chip {
    padding: .5rem .3rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600;
    cursor: pointer; text-align: center; transition: border-color .12s, background .12s;
}
.dt-time-chip:hover { border-color: var(--accent); }
.dt-time-chip-selected, .dt-time-chip-selected:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.dt-custom-time-toggle { background: none; border: none; color: var(--accent); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; padding: .5rem 0 0; }
.dt-custom-time-input { margin-top: .4rem; }

/* Compact variant of .dt-trigger for time-only fields packed into a tight
   row (e.g. the weekly-availability grid) — same look, less padding. */
.dt-trigger-compact { min-height: 44px; padding: .55rem .7rem; font-size: 15px; flex: 1; min-width: 100px; width: auto; }
.dt-trigger-compact .dt-trigger-text { font-weight: 600; font-size: .92rem; }

/* Search-style autocomplete over a plain text input — [data-ac-combo] wraps
   the input; dropdown rows show a title + a secondary preview line (address,
   job count) inline rather than gated behind hover, since most of this app's
   usage is touch. See initAutocomplete() in app.js. */
[data-ac-combo] { position: relative; }
.ac-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-2); max-height: 320px; overflow-y: auto; padding: .3rem;
}
.ac-row {
    display: block; width: 100%; text-align: left; background: none; border: none; border-radius: var(--radius-sm);
    padding: .55rem .65rem; cursor: pointer; font: inherit;
}
.ac-row:hover, .ac-row-active { background: var(--surface2); }
.ac-row-title { display: block; font-weight: 700; font-size: .9rem; color: var(--text); }
.ac-row-sub { display: block; margin-top: 1px; font-size: .76rem; color: var(--text-muted); }

/* Profile-photo crop modal — a circular clip window the user drags/zooms an
   uploaded image inside of; see initAvatarCropper() in app.js. */
.avatar-crop-viewport {
    width: 260px; height: 260px; margin: 0 auto; border-radius: 50%; overflow: hidden;
    position: relative; background: var(--surface2); touch-action: none; cursor: grab;
    box-shadow: 0 0 0 3px var(--border);
}
.avatar-crop-viewport:active { cursor: grabbing; }
.avatar-crop-viewport img { position: absolute; top: 0; left: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }

/* Messages thread — sticky identity bar + fixed compose bar, so the person
   you're talking to and the input never scroll out of reach (chat-app feel). */
.msg-thread-header {
    position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 20;
    display: flex; align-items: center; gap: .6rem;
    background: var(--surface2); padding: .6rem 0; margin: 0 0 .75rem;
    border-bottom: 1px solid var(--border);
}
.msg-back { font-size: 1.3rem; color: var(--text); text-decoration: none; padding: .2rem .4rem .2rem 0; flex-shrink: 0; }
.msg-thread-identity { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); flex: 1; min-width: 0; }
.msg-thread-name { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-call-btn { font-size: 1.25rem; text-decoration: none; flex-shrink: 0; padding: .3rem; }
.msg-thread-list { padding-bottom: 5rem; }

/* One message: bubble shrink-wraps to its content (not a fixed-width flex
   item), and its Edit/Delete actions stay hidden until the row is hovered
   or focused — the timestamp alone stays put as a quiet, permanent label. */
.msg-row { display: flex; flex-direction: column; width: fit-content; max-width: 80%; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-row:not(.mine) { align-self: flex-start; align-items: flex-start; }
.msg-row-inner { display: flex; gap: .5rem; align-items: flex-end; width: fit-content; max-width: 100%; }
.msg-row.mine .msg-row-inner { flex-direction: row-reverse; }
.msg-bubble-content { border-radius: var(--radius-md); padding: .55rem .8rem; font-size: .9rem; width: fit-content; max-width: 100%; }
.msg-row.mine .msg-bubble-content { background: var(--accent); color: #fff; }
.msg-row:not(.mine) .msg-bubble-content { background: var(--surface2); color: var(--text); }
.msg-meta { font-size: .78rem; color: var(--text-faint); margin-top: .15rem; width: 100%; align-self: stretch; }
.msg-row.mine .msg-meta { text-align: right; }
.msg-row:not(.mine) .msg-meta { text-align: left; }
.msg-actions { opacity: 0; transition: opacity .12s; }
.msg-row:hover .msg-actions, .msg-row:focus-within .msg-actions, .msg-row.msg-row--active .msg-actions { opacity: 1; }
.msg-actions button, .msg-actions a { background: none; border: none; padding: 0; cursor: pointer; color: var(--text-faint); font: inherit; text-decoration: none; }

/* Compose bar sits flush above the bottom tab bar with no gap: its own
   background is extended all the way to the true viewport bottom (padding,
   not position) so the tab bar — which renders on top — fully covers the
   overlap instead of leaving a sliver of page background showing through. */
.msg-compose-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 24;
    background: var(--surface2); border-top: 1px solid var(--border);
    padding: .6rem 0 calc(.6rem + 64px + var(--safe-b));
}
.msg-compose-bar-inner { max-width: 1040px; margin: 0 auto; padding: 0 1rem; display: flex; gap: .5rem; align-items: center; }

/* ---- On-screen keyboard (mobile) ----
   iOS anchors position:fixed and position:sticky to the *layout* viewport,
   which drifts above the visible area once the keyboard opens and the page
   scrolls to reveal the focused field. The result: the top bar rides up
   under the status bar while the tab bar floats over the keyboard. The
   visualViewport API is the only thing that reports what the user can
   actually see, so initKeyboardChrome() in app.js drives both from it —
   setting --kb-offset and toggling .kb-open on <body>. */
:root { --kb-offset: 0px; --kb-height: 0px; }
body.kb-open .tabbar,
body.kb-open .next-action-bar,
body.kb-open .bulk-bar { display: none; }
body.kb-open { padding-bottom: 0; }
/* The compose bar reserves room for the tab bar it normally sits above; with
   that bar hidden the reservation is just a gap floating over the keyboard. */
body.kb-open .msg-compose-bar { padding-bottom: .6rem; }
body.kb-open .topbar { transform: translateY(var(--kb-offset)); }
/* --kb-offset (visualViewport.offsetTop) is near-zero for a plain keyboard
   open — it's really a pinch-zoom-pan measurement — so it under-corrected
   here. --kb-height (the actual keyboard occlusion) is what the sticky
   header needs: without it, on a long thread the header rides out of the
   visible area (looks like the contact's name vanished) instead of staying
   pinned below the topbar. */
body.kb-open .msg-thread-header { top: calc(56px + env(safe-area-inset-top) + var(--kb-height)); }
/* .msg-compose-bar is fixed to the LAYOUT viewport's bottom edge, which the
   keyboard covers without moving — shift it up by the keyboard's own height
   so it lands right above the keys instead of floating beneath them with
   the (now-hidden) tab bar's old slot showing as a gap. */
body.kb-open .msg-compose-bar { transform: translateY(calc(-1 * var(--kb-height))); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { transform: translateY(24px); } to { transform: none; } }
@media (min-width: 640px) {
    .modal { align-items: center; padding: 1.5rem; }
    .modal-card { border-radius: var(--radius-lg); }
}

/* ---- Setup / Readiness Center ---- */
.setup-progress { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.1rem; }
.setup-ring { --pct: 0; width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--surface3) 0);
    display: flex; align-items: center; justify-content: center; }
.setup-ring span { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; }
.setup-progress .setup-sub { font-size: .82rem; color: var(--text-muted); }
.setup-group-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 1.1rem 0 .4rem; }
.setup-item { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: .5rem; background: var(--surface); }
.setup-item.is-done { background: var(--green-soft); border-color: transparent; }
.setup-check { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; margin-top: .05rem; }
.setup-item.is-done .setup-check { background: var(--green); color: #fff; }
.setup-item.is-todo .setup-check { background: var(--surface3); color: var(--text-faint); border: 1.5px dashed var(--border); }
.setup-item .setup-body { flex: 1; min-width: 0; }
.setup-item .setup-title { font-weight: 700; font-size: .9rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.setup-item.is-done .setup-title { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.setup-item .setup-why { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.setup-item .setup-status { font-size: .72rem; font-weight: 700; color: var(--text-muted); }
.setup-item .setup-action { flex-shrink: 0; align-self: center; }
.tag-required { background: var(--red-soft); color: var(--red); font-size: .58rem; padding: .1rem .4rem; border-radius: 4px; font-weight: 800; text-transform: uppercase; }

/* ---- Setup banner (app-wide nudge for admins) ---- */
/* Distinct from the amber setup banner on purpose — this one has no dismiss
   button and needs to read as "you are somewhere unusual", not routine. */
.viewing-as-banner { display: flex; align-items: center; gap: .7rem; background: var(--violet-soft); border: 1px solid var(--violet); border-radius: var(--radius-md); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .85rem; }
.viewing-as-banner .viewing-as-text { flex: 1; color: var(--text); font-weight: 600; }
.viewing-as-banner a.btn { flex-shrink: 0; background: var(--violet); }

.setup-banner { display: flex; align-items: center; gap: .7rem; background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius-md); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .85rem; }
.setup-banner .setup-banner-text { flex: 1; color: var(--text); font-weight: 600; }
.setup-banner a.btn { flex-shrink: 0; }
.setup-banner .setup-banner-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; flex-shrink: 0; }

/* ---- Address + map blocks ---- */
.addr-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .5rem; }
.addr-grid .field { margin-bottom: .75rem; }
@media (max-width: 480px) { .addr-grid { grid-template-columns: 1fr; } }

/* ---- New/Edit Job form layout ----
   Single column, top-to-bottom reading order on mobile. On wide screens the
   same sections split into a main column + a sticky context sidebar so the
   whole form fits without the old one-field-per-screen-height scroll. Named
   grid-areas (not just a 2-column split) so Assign Tech can sit right after
   Scheduled-for — availability IS the date/time above it — without also
   having to live in the sidebar. */
.wo-form-grid {
    display: grid; grid-template-columns: 1fr; gap: 1.1rem;
    grid-template-areas: "basics" "schedule" "assign" "context" "rate" "description" "travel" "onsite" "save";
}
.wo-sec-rate { grid-area: rate; }
.wo-sec-travel { grid-area: travel; }
.tag-temp { background: var(--amber-soft); color: var(--amber); }
.wo-ref-line { font-weight: 700; font-size: .9rem; margin: 0 0 .5rem; overflow-wrap: anywhere; }
.wo-sec-basics { grid-area: basics; }
.wo-sec-schedule { grid-area: schedule; }
.wo-sec-assign { grid-area: assign; }
.wo-sec-context { grid-area: context; }
.wo-sec-description { grid-area: description; }
.wo-sec-onsite { grid-area: onsite; }
.wo-sec-save { grid-area: save; }
@media (min-width: 860px) {
    .wo-form-grid {
        grid-template-columns: 1.3fr 1fr; gap: 0 1.5rem;
        grid-template-areas:
            "basics      context"
            "schedule    context"
            "assign      context"
            "rate        context"
            "description context"
            "travel      context"
            "onsite      context"
            "save        context";
    }
    .wo-sec-context { position: sticky; top: 1.5rem; align-self: start; }
}
/* On a wide desktop, Schedule (one row: date + time) doesn't need Basics' full
   width to itself. Setting it beside Basics instead of stacked under it removes
   a full section-height of scroll before Save is in view — the actual
   complaint in #202, since the 860px layout above only moved the context panel
   aside and left the rest of the form just as tall.
   Assign stays full-width rather than joining that pairing: its chip grid grows
   with team size, and squeezing it into a narrow column just traded one scroll
   problem for a dead-whitespace one (the shorter Basics/Schedule row leaving a
   gap while the tall chip list ran on beside it). Full width lets the same
   chips wrap into more columns and use less height overall instead. */
@media (min-width: 1180px) {
    .wo-form-grid {
        grid-template-columns: 1.3fr .85fr 1fr; gap: 1.1rem 1.5rem;
        align-items: start;
        grid-template-areas:
            "basics schedule context"
            "assign assign   context"
            "rate   rate     context"
            "description description context"
            "travel travel   context"
            "onsite onsite   context"
            "save   save     context";
    }
}
#woContext.card { background: var(--surface2); }
/* Live distance readout — confirms the Customer field resolved to a real,
   mappable place, right where it's typed rather than buried further down. */
.wo-location-line {
    display: flex; align-items: center; gap: .4rem;
    padding: .55rem .8rem; border-radius: var(--radius-md);
    background: var(--surface2); border: 1px solid var(--border);
    font-size: .82rem; font-weight: 600; color: var(--text);
}

/* Compact multi-select for job-assignment techs — a wrapping chip grid reads
   at a glance instead of a full-height checkbox-per-row list, so it can live
   right next to Scheduled-for without dominating the page. */
/* Fixed-width grid columns (not flex-wrap) so a tech with a long
   "no availability set" tag doesn't hog its own full row while short ones
   sit two-to-a-line next to it — every chip truncates to the same column
   width instead of sizing to its own content. */
.tech-chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.tech-chip {
    display: inline-flex; align-items: center; gap: .4rem; min-width: 0;
    padding: .5rem .7rem; border-radius: 999px; border: 1.5px solid var(--border);
    background: var(--surface); cursor: pointer; font-size: .85rem; font-weight: 600;
    transition: border-color .12s, background .12s;
}
.tech-chip input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.tech-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tech-chip .tech-chip-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; }
.tech-chip .tag { font-size: .66rem; padding: .12rem .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92px; flex-shrink: 0; margin-left: auto; }
.tech-day-jobs { font-size: .78rem; color: var(--text-muted); padding: .35rem 0; }
[data-tech-conflicts]:not(:empty) { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.map-embed {
    /* 16/9 alone means the map grows with the column — on a wide desktop that
       is ~730px of map, taller than the viewport, and it pushes every real
       detail below the fold. The cap keeps it a glanceable strip. */
    width: 100%; aspect-ratio: 16/9; max-height: 240px; border: 1px solid var(--border);
    border-radius: var(--radius-md); overflow: hidden; margin-top: .3rem; background: var(--surface2);
}
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- Channel header extras ---- */
.msg-thread-topic {
    display: block; font-size: .74rem; color: var(--text-muted); font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -.1rem;
}
.msg-member-count { font-size: .78rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ---- Home insights ---- */
.insight-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.1rem; }
.insight {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .7rem .85rem; border-radius: var(--radius-md);
    border: 1px solid var(--border); border-left-width: 3px;
    background: var(--surface); color: var(--text); text-decoration: none;
    transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.insight:hover { background: var(--surface2); }
a.insight:active { transform: scale(.99); background: var(--surface2); }
.insight-warn { border-left-color: var(--amber); }
.insight-good { border-left-color: var(--green); }
.insight-info { border-left-color: var(--accent); }
.insight-icon { font-size: 1.15rem; line-height: 1.25; flex-shrink: 0; }
.insight-body { display: flex; flex-direction: column; gap: .12rem; min-width: 0; flex: 1; }
.insight-headline { font-weight: 700; font-size: .9rem; }
.insight-detail { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
.insight-cta { font-size: .75rem; font-weight: 700; color: var(--accent); white-space: nowrap; flex-shrink: 0; align-self: center; }
@media (max-width: 560px) {
    .insight { flex-wrap: wrap; }
    .insight-cta { align-self: flex-start; margin-left: 1.85rem; }
}

/* ---- Settle tech pay (job Financials card) ---- */
.settle-pay { margin: .35rem 0 .6rem; }
.settle-pay-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.settle-pay-who { flex: 1 1 8rem; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-pay-amt {
    display: flex; align-items: center; gap: .2rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 .5rem; background: var(--surface);
}
.settle-pay-amt span { color: var(--text-muted); font-size: .9rem; }
.settle-pay-amt input {
    width: 6.5rem; border: 0; background: transparent; padding: .4rem .1rem;
    font-variant-numeric: tabular-nums; text-align: right;
}
.settle-pay-amt input:focus { outline: none; }
.settle-pay-amt:focus-within { border-color: var(--accent); }

/* ---- "Your pay for this job" (the one money figure a tech ever sees) ---- */
.mypay-row {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
}
.mypay-amt {
    font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em;
    color: var(--green); font-variant-numeric: tabular-nums;
}
.mypay-when { font-size: .8rem; color: var(--text-muted); }
.mypay-total { display: flex; flex-direction: column; gap: .15rem; align-items: flex-start; }
.mypay-total .mypay-amt { font-size: 2.1rem; line-height: 1.1; }
.mypay-total-label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-faint); font-weight: 700;
}

/* ---- "Still needed on this job" ---- */
.wo-missing {
    display: block; text-decoration: none; color: inherit;
    border-color: var(--amber);
    padding: .7rem .9rem;
}
.wo-missing-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .6rem; font-size: .88rem; font-weight: 700;
}
.wo-missing-cta { color: var(--amber); white-space: nowrap; }
.wo-missing-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.wo-missing-chip {
    font-size: .74rem; font-weight: 600;
    padding: .2rem .55rem; border-radius: 999px;
    background: var(--surface2); border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* ---- Google Places suggestion list ----
   Google appends .pac-container to <body> with its own light-mode styling and
   ~30px rows. On a phone with the keyboard up those rows were too small to hit
   reliably, which read as "the dropdown will not let me tap it". Rows are given
   a real 44px touch target here, and the panel is themed and lifted above every
   fixed bar in the app (the highest of ours is the modal overlay at 80). */
.pac-container {
    z-index: 100000 !important;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
    margin-top: 4px;
    font-family: inherit;
    /* Google renders the full result list at whatever height it needs. With the
       on-screen keyboard up, the last suggestion ended up below the visible
       viewport and could not be tapped at all. Capping the height and letting
       the list scroll keeps every row reachable, and the bottom padding stops
       the final row from tucking under the fixed tab bar. */
    max-height: 40vh;
    overflow-y: auto;
    padding-bottom: .35rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.pac-item {
    display: flex; align-items: center; flex-wrap: wrap;
    min-height: 44px;
    padding: .55rem .85rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text);
    font-size: .9rem;
    line-height: 1.35;
    cursor: pointer;
    touch-action: manipulation;
}
.pac-item:first-child { border-top: none; }
.pac-item:hover,
.pac-item-selected { background: var(--surface2); }
.pac-item-query { color: var(--text); font-size: .92rem; font-weight: 600; }
.pac-matched { font-weight: 800; }
.pac-icon { margin-right: .5rem; }
/* Google's own attribution row — keep it, just stop it looking broken. */
.pac-container:after { background-color: var(--surface); }

/* ---- Pager (long record lists) ---- */
.pager {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    margin: .9rem 0 .25rem; padding: .5rem .25rem;
}
.pager-status { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---- Login screen ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.75rem; font-weight: 800; font-size: 1.15rem; }
.auth-logo img { width: 44px; height: 44px; border-radius: 12px; }
.otp-code-input { letter-spacing: .5em; text-align: center; font-size: 1.4rem; font-weight: 800; }

.flash { padding: .8rem 1rem; border-radius: var(--radius-md); font-size: .85rem; font-weight: 600; margin-bottom: 1rem; }
.flash-error { background: var(--red-soft); color: var(--red); }
.flash-ok { background: var(--green-soft); color: var(--green); }
.flash-warn { background: var(--amber-soft); color: var(--amber); }

/* ---- Bulk select ---- */
.bulk-item { position: relative; }
.bulk-item .bulk-checkbox {
    position: absolute; top: .7rem; left: .7rem; z-index: 5; width: 22px; height: 22px;
    accent-color: var(--accent); background: var(--surface); border-radius: 6px;
}
.bulk-item .wo-row { padding-left: 3rem; }
.bulk-bar {
    position: fixed; left: 1rem; right: 1rem; bottom: calc(76px + var(--safe-b)); z-index: 40;
    background: var(--text); color: var(--surface); border-radius: var(--radius-md);
    padding: .7rem .9rem; display: flex; align-items: center; gap: .6rem; box-shadow: var(--shadow-2);
}
.bulk-bar select { min-height: 48px; padding: .4rem .6rem; flex: 1; }
.bulk-bar .btn { width: auto; min-height: 40px; }
@media (min-width: 860px) { .bulk-bar { left: auto; right: 2rem; bottom: 2rem; width: 420px; } }

/* ---- Utility ---- */
.hide-mobile { display: none; }
@media (min-width: 860px) { .hide-mobile { display: block; } }

/* ---- Filter pills ---- */
.pill-row { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .75rem; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }
.pill { white-space: nowrap; width: auto !important; }

/* ---- Calendar grid (schedule.php month view) ---- */
.cal-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 2px; }
.cal-dow { text-align: center; font-size: .62rem; font-weight: 800; color: var(--text-faint); text-transform: uppercase; padding: .3rem 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 1rem; }
.cal-cell {
    background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 6px;
    min-height: 64px; padding: .25rem; display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto; max-height: 150px;
}
.cal-cell.is-outside { background: var(--surface2); opacity: .5; }
.cal-cell.is-today { border-color: var(--accent); border-width: 1.5px; }
.cal-daynum { font-size: .68rem; font-weight: 700; color: var(--text-muted); position: sticky; top: 0; background: inherit; }
.cal-daytotal { float: right; font-size: .62rem; font-weight: 800; color: var(--green); }
.cal-cell.is-today .cal-daynum { color: var(--accent); }
.cal-chip {
    font-size: .66rem; font-weight: 700; padding: .18rem .35rem; border-radius: 4px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: var(--text); background: var(--surface3); display: block;
}
.cal-chip.is-overdue { background: var(--red-soft); color: var(--red); }
.cal-chip-more { font-size: .64rem; color: var(--text-muted); font-weight: 700; }
@media (min-width: 860px) {
    .cal-cell { min-height: 96px; padding: .4rem; }
    .cal-chip { font-size: .68rem; padding: .18rem .4rem; }
    .cal-daynum { font-size: .78rem; }
}

/* ---- Print (report.php and, incidentally, any page) ---- */
@media print {
    .topbar, .app-sidebar, .tabbar, .next-action-bar, .toast-stack, .no-print { display: none !important; }
    body { background: #fff; color: #000; padding-bottom: 0; }
    .app-main { padding: 0; max-width: 100%; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    a { color: #000; text-decoration: none; }
    /* Schedule: print the full month/week grid on ONE page — compact, no scroll. */
    @page { size: landscape; margin: 0.4in; }
    .page-header { margin: 0 0 .25rem; }
    .page-header h1 { font-size: 1.1rem; }
    .card { padding: .4rem .5rem !important; margin-bottom: .4rem; }
    .stat-row { gap: .3rem; margin-bottom: .3rem; }
    .stat-card { border: 1px solid #999; padding: .25rem; }
    .stat-value { font-size: .95rem !important; }
    .stat-label { font-size: .6rem; }
    .cal-grid { display: grid !important; grid-template-columns: repeat(7, 1fr); gap: 1px; }
    .cal-dow { font-size: .58rem; }
    .cal-cell { max-height: none !important; overflow: visible !important; min-height: 50px;
                border: 1px solid #999 !important; page-break-inside: avoid; padding: 2px; gap: 1px; }
    .cal-cell.is-outside { opacity: .5; }
    .cal-daynum { font-size: .6rem; }
    .cal-chip { background: #eee !important; color: #000 !important; border: 1px solid #ccc;
                white-space: normal; font-size: .55rem; padding: 0 2px; line-height: 1.02; }
    .section-head { margin: .05rem 0 .1rem !important; }
    .section-head h3 { font-size: .82rem !important; }
    .cal-daytotal { color: #060 !important; font-size: .55rem; }
    /* Insights panel: collapse the stacked callouts + tags into tight inline
       rows so the at-a-glance card stops eating a third of the page height. */
    .print-block .card-title { font-size: .62rem !important; margin: 0 0 .15rem !important; }
    .print-block .stat-row { margin-bottom: .2rem !important; }
    .print-block .stat-card { padding: .15rem !important; }
    .sched-callouts { flex-direction: row !important; flex-wrap: wrap !important;
                      gap: .1rem .7rem !important; font-size: .62rem !important; }
    .sched-whoson { margin: .25rem 0 .1rem !important; }
    .sched-tags { gap: .15rem .3rem !important; }
    .sched-tags .tag { font-size: .55rem !important; padding: 1px 4px !important; }
    .print-block { break-inside: avoid; }
    /* Per-tech handout: clean list. */
    .tech-sheet-day { border-top: 1px solid #999; padding-top: .1rem; }
}

/* ---- Desktop enhancement ---- */
@media (min-width: 860px) {
    body { padding-bottom: 0; }
    .tabbar, .next-action-bar { display: none; }
    .app-sidebar {
        display: flex; flex-direction: column; gap: .1rem;
        width: 232px; flex-shrink: 0; padding: .9rem .85rem 1.25rem;
        border-right: 1px solid var(--border); background: var(--surface);
        position: sticky; top: 56px; height: calc(100vh - 56px);
        /* Long nav (Home…Admin) must always scroll to reach Settings on short
           viewports — without this the bottom group gets clipped with no way down. */
        overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    }
    .app-sidebar::-webkit-scrollbar { width: 8px; }
    .app-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
    .app-sidebar .nav-group-label { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: .5rem .75rem .25rem; }
    .app-sidebar .nav-group-label:first-child { padding-top: 0; }
    .app-sidebar a {
        display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; border-radius: 10px;
        text-decoration: none; color: var(--text-muted); font-weight: 700; font-size: .87rem;
        position: relative; flex-shrink: 0;
    }
    .app-sidebar a:hover { background: var(--surface2); }
    .app-sidebar a.active { color: var(--accent); background: var(--accent-soft); }
    .app-sidebar a.active::before { content: ''; position: absolute; left: -.85rem; top: .35rem; bottom: .35rem; width: 3px; border-radius: 3px; background: var(--accent); }
    .app-main { padding: 1.5rem 2rem; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .btn.btn-cta { width: auto; min-width: 200px; }

    /* The fixed compose bar ignores document flow, so on desktop it must be
       shifted past the sidebar itself and no longer needs the mobile tabbar's
       bottom clearance (the tabbar is hidden above this breakpoint). */
    .msg-compose-bar { left: 232px; padding: .6rem 0; }
    .msg-compose-bar-inner { padding: 0 2rem; }

    /* dispatch-table row mode for lists — real flex children, no display:contents
       (bare text nodes as grid items render inconsistently across browsers) */
    .wo-row.grid-row {
        display: flex; align-items: center; gap: 1.1rem; padding: .65rem .95rem;
    }
    .wo-row.grid-row .row-dot {
        flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint);
    }
    .wo-row.grid-row.is-overdue .row-dot { background: var(--red); }
    .wo-row.grid-row .wo-top {
        flex: 1 1 0; min-width: 0; margin: 0; display: flex; align-items: center; gap: .6rem;
    }
    .wo-row.grid-row .wo-top .wo-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .wo-row.grid-row .cell-site {
        flex: 0 1 auto; max-width: 30%; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .wo-row.grid-row .wo-foot {
        flex: 0 0 auto; margin: 0; display: flex; align-items: center; gap: .85rem;
    }
    .wo-row.grid-row .cell-time { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
}

/* ============================================================
   Time clock + parts/materials (Wave M1–M2)
   ============================================================ */
.clock-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .55rem 0;
  border-top: 1px solid var(--border-subtle);
}
.clock-row:first-of-type { border-top: none; }
.clock-label { font-weight: 700; font-size: .9rem; min-width: 5.5rem; }
.clock-btns { display: flex; gap: .4rem; margin-left: auto; }
.live-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .02em;
  color: var(--green);
  min-width: 4.5rem;
}
.live-timer.paused { color: var(--text-faint); }
.clock-totals {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border-subtle);
  font-size: .88rem;
}
.time-entry {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .5rem 0;
  border-top: 1px solid var(--border-subtle);
}
.time-entry:first-of-type { border-top: none; }

/* ============================================================
   Financial summary stat cards (invoices / dashboards)
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-bottom: .85rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .7rem .6rem;
  text-align: center;
}
.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
/* The one number that matters most on a page (e.g. a job's total billed +
   margin) — a real hero, not the same size as everything else around it. */
.money-hero {
  display: flex; gap: 1.5rem; margin: .5rem 0 .75rem;
}
.money-hero-value {
  display: block; font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.money-hero-label {
  display: block; font-size: .74rem; color: var(--text-muted); margin-top: .1rem;
}
@media (min-width: 700px) {
  .stat-value { font-size: 1.5rem; }
}

/* ============================================================
   Per-tech printable handout (schedule)
   ============================================================ */
.tech-sheet-day {
  font-weight: 800; font-size: .8rem; color: var(--text-muted);
  margin: .5rem 0 .15rem;
}
.tech-sheet-job {
  display: flex; justify-content: space-between; gap: .6rem; align-items: baseline;
  padding: .3rem .2rem; border-bottom: 1px solid var(--border-subtle);
  text-decoration: none; color: var(--text); font-size: .88rem;
}
.tech-sheet-job:hover { background: var(--surface2); }
.tsj-loc { color: var(--text-muted); }
.tsj-money { white-space: nowrap; font-weight: 700; color: var(--green); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.tech-sheet-total {
  margin-top: .5rem; padding-top: .4rem; border-top: 2px solid var(--border);
  font-weight: 800; text-align: right;
}

/* ============================================================
   Invoice document (invoice.php) — the printable, branded invoice.
   ============================================================ */
.invoice-doc { max-width: 780px; margin: 0 auto; padding: 1.75rem 1.9rem; }
.inv-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1rem; border-bottom: 2px solid var(--border); margin-bottom: 1.1rem; }
.inv-biz { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.inv-line { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.inv-meta { text-align: right; min-width: 160px; }
.inv-title { font-size: 1.5rem; font-weight: 800; letter-spacing: .12em; color: var(--text-faint); }
.inv-num { font-size: 1rem; font-weight: 700; }
.inv-dates { margin-top: .5rem; font-size: .8rem; }
.inv-dates > div { display: flex; justify-content: flex-end; gap: .5rem; }
.inv-dates span { color: var(--text-faint); }
.inv-parties { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.inv-billto, .inv-ref { flex: 1; min-width: 200px; }
.inv-ref { text-align: left; }
.inv-label { display: block; font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint); margin-bottom: .3rem; }
.inv-cust { font-size: 1rem; font-weight: 700; margin-bottom: .15rem; }
.inv-lines { width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: 1rem; }
.inv-lines th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
  border-bottom: 1.5px solid var(--border); padding: .4rem .5rem; }
.inv-lines td { padding: .5rem; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.inv-lines .l { text-align: left; } .inv-lines .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-lines tfoot td { border: none; padding-top: .7rem; }
.inv-lines .total-label { font-weight: 700; color: var(--text-muted); }
.inv-lines .total-amt { font-size: 1.15rem; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.inv-terms { display: flex; flex-direction: column; gap: .6rem; font-size: .82rem; color: var(--text-muted);
  background: var(--surface2); border-radius: 10px; padding: .8rem 1rem; margin-bottom: .9rem; }
.inv-remit { font-size: .82rem; color: var(--text-muted); border-top: 1px solid var(--border-subtle); padding-top: .7rem; }

@media (max-width: 620px) {
  .invoice-doc { padding: 1.1rem 1rem; }
  .inv-meta { text-align: left; } .inv-dates > div { justify-content: flex-start; }
}
@media print {
  .invoice-doc { max-width: 100%; margin: 0; padding: 0; border: none; box-shadow: none; }
  .inv-biz, .inv-title { color: #000 !important; }
  .inv-lines .total-amt { color: #000 !important; }
  .inv-terms { background: #f4f4f4 !important; }
  @page { size: portrait; margin: 0.6in; }
}

/* Relationship / cross-link bar — quick jumps between linked records. */
.link-bar { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }

/* Collapsed edit form on profile pages (customer/others) — view-first. */
.edit-disclosure { margin-bottom: .85rem; }
.edit-disclosure > summary {
  cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--accent);
  padding: .7rem .95rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); list-style: none;
}
.edit-disclosure[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.edit-disclosure > summary::-webkit-details-marker { display: none; }
.edit-disclosure[open] > summary::before { content: '▾ '; }
.edit-disclosure:not([open]) > summary::before { content: '▸ '; }

/* Legacy (imported) marker — muted, low-emphasis so it reads as metadata not alarm. */
.badge-legacy { background: var(--surface3); color: var(--text-muted); border: 1px solid var(--border); }

/* Push-enable nudge (home) — soft accent banner, dismissible, client-gated. */
.push-nudge {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-md);
  padding: .7rem .9rem; margin-bottom: 1rem; font-size: .88rem; font-weight: 600; color: var(--text);
}
.push-nudge-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ============================================================
   Utility layer — maps to the design tokens so templates can stop
   hand-rolling inline styles (the root cause of spacing/alignment
   drift). Namespaced `u-` to guarantee no collision with components.
   ============================================================ */
.u-row { display: flex; align-items: center; gap: .5rem; }
.u-row-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.u-row-top { align-items: flex-start; }
.u-stack { display: flex; flex-direction: column; gap: .5rem; }
.u-wrap { flex-wrap: wrap; }
.u-grow { flex: 1; min-width: 0; }
.u-shrink-0 { flex-shrink: 0; }
.u-gap-1 { gap: .25rem; }
.u-gap-2 { gap: .5rem; }
.u-gap-3 { gap: .85rem; }
.u-right { margin-left: auto; }
.u-center { text-align: center; }
.u-tright { text-align: right; }
.u-muted { color: var(--text-muted); }
.u-faint { color: var(--text-faint); }
.u-strong { font-weight: 700; }
.u-nowrap { white-space: nowrap; }
.u-small { font-size: .82rem; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-mt-0 { margin-top: 0; } .u-mt-1 { margin-top: .5rem; } .u-mt-2 { margin-top: 1rem; }
.u-mb-0 { margin-bottom: 0; } .u-mb-1 { margin-bottom: .5rem; } .u-mb-2 { margin-bottom: 1rem; }
@media (max-width: 640px) { .u-hide-mobile { display: none !important; } }
@media (min-width: 641px) { .u-hide-desktop { display: none !important; } }

/* ---- Employee profile ---- */
.profile-head { display: flex; align-items: center; gap: .9rem; }
.avatar.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }
.profile-id { min-width: 0; flex: 1; }
.profile-id h1 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.profile-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.profile-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .75rem; }
.profile-cols { display: grid; grid-template-columns: 1fr; gap: 0 1.25rem; }
@media (min-width: 860px) { .profile-cols { grid-template-columns: 1fr 1.15fr; align-items: start; } }
.avail-line { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--border-subtle); font-size: .86rem; }
.avail-line:last-of-type { border-bottom: none; }
.avail-line form { margin: 0; }
.avail-edit { display: grid; grid-template-columns: 4.5rem 1fr 1fr; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.avail-day { display: flex; align-items: center; gap: .4rem; font-size: .86rem; min-height: 40px; }
#avatarCropZoom { width: 100%; }
