/* ---------------- clock ---------------- */
.clock-card { display: grid; gap: 10px; }
.clock-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.clock-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-hi); flex: none; }
:root[data-theme="dark"] .clock-icon { color: var(--brand); }
.clock-state { font-size: var(--step-1); font-weight: 650; }
.clock-elapsed { color: var(--brand-hi); }
:root[data-theme="dark"] .clock-elapsed { color: var(--brand); }
.clock-card.compact .btn.large { min-height: 44px; font-size: var(--step-0); }
@media (max-width: 640px) { .clock-actions { width: 100%; } .clock-actions .btn { flex: 1; } }

/* service icon tile in rows */
.svc-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-sunk); color: var(--text-2); }
.svc-icon svg { width: 18px; height: 18px; }
.svc-icon.cabinets { background: var(--svc-cabinets-soft); color: var(--svc-cabinets); }
.svc-icon.cabinet_install { background: var(--svc-install-soft); color: var(--svc-install); }
.svc-icon.countertops { background: var(--svc-countertops-soft); color: var(--svc-countertops); }

/* ---------------- projects ---------------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 240px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.toolbar .search .input { padding-left: 36px; }
.toolbar select.input { width: auto; min-width: 150px; }
.project-row .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.progress-mini { width: 72px; flex: none; }


/* project header + summary */
.project-head { display: grid; gap: 10px; margin-bottom: 14px; }
.project-head h1 { font-size: var(--step-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-size: var(--step--1); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.service-track { display: grid; gap: 10px; }
.service-line { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stage-steps { display: flex; gap: 4px; }
.stage-steps span { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-sunk); }
.stage-steps span.done { background: var(--good); }
.stage-steps span.now { background: var(--brand-hi); }
.next-action { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--step--1); }

/* forms */
.form-steps { display: grid; gap: 6px; }
.form-step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.form-step:hover { background: var(--surface-2); }
.form-step .st { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; }
.form-step .st.Completed { background: var(--good); }
.form-step .st.In\ Progress { background: var(--warn); }
.wizard-form { display: grid; gap: 16px; }
.wizard-form .info-block { padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: var(--text); }
.wizard-form .info-block h4 { margin-bottom: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.lineitems td, .lineitems th { padding: 6px; }
.terms { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); max-height: 320px; overflow: auto; font-size: var(--step--1); }
.terms h4 { margin: 10px 0 4px; }
.signature-img { max-width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 1023px) { .savebar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); } }

/* files */
.file-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.file-tile { position: relative; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.file-tile .thumb { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--surface-sunk); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.file-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .thumb svg { width: 32px; height: 32px; }
.file-tile .name { font-size: var(--step--1); font-weight: 600; overflow-wrap: anywhere; }
.file-tile input[type="checkbox"] { position: absolute; top: 12px; left: 12px; width: 20px; height: 20px; accent-color: var(--brand-hi); }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-l); padding: 20px; text-align: center; color: var(--muted); transition: background var(--t), border-color var(--t); }
.dropzone.over { background: var(--brand-soft); border-color: var(--brand-hi); color: var(--text); }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: var(--step--1); }

/* photos */
.photo-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.photo-grid figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-sunk); aspect-ratio: 1; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid figcaption { position: absolute; inset: auto 0 0 0; padding: 18px 8px 6px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.photo-grid .queued { position: absolute; top: 6px; left: 6px; }

/* timeline */
.timeline { display: grid; gap: 0; }
.timeline .ev { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; }
.timeline .ev .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-sunk); display: grid; place-items: center; color: var(--text-2); }
.timeline .ev .dot svg { width: 14px; height: 14px; }

/* schedule */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: 8px; font-size: var(--step--1); color: var(--muted); font-weight: 650; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 110px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; align-content: start; gap: 4px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: var(--surface-2); }
.cal .day.today .dnum { background: var(--brand-hi); color: #fff; }
.cal .dnum { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 650; }
.cal .ev { display: block; padding: 3px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); background: var(--surface-sunk); border-left: 3px solid var(--line-strong); }
.cal .ev.cabinets { background: var(--svc-cabinets-soft); border-color: var(--svc-cabinets); }
.cal .ev.cabinet_install { background: var(--svc-install-soft); border-color: var(--svc-install); }
.cal .ev.countertops { background: var(--svc-countertops-soft); border-color: var(--svc-countertops); }
.cal .ev.unreleased { border-left-style: dashed; }
@media (max-width: 760px) { .cal { display: none; } }
.agenda-day { display: grid; gap: 6px; }
.agenda-day h3 { font-size: var(--step-0); color: var(--muted); }

