:root{
  --plane:#f4f6f9; --surface:#ffffff; --surface-2:#f7f8fb;
  --ink:#1f2733; --ink-2:#4b5563; --muted:#8a94a6;
  --border:#e6e8ee; --border-2:#eef1f5;
  --brand:#2563eb; --brand-d:#1d4ed8; --brand-wash:#eaf1ff;
  --good:#16a34a; --good-ink:#127a32; --warn:#f59e0b; --warn-ink:#8a5a00;
  --serious:#ec835a; --crit:#e5484d; --crit-wash:#fdecec;
  --sidebar:#ffffff; --sidebar-2:#f0f3f8; --sidebar-ink:#4b5563; --sidebar-muted:#8a94a6;
  --radius:14px; --shadow:0 1px 2px rgba(20,40,80,.05),0 4px 14px rgba(20,40,80,.05);
  --font:system-ui,-apple-system,"Segoe UI",sans-serif;
}
*{box-sizing:border-box}
body{margin:0;font-family:var(--font);background:var(--plane);color:var(--ink);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4{margin:0;font-weight:650;letter-spacing:-.01em}
a{color:var(--brand);text-decoration:none;cursor:pointer}
.tnum{font-variant-numeric:tabular-nums}
.app{display:grid;grid-template-columns:232px 1fr;min-height:100vh}
.sidebar{background:var(--sidebar);color:var(--sidebar-ink);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;border-right:1px solid var(--border)}
.brand{display:flex;align-items:center;gap:10px;padding:16px 18px 10px}
.brand .logo{width:34px;height:34px;border-radius:8px;background:transparent!important;display:flex;align-items:center;justify-content:center;color:var(--brand);font-weight:800;font-size:16px;flex:none}
/* the customer's own company logo + name, shown under the Lock Pilot brand */
.company-brand{display:flex;align-items:center;gap:9px;padding:8px 18px 14px;margin-bottom:6px;border-bottom:1px solid var(--border-2)}
.company-brand .cb-logo{width:30px;height:30px;border-radius:7px;background:var(--brand-wash);display:flex;align-items:center;justify-content:center;overflow:hidden;color:var(--brand-d);font-weight:700;font-size:14px;flex:none}
.company-brand .cb-logo img{width:100%;height:100%;object-fit:contain}
.company-brand .cb-name{color:var(--ink);font-size:13.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-return{color:var(--muted);font-size:12px;padding:0 18px 12px;cursor:pointer;user-select:none}
.admin-return:hover{color:var(--brand-d)}
.brand b{color:var(--ink);font-size:16px;letter-spacing:-.02em}
.brand small{display:block;color:var(--muted);font-size:11px;font-weight:500;letter-spacing:.02em}
.company-switch{margin:2px 12px 10px;padding:8px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;font-size:12.5px;color:var(--ink-2);display:flex;align-items:center;justify-content:space-between;cursor:pointer}
.company-switch .dot{width:18px;height:18px;border-radius:5px;background:var(--brand);display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:10px;font-weight:800;margin-right:8px}
nav{padding:8px 12px;overflow-y:auto;flex:1}
.nav-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:14px 10px 6px}
.nav-item{display:flex;align-items:center;gap:11px;padding:8px 11px;border-radius:9px;color:var(--ink-2);cursor:pointer;font-weight:500;font-size:13.5px;margin-bottom:1px}
.nav-more{display:flex;align-items:center;justify-content:flex-start;gap:6px;padding:8px 11px;margin-top:8px;border-top:1px solid var(--border-2);padding-top:12px;color:var(--muted);cursor:pointer;font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.05em;user-select:none}
.nav-more:hover{color:var(--ink-2)}
.nav-more .chev{transition:transform .2s}
.nav-more.open .chev{transform:rotate(180deg)}
.nav-item svg{width:17px;height:17px;flex:none;opacity:.85}
.nav-item:hover{background:var(--surface-2);color:var(--ink)}
.nav-item.active{background:var(--brand-wash);color:var(--brand-d);font-weight:600}
.nav-item.active svg{opacity:1}
.nav-item .badge{margin-left:auto;background:var(--crit);color:#fff;font-size:10.5px;font-weight:700;padding:1px 6px;border-radius:20px}
.nav-item.active .badge{background:var(--brand)}
.sidebar-foot{padding:12px 14px;border-top:1px solid var(--border-2);display:flex;align-items:center;gap:10px}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:12px}
.main{min-width:0;display:flex;flex-direction:column}
.topbar{background:var(--surface);border-bottom:1px solid var(--border);padding:12px 26px;display:flex;align-items:center;gap:18px;position:sticky;top:0;z-index:20}
.topbar h2{font-size:18px}
.search{flex:1;max-width:420px;position:relative}
.search input{width:100%;padding:8px 12px 8px 34px;border:1px solid var(--border);border-radius:8px;background:var(--surface-2);font-size:13px;font-family:var(--font)}
.search svg{position:absolute;left:10px;top:9px;width:16px;height:16px;color:var(--muted)}
.btn{border:1px solid var(--border);background:var(--surface);color:var(--ink);padding:8px 13px;border-radius:8px;font-weight:600;font-size:13px;cursor:pointer;font-family:var(--font);display:inline-flex;align-items:center;gap:7px}
.btn:hover{background:var(--surface-2)}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:var(--brand-d)}
.content{padding:24px 26px 60px;overflow-x:hidden}
.screen{display:none}
.screen.active{display:block;animation:fade .2s ease}
@keyframes fade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-h{padding:14px 16px;border-bottom:1px solid var(--border-2);display:flex;align-items:center;justify-content:space-between}
.card-h h3{font-size:14.5px}
.card-b{padding:16px}
.muted{color:var(--muted)} .sub{color:var(--ink-2)}
.row{display:flex;gap:16px} .grid{display:grid;gap:16px}
.pill{display:inline-flex;align-items:center;gap:5px;padding:2px 9px;border-radius:20px;font-size:11.5px;font-weight:650;line-height:1.7}
.pill.blue{background:var(--brand-wash);color:var(--brand-d)}
.pill.green{background:#e6f4e6;color:var(--good-ink)}
.pill.amber{background:#fdf1d8;color:var(--warn-ink)}
.pill.red{background:var(--crit-wash);color:#a82b2b}
.pill.grey{background:#eeedea;color:#5a5954}
.pill.violet{background:#ecebf7;color:#3a2e86}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block}
table{width:100%;border-collapse:collapse}
th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:650;padding:10px 12px;border-bottom:1px solid var(--border)}
td{padding:11px 12px;border-bottom:1px solid var(--border-2);vertical-align:middle}
tr:last-child td{border-bottom:none}
tbody tr{cursor:pointer} tbody tr:hover{background:var(--surface-2)}
.avatar-sm{width:26px;height:26px;border-radius:50%;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:11px;flex:none}
.kpis{display:grid;grid-template-columns:repeat(6,1fr);gap:14px;margin-bottom:18px}
.kpi{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px 15px;box-shadow:var(--shadow);display:flex;flex-direction:column}
/* reserve a consistent label height (fits two lines) so every value lines up and boxes never jump */
.kpi .lbl{font-size:11.5px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.04em;line-height:1.25;min-height:2.5em;display:flex;align-items:flex-start}
.kpi .val{font-size:25px;font-weight:700;margin-top:6px;letter-spacing:-.02em}
.kpi .delta{font-size:12px;font-weight:650;margin-top:3px;min-height:1.1em;display:flex;align-items:center;gap:4px}
.delta.up{color:var(--good-ink)} .delta.down{color:#a82b2b}
.board{display:grid;grid-template-columns:56px repeat(4,1fr);gap:0;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;background:var(--surface)}
.board .col-h{padding:10px;border-bottom:1px solid var(--border);border-left:1px solid var(--border-2);font-weight:650;font-size:13px;display:flex;align-items:center;gap:8px;background:var(--surface-2)}
.board .time-h{border-left:none}
.job-chip{position:absolute;left:3px;right:3px;border-radius:7px;padding:6px 8px;color:#fff;font-size:11.5px;font-weight:600;overflow:hidden;cursor:pointer;box-shadow:0 1px 3px rgba(0,0,0,.15);line-height:1.25}
.job-chip small{opacity:.9;font-weight:500;display:block;font-size:10.5px}
.job-chip .emg{background:rgba(255,255,255,.28);border-radius:4px;padding:0 4px;font-size:9.5px;font-weight:800;letter-spacing:.03em}
.detail-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:16px}
.kv{display:grid;grid-template-columns:130px 1fr;gap:6px 12px;font-size:13px}
.kv .k{color:var(--muted)} .kv .v{font-weight:550}
.timeline-item{display:flex;gap:11px;padding:10px 0;border-bottom:1px solid var(--border-2)}
.timeline-item:last-child{border:none}
.ti-ic{width:28px;height:28px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;font-size:13px}
.matrix-wrap{overflow-x:auto}
table.matrix td,table.matrix th{text-align:center;padding:8px 6px;border:1px solid var(--border-2);font-size:12px}
table.matrix th{background:var(--surface-2)}
table.matrix .rowh{text-align:left;font-weight:650;background:var(--surface-2);white-space:nowrap}
table.matrix td.cell{cursor:pointer} table.matrix td.cell:hover{background:var(--brand-wash)}
.xmark{color:var(--brand);font-weight:800}
.lvl-badge{display:inline-block;width:20px;text-align:center;border-radius:4px;font-size:10px;font-weight:800;color:#fff;margin-right:6px}
.tree{font-size:13px}
.tree .node{padding:6px 10px;border-radius:7px;margin:3px 0;display:inline-flex;align-items:center;gap:8px;border:1px solid var(--border-2);background:var(--surface-2)}
.tree .conn{color:var(--muted)}
.code-val{font-family:ui-monospace,Menlo,monospace;letter-spacing:1px;font-weight:600}
.reveal-btn{border:1px solid var(--border);background:var(--surface-2);padding:2px 8px;border-radius:6px;font-size:11px;cursor:pointer;font-weight:600;color:var(--brand-d)}
.reveal-btn:hover{background:var(--brand-wash)}
.bar-track{height:7px;background:#edecea;border-radius:20px;overflow:hidden}
.bar-fill{height:100%;border-radius:20px}
.phone-stage{display:flex;gap:34px;align-items:flex-start;flex-wrap:wrap}
.phone{width:340px;height:710px;background:#0d0d0d;border-radius:42px;padding:11px;box-shadow:0 20px 50px rgba(0,0,0,.28);flex:none}
.phone-screen{background:#f4f4f2;border-radius:32px;height:100%;overflow:hidden;position:relative;display:flex;flex-direction:column}
.phone-notch{position:absolute;top:0;left:50%;transform:translateX(-50%);width:130px;height:26px;background:#0d0d0d;border-radius:0 0 16px 16px;z-index:5}
.m-top{background:var(--brand);color:#fff;padding:30px 16px 12px;flex:none}
.m-body{flex:1;overflow-y:auto;padding:12px}
.m-tabbar{display:flex;background:var(--surface);border-top:1px solid var(--border);flex:none}
.m-tab{flex:1;text-align:center;padding:9px 0 12px;font-size:10.5px;color:var(--muted);font-weight:600}
.m-tab.active{color:var(--brand)}
.m-tab svg{width:20px;height:20px;display:block;margin:0 auto 3px}
.m-job{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:10px;box-shadow:var(--shadow)}
.m-job .t{font-weight:650;font-size:13.5px}
.m-btn{display:block;width:100%;text-align:center;padding:11px;border-radius:10px;font-weight:650;font-size:13.5px;border:none;margin-bottom:9px;cursor:pointer;font-family:var(--font)}
.m-btn.primary{background:var(--brand);color:#fff}
.m-btn.ghost{background:var(--surface);border:1px solid var(--border);color:var(--ink)}
.m-btn.good{background:var(--good);color:#fff}
.phone-cap{width:340px;text-align:center;color:var(--muted);font-size:12px;margin-top:12px}
.m-tech-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 11px;border-radius:20px;border:1px solid var(--border);background:var(--surface);cursor:pointer;font-size:12.5px;font-weight:600;margin-right:6px}
.m-tech-chip.active{color:#fff;border-color:transparent}
.sig-pad{width:100%;height:120px;border:2px dashed var(--border);border-radius:10px;background:#fff;touch-action:none;display:block}
.sig-saved{width:100%;border:1px solid var(--border);border-radius:10px;background:#fff}
.m-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:700;color:var(--muted)}
.m-back{font-size:12px;opacity:.9;cursor:pointer;display:inline-flex;align-items:center;gap:4px}
.li-tbl{width:100%;border-collapse:collapse}
.li-tbl th{font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700;padding:6px;border-bottom:1px solid var(--border);text-align:left}
.li-tbl th.num{text-align:right}
.li-tbl td{padding:1px 3px;border-bottom:1px solid var(--border-2);vertical-align:middle}
.li-in{width:100%;border:1px solid transparent;background:transparent;padding:6px 7px;border-radius:6px;font-size:13px;font-family:var(--font)}
.li-in:hover{border-color:var(--border-2)}
.li-in:focus{border-color:var(--brand);background:#fff;outline:none;box-shadow:0 0 0 2px var(--brand-wash)}
.li-in.num{text-align:right}
.li-amt{font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;text-align:right;padding-right:8px;font-size:13px}
.li-del{color:var(--muted);cursor:pointer;opacity:.55;font-size:14px}
.li-del:hover{opacity:1}
.modal:has(.li-tbl) .modal-h{border-top:4px solid #267779}
.modal:has(.li-tbl) .modal-h>div{min-width:0}
.modal:has(.li-tbl) .modal-h input{max-width:100%}
.modal:has(.li-tbl) .li-tbl thead{background:#ebf2f2}
.modal:has(.li-tbl) .li-tbl th{color:#294c53;padding-block:10px}
.li-num{color:var(--muted);font-size:12px;text-align:center}
.section-title{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700;margin:22px 0 10px}
.note{background:var(--brand-wash);border:1px solid #cfe1f8;border-radius:8px;padding:10px 13px;font-size:12.5px;color:#1a4a86;margin-bottom:16px;display:flex;gap:9px}
.legend{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:var(--ink-2);margin-top:12px}
.legend span{display:inline-flex;align-items:center;gap:6px}
/* Views & edit forms open as a full screen (a page), never a floating popup */
.modal-bg{display:none;position:fixed;inset:0;background:var(--surface);z-index:100;overflow:hidden}
/* on desktop, keep the left navigation panel visible — the view fills the area to its right */
@media(min-width:861px){ .modal-bg{left:232px;border-left:1px solid var(--border)} }
.modal-bg.open{display:flex}
.modal{background:var(--surface);border-radius:0;width:100%;max-width:none;box-shadow:none;display:flex;flex-direction:column;height:100vh;height:100dvh}
.modal.sm{max-width:none}
.modal-h{padding:16px 24px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:16px;position:sticky;top:0;background:var(--surface);z-index:2}
.modal-h .x{font-size:26px;line-height:1;padding:2px 8px;flex:none}
/* body scrolls; content sits in a comfortable centred column so it reads like a page on wide screens */
.modal-b{padding:22px 24px 44px;flex:1 1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch}
.modal-b>*{max-width:980px;margin-left:auto;margin-right:auto}
.x{cursor:pointer;color:var(--muted);font-size:22px;line-height:1;border:none;background:none}
.field{margin-bottom:13px}
.field label{display:block;font-size:12px;font-weight:650;color:var(--ink-2);margin-bottom:5px}
.field input,.field select{width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:8px;font-size:13px;font-family:var(--font);background:var(--surface)}
.field.chk{display:flex;align-items:center;gap:8px}
.field.chk input{width:auto}
.field.chk label{margin:0}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#1f2733;color:#fff;padding:11px 18px;border-radius:10px;font-size:13px;font-weight:600;box-shadow:0 8px 24px rgba(0,0,0,.3);z-index:200;opacity:0;transition:opacity .25s,transform .25s}
.toast.show{opacity:1;transform:translateX(-50%) translateY(-4px)}
.loading{display:flex;align-items:center;justify-content:center;height:60vh;color:var(--muted);font-size:14px}
.addr-sug{position:absolute;left:0;right:0;top:100%;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px rgba(11,11,11,.14);z-index:10;margin-top:3px;max-height:210px;overflow-y:auto;display:none}
.addr-sug.open{display:block}
.address-field{position:relative}
.phone-error{display:block;margin-top:4px;color:#95342e;font-size:12px}
input[aria-invalid=true]{border-color:#b65147}
.address-field .addr-sug{z-index:25;text-align:left}
.addr-sug .opt{padding:8px 11px;font-size:12.5px;cursor:pointer;border-bottom:1px solid var(--border-2);display:flex;gap:8px;align-items:center}
.addr-sug .opt:last-child{border-bottom:none}
.addr-sug .opt:hover,.addr-sug .opt.active{background:var(--brand-wash)}
.addr-sug .opt .pin{color:var(--muted);flex:none}
.addr-sug .hint{padding:8px 11px;font-size:12px;color:var(--muted)}
.search-results{position:absolute;left:0;right:0;top:100%;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px rgba(11,11,11,.18);z-index:60;margin-top:5px;max-height:420px;overflow-y:auto;display:none;width:460px}
.search-results.open{display:block}
.search-results .sr-group{padding:7px 12px 3px;font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);background:var(--surface-2)}
.search-results .sr-item{padding:8px 12px;font-size:13px;cursor:pointer;border-bottom:1px solid var(--border-2);display:flex;gap:9px;align-items:center}
.search-results .sr-item:hover{background:var(--brand-wash)}
.search-results .sr-ic{flex:none;width:24px;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:13px;background:var(--surface-2)}
.search-results .sr-main{flex:1;min-width:0}
.search-results .sr-main b{font-weight:650}
.search-results .sr-sub{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-results .sr-meta{font-size:11.5px;color:var(--muted);flex:none}
.search-results .sr-empty{padding:14px 12px;font-size:12.5px;color:var(--muted);text-align:center}
.rem-badge{position:absolute;top:-6px;right:-6px;background:#d03b3b;color:#fff;font-size:10px;font-weight:800;min-width:17px;height:17px;border-radius:20px;display:flex;align-items:center;justify-content:center;padding:0 4px;border:2px solid var(--surface)}
.rem{display:flex;align-items:flex-start;gap:10px;padding:9px 0;border-bottom:1px solid var(--border-2)}
.rem:last-child{border-bottom:none}
.rem .chk{width:19px;height:19px;border:2px solid var(--border);border-radius:5px;flex:none;cursor:pointer;margin-top:1px;display:flex;align-items:center;justify-content:center;font-size:12px;color:#fff}
.rem .chk.on{background:var(--good);border-color:var(--good)}
.rem.done .txt{text-decoration:line-through;color:var(--muted)}
.rem .txt{font-size:13px;font-weight:550;line-height:1.35}
.rem .meta{font-size:11.5px;color:var(--muted);margin-top:2px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.rem .del{color:var(--muted);cursor:pointer;font-size:13px;flex:none;opacity:.6}
.rem .del:hover{opacity:1;color:#a82b2b}
.due-pill{font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:20px}
.due-over{background:var(--crit-wash);color:#a82b2b}
.due-today{background:#fdf1d8;color:#8a5a00}
.due-soon{background:var(--brand-wash);color:var(--brand-d)}
.due-later{background:#eeedea;color:#5a5954}
@media(max-width:1150px){.kpis{grid-template-columns:repeat(3,1fr)}.detail-grid{grid-template-columns:1fr}}

/* ============ RESPONSIVE + MOBILE (tablet & phone) ============ */
.m-topbar,nav.m-tabbar,.app-scrim,.m-tiles{display:none}
@media(max-width:1150px){ .kpis{grid-template-columns:repeat(3,1fr)} }
@media(max-width:900px){ .kpis{grid-template-columns:repeat(2,1fr)} }
@media(max-width:860px){
  .app{display:block}
  .sidebar{position:fixed;left:0;top:0;bottom:0;width:270px;z-index:70;transform:translateX(-100%);transition:transform .22s ease;box-shadow:0 0 50px rgba(15,23,42,.3)}
  .sidebar.open{transform:translateX(0)}
  .app-scrim{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:65;display:none}
  .app-scrim.open{display:block}
  .topbar{display:none}
  .m-topbar{display:flex;align-items:center;gap:12px;background:#fff;border-bottom:1px solid var(--border);padding:11px 14px;position:sticky;top:0;z-index:40}
  .m-topbar .mb{background:none;border:none;font-size:23px;line-height:1;cursor:pointer;color:var(--ink);padding:0 4px}
  .m-topbar .mt{flex:1;font-size:16px;font-weight:700}
  .m-topbar .mnew{padding:7px 13px;border-radius:9px;background:var(--brand);color:#fff;border:none;font-weight:600;font-size:13px}
  .content{padding:16px 14px 92px}
  nav.m-tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px solid var(--border);z-index:60;justify-content:space-around;padding:7px 2px 9px;box-shadow:0 -2px 14px rgba(20,40,80,.06)}
  .m-tabbar a{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10.5px;color:var(--muted);font-weight:600;cursor:pointer;flex:1;text-align:center;padding:2px 0}
  .m-tabbar a svg{width:22px;height:22px;stroke:currentColor;fill:none}
  .m-tabbar a.on{color:var(--brand)}
  .grid{grid-template-columns:1fr!important}
  .detail-grid{grid-template-columns:1fr!important}
  .content .row{flex-wrap:wrap}
  .board{overflow-x:auto}
  /* mobile home tiles */
  .m-tiles{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
  .mtile{display:flex;flex-direction:column;gap:9px;padding:15px 14px;border:1px solid var(--border);border-radius:16px;background:#fff;cursor:pointer;min-height:96px;text-decoration:none;color:var(--ink)}
  .mtile .mi{width:42px;height:42px;border-radius:12px;background:var(--brand-wash);color:var(--brand-d);display:flex;align-items:center;justify-content:center}
  .mtile b{font-size:14.5px} .mtile small{color:var(--muted);font-size:11.5px}
  .mtile.b{background:var(--brand);border-color:var(--brand)} .mtile.b .mi{background:rgba(255,255,255,.2);color:#fff} .mtile.b b,.mtile.b small{color:#fff}
}
@media(max-width:430px){ .kpis{grid-template-columns:1fr 1fr!important;gap:12px} }

/* ===== mobile: lists become cards, schedule scrolls (no cut-off) ===== */
@media(max-width:860px){
  .content .card>.card-b{padding:12px!important}
  .content table:not(.matrix),
  .content table:not(.matrix) tbody,
  .content table:not(.matrix) tr,
  .content table:not(.matrix) td{display:block;width:auto}
  .content table:not(.matrix) thead{display:none}
  .content table:not(.matrix) tr{border:1px solid var(--border);border-radius:12px;margin:0 0 10px;background:#fff;padding:8px 2px}
  .content table:not(.matrix) tr:last-child{margin-bottom:0}
  .content table:not(.matrix) tr:hover{background:#fff}
  .content table:not(.matrix) td{border:none!important;padding:5px 13px;display:flex;justify-content:space-between;align-items:baseline;gap:14px;text-align:right!important}
  .content table:not(.matrix) td::before{content:attr(data-label);color:var(--muted);font-weight:600;font-size:12px;flex:none;text-align:left}
  .content table:not(.matrix) td:first-child{display:block;font-weight:700;font-size:14.5px;padding-top:8px;text-align:left!important}
  .content table:not(.matrix) td:first-child::before,.content table:not(.matrix) td[data-label='']::before{display:none}
  .content table:not(.matrix) td[data-label='']{justify-content:flex-end}
  /* schedule board scrolls sideways instead of clipping */
  #schedBody{overflow-x:auto;-webkit-overflow-scrolling:touch}
  #schedBody .board{min-width:680px}
  .content .row.vbtn,.vbtn{flex-wrap:wrap}
}

/* schedule agenda (mobile day view) */
.agenda{display:flex;flex-direction:column;gap:10px}
.ag-item{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:12px 14px;cursor:pointer}
.ag-time{font-weight:700;font-size:13px;color:var(--brand-d);min-width:56px;flex:none}
.ag-body{flex:1;min-width:0}
.ag-t{font-weight:700;font-size:14px}
.ag-sub{color:var(--muted);font-size:12.5px}
.ag-meta{display:flex;align-items:center;gap:7px;margin-top:5px;font-size:12px}
.ag-val{font-weight:700;font-size:13px;flex:none}
/* Mobile week/month agenda: stacked day sections */
.wk-agenda{display:flex;flex-direction:column;gap:16px}
.wk-day{display:flex;flex-direction:column;gap:8px}
.wk-dayhead{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;background:var(--surface-2);border:1px solid var(--border-2);border-radius:10px;cursor:pointer}
.wk-dayhead.today{background:var(--brand-wash);border-color:#cfe1f8}
.wk-dl{display:flex;flex-direction:column;line-height:1.25}
.wk-dl b{font-size:14px;color:var(--ink)}
.wk-dl span{font-size:12px;color:var(--muted)}
.wk-dayhead.today .wk-dl span{color:var(--brand-d)}
.wk-count{font-size:12px;font-weight:700;color:var(--brand-d);flex:none}
.wk-day .agenda{padding-left:2px}

/* ADMIN console: tables become cards on phones (billing, backup, companies) */
@media(max-width:860px){
  .adm-tablewrap table,.adm-tablewrap tbody,.adm-tablewrap tr,.adm-tablewrap td{display:block;width:auto}
  .adm-tablewrap thead{display:none}
  .adm-tablewrap tr{border:1px solid var(--border);border-radius:12px;margin:0 0 10px;background:#fff;padding:8px 2px}
  .adm-tablewrap tr:last-child{margin-bottom:0}
  .adm-tablewrap tr:hover{background:#fff}
  .adm-tablewrap td{border:none!important;padding:5px 13px;display:flex;justify-content:space-between;align-items:baseline;gap:14px;text-align:right!important}
  .adm-tablewrap td::before{content:attr(data-label);color:var(--muted);font-weight:600;font-size:12px;flex:none;text-align:left}
  .adm-tablewrap td:first-child{display:block;font-weight:700;font-size:14.5px;padding-top:8px;text-align:left!important}
  .adm-tablewrap td:first-child::before,.adm-tablewrap td[data-label='']::before{display:none}
  .adm-tablewrap td[data-label='']{justify-content:flex-end}
  .adm-body .kpis{grid-template-columns:1fr 1fr!important}
  .adm-body .detail-grid{grid-template-columns:1fr!important}
}

/* ============ Compact mobile cards for Inventory, Clients, Team ============ */
@media(max-width:860px){
  /* Smaller KPI stat boxes on phones (dashboard + team) */
  .kpi{padding:11px 12px}
  .kpi .lbl{font-size:10px;letter-spacing:.03em}
  .kpi .val{font-size:19px;margin-top:3px}
  .kpi .delta{font-size:11px;margin-top:2px}

  /* --- INVENTORY: tight 3-line card instead of 6 stacked rows --- */
  #invTable tr{display:grid;grid-template-columns:1fr auto;column-gap:12px;row-gap:3px;align-items:baseline;padding:11px 13px}
  #invTable td{display:block!important;padding:0!important;border:none!important;text-align:left!important}
  #invTable td::before{display:none!important}
  #invTable td:nth-child(1){grid-column:1;grid-row:1;font-weight:700;font-size:14px;align-self:center}
  #invTable td:nth-child(5){grid-column:2;grid-row:1;text-align:right!important;align-self:center}
  #invTable td:nth-child(2){grid-column:1;grid-row:2}
  #invTable td:nth-child(3){grid-column:1;grid-row:3;color:var(--muted);font-size:12px}
  #invTable td:nth-child(4){grid-column:2;text-align:right!important;font-size:12px;color:var(--ink-2)}
  #invTable td:nth-child(4){grid-row:2}
  #invTable td:nth-child(4)::before{display:inline!important;content:attr(data-label)" ";color:var(--muted);font-weight:600;font-size:11px}

  /* --- CLIENTS: 2-line card --- */
  #clientsTable tr{display:grid;grid-template-columns:1fr auto;column-gap:12px;row-gap:4px;align-items:baseline;padding:11px 13px}
  #clientsTable td{display:block!important;padding:0!important;border:none!important;text-align:left!important}
  #clientsTable td::before{display:none!important}
  #clientsTable td:nth-child(1){grid-column:1;grid-row:1;font-weight:700;font-size:14px}
  #clientsTable td:nth-child(4){grid-column:2;grid-row:1;text-align:right!important;font-weight:650}
  #clientsTable td:nth-child(2){grid-column:1;grid-row:2}
  #clientsTable td:nth-child(3){grid-column:2;grid-row:2;text-align:right!important;color:var(--muted);font-size:12px}

  /* --- TEAM: name on top, metrics packed 2-per-row (labelled), actions at foot --- */
  #teamList table tr{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:12px;row-gap:7px;padding:12px 13px;border:1px solid var(--border);border-radius:12px;margin:0 0 10px;background:#fff}
  #teamList table td{display:flex!important;padding:0!important;border:none!important;justify-content:flex-start!important;align-items:baseline;gap:6px;flex:1 1 40%;font-size:12.5px;text-align:left!important}
  #teamList table td::before{content:attr(data-label);color:var(--muted);font-weight:600;font-size:11px;flex:none}
  #teamList table td:nth-child(1){flex:1 1 100%;font-weight:700;font-size:14.5px}
  #teamList table td:nth-child(1)::before{display:none}
  #teamList table td:nth-child(8){flex:1 1 100%;justify-content:flex-end!important;margin-top:2px}
  #teamList table td:nth-child(8)::before{display:none}

  /* Tables inside a modal (e.g. a client's Work done / Invoices) become cards too */
  #modalBody table:not(.matrix),#modalBody table:not(.matrix) tbody,#modalBody table:not(.matrix) tr,#modalBody table:not(.matrix) td{display:block;width:auto}
  #modalBody table:not(.matrix) thead{display:none}
  #modalBody table:not(.matrix) tr{border:1px solid var(--border);border-radius:12px;margin:0 0 10px;background:#fff;padding:8px 2px}
  #modalBody table:not(.matrix) tr:last-child{margin-bottom:0}
  #modalBody table:not(.matrix) td{border:none!important;padding:5px 13px;display:flex;justify-content:space-between;align-items:baseline;gap:14px;text-align:right!important}
  #modalBody table:not(.matrix) td::before{content:attr(data-label);color:var(--muted);font-weight:600;font-size:12px;flex:none;text-align:left}
  #modalBody table:not(.matrix) td:first-child{display:block;font-weight:700;font-size:14px;padding-top:8px;text-align:left!important}
  #modalBody table:not(.matrix) td:first-child::before,#modalBody table:not(.matrix) td[data-label='']::before{display:none}
}

/* ============ Mobile: 2×2 stat boxes (modals are full-screen on every size, set above) ============ */
@media(max-width:860px){
  /* Top stat boxes: always two-per-row on phones (overrides inline repeat(4)) */
  .kpis{grid-template-columns:repeat(2,1fr)!important}
  /* edge-to-edge content on phones */
  .modal-b>*{max-width:none}
  .modal-h,.modal-b{padding-left:16px;padding-right:16px}
}

/* ============ Technician login mode — a phone-only field view ============ */
body.tech-mode .sidebar,
body.tech-mode .topbar,
body.tech-mode .m-topbar,
body.tech-mode nav.m-tabbar,
body.tech-mode #mobileNote,
body.tech-mode #mobileViewAs,
body.tech-mode #mobileSideNote,
body.tech-mode .phone-cap,
body.tech-mode .phone-notch{ display:none !important; }
body.tech-mode .screen:not(#scr-mobile){ display:none !important; }
body.tech-mode .app{ display:block }
body.tech-mode .main{ min-height:100vh }
body.tech-mode .content{ padding:0 !important; overflow:visible }
body.tech-mode #scr-mobile{ display:block !important }
body.tech-mode .phone-stage{ display:block; gap:0 }
body.tech-mode .phone{ width:100%; max-width:520px; height:100vh; height:100dvh; margin:0 auto; background:transparent; border-radius:0; padding:0; box-shadow:none }
body.tech-mode .phone-screen{ border-radius:0; height:100vh; height:100dvh }

/* The billing editor uses the same ink and teal as the printed document. */
#modalBody .bill-header{min-height:78px;padding:16px clamp(16px,3vw,44px);background:#173642;color:#fff;border:0}
.bill-heading,.bill-title,.bill-tools,.bill-actions{display:flex;align-items:center;gap:14px}
.bill-heading,.bill-title,.bill-actions{flex-wrap:wrap}
.bill-title h2{font-size:25px;line-height:1.1;letter-spacing:-.045em;color:inherit}
.bill-ref{color:#c2d7dc;font-size:14px;font-variant-numeric:tabular-nums}
.bill-status.pill{border-radius:5px;font-size:11px;font-weight:650;padding:4px 8px}
.bill-tools{gap:10px;flex:none}
.bill-tools .bill-print,.bill-tools .x{background:#234957;color:#fff;border:1px solid #54717a;border-radius:7px}
.bill-tools .x{width:36px;height:36px;line-height:1}.bill-tools .btn:hover,.bill-tools .x:hover{background:#315869}
.bill-workspace{background:#f1f5f5;padding:26px clamp(14px,3vw,44px) 48px;color:#1e3740}
.bill-workspace .bill-sheet{max-width:1080px;background:white;border:1px solid #d5e0e2;border-radius:14px;box-shadow:0 5px 18px #17364209}
.bill-parties,.bill-lines,.bill-bottom,.bill-actionbar{padding:22px clamp(16px,2.3vw,30px)}
.bill-parties{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px 36px;border-top:4px solid #287b79;border-radius:14px 14px 0 0}
.bill-label{display:block;text-transform:uppercase;letter-spacing:.085em;font-size:11px;line-height:1.5;font-weight:700;color:#4d6973;margin:0 0 7px}
.bill-brand{display:flex;align-items:center;gap:15px;overflow-wrap:anywhere}
.bill-brand img{max-width:min(125px,37%)!important;max-height:62px!important;margin:0!important}
.bill-brand strong{font-size:17px;letter-spacing:-.025em}.bill-contact{color:#546974;font-size:13px;line-height:1.5;margin:3px 0 0;overflow-wrap:anywhere}
.bill-input{width:100%;min-width:0;border:1px solid #b9cace;background:#fff;color:#18343e;border-radius:7px;padding:10px 12px;font:inherit;line-height:1.3}
.bill-workspace input::placeholder{color:#647883;opacity:1}
.bill-workspace input:focus{border-color:#267779;outline:2px solid #94c5c3;outline-offset:1px}
.bill-subject{grid-column:1/-1}.bill-subject .bill-input{max-width:100%}
@media(min-width:601px){.bill-to{grid-column:2;grid-row:1/3}.bill-subject{grid-column:1;align-self:end}}
.bill-recipient-fields{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin-top:10px}
.bill-recipient-fields label,.price-panel label{display:block;font-size:13px;font-weight:600;color:#415d67}
.bill-recipient-fields input,.price-panel label .bill-input{margin-top:4px;font-weight:400}
.bill-section-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 14px}
.bill-section-head h3{margin:0}
.price-panel{max-width:760px;margin:auto;padding:18px;background:white;border:1px solid #d5e0e2;border-radius:10px}
.price-panel label{margin-bottom:14px}.price-panel>.btn,.price-panel>h3{margin-top:14px}
.price-entry{display:flex;justify-content:space-between;align-items:center;width:100%;gap:12px;text-align:left;background:white;border:0;border-bottom:1px solid #e0e8ea;color:#193e48;font:inherit;padding:12px 5px;cursor:pointer}
.price-entry small{display:block;color:#526670;white-space:pre-wrap}.price-entry span{min-width:0;overflow-wrap:anywhere}.price-entry span:last-child{flex:none;font-variant-numeric:tabular-nums}
.bill-lines{border-block:1px solid #dbe5e6;padding-top:18px;padding-bottom:17px}
.bill-lines h3{font-size:18px;line-height:1.25;letter-spacing:-.03em;margin-bottom:12px}
.bill-lines .li-in{min-height:35px;border:1px solid #cfdbdd;background:#fff;border-radius:6px;color:#203942}
.bill-lines .li-tbl td{padding:7px 3px}.bill-lines .li-tbl th{font-size:10px;letter-spacing:.065em}
input[data-money],.quantity-box input[type=number]{appearance:textfield;-moz-appearance:textfield}
input[data-money]::-webkit-inner-spin-button,input[data-money]::-webkit-outer-spin-button,
.quantity-box input::-webkit-inner-spin-button,.quantity-box input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.bill-lines .quantity-cell{width:90px}
.quantity-box{display:grid;grid-template-columns:minmax(0,1fr) 25px;gap:3px;align-items:stretch}
.quantity-box input{min-width:0}
.quantity-arrows{display:grid;grid-template-rows:1fr 1fr;gap:3px}
.quantity-arrows button{display:grid;place-items:center;min-height:19px;padding:0;border:1px solid #c0ced1;border-radius:4px;background:#f4f8f8;color:#294c53;font:14px/1 system-ui;cursor:pointer}
.quantity-arrows button:hover,.quantity-arrows button:focus-visible{background:#dfeded;color:#164549}
@media(min-width:861px){.bill-lines .li-tbl .quantity-cell{padding-right:12px}}
@media(max-width:860px){.quantity-box{grid-template-columns:minmax(0,1fr) 34px}.quantity-arrows button{min-height:24px}}
.bill-lines .li-del{border:0;background:transparent;font:inherit;color:#7c4343;border-radius:5px;cursor:pointer;opacity:1}
.bill-lines .li-del:focus-visible,.bill-lines .li-del:hover{background:#faeeee}
.bill-bottom{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,.82fr);gap:20px;align-items:start}
.bill-terms .bill-input{width:auto;max-width:100%}
.bill-totals{grid-column:2;background:#edf5f4;border:1px solid #d5e4e2;border-radius:9px;padding:14px 18px;color:#36545a;font-size:13px}
.bill-totals>div{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:2px 0;font-variant-numeric:tabular-nums}
.bill-totals .bill-grand{border-top:1px solid #c1d5d1;margin-top:8px;padding-top:8px;color:#153e41;font-weight:650}
.bill-grand strong{font-size:23px;letter-spacing:-.035em}
.bill-actionbar{display:flex;align-items:start;justify-content:space-between;gap:12px;border-bottom:1px solid #dbe5e6}
.bill-actions{gap:8px}.bill-actionbar .btn,.bill-lines .btn{border-color:#c7d5d8;color:#254752;min-height:38px}
.bill-actionbar .btn.primary{background:#175e62;border-color:#175e62;color:white}.bill-actionbar .btn.primary:hover{background:#104b4e}
.bill-more{position:relative}.bill-more>summary{cursor:pointer;list-style:none;white-space:nowrap}.bill-more>summary::-webkit-details-marker{display:none}
.bill-more>summary::after{content:"";margin:0 1px 3px 5px;width:6px;height:6px;border-right:1.5px solid;border-bottom:1.5px solid;transform:rotate(45deg)}
.bill-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:158px;z-index:3;background:white;border:1px solid #d5e0e2;padding:5px;border-radius:8px;box-shadow:0 6px 22px #1e37401c}
.bill-menu button{display:block;width:100%;border:0;text-align:left;background:white;color:#254752;padding:9px;border-radius:5px;font:inherit;cursor:pointer}
.bill-menu button:hover,.bill-menu button:focus-visible{background:#edf5f4}.bill-menu .bill-delete{color:#983f3f}
@media(max-width:860px){
  #modalBody .bill-lines .li-tbl tr{background:#f7fafa;padding:10px}
  #modalBody .bill-lines .li-tbl td{padding:4px 3px}
  #modalBody .bill-lines .li-tbl td:before{color:#4c6871}
  #modalBody .bill-lines .li-tbl td.li-num{display:none}
  .bill-tools .x,.bill-tools .bill-print,.bill-more summary,.bill-menu button{min-height:44px}
  .bill-tools .x{min-width:44px}.bill-input{font-size:16px}
}
@media(max-width:600px){
  #modalBody .bill-header{min-height:72px;padding:10px 12px;gap:6px}
  .bill-heading{display:grid;justify-items:start;gap:4px}.bill-title{gap:7px}.bill-title h2{font-size:20px}.bill-ref{font-size:12px}
  .bill-tools{gap:5px}.bill-tools .btn{padding:7px;font-size:12px}
  #modalBody .bill-workspace{padding:12px 8px 32px}.bill-parties,.bill-bottom{grid-template-columns:minmax(0,1fr);gap:16px}
  .bill-parties,.bill-lines,.bill-bottom,.bill-actionbar{padding:16px 12px}
  .bill-actionbar{flex-wrap:wrap}.bill-menu{left:0;right:auto}
  .bill-totals{grid-column:1}.bill-brand{gap:12px}.bill-brand img{max-height:45px!important}
  #modalBody .bill-lines .li-tbl tr{display:grid;grid-template-columns:1fr 1fr;gap:7px 10px}
  #modalBody .bill-lines .li-tbl td:nth-child(2),#modalBody .bill-lines .li-tbl td:nth-child(3){grid-column:1/-1}
  #modalBody .bill-lines .li-tbl td:nth-child(n+2):nth-child(-n+5){display:block}
  #modalBody .bill-lines .li-tbl td:nth-child(n+2):nth-child(-n+5)::before{display:block;text-align:left;margin-bottom:3px}
  #modalBody .bill-lines .li-tbl td:last-child{justify-content:flex-end}
  #modalBody .bill-lines .li-tbl input{width:100%}
}
@media(max-width:860px){
  #modalBody .modal-b .li-tbl td{width:auto!important;align-items:center}
  #modalBody .li-tbl input{min-width:0;min-height:44px;font-size:16px;border-color:var(--border)}
  #modalBody .li-tbl .li-del{display:inline-grid;place-items:center;min-width:44px;min-height:44px}
  #modalBody:has(.li-tbl) .modal-b .btn{min-height:44px;white-space:normal}
  #modalBody:has(.li-tbl) .modal-b .row{flex-wrap:wrap}
}

.inline-delete{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:8px 0;padding:12px;border:1px solid #deb4af;border-radius:8px;background:#fff8f7;color:#512a27;white-space:normal}
.inline-delete p{flex:1 1 180px;margin:0}
.inline-delete>div{display:flex;gap:8px}
.inline-delete .danger{background:#9f3430;color:white;border-color:#9f3430}
.bill-sheet>.inline-delete{margin:0 16px 12px}

.directory-tools{flex-wrap:wrap}.directory-card{overflow:hidden;border-top:3px solid #257273}
.directory-card th{background:#edf4f3;color:#315459}.directory-card td{padding-block:12px}
.client-link{display:inline-flex;align-items:center;gap:12px;color:#1e3c45;background:none;border:0;text-align:left;font:inherit;font-weight:650;padding:2px;cursor:pointer}
.client-link small{display:block;color:#516875;font-size:12px;font-weight:400}.client-avatar{border-radius:10px;background:#e3f0ed;color:#285d5c;display:grid;place-items:center;width:38px;height:38px;flex:none}
.client-heading{border-top:4px solid #277b79}.client-heading h2{margin:0;font-size:clamp(20px,3vw,29px);letter-spacing:-.035em}.client-heading>div{display:flex;align-items:center;flex-wrap:wrap;gap:12px}
#modalBody .client-profile,#modalBody .client-form{background:#f3f6f6;padding:clamp(12px,3vw,32px);width:100%;max-width:none;margin:0;box-sizing:border-box}
.client-panel,.client-form>.row{box-sizing:border-box;max-width:980px;margin:0 auto 16px}.client-form .client-panel,.client-form>.row{max-width:720px}
.client-panel{background:white;border:1px solid #d5e0e0;border-radius:12px;padding:clamp(15px,2.5vw,26px);color:#243e47}
.client-panel h3{font-size:18px;letter-spacing:-.02em;margin:0 0 16px}.client-panel header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}.client-panel header h3{margin:0}
.client-panel dl,.client-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:0}.client-panel dt{font-size:12px;color:#516875}.client-panel dd{margin:4px 0 0;overflow-wrap:anywhere}
.client-metrics>div{background:#edf5f3;border-radius:8px;padding:12px}.client-form .field label{color:#344f58}.client-form input,.client-form select{min-height:42px}
@media(max-width:650px){.client-panel dl{grid-template-columns:1fr}.client-metrics{gap:5px}.client-metrics>div{padding:8px}.client-form .grid2{grid-template-columns:1fr}.directory-tools .btn,.client-panel .btn{min-height:40px}.client-link{max-width:100%;overflow-wrap:anywhere}}

#modalBody .client-profile{background:#f1f5f5}
.client-profile>.profile-columns{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:clamp(14px,2vw,30px);align-items:start;max-width:none;width:100%;margin:0}
.profile-columns>.bill-sheet{width:100%;min-width:0;max-width:none;margin:0;border-top:4px solid #287b79}
.profile-columns .client-info dl{grid-template-columns:minmax(0,1fr);gap:0}.client-info dl>div{padding:10px 0;border-bottom:1px solid #dbe5e6}
.profile-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}.profile-actions .inline-delete{width:100%}.profile-actions .profile-delete{color:#973a34}
.profile-filter{display:flex;align-items:center;gap:8px;margin-bottom:12px;font-weight:600}.profile-filter select{padding:8px;border:1px solid #c7d5d8;border-radius:6px;background:white;color:#254752}
@media(max-width:800px){.client-profile>.profile-columns{grid-template-columns:minmax(0,1fr)}}

#payment-dialog{width:min(450px,calc(100vw - 24px));max-height:90dvh;box-sizing:border-box;padding:0;border:1px solid #bcced0;border-radius:14px;box-shadow:0 18px 70px #17364240;color:#203b45}
#payment-dialog::backdrop{background:#122a36a6}
#payment-dialog header,#payment-dialog footer,.payment-summary{display:flex;align-items:center;justify-content:space-between;gap:12px}
#payment-dialog header{background:#173642;color:white;padding:14px 20px}#payment-dialog h2{font-size:20px;margin:0}#payment-dialog .x{color:white;background:transparent}
.payment-body{padding:20px}.payment-summary{padding:16px;background:#edf5f3;border-radius:8px;margin-bottom:18px;overflow-wrap:anywhere}.payment-summary>div:last-child{text-align:right}.payment-summary small,.payment-summary strong{display:block}.payment-summary small{color:#47646a}.payment-summary small+strong{font-size:24px}
#payment-dialog footer{justify-content:flex-end;padding:14px 20px;border-top:1px solid #dae4e4}#payment-dialog footer .primary{background:#175e62;border-color:#175e62}#payment-dialog input,#payment-dialog select{min-height:42px;min-width:0;box-sizing:border-box}
@media(max-width:480px){#payment-dialog .grid2{grid-template-columns:1fr}#payment-dialog footer .btn{min-height:44px}}

.ag-item.ag-complete{background:#e8f5ed;border-color:#93c8a8;border-left:4px solid #176440}.ag-complete .ag-meta .pill{background:#176440;color:white}

.week-board{display:grid;grid-template-columns:repeat(7,minmax(156px,1fr));gap:10px;overflow-x:auto;padding-bottom:8px}.week-day{min-height:clamp(320px,55vh,640px)}.week-job{margin-bottom:9px}.week-job .job-chip{font-size:14px;padding:10px;line-height:1.4}.week-job>.btn{font-size:12px;padding:4px 9px}.tech-profile .client-metrics{margin:16px 0}
.portal-dialog{border:1px solid #cad8db;border-radius:12px;padding:0;width:min(420px,calc(100vw - 28px));color:#193a44}.portal-dialog::backdrop{background:#17364299}.portal-dialog h2{margin:0;background:#173642;color:white;padding:16px 20px;font-size:20px}.dialog-fields,.portal-dialog footer{padding:14px 20px}.portal-dialog footer{display:flex;gap:8px;justify-content:flex-end;border-top:1px solid #dae4e4}.dialog-fields [role=alert]{color:#963e36}

/* Shared workspace, panels and metric tiles across the portal. */
:root{--plane:#f1f5f5;--ink:#203a44;--ink-2:#415b65;--muted:#617480;--border:#d5e0e2;--border-2:#e4ebec;--panel-edge:#287b79;--metric-fill:#edf5f3;--shadow:0 5px 18px #17364209}
.screen,.adm-screen{min-width:0}
:is(.screen,.adm-screen) .card,.board,.bill-sheet,body .lg-card{border:1px solid var(--border);border-top:4px solid var(--panel-edge);border-radius:14px;background:var(--surface);box-shadow:var(--shadow)}
:is(.screen,.adm-screen) .card .card{border-top-width:1px;box-shadow:none}
.card-h{padding:16px clamp(14px,1.6vw,24px);gap:10px}.card-h h3{font-size:16px;color:var(--ink)}
.kpi,.client-metrics>div{background:var(--metric-fill);border:1px solid transparent;border-radius:9px;box-shadow:none}
.kpis{padding:clamp(12px,1.6vw,22px);border:1px solid var(--border);border-top:4px solid var(--panel-edge);border-radius:14px;background:#fff;box-shadow:var(--shadow)}
.screen table thead,.adm-screen table thead{background:#f2f7f6}
#scr-schedule #schedBody,#scr-mobile .phone-stage{padding:clamp(8px,1.5vw,20px);background:white;border:1px solid var(--border);border-top:4px solid var(--panel-edge);border-radius:14px;min-width:0}
#scr-schedule #schedBody .board,#scr-schedule #schedBody .card{border-top-width:1px}
#modalBody>.modal-h:not(.bill-header){border-top:4px solid var(--panel-edge)}
#modalBody>.modal-b:not(.bill-workspace):not(.client-form){background:linear-gradient(var(--surface),var(--plane))}
@media(min-width:901px){#scr-dashboard>.grid,#scr-settings>.grid{grid-template-columns:minmax(0,2fr) minmax(0,1fr)!important}}
@media(max-width:700px){.kpis{gap:8px}.card-h{padding:12px 14px}}

/* Shared page controls and list surfaces */
button,input,select,textarea{font-family:inherit}
:is(.screen,.adm-screen)>.row:has(.btn){background:var(--surface);border:1px solid var(--border);border-top:4px solid var(--panel-edge);border-radius:14px;padding:12px clamp(12px,1.4vw,22px);flex-wrap:wrap;box-shadow:var(--shadow)}
:is(.screen,.adm-screen)>.row:has(.btn)+.row:has(.btn){margin-top:-11px;border-top:1px solid var(--border);border-radius:0 0 14px 14px}
:is(.screen,.adm-screen)>.row:has(.btn):has(+.row .btn){border-radius:14px 14px 0 0}
:is(.screen,.adm-screen) .card thead th{color:var(--ink-2);background:#edf5f3}
:is(.screen,.adm-screen) .card tbody tr:has([onclick]):hover,:is(.screen,.adm-screen) .card tbody tr[onclick]:hover{background:#f3f8f7}
#modalBody>.modal-h:not(.bill-header){background:#f4f8f7;border-bottom:1px solid var(--border)}
@media(max-width:700px){.screen>.kpis[style]{grid-template-columns:repeat(2,minmax(0,1fr))!important}.screen .card-b:has(>table),.adm-screen .card-b:has(>table){overflow-x:auto}}

.inventory-filters{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#stockWarning[hidden]{display:none}
.inventory-editor>.inventory-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(270px,1fr);gap:20px;max-width:none}
.inventory-layout>.client-panel{width:100%;max-width:none;margin:0;align-self:start}
.inventory-editor>.row{max-width:none;margin-top:16px}
.inventory-category-list{list-style:none;margin:16px 0 0;padding:0}
.inventory-category-list li{display:flex;align-items:center;gap:12px;padding:8px 0;border-top:1px solid var(--border)}
.inventory-category-list li span{flex:1;overflow-wrap:anywhere}
#categoryForm input{flex:1;min-width:0}
@media(max-width:760px){.inventory-editor>.inventory-layout{grid-template-columns:1fr}.inventory-layout .grid2{grid-template-columns:1fr}}

#categoryForm{display:grid;gap:10px;margin:0}
#categoryForm input{width:100%;min-height:42px;box-sizing:border-box}
#categoryForm button{justify-self:start}
.inventory-category-list{margin:0}
.inventory-category-list small{color:var(--muted);white-space:nowrap}

/* Billing editor command and contact header */
#modalBody .bill-header:has(.bill-actionbar){display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;min-height:0;padding:8px clamp(10px,2vw,24px);z-index:5}
.bill-header:has(.bill-actionbar) .bill-heading{gap:8px}
.bill-header:has(.bill-actionbar) .bill-title{display:flex;align-items:baseline;gap:6px}
.bill-header:has(.bill-actionbar) h2{font-size:20px;margin:0}
.bill-header:has(.bill-actionbar) .bill-tools{margin-left:auto;gap:5px;flex-wrap:wrap}
.bill-header .bill-actionbar{flex:1 0 100%;padding:4px 0 0;border:0;border-top:1px solid #466570;align-items:center}
.bill-header .bill-actions{flex-wrap:wrap;gap:5px}
.bill-header .bill-actionbar .btn{min-height:32px;padding:5px 9px}
.bill-header .bill-menu{color:#203a44;background:white;left:auto;right:0}
.bill-header .inline-delete{flex-basis:100%;color:#203a44}
#modalBody .bill-parties{padding:12px clamp(12px,2vw,24px);gap:10px 20px}
@media(min-width:701px){
 #modalBody .bill-parties{grid-template-columns:minmax(145px,.75fr) minmax(0,2.25fr)}
 .bill-to{grid-row:auto}
 .bill-to .bill-section-head{margin-bottom:4px}
 .bill-recipient-fields{grid-template-columns:minmax(0,1.45fr) minmax(0,.85fr) minmax(0,1.1fr);margin-top:6px;gap:8px}
 .bill-parties .bill-input{padding:7px 9px}
 .bill-brand{align-items:flex-start;flex-wrap:wrap;gap:4px 9px}
}
@media(max-width:700px){
 #modalBody .bill-parties{grid-template-columns:minmax(0,1fr)}
 .bill-to{grid-column:1;grid-row:auto}
 .bill-from>.bill-label{display:none}
 .bill-recipient-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 8px;margin-top:5px}
 .bill-recipient-fields>div:first-child{grid-column:1/-1}
 .bill-header:has(.bill-actionbar) .bill-heading{flex-wrap:wrap}
 .bill-header:has(.bill-actionbar) .bill-tools{max-width:100%}
 .bill-header .bill-actionbar{gap:4px;flex-wrap:wrap}
}
@media(max-width:400px){.bill-header .bill-actionbar{justify-content:flex-start}.bill-header .bill-menu{left:0;right:auto}}

#modalBody .bill-tools .bill-delete{background:#fff2ef;color:#8b271b;border:1px solid #f0afa3}

#modalBody>.bill-header:has(.bill-actionbar){flex:none}
#modalBody>.bill-workspace{min-height:0}

@media(min-width:861px) and (max-width:1024px){
  #scr-jobs .card-b:has(#jobsTable),#teamList{overflow-x:auto}
}

@media(max-width:860px){
  .m-topbar .mb,.m-topbar .mnew{min-width:44px;min-height:44px}
  .m-topbar .mt{min-width:0;line-height:1.25}
  nav.m-tabbar a{min-height:44px;justify-content:center}
  .price-panel .btn,.price-entry,.price-panel .bill-input{min-height:44px}
  #modalBody:has(.price-panel)>.modal-h .x{min-width:44px;min-height:44px}
  #modalBody .bill-header .bill-actionbar .btn,
  #modalBody .bill-header .bill-tools button{min-width:44px;min-height:44px}
  #modalBody .bill-header .bill-actions{min-width:0}
  body:not(.tech-mode) #scr-mobile .phone-stage>div{min-width:0;max-width:100%}
  body:not(.tech-mode) #scr-mobile :is(.phone,.phone-cap){max-width:100%}
  .job-profile .row,#modalBody>.modal-b:has(#pf_from) .row{flex-wrap:wrap}
}

@media(max-height:540px){
  #modalBody:has(>.bill-header .bill-actionbar){overflow-y:auto}
  #modalBody>.bill-header:has(.bill-actionbar){position:static}
  #modalBody>.bill-header:has(.bill-actionbar)+.bill-workspace{flex:none;overflow:visible}
}
/* Keep wrapped document actions in the header's measured height. */
#modalBody > .bill-header { flex: 0 0 auto; }
#modalBody > .modal-b { min-height: 0; }
@media (max-height: 540px) {
  #modalBody:has(> .bill-header) { overflow-y: auto; }
  #modalBody > .bill-header { position: static; }
  #modalBody > .bill-header + .modal-b { flex: none; overflow: visible; }
}
.phone-stage > div { max-width: 100%; min-width: 0; }
.phone-stage .phone, .phone-stage .phone-cap { max-width: 100%; }
#scr-jobs .card-b:has(#jobsTable), #teamList { overflow-x: auto; }
.job-profile .row { flex-wrap: wrap; }
/* Shared form panels and action shapes. */
#modalBody .client-form {
  display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  gap:16px; align-content:start; align-items:start;
}
#modalBody .client-form > * {width:100%; max-width:none; margin:0}
#modalBody .client-form > .row {grid-column:1/-1}
.client-form .client-panel {border-top:4px solid var(--panel-edge);border-radius:14px;box-shadow:var(--shadow)}
body :is(.btn,.m-tech-chip,button.pill,#jobCount) {border-radius:8px}
nav.m-tabbar a {min-height:44px;justify-content:center;text-decoration:none}
nav.m-tabbar svg {pointer-events:none}
.tech-tabs {display:flex;background:white;border-top:1px solid var(--border)}
.tech-tabs button {font:inherit;font-size:11px;border:0;background:white;cursor:pointer}
@media(max-width:860px){
  #modalBody .client-form {grid-template-columns:minmax(0,1fr);gap:10px}
  #invoicesTable tr:has(td:nth-child(2)),#todayJobs tr {display:grid;align-items:center;gap:3px 8px;padding:8px 10px}
  #invoicesTable tr:has(td:nth-child(2)) {grid-template-columns:minmax(0,1fr) minmax(0,auto)}
  #todayJobs tr {grid-template-columns:auto minmax(0,1fr) auto auto}
  #invoicesTable tr:has(td:nth-child(2)) td,#todayJobs tr td {display:block;width:auto!important;padding:0;text-align:start!important;overflow-wrap:anywhere;min-width:0}
  #invoicesTable td::before,#todayJobs td::before {display:none!important}
  #invoicesTable td:nth-child(1){grid-area:1/1}
  #invoicesTable td:nth-child(4){grid-area:1/2;justify-self:end}
  #invoicesTable td:nth-child(2){grid-area:2/1}
  #invoicesTable td:nth-child(5){grid-area:2/2;justify-self:end}
  #invoicesTable td:nth-child(3){grid-area:3/1;color:var(--muted)}
  #invoicesTable td:nth-child(6){grid-area:3/2;justify-self:end}
  #invoicesTable tr:has(td:nth-child(2)) td.bill-empty {display:none}
  #modalBody .bill-lines .li-tbl tr {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:4px 8px;align-items:end}
  #modalBody .bill-lines .li-tbl tr td {width:auto!important;min-width:0;padding:0;display:block;text-align:start!important}
  #modalBody .bill-lines .li-tbl tr .li-num {display:none}
  #modalBody .bill-lines .li-tbl tr td:nth-child(2){grid-area:1/1/2/3}
  #modalBody .bill-lines .li-tbl tr td:nth-child(3){grid-area:2/1/3/4}
  #modalBody .bill-lines .li-tbl tr td:nth-child(4){grid-area:3/1}
  #modalBody .bill-lines .li-tbl tr td:nth-child(5){grid-area:3/2}
  #modalBody .bill-lines .li-tbl tr td:nth-child(6){grid-area:3/3;align-self:center}
  #modalBody .bill-lines .li-tbl tr td:last-child{grid-area:1/3;justify-self:end}
  #modalBody .li-tbl .li-del {min-width:36px;min-height:40px}
  #modalBody .bill-lines .li-tbl td::before {display:block;text-align:start}
  #modalBody .bill-header:has(.bill-actionbar){position:relative;display:grid;grid-template-columns:minmax(0,1fr);gap:5px;padding:7px 9px}
  #modalBody .bill-header .bill-heading {padding-right:44px;min-height:38px;align-items:center;display:flex}
  #modalBody .bill-header .bill-tools {display:grid;width:100%;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
  #modalBody .bill-header .x {position:absolute;top:4px;right:9px;width:40px;height:40px}
  #modalBody .bill-header .bill-actions {display:grid;width:100%;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:4px}
  #modalBody .bill-header .bill-actions:has(>:nth-child(4)){grid-auto-flow:row;grid-template-columns:repeat(3,minmax(0,1fr))}
  #modalBody .bill-header .btn {min-width:0;white-space:normal;font-size:12px;line-height:1.15;padding:4px;min-height:42px;justify-content:center;gap:3px;text-align:center}
}
@media(max-width:420px){
  #todayJobs tr {grid-template-columns:auto minmax(0,1fr) auto}
  #todayJobs td:nth-child(2){grid-area:1/2/3/3}
  #todayJobs td:nth-child(3){grid-area:1/3;justify-self:end}
  #todayJobs td:nth-child(4){grid-area:2/3}
}
#toast {pointer-events:none}
#clientsTable .client-link {width:100%;text-align:start}
#clientsTable .client-link::before {display:none}
#clientsTable tr.client-selected {background:#e4f2ef;box-shadow:inset 3px 0 #267b77}
#clientsTable tr[data-client-index]:hover {background:#eff7f5}
#clientsTable tr.client-selected:hover {background:#e4f2ef}
#clientsTable tr .client-link:hover {background:transparent!important;box-shadow:none;color:#1e3c45!important;border-color:transparent!important}
#clientsTable .client-link small {color:#48626a}
@media(max-width:860px){
  #modalBody table.client-job-history tbody tr {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 8px;padding:9px 12px}
  #modalBody table.client-job-history tbody td {display:flex;width:auto;min-width:0;gap:5px;padding:0;justify-content:flex-start;text-align:left!important;overflow-wrap:anywhere}
  #modalBody table.client-job-history tbody td::before {display:none}
  #modalBody table.client-job-history td:nth-child(1){grid-area:1/1;display:block}
  #modalBody table.client-job-history td:nth-child(6){grid-area:1/2;justify-self:end}
  #modalBody table.client-job-history td:nth-child(2){grid-area:2/1;align-items:center}
  #modalBody table.client-job-history td:nth-child(3){grid-area:2/2;justify-self:end}
  #modalBody table.client-job-history td:nth-child(4){grid-area:3/1}
  #modalBody table.client-job-history td:nth-child(5){grid-area:3/2;justify-self:end;flex-wrap:wrap}
}
@media(max-width:860px){#modalBody table.client-job-history tbody tr{grid-template-columns:minmax(0,1fr) fit-content(48%)}#modalBody table.client-job-history tbody td:first-child{padding-top:0}#modalBody .client-job-history .pill{white-space:normal}}

/* Keep short inventory labels and currency together at every width. */
#invTable .pill, #invTable td:nth-child(3) { white-space:nowrap; flex-shrink:0; }
#scr-inventory .card-b:has(#invTable) {overflow-x:auto}
@media(max-width:860px){
  #scr-inventory table:has(#invTable){display:table;min-width:100%;width:max-content}
  #scr-inventory table:has(#invTable) thead{display:table-header-group}
  #scr-inventory table:has(#invTable) thead tr,#invTable tr{display:table-row}
  #scr-inventory table:has(#invTable) th,#invTable tr td{display:table-cell!important;padding:8px 9px!important;white-space:nowrap;vertical-align:middle}
  #invTable{display:table-row-group}
  #invTable tr td::before{display:none!important}
  #invTable td:first-child .muted{display:inline;margin-inline-start:5px}
}
@media(max-width:860px){
  .bill-tools .bill-label-detail{display:none}
  #modalBody .bill-header .bill-tools .btn{white-space:nowrap}
}
@media(max-width:370px){
  #modalBody .bill-header .bill-tools .btn{padding-inline:2px;gap:2px;font-size:11px}
}
@media(max-width:860px){
  #modalBody .bill-lines table.li-tbl tr {
    grid-template-columns:minmax(0,4.75rem) minmax(0,6rem) minmax(0,1fr);
    gap:5px 8px;
  }
  #modalBody .bill-lines table.li-tbl tr td:nth-child(2){grid-column:1/-1;padding-right:38px}
  #modalBody .bill-lines table.li-tbl tr td:last-child{grid-column:3;align-self:end}
  #modalBody .bill-lines table.li-tbl tr td:nth-child(4)::before,
  #modalBody .bill-lines table.li-tbl tr td:nth-child(5)::before,
  #modalBody .bill-lines table.li-tbl tr td:nth-child(6)::before{
    display:block;font-size:11px;line-height:15px;margin:0 0 2px;color:#48626a;
  }
  #modalBody .bill-lines table.li-tbl tr td:nth-child(4)::before{content:"Qty"}
  #modalBody .bill-lines table.li-tbl tr td:nth-child(5)::before{content:"Rate"}
  #modalBody .bill-lines table.li-tbl tr td:nth-child(6)::before{content:"Total";text-align:right}
  #modalBody .bill-lines table.li-tbl tr td:nth-child(6){
    align-self:end;text-align:right!important;line-height:40px;
    white-space:nowrap;font-variant-numeric:tabular-nums
  }
  #modalBody .bill-lines .quantity-box{grid-template-columns:minmax(0,1fr) 25px}
  #modalBody .bill-lines .quantity-arrows{gap:2px}
  #modalBody .bill-lines .quantity-arrows button{min-height:19px;height:19px;padding:0}
  #modalBody .bill-lines .li-in.num{width:100%;height:40px;min-height:40px;padding-inline:5px}
}
@media(max-width:860px){
  #modalBody .bill-header:has(.bill-actionbar) .bill-heading {
    width:100%;justify-content:center;align-items:center;text-align:center;
    padding-inline:42px;gap:6px;
  }
  #modalBody .bill-header .bill-heading .bill-title {align-items:center}
}
#modalBody .reminder-workspace>.client-panel {max-width:none;border-top:4px solid var(--panel-edge)}
#modalBody .client-form:has(#f_title) .field {min-width:0}
@media(max-width:1100px){#modalBody .client-form:has(#f_title){grid-template-columns:minmax(0,1fr)}}
.invoice-schedule {padding:10px clamp(12px,2vw,26px);border-bottom:1px solid var(--border);display:flex;justify-content:flex-end}
@media(max-width:860px){.invoice-schedule>.btn{width:100%;justify-content:center}}
#modalBody > .modal-b:has(> .field):not(.bill-workspace):not(.client-form){
  background:white;border:1px solid var(--border);border-top:4px solid var(--panel-edge);border-radius:14px;
  margin:clamp(8px,2vw,24px);padding:clamp(14px,2.5vw,30px);box-shadow:var(--shadow)
}
#modalBody .price-panel{border-top:4px solid var(--panel-edge);border-radius:14px}

.jobs-technician { display:inline-flex; align-items:center; gap:6px; max-width:100%; }
.jobs-technician select { min-width:0; max-width:100%; }

.stock-toolbar{display:flex;align-items:flex-end;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.stock-toolbar label{display:grid;gap:4px;min-width:0;font-size:12px;font-weight:600}
.stock-toolbar :is(select,input){width:100%;min-width:0;padding:8px;border:1px solid var(--border);border-radius:8px;font:inherit;background:white;color:inherit}
@media(max-width:600px){.stock-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.stock-toolbar button{grid-column:1/-1}}
.inventory-sku,.transfer-line small{display:block;color:#435f6b;font-size:12px}
.transfer-dialog{box-sizing:border-box;width:min(480px,calc(100% - 24px));max-height:85dvh;padding:0;border:1px solid #c4d4d9;border-radius:12px;color:#173642}
.transfer-dialog::backdrop{background:#17364277}
.transfer-dialog form{display:flex;flex-direction:column;max-height:83dvh}
.transfer-dialog header,.transfer-dialog footer,.transfer-caption,.transfer-line{display:flex;align-items:center;justify-content:space-between;gap:10px}
.transfer-dialog header,.transfer-dialog footer{padding:12px 16px;background:#f2f7f6}
.transfer-dialog h3{margin:0}.transfer-body{overflow:auto;padding:14px 16px}
.transfer-caption{font-size:12px;font-weight:600;margin-top:12px}
.transfer-line{padding:8px 0;border-top:1px solid #d8e3e3}
.transfer-line label{display:flex;align-items:center;gap:8px;min-width:0;overflow-wrap:anywhere}
.transfer-line input[type=checkbox]{width:18px;height:18px;flex:none;accent-color:#15585b}
.transfer-line input[type=number]{width:64px;border:1px solid #aec2c7;border-radius:6px;padding:7px;font:inherit}
.transfer-dialog select{width:100%}

.document-notes{padding:10px clamp(12px,2vw,26px)}.document-notes textarea,#f_notes{display:block;width:100%;box-sizing:border-box;resize:vertical;font:inherit}

#modalBody .bill-bottom{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start}
.bill-bottom .document-notes{grid-column:1;padding:0;min-width:0}
.bill-bottom .bill-totals{grid-column:2;min-width:0;overflow-wrap:anywhere}
.bill-from .bill-terms{margin-top:6px}
.bill-from .bill-terms label{display:block}
.bill-from .bill-terms p{margin:2px 0}
@media(max-width:600px){
 #modalBody .bill-bottom{gap:8px;padding:12px 8px;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr)}
 .bill-bottom .bill-totals{padding:8px;font-size:12px}
 .bill-bottom .bill-totals>div{gap:4px}
 .bill-bottom .bill-totals>div>:last-child{white-space:nowrap}
}

#modalBody .bill-bottom{grid-template-columns:repeat(2,minmax(0,1fr))}

#modalBody .bill-bottom{align-items:stretch}
.bill-bottom .document-notes{display:grid}
.bill-bottom #bill-notes{height:100%;min-height:0;resize:none;margin:0}
@media(min-width:701px){
 .bill-terms label[for=bill-due]{font-size:13px;font-weight:600;text-transform:none;letter-spacing:normal;line-height:inherit;color:#415d67;margin:0}
 .bill-terms #bill-due{margin:4px 0 0;max-width:100%}
}
.report-controls{display:flex;align-items:end;gap:10px;flex-wrap:wrap}.report-controls label{display:grid;gap:4px;font-size:12px;font-weight:600;min-width:0}.report-controls :is(select,input){min-width:0;width:100%;border:1px solid #b6c9cb;border-radius:8px;padding:8px;font:inherit;background:white;color:#173642}
#reportResult{margin:18px 0;max-width:100%;overflow:auto}#reportResult :is(h2,p){margin:4px 0 8px}#reportResult thead,#reportResult tfoot{background:#eef6f4}
#scr-reports .card,#scr-reports .card-b{min-width:0}
#reportResult table{display:table}#reportResult thead{display:table-header-group}#reportResult tbody{display:table-row-group}#reportResult tr{display:table-row}#reportResult :is(th,td){display:table-cell;white-space:normal}#reportResult td:before{display:none}
@media(max-width:600px){.report-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.report-controls label:first-child,#reportDelivery label{grid-column:1/-1}#reportDelivery label{grid-row:1}#reportResult article{min-width:300px}}
.report-summary{margin:0 0 14px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:#fff;border:1px solid #cddedc;border-top:3px solid #217575;border-radius:12px;overflow:hidden}
.report-summary>div{padding:15px clamp(10px,1.5vw,24px);min-width:0}
.report-summary>div+div{border-left:1px solid #dce8e6}
.report-summary dt{display:flex;align-items:center;gap:7px;color:#3b5960;font-size:13px;font-weight:600}
.report-summary svg{width:18px;height:18px;flex:none;fill:none;stroke:#16716f;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.report-summary dd{margin:6px 0 0;color:#153e41;font-size:clamp(20px,2vw,30px);font-weight:700;font-variant-numeric:tabular-nums;line-height:1.18;overflow-wrap:anywhere}
@media(max-width:700px){.report-summary{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:10px}.report-summary>div{padding:10px 12px}.report-summary>div:nth-child(3){border-left:0}.report-summary>div:nth-child(n+3){border-top:1px solid #dce8e6}.report-summary dt{font-size:12px;gap:5px}.report-summary dd{margin-top:4px}}

#reportFilters + .report-summary{margin:16px 0}

#modalBody .job-sheet {--job-inset:clamp(14px,3vw,30px)}
#modalBody .job-sheet > :is(.bill-parties,.job-details,.bill-lines,.bill-bottom,.client-panel) {padding-inline:var(--job-inset)}
#modalBody .job-sheet > :is(.job-details,.client-panel) {padding-block:18px;border:0;border-top:1px solid var(--border);border-radius:0;box-shadow:none;margin:0}
.job-details h3 {margin:0 0 12px}
.job-fields {display:grid;grid-template-columns:1.2fr 1.4fr 1fr;gap:12px}
.job-fields .field {margin:0;min-width:0}
@media(max-width:650px){.job-fields{grid-template-columns:1fr}}

#modalBody .bill-to{align-self:start}
#f_availability:not(:empty){display:block;color:#922821;margin-top:4px}

#modalBody .new-job-columns{display:grid;grid-template-columns:minmax(260px,1fr) minmax(0,2.5fr);align-items:start;gap:clamp(12px,1.5vw,24px);width:100%;max-width:1540px;margin-inline:auto}
#modalBody .new-job-columns .job-technician{padding:clamp(14px,1.8vw,24px)}
.job-technician .grid2>*{min-width:0}
.job-technician :is(input:not([type=checkbox]),select,textarea){max-width:100%;width:100%}
.job-technician .field:has(#f_tech){grid-column:1/-1}
@media(max-width:960px){#modalBody .new-job-columns{grid-template-columns:minmax(0,1fr)}}
.invoice-origin{display:block;font-size:11px;font-weight:400;color:var(--muted)}

#modalBody .bill-job-type{padding:0 clamp(14px,3vw,30px);margin:8px 0 16px}#modalBody .bill-job-type select{width:100%;max-width:22rem}

.limited-delete [data-destructive], .limited-delete [onclick^="delete"] { display:none !important; }

.kpi-link{font:inherit;text-align:left;color:inherit;cursor:pointer}
.kpi-link:is(:hover,:focus-visible){background:#e4f2ef;border-color:#377a72;color:#163c40}
.kpi-link:is(:hover,:focus-visible) .lbl{color:#365957}
.kpi-link:is(:hover,:focus-visible) .delta.down{color:#96382f}
#scr-jobs [hidden]{display:none!important}

.jobs-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 12px}.jobs-toolbar>.primary{margin-left:auto}.jobs-toolbar select{min-width:0;max-width:100%}

.pay-period{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:12px}.pay-total,.pay-breakdown p{display:flex;align-items:baseline;justify-content:space-between;gap:10px}.pay-total{padding:12px 14px;background:#eaf4f2;border-radius:8px;color:#163c40}.pay-total strong{font-size:24px}.pay-breakdown{margin-top:10px}.pay-breakdown summary{cursor:pointer;color:var(--brand);font-weight:600}.pay-breakdown p{margin:8px 0}

#jobBalances{overflow-x:auto}#jobBalances>p{padding:0 14px}.balance-table{width:100%}.balance-table th:last-child,.balance-table td:last-child{text-align:right;white-space:nowrap}.balance-table .btn{white-space:nowrap}.balance-job{display:block;border:0;background:transparent;color:var(--brand);font:inherit;text-align:left;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.balance-table td:nth-child(2){overflow-wrap:anywhere}
@media(max-width:620px){.balance-table th,.balance-table td{padding:7px 5px;font-size:12px}.balance-table .btn{min-height:32px;padding:4px 6px}}

.share-payment-row{display:flex;align-items:center;gap:8px;margin-bottom:8px}.share-payment-row input{flex:none;width:18px;height:18px}.share-payment-row .tnum{margin-left:auto;white-space:nowrap}.balance-table.matrix{table-layout:auto}.balance-table.matrix td:last-child{white-space:nowrap}

#modalBody table.work-history-grid{display:table;width:max-content;min-width:100%;table-layout:auto}#modalBody .work-history-grid thead{display:table-header-group}#modalBody .work-history-grid tbody{display:table-row-group}#modalBody .work-history-grid tr{display:table-row}#modalBody .work-history-grid :is(td,th){display:table-cell;white-space:nowrap;text-align:left;padding:8px}#modalBody .work-history-grid td::before{display:none}

.share-balance{padding:10px 12px;background:var(--surface-2);border-radius:8px;font-weight:650}.share-history{overflow-x:auto;border:1px solid var(--border);border-top:3px solid var(--brand);border-radius:10px}
#modalBody .share-history table{width:100%;table-layout:auto}
#modalBody .share-history :is(th,td){text-align:left;white-space:nowrap;border:0;border-bottom:1px solid var(--border-2);padding:9px 10px}
#modalBody .share-history th{background:var(--surface-2)}
#modalBody .share-history .amount{text-align:right;font-variant-numeric:tabular-nums}
#modalBody .share-history tr[hidden]{display:none}
.share-invoice-ref{font:inherit;font-weight:700;color:var(--brand);background:transparent;border:0;padding:4px 0;cursor:pointer}
.share-invoice-ref:hover{text-decoration:underline}
#modalBody .share-history .receipt-detail{width:100%;background:var(--surface-2)}

.sidebar-foot{display:grid;gap:6px}.account-identity,.account-actions{display:flex;align-items:center;gap:8px}.account-details{min-width:0}.account-details #userName{font-size:14px;font-weight:650;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-details small{display:block;font-size:12px;color:var(--muted);text-transform:capitalize}.account-details small:empty{display:none}.account-actions{justify-content:space-between}.account-actions button{font:inherit;font-size:12px;color:var(--brand);background:transparent;border:0;cursor:pointer;padding:5px 0;white-space:nowrap}.account-actions button:hover{text-decoration:underline}

.import-panel{max-width:900px;margin:auto}.import-panel .field{margin:18px 0}.import-panel .import-scroll{overflow:auto;max-height:45vh}.import-panel .import-error{color:#922c24}.import-panel table.matrix :is(th,td){text-align:left;padding:8px 10px}
