:root {
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.86);
  --text-3: rgba(255, 255, 255, 0.68);
  --glass: rgba(255, 255, 255, 0.16);
  --glass-strong: rgba(255, 255, 255, 0.26);
  --stroke: rgba(255, 255, 255, 0.32);
  --stroke-soft: rgba(255, 255, 255, 0.16);
  --clear: #7fe0b0;
  --defect: #ff9b8a;
  --progress: #ffd98a;
  --accent: #b9d7ff;
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(160deg, #5d7389 0%, #4a5f74 45%, #3a4c5f 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-shadow: 0 1px 3px rgba(15, 25, 38, 0.35);
}

/* soft out-of-focus "window light" background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg i { position: absolute; border-radius: 50%; filter: blur(90px); }
.bg i:nth-child(1) { width: 45vw; height: 45vw; left: -12vw; top: -22vw; background: #9fb6cc; opacity: 0.45; }
.bg i:nth-child(2) { width: 35vw; height: 35vw; right: -8vw; top: 10vh; background: #7f9a7c; opacity: 0.3; }
.bg i:nth-child(3) { width: 45vw; height: 25vw; left: 20vw; bottom: -14vw; background: #a7b5c3; opacity: 0.25; }
.bg i:nth-child(4) { width: 30vw; height: 30vw; left: 45vw; top: 25vh; background: #6d88a6; opacity: 0.4; }

.glass {
  background: linear-gradient(160deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04)), rgba(30, 44, 60, 0.30);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 10px 40px rgba(15, 25, 38, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.sub, .faint { color: var(--text-2); font-size: 13px; }
.small { font-size: 12px; }
.big { font-size: 26px; font-weight: 300; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 14px; }

.topbar {
  margin: 16px 16px 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--glass-strong); border: 1px solid var(--stroke);
}
.tabs { display: flex; gap: 6px; margin-left: 12px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); }
.tab { all: unset; cursor: pointer; padding: 8px 18px; border-radius: 999px; font-size: 14px; color: var(--text-2); }
.tab.active { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,0.5); }
.conn { margin-left: auto; display: flex; align-items: center; gap: 10px; text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--defect); box-shadow: 0 0 10px var(--defect); }
.dot.on { background: var(--clear); box-shadow: 0 0 10px var(--clear); }

.view { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px; }
.hidden { display: none !important; }
.col-left { width: 380px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.col-right { flex: 1; min-width: 0; overflow: auto; }
.panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel.wide { flex: 1; overflow: auto; }
.grow { flex: 1; min-height: 0; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.gap { gap: 10px; }

.btn {
  all: unset; cursor: pointer; padding: 9px 16px; border-radius: 999px; font-size: 14px;
  background: var(--glass); border: 1px solid var(--stroke); text-align: center;
  transition: background .15s;
}
.btn:hover { background: var(--glass-strong); }
.btn.primary { background: rgba(255,255,255,0.85); color: #3c5368; text-shadow: none; font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn.danger { color: #ffe1dc; border-color: rgba(255,155,138,0.6); }
.icon-btn { all: unset; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; background: var(--glass); border: 1px solid var(--stroke-soft); }

.input {
  width: 100%; padding: 11px 14px; border-radius: 14px; font: inherit; font-size: 14px; color: var(--text);
  background: rgba(255,255,255,0.14); border: 1px solid var(--stroke); outline: none;
}
.input:focus { border-color: #fff; background: rgba(255,255,255,0.22); }
.input.small { padding: 8px 12px; width: auto; flex: 1; }
.input::placeholder { color: var(--text-3); }
select.input option { color: #223; }
textarea.input { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  all: unset; cursor: pointer; text-align: center; padding: 8px 0; border-radius: 14px;
  border: 1px solid transparent; display: flex; flex-direction: column; gap: 2px;
}
.day:hover { background: var(--glass); }
.day .dn { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.day .dd { font-size: 18px; font-weight: 500; }
.day .dc { font-size: 10px; color: var(--accent); height: 12px; }
.day.today .dd { color: var(--accent); }
.day.sel { background: var(--glass-strong); border-color: var(--stroke); }

.list { display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 0; padding-right: 2px; }
.job {
  all: unset; cursor: pointer; display: block; padding: 14px; border-radius: 16px;
  background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft);
}
.job:hover { background: rgba(255,255,255,0.16); }
.job.sel { background: var(--glass-strong); border-color: var(--stroke); }
.job .t { font-weight: 600; font-size: 15px; }
.jobno {
  display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; vertical-align: 1px;
  font: 600 11px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em;
  background: rgba(255,255,255,0.22); border: 1px solid var(--stroke-soft); color: var(--text-2);
}
h2 .jobno { font-size: 13px; vertical-align: 3px; }
.job .m { color: var(--text-2); font-size: 12px; margin-top: 3px; }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.18); overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: var(--clear); border-radius: 99px; transition: width .4s; }

.empty { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.empty-small { color: var(--text-3); font-size: 14px; padding: 20px 0; text-align: center; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); }
.stat .v { font-size: 30px; font-weight: 300; }
.stat .l { font-size: 12px; color: var(--text-2); }

.assets { display: flex; flex-direction: column; gap: 10px; }
.asset { border-radius: 18px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); overflow: hidden; }
.asset-head { all: unset; cursor: pointer; display: flex; align-items: center; gap: 16px; padding: 10px; width: 100%; box-sizing: border-box; }
.asset-head:hover { background: rgba(255,255,255,0.06); }
.cover { width: 84px; height: 64px; border-radius: 12px; object-fit: cover; background: rgba(255,255,255,0.15); flex-shrink: 0; display: grid; place-items: center; color: var(--text-3); font-size: 11px; }
.bay { font-size: 30px; font-weight: 600; min-width: 70px; letter-spacing: -0.02em; line-height: 1; }
.bay small { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.asset-meta { flex: 1; min-width: 0; }
.asset-meta .a { font-size: 14px; }
.asset-meta .b { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pill { font-size: 12px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--stroke-soft); white-space: nowrap; }
.pill.completed { background: rgba(127,224,176,0.22); border-color: rgba(127,224,176,0.6); }
.pill.in_progress { background: rgba(255,217,138,0.2); border-color: rgba(255,217,138,0.55); }
.pill.defects { background: rgba(255,155,138,0.22); border-color: rgba(255,155,138,0.6); }

.checklist { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.ci { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.07); }
.ci .res { font-size: 12px; font-weight: 600; }
.ci .res.clear { color: var(--clear); }
.ci .res.deficiency { color: var(--defect); }
.ci .res.none { color: var(--text-3); font-weight: 400; }
.ci .notes { grid-column: 1 / -1; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.ci .photos { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.ci .photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1px solid var(--stroke-soft); }

.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.user { padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-strong); border: 1px solid var(--stroke); font-weight: 600; }
.user .info { flex: 1; min-width: 0; }
.user.pending { border-color: rgba(255,217,138,0.55); }
.user .info .pill { margin-left: 6px; font-size: 11px; padding: 2px 8px; }
.user .info div:last-child { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }

.dialog { color: var(--text); padding: 24px; width: min(520px, calc(100vw - 32px)); }
.dialog.narrow { width: 360px; }
.dialog::backdrop { background: rgba(40, 55, 70, 0.35); backdrop-filter: blur(4px); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.error { color: #ffd4cc; font-size: 13px; min-height: 1em; }
.badge { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; margin-bottom: 18px; }
.qr { background: #fff; padding: 14px; border-radius: 18px; width: 240px; height: 240px; margin: 6px 0; }
.qr svg { width: 100%; height: 100%; display: block; }

.photo-dialog { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; }
.photo-dialog::backdrop { background: rgba(20, 30, 40, 0.75); }
.photo-dialog img { max-width: 92vw; max-height: 92vh; border-radius: 16px; display: block; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 10; }
.toast { padding: 14px 18px; border-radius: 16px; font-size: 14px; animation: pop .3s ease; max-width: 340px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 8px; }

@media print {
  body > *:not(#qrDialog) { display: none !important; }
  body { background: #fff; color: #000; }
  #qrDialog { position: static; border: 0; box-shadow: none; background: #fff; color: #000; }
  #qrDialog .row { display: none; }
  .faint { color: #444; }
}

/* narrow windows: stack the columns */
@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .conn { margin-left: 0; text-align: left; }
  .view { flex-direction: column; }
  .col-left { width: auto; }
  .col-right { min-height: 420px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
.panel.wide > .row { gap: 16px; flex-wrap: wrap; }

/* site details (building photo + service manager) */
.site { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); flex-wrap: wrap; }
.site-block { display: flex; flex-direction: column; gap: 4px; }
.site-photo { width: 120px; height: 84px; object-fit: cover; border-radius: 12px; cursor: zoom-in; border: 1px solid var(--stroke-soft); }
.sm-line { font-size: 16px; }
.sm-line.faint { font-size: 14px; }
.sm-line a { color: var(--accent); }