/* crew */
.job-card { display: grid; gap: 8px; }
.job-card .addr { font-size: var(--step-1); font-weight: 650; }
.checklist { display: grid; gap: 2px; }
.checklist label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 8px; border-radius: 10px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { width: 22px; height: 22px; accent-color: var(--good); flex: none; }
.checklist .done-text { text-decoration: line-through; color: var(--muted); }
.big-actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .big-actions { grid-template-columns: 1fr; } }

/* success panel */
.success-panel { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 28px 16px; }

/* team / time */
.time-table td, .time-table th { white-space: nowrap; }
.ot { color: var(--warn); font-weight: 650; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-right: 6px; }
.status-dot.on { background: var(--good); }

/* settings */
.settings-list { display: grid; gap: 16px; max-width: 720px; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pref-row:first-of-type { border-top: 0; }
.theme-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-choice button { display: grid; justify-items: center; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text-2); }
.theme-choice button[aria-pressed="true"] { border-color: var(--brand-hi); color: var(--text); box-shadow: var(--focus); }
.theme-choice svg { width: 24px; height: 24px; }
.theme-choice.two { grid-template-columns: repeat(2, 1fr); }
.lang-flag { display: grid; place-items: center; width: 30px; height: 24px; border-radius: 6px; font-size: 12px; font-weight: 750; letter-spacing: .04em; background: var(--surface-2, var(--line)); color: var(--text); }
.theme-choice button[aria-pressed="true"] .lang-flag { background: var(--brand-hi); color: #fff; }

/* notifications */
.notif.unread { background: var(--brand-soft); }
.notif .when { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* wizard */
.wizard-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
.wizard-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface-sunk); color: var(--muted); font-weight: 600; font-size: var(--step--1); }
.wizard-steps li .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font-size: 12px; }
.wizard-steps li.now { background: var(--brand-soft); color: var(--text); }
.wizard-steps li.now .n { background: var(--brand-hi); color: #fff; border-color: transparent; }
.wizard-steps li.done { color: var(--good); }
.wizard-steps li.done .n { background: var(--good); color: #fff; border-color: transparent; }
.service-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color var(--t), background var(--t); }
.service-option:hover { background: var(--surface-2); }
.service-option:has(input:checked) { border-color: var(--brand-hi); background: var(--brand-soft); }
.service-option input { width: 20px; height: 20px; accent-color: var(--brand-hi); flex: none; }

/* signatures & document frames */
.sig-canvas { width: 100%; height: 220px; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; touch-action: none; cursor: crosshair; }
.sig-line { border-top: 1px dashed var(--line-strong); padding-top: 4px; margin-top: -60px; margin-inline: 16px; pointer-events: none; }
.doc-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* measuring tool */
.measure-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .measure-layout { grid-template-columns: 1fr; } .measure-layout > :last-child { order: -1; } }
.measure-controls { max-height: calc(100dvh - 190px); overflow: auto; padding-right: 4px; }
@media (max-width: 900px) { .measure-controls { max-height: none; } }
.measure-stage { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; min-height: 320px; max-height: calc(100dvh - 230px); touch-action: pan-x pan-y; }
.measure-svg { display: block; width: 100%; height: auto; }
.measure-svg .wall-shape { cursor: pointer; }
.measure-svg .wall-shape.selected { fill: #9fb4cc; }
.measure-walls { display: grid; gap: 4px; }
.measure-row { display: grid; grid-template-columns: 22px 38px minmax(90px, 1fr) minmax(110px, 1fr) auto auto; gap: 6px; align-items: center; padding: 4px; border-radius: 10px; }
.measure-row.selected { background: var(--brand-soft); }
.measure-thumb { background: #fff; border: 1px solid var(--line); border-radius: 8px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.measure-thumb svg { width: 100%; height: 100%; }
.measure-preview { background: #fff; border: 1px solid var(--line); border-radius: 10px; max-height: 300px; overflow: auto; }

.room-picker { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }

/* ---------------- room drawing editor (web/js/measure/editor.js) ---------------- */
dialog.dialog.full:has(.rd) { display: flex; flex-direction: column; }
dialog.dialog.full:has(.rd) .dialog-body { display: flex; flex-direction: column; min-height: 0; padding: 10px 12px; overflow: hidden; }
.rd { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.rd-top { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.rd-tabs { overflow-x: auto; max-width: 100%; flex: 1 1 auto; scrollbar-width: thin; }
.rd-top > .btn { flex: none; }
.rd-stage { position: relative; flex: 1 1 0; min-height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
/* pinned to the stage, so the drawing never sizes the stage (an elevation's own proportions used to stretch it past the window) */
.rd-stage > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.rd-svg { cursor: crosshair; }
.rd-svg .wall-shape { cursor: inherit; }
.rd-tools { display: flex; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: thin; flex: none; }
.rd-tool { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 58px; min-height: 52px; padding: 4px 6px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; flex: none; }
.rd-tool:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.rd-tool.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink, var(--text)); }
.rd-tool:disabled { opacity: .4; cursor: default; }
.rd-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); flex: none; }
.rd-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; padding: 0 6px; flex: none; }
.rd-tools > .btn { flex: none; }
.rd-status { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); min-height: 20px; flex: none; }
.rd-status.live { color: var(--text); font-weight: 650; }
.rd-facts { color: var(--text-3, var(--text-2)); }
.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { min-height: 34px; min-width: 44px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip.on, .chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); font-weight: 650; }
.rd-seg { flex-wrap: wrap; }
.rd-inch { font-size: 18px; font-variant-numeric: tabular-nums; }
.field-error { color: var(--bad); font-size: 13px; min-height: 0; }
.field-error:empty { display: none; }
@media (max-width: 640px) {
  .rd-tools { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .rd-sep { display: none; }
  .rd-tool { min-width: 52px; min-height: 48px; font-size: 11px; }
  .rd-status .rd-facts { width: 100%; }
}
.takeoff-figure { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.takeoff-figure strong { font-size: var(--step-2, 1.5rem); }

/* appointment card (Schedule) */
.visit-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.visit-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; text-align: center; text-decoration: none; cursor: pointer; }
.visit-action:hover { background: var(--surface-2); }
.visit-action:first-child { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------------- projects board ---------------- */
.board-tabs { margin-bottom: 12px; max-width: 100%; overflow-x: auto; }
.board-tabs .tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-sunk); color: var(--text-2); font-size: 12px; display: inline-grid; place-items: center; }
.board-tabs button[aria-pressed="true"] .tab-count { background: var(--brand-soft); color: var(--text); }
/* stages fill the width and wrap to another row when they do not fit: never a sideways scroll */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; padding-bottom: 10px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--col-accent, var(--line-strong)); border-radius: 12px; padding: 8px; display: grid; gap: 8px; align-content: start; transition: background var(--t), box-shadow var(--t); }
.board-col.cabinets { --col-accent: #8b7cf6; }
.board-col.countertops { --col-accent: #2bb39a; }
.board-col.cabinet_install { --col-accent: #e0a243; }
.board-col.paused { --col-accent: var(--muted); }
.board-col.drop { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.board-col > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 4px; font-weight: 650; font-size: 14px;
  position: sticky; top: -8px; z-index: 1; margin: -8px -8px 0; padding: 10px 12px 6px; background: var(--surface-2); border-radius: 12px 12px 0 0; }
/* a busy stage scrolls inside its own column, so the board stays one screen tall and every header stays in view */
.board-col { max-height: max(360px, calc(100dvh - 250px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
@media (max-width: 1023px) { .board-col { max-height: max(360px, calc(100dvh - 300px)); } }
.board-col .col-count { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.board-empty { color: var(--muted); font-size: 13px; padding: 0 4px 2px; }
.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; min-width: 0; box-shadow: var(--shadow-1); transition: box-shadow var(--t), opacity var(--t); cursor: grab; }
.board-card:hover { box-shadow: var(--shadow-2); }
.board-card.dragging { opacity: .45; }
.board-card .card-link { display: grid; gap: 2px; padding: 10px 12px 8px; color: inherit; text-decoration: none; min-width: 0; }
.board-card .card-link b { font-size: 14.5px; }
.board-card .next-stage { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 36px; padding: 6px 12px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 0 0 10px 10px; text-align: left; }
.board-card .next-stage:hover { background: var(--surface-2); color: var(--text); }


/* ================= phones and small tablets: nothing scrolls sideways ================= */
.list-item.wrap { flex-wrap: wrap; }
.tab-short, .tabs .tab-icon { display: none; }

/* client document rows: the buttons drop below the name when space is tight */
@media (max-width: 720px) {
  .list-item.wrap > .row:last-child { flex: 1 0 100%; justify-content: flex-end; }
  .list-item.wrap > .row:last-child > * { flex: 1; justify-content: center; }
}

@media (max-width: 640px) {
  /* project tabs: five equal tabs, icon over a short name */
  .tabs.project-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .tabs.project-tabs a { flex-direction: column; justify-content: center; gap: 2px; min-height: 54px; padding: 6px 2px; font-size: 12px; }
  .tabs.project-tabs .tab-icon { display: inline-grid; }
  .tabs.project-tabs .tab-long { display: none; }
  .tabs.project-tabs .tab-short { display: inline; }

  /* projects board: stages stack top to bottom; an empty one is a single line */
  .board-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; overflow: visible; }
  .board-tabs button { justify-content: center; padding: 0 6px; }
  .board-tabs .tab-long { display: none; }
  .board-tabs .tab-short { display: inline; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-col { max-height: none; overflow: visible; }
  .board-col > header { top: calc(var(--topbar-h) - 1px); }
  .board-col.empty { padding-bottom: 4px; }
  .board-col.empty .board-empty { display: none; }

  /* time & payroll: each row is a small card with labelled values */
  .time-table thead { display: none; }
  .time-table, .time-table tbody { display: block; }
  .time-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 10px 14px; border-top: 1px solid var(--line); }
  .time-table td { display: block; padding: 0; border: 0; white-space: nowrap; }
  .time-table td.tt-check:empty { display: none; }
  .time-table td.tt-day { font-weight: 650; flex: 1 1 auto; }
  .time-table td.tt-status { flex: 1 0 100%; display: flex; gap: 6px; flex-wrap: wrap; }
  .time-table td.tt-status:empty { display: none; }
  .time-table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; font-weight: 500; }
  .time-table td.tt-actions { flex: 1 0 100%; }
  .table-wrap:has(.time-table) { overflow: visible; }

  /* room pad: the Floor plan / Wall tabs wrap instead of scrolling */
  .rd-tabs { flex-wrap: wrap; overflow: visible; }
}

/* touch screens and phones: every tap target at least ~42 px tall (a thumb, not a mouse pointer) */
@media (max-width: 640px), (pointer: coarse) {
  .btn.small { min-height: 42px; padding-inline: 14px; }
  .btn.icon.small { min-width: 42px; }
  .segmented button { min-height: 40px; }
  .kv dd a, .card header a.small, .row.between > a.small { display: inline-block; padding: 10px 0; margin: -10px 0; }
}

/* new project: search a returning client, or enter a new one */
.or-rule { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.or-rule::before, .or-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field .search { position: relative; }
.field .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.field .search input { padding-left: 36px; }

/* photo tiles: blurred preview at once, full image fades in over it (video 4 #15) */
.photo-grid figure.ph .ph-blur { position: absolute; inset: 0; border-radius: 0; background-size: cover; background-position: center; filter: blur(10px); transform: scale(1.15); }
/* The full photo arrives soft and settles into focus, like the reference
   (video 4 "blurry on purpose"): blur 14px -> 0 while it fades in. */
.photo-grid figure.ph .ph-img { position: relative; opacity: 0; filter: blur(14px); transform: scale(1.04); transition: opacity .35s ease-out, filter .6s ease-out, transform .6s ease-out; }
.photo-grid figure.ph .ph-img.loaded { opacity: 1; filter: none; transform: none; }
.photo-grid figure.ph:not(:has(.ph-img.loaded)) .ph-blur:not(.skel) { animation: ph-breathe 1.6s ease-in-out infinite; }
@keyframes ph-breathe { 50% { filter: blur(10px) brightness(1.12); } }
.photo-grid figure.ph.ph-failed .ph-blur { filter: blur(4px) grayscale(.6); }
@media (prefers-reduced-motion: reduce) { .photo-grid figure.ph .ph-img { transition: none; filter: none; transform: none; } .photo-grid figure.ph .ph-blur { animation: none !important; } }

/* toasts on phones and tablets: above the bottom tab bar, full width, the two newest only */
@media (max-width: 1023px) {
  .toasts { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
  .toasts > .toast:nth-last-child(n+3) { display: none; }
}
.toasts > .toast:nth-last-child(n+4) { display: none; }

/* ---------------- punch locations ---------------- */
.clock-loc { display: flex; align-items: flex-start; gap: 4px; margin: 10px 0 0; }
.clock-loc .icon { flex: none; margin-top: 2px; }
.clock-loc.warn-text { color: var(--warn); }
.loc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 560; cursor: pointer; }
.loc-chip .icon { width: 14px; height: 14px; color: var(--good); }
.loc-chip.off { color: var(--muted); border-style: dashed; }
.loc-chip.off .icon { color: var(--muted); }
.loc-chip.far .icon { color: var(--warn); }
.loc-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.loc-list li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.loc-list li > .icon { grid-row: span 3; margin-top: 2px; color: var(--good); }
.loc-list li.off > .icon { color: var(--muted); }
.loc-list .loc-actions { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.time-table td.tt-where { white-space: normal; }
@media (max-width: 640px) {
  .time-table td.tt-where { flex: 1 0 100%; }
}

/* ---------------- document viewer (fits the page, then zoom) ---------------- */
.doc-viewer { display: grid; gap: 8px; min-width: 0; }
.doc-viewer .doc-frame { height: min(72vh, 900px); }
.dv-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dv-bar .dv-pct { min-width: 42px; text-align: center; }
.dv-bar .dv-hint { margin-left: auto; }
.dv-bar [aria-pressed="true"] { border-color: var(--brand); color: var(--brand-hi); }
@media (pointer: fine) { .dv-bar .dv-hint { display: none; } }

/* signature record */
.sig-record th { width: 34%; font-weight: 600; color: var(--muted); vertical-align: top; white-space: normal; }
.sig-record td { word-break: break-word; white-space: normal; }
@media (max-width: 640px) { .sig-record th { width: 40%; } }

/* install the app */
.install-head { display: flex; align-items: center; gap: 12px; }
.install-head b { display: block; font-size: 17px; }
.install-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 6px 18px -8px rgba(36, 38, 107, .45); }
.install-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: step; }
.install-steps li { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.install-step-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-sunk); color: var(--brand-hi, var(--brand)); }
.install-step-icon svg { width: 22px; height: 22px; }

/* ---- help videos (ui/help.js) ---- */
.help-dialog { width: min(980px, calc(100vw - 24px)); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.help-card { display: grid; gap: 10px; align-content: start; text-align: left; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; font: inherit; }
.help-thumb { position: relative; display: block; overflow: hidden; border-radius: 14px; background: #0d1520; box-shadow: var(--shadow-1, 0 1px 3px rgba(0,0,0,.12)); aspect-ratio: 16 / 10; }
.help-thumb.tall img { object-position: center 38%; }
.help-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.help-card:hover .help-thumb img, .help-card:focus-visible .help-thumb img { transform: scale(1.04); }
.help-play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: #16324f; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.help-play svg { width: 24px; height: 24px; margin-left: 3px; fill: currentColor; }
.help-time { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 650; background: rgba(0,0,0,.65); color: #fff; }
.help-text { display: grid; gap: 2px; }
.help-video { display: block; width: 100%; border-radius: 14px; background: #000; }
.help-video.tall { width: auto; max-width: 100%; height: min(72vh, 760px); margin: 0 auto; }
.help-video.wide { max-height: 70vh; }
@media (max-width: 560px) { .help-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .help-play { width: 44px; height: 44px; } }