/* serial plate thumbnail beside the cover photo */
.cover.plate { width: 64px; margin-left: -8px; }

/* ───────── sign in / create organization ───────── */
.auth { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px; }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.big-logo { width: 64px; height: 64px; }
.display { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.auth-card { width: min(400px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn.primary { padding: 12px 16px; }
.center { text-align: center; }
a { color: var(--accent); }

/* ───────── team & organization ───────── */
#view-team { flex-direction: column; overflow: auto; }
#view-team .panel.wide { flex: none; }
.org-head { display: flex; justify-content: space-between; align-items: flex-start; }
.small-btn { padding: 5px 12px; font-size: 12px; }
.org-qr { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.org-qr .qr { flex-shrink: 0; width: 200px; height: 200px; margin: 0; }
.org-qr-info { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }
.org-qr-info h3 { font-weight: 600; font-size: 17px; }
.join-code { font-size: 26px; letter-spacing: 0.12em; padding: 8px 14px; border-radius: 12px; background: rgba(255,255,255,0.12); border: 1px solid var(--stroke-soft); align-self: flex-start; }
.wrap { flex-wrap: wrap; }
.pill.admin { background: rgba(185,215,255,0.22); border-color: rgba(185,215,255,0.6); }
.role-select { width: auto; padding: 7px 10px; font-size: 13px; }
.user { flex-wrap: wrap; }
.conn .btn { margin-left: 8px; white-space: nowrap; }

/* ───────── organizations (hub owner) ───────── */
#view-orgs { flex-direction: column; overflow: auto; }
#view-orgs .panel.wide { flex: none; }
.new-org-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.new-org-form .error, .new-org-form button { grid-column: 1 / -1; }
.new-org-form button { justify-self: start; }
@media (max-width: 700px) { .new-org-form { grid-template-columns: 1fr; } }

/* ───────── schedule an existing job ───────── */
.wide-dialog { width: min(620px, calc(100vw - 32px)); }
.existing-step { display: flex; flex-direction: column; gap: 14px; }
.existing-list { max-height: min(52vh, 460px); }
.existing-summary { padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 3px; }
.existing-summary .t { font-weight: 600; font-size: 16px; }
.choice { border: 1px solid var(--stroke-soft); border-radius: 16px; padding: 10px 14px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.choice legend { font-size: 13px; color: var(--text-2); padding: 0 6px; }
.choice .option { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); font-size: 14px; cursor: pointer; padding: 8px; border-radius: 12px; }
.choice .option:has(input:checked) { background: rgba(127,224,176,0.16); }
.choice input { margin-top: 3px; accent-color: #7fe0b0; }
.job .m.booked { color: var(--progress); }

/* ───────── asset life ───────── */
.life { padding: 2px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.life.none { padding-top: 0; }
.life-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; }
.life-bar { margin-top: 0; height: 8px; }
.life-good { color: var(--clear); }
.life-warn { color: var(--progress); }
.life-low { color: var(--defect); }
.life-bar > span.life-fill-good { background: var(--clear); }
.life-bar > span.life-fill-warn { background: var(--progress); }
.life-bar > span.life-fill-low { background: var(--defect); }

/* ───────── shared bits for history & billing ───────── */
.tabs .tab { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.span-2 { grid-column: 1 / -1; }
label.inline { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
.box { border: 1px solid var(--stroke-soft); border-radius: 16px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; background: rgba(255,255,255,0.05); min-width: 0; }
.box legend { font-size: 13px; color: var(--text-2); padding: 0 6px; }
.box h3 { font-size: 16px; font-weight: 600; }
.table-wrap { overflow: auto; border-radius: 16px; border: 1px solid var(--stroke-soft); background: rgba(255,255,255,0.05); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--stroke-soft); position: sticky; top: 0; background: rgba(52, 69, 87, 0.96); z-index: 1; }
.table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }

/* status pills */
.pill.st-draft { background: rgba(255,255,255,0.12); }
.pill.st-sent { background: rgba(185,215,255,0.22); border-color: rgba(185,215,255,0.6); }
.pill.st-partial { background: rgba(255,217,138,0.2); border-color: rgba(255,217,138,0.55); }
.pill.st-paid, .pill.st-accepted { background: rgba(127,224,176,0.22); border-color: rgba(127,224,176,0.6); }
.pill.st-overdue, .pill.st-declined, .pill.st-expired { background: rgba(255,155,138,0.22); border-color: rgba(255,155,138,0.6); }
.pill.st-void { background: rgba(255,255,255,0.06); color: var(--text-3); text-decoration: line-through; }

.doc-chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); font-size: 13px; }
.doc-chip:hover { background: rgba(255,255,255,0.18); }
.doc-chip.small { padding: 3px 4px 3px 10px; font-size: 12px; }
.doc-chip.small .pill { padding: 2px 8px; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.not-invoiced { color: var(--progress); font-size: 13px; }

/* job detail → billing */
.job-billing { padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 10px; }
.job-docs { display: flex; flex-wrap: wrap; gap: 8px; }

/* ───────── history ───────── */
#view-history .panel.wide { min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .input { width: auto; flex: 1 1 150px; }
.filters .grow-2 { flex: 3 1 260px; }
.filters label.inline .input { flex: 1 1 140px; }
.history-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.history-stats .v { font-size: 24px; }
#view-history .table-wrap { flex: 1; min-height: 200px; }
#hRows tr[data-job] { cursor: pointer; }
#hRows tr[data-job]:hover td { background: rgba(255,255,255,0.06); }
#hRows .pill { font-size: 11px; padding: 2px 8px; margin-left: 4px; }

/* ───────── billing ───────── */
.money-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.money { padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.money span { font-size: 12px; color: var(--text-2); }
.money b { font-size: 19px; font-weight: 600; }
.money small { font-size: 11px; color: var(--text-3); }
.money.bad b { color: var(--defect); }
.money.good b { color: var(--clear); }
.ready { all: unset; cursor: pointer; grid-column: 1 / -1; padding: 10px 12px; border-radius: 14px; font-size: 13px; text-align: center; color: var(--progress); background: rgba(255,217,138,0.12); border: 1px solid rgba(255,217,138,0.45); }
.ready:hover { background: rgba(255,217,138,0.2); }
.seg { display: flex; padding: 4px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); }
.seg button { all: unset; cursor: pointer; flex: 1; text-align: center; padding: 8px; border-radius: 999px; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--glass-strong); color: var(--text); }
.job.doc .amt { color: var(--text); font-size: 13px; }

#docEditor { gap: 16px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.doc-head h2 { font-size: 24px; }
.doc-actions { justify-content: flex-end; }
.doc-form { display: flex; flex-direction: column; gap: 14px; }
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lines-table td { padding: 6px 8px; vertical-align: middle; }
.lines-table .input { padding: 8px 10px; border-radius: 10px; }
.lines-table .line-desc { min-width: 220px; resize: none; overflow: hidden; line-height: 1.35; }
.lines-table .qty { width: 80px; }
.lines-table .price { width: 120px; }
.lines-table input.num { text-align: right; }
.lines-table td[data-amount] { white-space: nowrap; font-weight: 600; }
.lines-table input[type=checkbox], .cat-row input[type=checkbox] { accent-color: #7fe0b0; width: 16px; height: 16px; }
.price-pick { flex: 0 1 340px !important; }
.doc-bottom { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.totals { min-width: 260px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); }
.totals > div { display: flex; justify-content: space-between; gap: 20px; }
.totals .grand { font-size: 17px; font-weight: 600; border-top: 1px solid var(--stroke-soft); padding-top: 6px; }
.payments .paid-up { color: var(--clear); }
.pay-list { display: flex; flex-direction: column; gap: 6px; }
.pay-row { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,0.07); font-size: 14px; }
.pay-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pay-form label { flex: 1 1 130px; }
.pay-form label.grow { flex: 3 1 200px; }

.scroll-dialog { max-height: 92vh; overflow: auto; width: min(720px, calc(100vw - 32px)); }
.catalog-rows { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; gap: 8px; align-items: center; }
.cat-row .price { width: 120px; flex: none; }

@media (max-width: 1100px) {
  .history-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tabs { margin-left: 0; overflow-x: auto; max-width: 100%; }
}

/* ───────── join an organization (sign-in page) ───────── */
.code-input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 20px; letter-spacing: 0.14em; text-transform: uppercase; }
.join-org { padding: 10px 14px; border-radius: 14px; font-size: 13px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke-soft); }
.join-org.ok { display: flex; flex-direction: column; gap: 2px; background: rgba(127,224,176,0.16); border-color: rgba(127,224,176,0.6); }
.join-org.ok strong { font-size: 18px; }
.join-org.bad { color: #ffd4cc; background: rgba(255,155,138,0.14); border-color: rgba(255,155,138,0.55); }
#joinDone .badge { margin-bottom: 4px; }
@media print {
  body.print-join > #auth { display: block !important; padding: 0; }
  body.print-join #auth > *:not(#joinDone), body.print-join #joinDone > *:not(#joinBadge) { display: none !important; }
  body.print-join #joinDone { background: #fff; border: 0; box-shadow: none; color: #000; text-shadow: none; }
}

/* ───────── several inspectors per job ───────── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.people-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.people-pick .person { flex-direction: row; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--text); background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); }
.people-pick .person:has(input:checked) { background: rgba(127,224,176,0.22); border-color: rgba(127,224,176,0.7); }
.people-pick input { accent-color: #7fe0b0; margin: 0; }

/* someone has this hoist's checklist open in the app */
.pill.working { background: rgba(185,215,255,0.20); border-color: rgba(185,215,255,0.6); color: var(--accent); }

.pill.hidden-pill { border-style: dashed; color: var(--text-2); }

/* Account drop-down with search */
.combo { position: relative; }
.combo .input { padding-right: 38px; }
.combo.has-logo .input { padding-left: 64px; }
.combo-logo { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); max-height: 24px; max-width: 46px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; pointer-events: none; }
.combo-toggle { all: unset; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); border-radius: 8px; }
.combo-toggle:hover { background: rgba(255,255,255,0.18); }
.combo-field { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 232px; overflow: auto; border-radius: 14px; background: rgba(70, 88, 108, 0.96); border: 1px solid var(--stroke); padding: 4px; box-shadow: 0 12px 32px rgba(20, 30, 45, 0.35); }
.combo-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.combo-opt:hover, .combo-opt.active { background: rgba(255,255,255,0.22); }
.combo-opt.chosen { font-weight: 600; }
.combo-opt-logo { width: 46px; height: 28px; display: grid; place-items: center; flex: none; }
.combo-opt-logo img { max-width: 46px; max-height: 28px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; }
.combo-empty { padding: 10px; color: var(--text-2); font-size: 13px; }

/* ───────── Dashboard ───────── */
.dash-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dash-stats .v { font-size: 26px; }
.dash-groups { display: flex; flex-direction: column; gap: 22px; }
.dash-group { display: flex; flex-direction: column; gap: 12px; }
.dash-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--stroke-soft); }
.dash-group-head h3 { margin: 0 0 2px; font-weight: 600; }
.dash-shops { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.dash-shop { padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.10); border: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dash-shop-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.dash-shop-head .t { font-weight: 600; font-size: 15px; }
.dash-logos { display: flex; gap: 6px; flex: none; }
.dash-logo { height: 34px; max-width: 70px; object-fit: contain; border-radius: 6px; }
.dash-block { display: flex; flex-direction: column; gap: 6px; }
.dash-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dash-avg { display: flex; align-items: center; gap: 10px; }
.dash-num { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-meter { flex: 1; height: 10px; border-radius: 99px; background: rgba(255,255,255,0.16); overflow: hidden; }
.dash-meter > span, .dash-mini > span { display: block; height: 100%; border-radius: 99px; }
.dash-mini { display: inline-block; width: 46px; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.16); overflow: hidden; vertical-align: middle; margin-right: 4px; }
/* status colours: condition only */
.dash-meter .good, .dash-mini .good, .dash-stack .good, .dash-legend i.good { background: var(--clear); }
.dash-meter .fair, .dash-mini .fair, .dash-stack .fair, .dash-legend i.fair { background: var(--progress); }
.dash-meter .soon, .dash-mini .soon, .dash-stack .soon, .dash-legend i.soon { background: var(--defect); }
.dash-meter .review, .dash-mini .review, .dash-stack .review, .dash-legend i.review { background: rgba(255,255,255,0.55); }
.dash-stack .unrated, .dash-legend i.unrated { background: repeating-linear-gradient(135deg, rgba(255,255,255,0.30) 0 3px, rgba(255,255,255,0.12) 3px 6px); }
.dash-stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.dash-stack > span { min-width: 4px; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.dash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dash-legend b { color: var(--text); font-weight: 600; }
.dash-mix { display: flex; flex-direction: column; gap: 6px; }
.dash-mix-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.dash-mix-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-mix-bar { height: 10px; border-radius: 0 4px 4px 0; background: rgba(255,255,255,0.08); }
.dash-mix-bar > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: rgba(185,215,255,0.55); }
.dash-mix-bar > span.top { background: var(--accent); }
.dash-major { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 99px; background: rgba(185,215,255,0.22); color: var(--text); margin-left: 4px; }
.pill.dash-pill { font-size: 11px; padding: 2px 9px; color: var(--text); }
.pill.dash-pill.good { background: rgba(127,224,176,0.22); border-color: var(--clear); }
.pill.dash-pill.fair { background: rgba(255,217,138,0.20); border-color: var(--progress); }
.pill.dash-pill.soon { background: rgba(255,155,138,0.24); border-color: var(--defect); }
.pill.dash-pill.review, .pill.dash-pill.unrated { background: rgba(255,255,255,0.10); }
.dash-table { max-height: 320px; }
.dash-table .table td, .dash-table .table th { font-size: 12px; }
@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-shops { grid-template-columns: 1fr; } }
.btn.small { padding: 6px 12px; font-size: 12px; }
.dash-shop-head .grow { min-width: 0; }
.dash-shop.open { grid-column: 1 / -1; } /* an expanded shop takes the whole row so its asset table has room */
.dash-shop.open .dash-block { max-width: 560px; }
