:root {
  /* Bob Moses Ceramic Coating brand (bobmosescc.com): royal blue, bright blue, amber highlight, dark navy, Montserrat. */
  --bg: #f1f4f8;
  --panel: #ffffff;
  --text: #0e1a2b;
  --muted: #5d6878;
  --border: #d8dee7;
  --accent: #004ea2;
  --accent-text: #ffffff;
  --link: #004ea2;
  --highlight: #ffad43;
  --danger: #c7392f;
  --warn: #b26b00;
  --ok: #1d8a52;
  --fb: #1877f2;
  --web: #7a4ce0;
  --manual: #5b6476;
  --bar: #ffffff;
  --bar-text: #00142b;
  --bar-muted: #5d6878;
  --bar-field: #f4f6f9;
  --bar-border: #d3dae4;
  --font-brand: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(0, 20, 43, 0.06), 0 1px 3px rgba(0, 20, 43, 0.1);
  color-scheme: light;
}
/* Dark look: the device's setting, unless someone picked Light or Dark under Appearance. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07111e;
    --panel: #0f1c2e;
    --text: #e6ecf3;
    --muted: #97a3b4;
    --border: #22324a;
    --accent: #0f83ff;
    --accent-text: #00142b;
    --link: #5aa8ff;
    --danger: #ef6a60;
    --warn: #ffad43;
    --ok: #3fbf87;
    --bar: #00142b;
    --bar-text: #f1f4f8;
    --bar-muted: #97a3b4;
    --bar-field: #0b2038;
    --bar-border: #22324a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07111e;
  --panel: #0f1c2e;
  --text: #e6ecf3;
  --muted: #97a3b4;
  --border: #22324a;
  --accent: #0f83ff;
  --accent-text: #00142b;
  --link: #5aa8ff;
  --danger: #ef6a60;
  --warn: #ffad43;
  --ok: #3fbf87;
  --bar: #00142b;
  --bar-text: #f1f4f8;
  --bar-muted: #97a3b4;
  --bar-field: #0b2038;
  --bar-border: #22324a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh; /* phones: the visible screen, not counting the browser's address bar */
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
input, select, textarea {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
}
label { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; font-size: 14px; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: -4px 0 10px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--bar);
  border-bottom: 3px solid var(--accent);
  box-shadow: inset 0 -1px 0 var(--highlight);
  color: var(--bar-text);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; height: 46px; width: auto; }
.brand-sub {
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 700;
  color: var(--bar-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-left: 12px;
  border-left: 2px solid var(--highlight);
  line-height: 1.5;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2, h3, .column-head { font-family: var(--font-brand); }
.topbar #currentUser { color: var(--bar-muted); }
.topbar input, .topbar select, .topbar button:not(.primary) {
  background: var(--bar-field);
  border-color: var(--bar-border);
  color: var(--bar-text);
}
.topbar input::placeholder { color: var(--bar-muted); }
.topbar button:not(.primary):hover { border-color: var(--accent); }
.filters { display: flex; gap: 8px; flex: 1 1 320px; }
.filters input { flex: 2; }
.filters select { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.pipeline-tabs {
  display: flex;
  gap: 4px;
  padding: 10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.pipeline-tab {
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: none;
  padding: 9px 16px 10px;
  font-family: var(--font-brand);
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  margin-bottom: -1px;
}
.pipeline-tab:hover { color: var(--text); border-color: transparent; }
.pipeline-tab[aria-selected="true"] {
  background: var(--panel);
  border-color: var(--border);
  color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}
.pipeline-tab .count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tag.rv { background: var(--accent); color: var(--accent-text); }
.pipeline-tabs .spacer { flex: 1; }
.pipeline-tab.old-tab { color: var(--muted); }
.pipeline-tab.old-tab[aria-selected="true"] { color: var(--text); box-shadow: inset 0 3px 0 var(--muted); }
.export-link {
  align-self: center;
  margin-bottom: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ok);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.export-link:hover { border-color: var(--ok); }

.old-view { flex: 1; overflow: auto; padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; }
/* Keep each block at its natural height; the page scrolls instead of squashing them. */
.old-view > * { flex-shrink: 0; }
.old-head h2 { font-size: 20px; }
.old-head p { margin: 4px 0 0; max-width: 70ch; }
.old-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.old-filters label { margin: 0; min-width: 180px; flex: 0 1 220px; }
.old-sub { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
table.matrix, table.old-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix { width: auto; min-width: 420px; }
.table-scroll.fit { width: fit-content; max-width: 100%; }
.short-label { display: none; }
@media (max-width: 640px) {
  .pipeline-tabs { gap: 2px; }
  .pipeline-tab { padding: 8px 10px 9px; font-size: 13px; }
  .pipeline-tab .count { margin-left: 4px; }
  .long-label { display: none; }
  .short-label { display: inline; }
}
/* Same column widths in every vehicle group so the tables line up. */
table.old-table { table-layout: fixed; min-width: 960px; }
.old-table td { overflow: hidden; text-overflow: ellipsis; }
.old-table th:nth-child(1) { width: 17%; }
.old-table th:nth-child(2) { width: 9%; }
.old-table th:nth-child(3) { width: 8%; }
.old-table th:nth-child(4) { width: 12%; }
.old-table th:nth-child(5) { width: 17%; }
.old-table th:nth-child(6) { width: 15%; }
.old-table th:nth-child(7), .old-table th:nth-child(8) { width: 9%; }
/* Past Customers: its own column widths; vehicle and services wrap instead of cutting off. */
table.customers-table { min-width: 860px; }
.customers-table th:nth-child(1) { width: 16%; }
.customers-table th:nth-child(2) { width: 22%; }
.customers-table th:nth-child(3) { width: 12%; }
.customers-table th:nth-child(4) { width: 11%; }
.customers-table th:nth-child(5) { width: 6%; }
.customers-table th:nth-child(6) { width: 16%; }
.customers-table th:nth-child(7) { width: 8%; }
.customers-table th:nth-child(8) { width: 9%; }
.customers-table td:nth-child(2), .customers-table td:nth-child(4), .customers-table td:nth-child(6) { white-space: normal; }
.customers-table td.num, .customers-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.customers-summary { margin: 0; }
.old-table th:nth-child(9) { width: 9%; }
.matrix th, .matrix td, .old-table th, .old-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.matrix th, .old-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); }
.matrix td.num, .matrix th.num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix tr:last-child td, .old-table tr:last-child td { border-bottom: none; }
.matrix button.cell { border: none; background: none; padding: 2px 6px; color: var(--link); font-weight: 600; font-variant-numeric: tabular-nums; }
.matrix button.cell.zero { color: var(--muted); font-weight: 400; }
.matrix tr.total td { font-weight: 700; }
.old-group { display: grid; gap: 8px; }
.old-group h3 { font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.old-group h3 .muted { font-weight: 500; }
.old-table tbody tr { cursor: pointer; }
.old-table tbody tr:hover td { background: var(--bg); }
.status-pill { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; }
.status-pill.old { color: var(--warn); }
.status-pill.dead { color: var(--danger); }
.archived-notice { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.due-banner {
  margin: 10px 16px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 15%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
  cursor: pointer;
}

.board {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 12px 16px 16px;
  overflow-x: auto;
  align-items: stretch;
}
.column {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--panel) 55%, var(--bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 0;
}
.column.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.column-head .count { color: var(--muted); font-weight: 500; }
.column[data-stage="booked"] .column-head { color: var(--ok); }
.column[data-stage="waste"] .column-head { color: var(--muted); }
.cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.empty { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }

.lead-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.lead-card:hover { border-color: var(--accent); }
.lead-card .name { font-weight: 600; }
.lead-card .row { display: flex; justify-content: space-between; gap: 6px; align-items: center; margin-top: 4px; }
.lead-card .phone { color: var(--muted); font-size: 12px; }
.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.tag.facebook { background: var(--fb); }
.tag.website { background: var(--web); }
.tag.manual { background: var(--manual); }
.tag.import { background: #7a6a4f; }
.tag.text { background: var(--accent); }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); }
.pill.due { border-color: var(--danger); color: var(--danger); font-weight: 600; }
.pill.today { border-color: var(--warn); color: var(--warn); font-weight: 600; }

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 10; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 11;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head { padding-top: max(16px, env(safe-area-inset-top)); }
.drawer-body { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.icon-btn { border: none; font-size: 22px; line-height: 1; padding: 2px 8px; }
.card-section { margin-top: 18px; }
.card-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; }
.contact { display: grid; gap: 6px; }
.contact a { color: var(--link); text-decoration: none; font-weight: 600; }
.contact .message { white-space: pre-wrap; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.contact a.call-btn {
  justify-self: start;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 16px;
  border-radius: 8px;
}

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.list li, .reminder-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.list li.done { opacity: 0.55; }
.reminder-item { margin-bottom: 6px; cursor: pointer; }
.reminder-item .when { font-size: 12px; color: var(--muted); }
.reminder-item.overdue .when { color: var(--danger); font-weight: 600; }
.reminder-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin: 14px 0 6px; }
.small-btns { display: flex; gap: 4px; flex-shrink: 0; }
.small-btns button, .btn-link { padding: 3px 8px; font-size: 12px; }
.btn-link { border: 1px solid var(--border); border-radius: 8px; color: var(--link); text-decoration: none; }

.invalid > textarea, .invalid > input, input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}
.invalid > textarea:focus, .invalid > input:focus, input.invalid:focus { outline: 2px solid var(--danger); outline-offset: 0; }
label.invalid { color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; font-weight: 600; margin: -6px 0 10px; }
.timeline .who { font-weight: 600; color: var(--text); }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.info-grid .span-2 { grid-column: 1 / -1; }
.info-actions { display: flex; gap: 10px; align-items: center; }
.info-grid label.opt-in { align-self: end; margin-bottom: 18px; }
.pill.promise { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tag.text-ok { background: var(--ok); }
.info-grid button[disabled] { opacity: 0.5; cursor: default; }
.lead-card .vehicle { font-size: 12px; margin-top: 4px; }
fieldset.services { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 4px; margin: 0 0 10px; min-width: 0; }
fieldset.services legend { font-weight: 600; font-size: 12px; color: var(--muted); padding: 0 4px; }
fieldset.services.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
fieldset.services.invalid legend { color: var(--danger); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
.checks label.check { margin: 0; padding: 4px 0; font-size: 13px; }
.lead-card .services-line { font-size: 12px; color: var(--ok); margin-top: 2px; }
@media (max-width: 380px) { .checks { grid-template-columns: minmax(0, 1fr); } }
.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
}
.chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.email-preview { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: grid; gap: 8px; }
.preview-body { white-space: pre-wrap; }
.status { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; }
.status.sent { color: var(--ok); }
.status.failed, .status.not_configured { color: var(--danger); }
.list li .email-line { display: grid; gap: 2px; min-width: 0; }
.inline-form { display: flex; gap: 6px; margin-bottom: 10px; }
.inline-form button { flex-shrink: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline .what { font-weight: 600; }
.timeline .note { white-space: pre-wrap; margin-top: 2px; }

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
}
dialog h2 { margin-bottom: 14px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toasts { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 20; }
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--highlight); color: #2b1a00; font-weight: 600; }

@media (max-width: 640px) {
  /* Phones: a compact header so the board gets the screen. The buttons sit on one row you swipe
     sideways (faded at the edge to show there's more), and the section menu does the same. */
  .topbar { gap: 8px 10px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .brand { gap: 8px; flex: 1 1 auto; }
  .brand-logo { height: 34px; }
  .brand-sub { font-size: 10px; padding-left: 8px; line-height: 1.35; }
  .topbar #currentUser { display: none; }
  .topbar .link-btn { font-size: 13px; padding: 6px 8px; }
  .filters { flex: 1 1 100%; order: 2; }
  .filters input, .filters select { padding: 8px 10px; font-size: 16px; min-width: 0; }
  .actions {
    width: calc(100% + 24px); margin: 0 -12px; padding: 0 12px; order: 3;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .actions::-webkit-scrollbar { display: none; }
  .actions button { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 14px; }
  .actions button:last-child { margin-right: 24px; }
  /* The two used most come first: Reminders, then Add lead. */
  .actions #remindersBtn { order: -2; }
  .actions #addLeadBtn { order: -1; }
  .main-nav { order: 4; }
  .board { padding: 10px 12px 12px; scroll-snap-type: x mandatory; }
  .column { flex-basis: 85vw; scroll-snap-align: start; }
}

/* ---------- Sections: Leads / Calendar ---------- */
.section { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.main-nav { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--bar-border); border-radius: 10px; background: var(--bar-field); }
.main-nav button {
  border: none;
  background: none;
  padding: 6px 14px;
  border-radius: 7px;
  font-family: var(--font-brand);
  font-weight: 700;
  color: var(--bar-muted);
}
.main-nav button[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
body[data-section]:not([data-section="leads"]) .lead-only { display: none !important; }
/* Login levels: shop sees only the calendar, sales the leads plus a view-only calendar, admin everything. */
body[data-role="shop"] .main-nav,
body[data-role="shop"] #remindersBtn,
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* Admin Updates feed */
.updates-filter { display: flex; gap: 6px; margin-bottom: 12px; }
.updates-filter button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.updates-list { list-style: none; margin: 0; padding: 0; }
.updates-day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin: 14px 0 6px; }
.update-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.update-item:hover { border-color: var(--accent); }
.update-item.unseen { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.update-item > * { grid-column: 2; }
.update-item > .who-badge {
  grid-column: 1;
  grid-row: 1 / span 4;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  background: var(--accent); color: var(--accent-text);
}
.update-item .who-badge.shop { background: #c47a00; color: #fff; }
.update-item .head { font-weight: 600; }
.update-item .note { white-space: pre-wrap; overflow-wrap: anywhere; }
.update-item .meta { font-size: 12px; color: var(--muted); }
#olderUpdates { width: 100%; margin-top: 8px; }

/* Job amount (sales and admins) */
.job-amount { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.job-amount .amount-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.job-amount .amount-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.job-amount .amount-missing { color: var(--warn); font-weight: 600; }
.job-amount .amount-edit { margin-left: auto; }
.amount-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.amount-form input { flex: 1 1 110px; min-width: 0; margin: 0; }
#leadJob { display: grid; gap: 8px; }
.optional { font-weight: 400; }

/* Revenue page (admins) */
.revenue { overflow: auto; padding: 14px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); gap: 14px; }
.revenue > * { flex-shrink: 0; }
.rev-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.rev-title { font-family: var(--font-brand); font-size: 22px; }
.rev-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rev-controls select { width: auto; }
.rev-note { margin: 0; }
.rev-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rev-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.rev-tile h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rev-range { font-size: 12px; color: var(--muted); }
.rev-total { font-family: var(--font-brand); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 6px 0 2px; color: var(--text); }
.rev-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rev-flag { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--warn); }
.rev-missing { background: var(--panel); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); border-radius: 12px; padding: 10px 14px; }
.rev-missing summary { cursor: pointer; font-weight: 600; color: var(--warn); }
.rev-missing ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.rev-missing li { display: grid; gap: 6px; }
.rev-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.rev-block { display: grid; gap: 8px; min-width: 0; }
.rev-block-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.rev-block-head h3 { font-size: 15px; }
table.rev-table { width: 100%; min-width: 0; }
.rev-table caption { text-align: left; padding: 8px 10px; font-size: 12px; color: var(--muted); caption-side: top; }
.rev-table tr.empty td { color: var(--muted); }
.rev-table tr.current td { background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 600; }
.rev-table tfoot th { border-top: 2px solid var(--border); border-bottom: none; color: var(--text); background: var(--panel); }
.rev-now { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--accent); border-radius: 8px; padding: 1px 6px; }
.rev-flag-inline { color: var(--warn); font-size: 12px; }
@media (max-width: 900px) {
  .rev-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rev-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .rev-total { font-size: 24px; }
}

/* Small text-style buttons (sign out, add a line) */
.link-btn { border: none; background: none; padding: 4px 2px; color: var(--link); font-weight: 600; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
#signOutBtn { padding: 4px 6px; }

/* Quote builder (lead drawer) */
.quote-form { display: grid; gap: 4px; }
.quote-addons { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 6px; display: grid; gap: 4px; }
.quote-addons legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.quote-addons label { margin: 0; }
.quote-custom { display: grid; gap: 6px; }
.custom-line, .price-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 6px; align-items: center; }
.custom-line input, .price-row input { margin: 0; min-width: 0; }
#quoteAddLine { justify-self: start; }
.quote-total { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg); margin: 4px 0 8px; }
.quote-lines { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.quote-lines li, .quote-sum { display: flex; justify-content: space-between; gap: 10px; }
.quote-lines .amt, .quote-sum strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-sum { border-top: 1px solid var(--border); padding-top: 6px; font-size: 15px; }
.quote-sum strong { font-size: 18px; }
.quote-form > button[type="submit"] { justify-self: start; }
.quote-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.quote-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.quote-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.quote-head strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.quote-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* Price list panel (admins) */
.price-group h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.price-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.price-input { display: flex; align-items: center; gap: 4px; }
.price-input input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }

/* Review request settings */
.review-settings > .muted { margin: 0 0 10px; }

/* Past Customers: maintenance due */
.status-pill.due { display: inline-block; margin: 2px 0 0 0; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.rev-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rev-sources { margin-top: 6px; }
.rev-sources select { width: auto; }
@media (max-width: 900px) { .rev-grid.even { grid-template-columns: minmax(0, 1fr); } }

/* Deposits and commissions */
.com-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; }
.com-pill.owed { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.com-pill.pending { color: var(--warn); }
.com-pill.paid { color: var(--ok); }
.com-pill.no_amount, .com-pill.cancelled { color: var(--muted); }
.com-settings { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.com-settings label { margin: 0; }
.com-settings select { width: auto; }
.pct-input { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.pct-input input { width: 80px; margin: 0; }
table.com-table { min-width: 760px; }
.com-table td { vertical-align: top; }
.com-table .link-btn { padding: 0; text-align: left; }
.com-table .amount-form { min-width: 520px; }
.com-paybar {
  position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--panel);
  border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow);
}
.com-paybar #comPayText { font-weight: 700; font-variant-numeric: tabular-nums; }
.com-paybar input { flex: 1 1 200px; min-width: 0; margin: 0; }
.deposit-box .amount-form select, .amount-form select { width: auto; margin: 0; }
.deposit-field { margin: 0; }

/* View-only job panel (sales) */
.view-only { margin: 0 0 4px; }
.job-times { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.job-times dt { color: var(--muted); font-size: 12px; font-weight: 600; align-self: center; }
.job-times dd { margin: 0; font-weight: 600; }
.job-notes-text { white-space: pre-wrap; margin: 0; }
.checklist input:disabled { opacity: 1; cursor: default; }

/* Team panel (admins) */
.team-add { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.team-add h3 { font-size: 15px; margin-bottom: 10px; }
.team-add .muted { margin: 0 0 10px; }
.password-row { display: flex; gap: 6px; margin-top: 4px; }
.password-row input { flex: 1; min-width: 0; margin: 0; }
.team-list, .team-history { list-style: none; margin: 0; padding: 0; }
.team-person { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.team-person:last-child { border-bottom: 0; }
.team-person .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-person .name { font-weight: 700; font-size: 15px; }
.team-person.inactive .name { color: var(--muted); text-decoration: line-through; }
.level { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.level-admin { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.level-shop { background: #c47a00; border-color: #c47a00; color: #fff; }
.team-person .tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.team-person .tools select { width: auto; margin: 0; }
.team-person .tools input { flex: 1 1 160px; min-width: 0; margin: 0; }
.team-person .danger { color: var(--danger); border-color: var(--danger); }
.team-history li { padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.team-history li:last-child { border-bottom: 0; }

/* Job status colors, used by chips, cards, the legend and the status picker. */
/* Scheduled is its own blue (not the button color), so a red or green preset never makes it look
   like Cancelled or Ready. */
.status-scheduled { --st: #1f63c6; }
.status-in_shop { --st: #c47a00; }
.status-ready { --st: var(--ok); }
.status-picked_up { --st: var(--muted); }
.status-cancelled { --st: var(--danger); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status-in_shop { --st: #ffad43; }
  :root:not([data-theme="light"]) .status-scheduled { --st: #4c9dff; }
}
:root[data-theme="dark"] .status-in_shop { --st: #ffad43; }
:root[data-theme="dark"] .status-scheduled { --st: #4c9dff; }

/* ---------- Calendar ---------- */
.calendar { overflow: auto; padding: 14px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left)); gap: 12px; }
.calendar > * { flex-shrink: 0; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.nav-arrow { font-size: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); line-height: 34px; }
.cal-title { font-family: var(--font-brand); font-size: 22px; flex: 1; min-width: 180px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.segmented button { border: none; background: none; padding: 6px 14px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; background: var(--st); }
.cal-unscheduled {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--warn) 60%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--panel));
}
.waiting-text { font-weight: 600; }
.waiting-chip { padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.cal-empty { color: var(--muted); padding: 24px 0; }

.job-chip {
  display: flex; align-items: center; gap: 5px; width: 100%;
  padding: 3px 6px; border: none; border-left: 3px solid var(--st); border-radius: 5px;
  background: color-mix(in srgb, var(--st) 14%, var(--panel));
  font-size: 12px; text-align: left; line-height: 1.3; min-width: 0;
}
.job-chip:hover { background: color-mix(in srgb, var(--st) 24%, var(--panel)); }
.job-chip.cont { border-left-style: dotted; }
.job-chip.status-cancelled .chip-name, .job-card.status-cancelled .job-card-name { text-decoration: line-through; }
.job-chip.status-picked_up { opacity: 0.7; }
.chip-time { font-weight: 700; color: var(--st); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.chip-rv { flex-shrink: 0; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 0 5px; border-radius: 4px; background: var(--highlight); color: #3a2500; }

/* Month */
.cal-month { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-mhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
/* One week: day backgrounds span every row; bars sit on top and cover the 1px lines between days. */
.cal-mweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 1px; row-gap: 0; min-height: 112px; }
.cal-mweek > .cal-cell { min-height: 0; padding: 0; }
.cal-mweek > .cal-cell-top { padding: 6px 6px 3px; position: relative; z-index: 1; }
.cal-mweek > .cal-more { position: relative; z-index: 1; align-self: start; margin: 0 2px 4px; }
.bar { position: relative; z-index: 2; margin: 0 6px 3px; min-width: 0; }
.bar.from-before { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.goes-on { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.job-chip.bar { width: auto; }
.job-chip.bar.from-before { border-left-color: transparent; }
.chip-out { margin-left: auto; padding-left: 6px; }
.off-bar { display: flex; align-items: center; gap: 4px; border: none; border-radius: 5px; padding: 3px 7px; font-size: 12px; font-weight: 600; line-height: 1.3; text-align: left; white-space: nowrap; overflow: hidden;
  background: color-mix(in srgb, var(--warn) 16%, var(--panel)); color: var(--warn); }
.off-bar.kind-sick { background: color-mix(in srgb, var(--danger) 14%, var(--panel)); color: var(--danger); }
button.off-bar, button.off-tag { cursor: pointer; font-family: inherit; }
button.off-bar:hover { background: color-mix(in srgb, var(--warn) 28%, var(--panel)); }
button.off-bar.kind-sick:hover { background: color-mix(in srgb, var(--danger) 24%, var(--panel)); }
button.off-tag { border: none; }
.cal-dow { background: var(--bg); padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cal-cell { background: var(--panel); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.weekend { background: color-mix(in srgb, var(--bg) 70%, var(--panel)); }
.cal-cell.other-month .cal-date, .cal-cell-top.other-month .cal-date { opacity: 0.4; }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.cal-date { align-self: flex-start; border: none; background: none; padding: 2px 7px; border-radius: 999px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-date:hover { background: var(--bg); }
.cal-cell.today .cal-date, .cal-cell-top.today .cal-date { background: var(--accent); color: var(--accent-text); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-more { border: none; background: none; padding: 0 6px; font-size: 12px; color: var(--link); font-weight: 600; text-align: left; }

/* Week */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); column-gap: 8px; row-gap: 0; overflow-x: auto; padding-bottom: 4px; }
.cal-week > .week-head, .cal-week > .week-load, .cal-week > .week-jobs { position: relative; z-index: 1; min-width: 0; margin: 0 1px; }
.cal-week > .week-load { padding-bottom: 8px; }
.cal-week .bar { margin: 0 8px 6px; }
.cal-week .bar.from-before { margin-left: 0; }
.cal-week .bar.goes-on { margin-right: 0; }
.cal-week .off-bar { padding: 5px 9px; font-size: 13px; }
.week-bar { display: grid; gap: 3px; text-align: left; padding: 7px 10px; border: 1px solid var(--border); border-left: 4px solid var(--st); border-radius: 10px;
  background: color-mix(in srgb, var(--st) 12%, var(--panel)); color: var(--text); font-size: 13px; overflow: hidden; }
.week-bar:hover { background: color-mix(in srgb, var(--st) 20%, var(--panel)); }
.week-bar.from-before { border-left-color: transparent; }
.week-bar.status-cancelled .week-bar-name { text-decoration: line-through; }
.week-bar-top { display: flex; gap: 6px; align-items: center; min-width: 0; }
.week-bar-top .progress { margin-left: auto; flex-shrink: 0; }
.week-bar-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.week-bar-when { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.off-dialog { width: min(440px, calc(100vw - 32px)); }
.off-dialog h2 { margin-bottom: 4px; }
.off-detail { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; font-size: 14px; }
.off-detail dt { color: var(--muted); font-weight: 600; }
.off-detail dd { margin: 0; white-space: pre-wrap; }
.week-col { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; min-height: 360px; min-width: 0; }
.week-col.weekend { background: var(--bg); }
.week-col.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.week-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.week-dow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.week-date { font-family: var(--font-brand); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-col.today .week-date, .week-head.today .week-date { color: var(--accent); }
.week-load { padding: 6px 12px 0; display: flex; }
.week-jobs { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.week-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }

/* Job cards (week and list) */
.job-card {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-left: 4px solid var(--st); border-radius: 10px;
  background: var(--panel); box-shadow: var(--shadow);
}
.job-card:hover { border-color: var(--st); }
.job-card.compact { gap: 2px; padding: 8px 10px; box-shadow: none; background: color-mix(in srgb, var(--st) 7%, var(--panel)); }
.job-card.compact .job-card-name { font-size: 14px; }
.job-card.status-picked_up { opacity: 0.75; }
.job-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.job-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; color: var(--st); background: color-mix(in srgb, var(--st) 14%, var(--panel)); }
.job-card-name { font-weight: 700; font-size: 15px; }
.job-card-vehicle { font-size: 13px; }
.job-card-when { font-size: 12px; font-weight: 600; color: var(--st); }
.job-card-services { font-size: 12px; color: var(--muted); }
.job-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.photo-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.progress { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.progress-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.progress-text { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress.big .progress-bar { height: 10px; }

/* List */
.cal-list { display: grid; gap: 18px; max-width: 760px; }
.list-day-head { font-family: var(--font-brand); font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; position: sticky; top: -14px; background: var(--bg); padding: 6px 0; z-index: 1; }
.today-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.list-jobs { display: grid; gap: 8px; }

/* ---------- Job panel ---------- */
.job-panel { width: min(560px, 100vw); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.section-head h3 { margin: 0; }
.status-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.status-option { border: 1px solid color-mix(in srgb, var(--st) 45%, var(--border)); color: var(--st); font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.status-option[aria-checked="true"] { background: var(--st); border-color: var(--st); color: #fff; }
.schedule-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.schedule-form label { margin: 0; }
.schedule-form button { margin-bottom: 1px; }
.job-customer { display: grid; gap: 6px; }
.job-customer > button { justify-self: start; }
.job-customer a { color: var(--link); font-weight: 600; text-decoration: none; }
.service-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.service-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); }
.notes-form { display: grid; gap: 6px; }
.notes-form button { justify-self: start; }
.check-group { margin-top: 12px; }
.check-group-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.checklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.checklist li { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); background: var(--panel); }
.checklist li:last-child { border-bottom: none; }
.check-item { display: flex; align-items: flex-start; gap: 10px; flex: 1; margin: 0; padding: 10px 12px; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; min-width: 0; }
.check-item input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--ok); }
.check-text { display: grid; gap: 2px; min-width: 0; }
.check-meta { font-size: 12px; color: var(--ok); font-weight: 600; }
.checklist li.done .check-text { color: var(--muted); }
.checklist .remove { opacity: 0.35; font-size: 20px; margin-right: 6px; }
.checklist li:hover .remove, .checklist .remove:focus-visible { opacity: 1; }
.add-check { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; margin-top: 10px; }
.add-check select { width: auto; }
.photo-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.phase-picker { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; }
.phase-picker button { border: none; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.phase-picker button[aria-checked="true"] { background: var(--text); color: var(--panel); }
.upload-btn { margin: 0; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; cursor: pointer; }
.upload-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-group { margin-top: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.photo-thumb { padding: 0; border: none; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--bg); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.15s; }
.photo-thumb:hover img { transform: scale(1.04); }
.lead-job { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.lead-job-when { font-weight: 600; margin-top: 4px; }
fieldset.services.schedule .info-grid label { margin-bottom: 6px; }

/* Photo viewer */
.photo-dialog { width: min(1100px, calc(100vw - 24px)); max-width: none; padding: 0; background: #0b0d10; color: #f1f4f8; border: none; overflow: hidden; }
.photo-dialog::backdrop { background: rgba(0, 0, 0, 0.8); }
.photo-stage { position: relative; display: grid; place-items: center; background: #000; min-height: 240px; }
.photo-stage img { max-width: 100%; max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); display: block; }
.photo-nav { position: absolute; top: 50%; transform: translateY(-50%); border: none; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 34px; width: 46px; height: 64px; border-radius: 8px; }
.photo-nav.prev { left: 8px; }
.photo-nav.next { right: 8px; }
.photo-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; }
.photo-bar .muted { color: #a9b6c7; }
.photo-actions { display: flex; gap: 8px; }
.danger-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: transparent; }

@media (max-width: 700px) {
  .main-nav { order: 1; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav button { flex: 1 0 auto; padding: 6px 9px; font-size: 13px; }
  .cal-title { font-size: 18px; min-width: 0; order: -1; flex-basis: 100%; }
  .cal-month { font-size: 11px; }
  .cal-cell { min-height: 76px; padding: 3px; }
  .cal-mweek { min-height: 76px; }
  .cal-mweek > .cal-cell-top { padding: 3px 2px 2px; }
  .cal-mweek .bar { margin: 0 2px 2px; }
  .cal-mweek .bar.from-before { margin-left: 0; }
  .cal-mweek .bar.goes-on { margin-right: 0; }
  .cal-mweek .job-chip, .cal-mweek .off-bar { padding: 2px 4px; font-size: 10px; }
  .chip-out { display: none; }
  .job-chip .chip-time { display: none; }
  .cal-week { grid-template-columns: repeat(7, minmax(78vw, 1fr)); scroll-snap-type: x mandatory; }
  .week-col { scroll-snap-align: start; }
  .schedule-form { grid-template-columns: 1fr; }
  .schedule-form button { justify-self: start; }
}
.quote-note { font-size: 13px; font-style: italic; }

/* Shop time: booked hours per day against the shop's hours */
.load-tag { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 999px; }
.load-tag.full { color: var(--ok); }
.load-tag.over { color: #fff; background: var(--danger); }
.week-head .load-tag { margin-left: auto; }
.load-tag .lt-short { display: none; }
.load-bar { display: block; flex: 1; height: 6px; min-width: 40px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.load-bar > span { display: block; height: 100%; background: var(--ok); }
.load-bar.over > span { background: var(--danger); }
.shop-time-note { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 13px; margin-bottom: 10px; }
.shop-time-note.warn { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.shop-time-head { font-weight: 600; }
.shop-day { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 10px; }
.shop-day-hours { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.shop-day.over .shop-day-hours, .shop-day.over .shop-day-date { color: var(--danger); font-weight: 700; }
.shop-warning { margin: 0; color: var(--danger); font-weight: 600; }
.shop-warning::before { content: "⚠ "; }
.schedule-form .span-all { grid-column: 1 / -1; }
.work-days { border: none; padding: 0; margin: 0; }
.work-days legend { font-size: 13px; padding: 0; margin-bottom: 4px; }
.work-days .checks { grid-template-columns: repeat(7, auto); gap: 2px 10px; }
@media (max-width: 640px) {
  .work-days .checks { grid-template-columns: repeat(4, auto); }
  .shop-day { grid-template-columns: 100px 1fr auto; }
  .cal-cell .load-tag { font-size: 10px; padding: 0 4px; }
  .cal-cell .load-tag .lt-full { display: none; }
  .cal-cell .load-tag .lt-short { display: inline; }
  .cal-cell-top { flex-wrap: wrap; }
}

/* Texts on a lead */
.text-thread { list-style: none; margin: 0 0 10px; padding: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.text-thread .empty { text-align: center; font-size: 13px; padding: 8px 0; }
.bubble { max-width: 85%; display: grid; gap: 2px; }
.bubble.in { align-self: flex-start; }
.bubble.out { align-self: flex-end; text-align: right; }
.bubble-body { padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.bubble.in .bubble-body { background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.out .bubble-body { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.bubble.failed .bubble-body { background: color-mix(in srgb, var(--danger) 14%, var(--panel)); color: var(--text); border: 1px dashed var(--danger); }
.bubble-meta { font-size: 11px; color: var(--muted); }
.text-form { display: grid; gap: 8px; }
.text-form textarea { margin: 0; }
.text-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.confirm-option { margin-top: 4px; }

/* Texts & reminders panel */
.template-rows { display: grid; gap: 12px; margin-bottom: 8px; }
.template-row { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.template-row-head { display: flex; gap: 8px; align-items: center; }
.template-row-head input { margin: 0; font-weight: 600; }
.template-row textarea { margin: 0; }
.placeholder-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* My phone alerts (Reminders panel) */
.my-alerts { margin-bottom: 14px; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.my-alerts .inline-form { margin-top: 6px; }

/* Online booking links (lead drawer) */
.book-links:not(:empty) { margin-bottom: 10px; }
.book-link-maker summary { cursor: pointer; color: var(--link); font-weight: 600; padding: 4px 0; }
.book-link-maker[open] summary { margin-bottom: 6px; }
.book-link-maker form { display: grid; gap: 10px; }
.book-link-maker .info-grid label { margin: 0; }
.send-by { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* Day sheet (calendar) */
.day-sheet { display: grid; gap: 16px; max-width: 980px; }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 10px; }
.sheet-head h2 { font-family: var(--font-brand); font-size: 20px; margin: 0 0 6px; }
.sheet-load { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-width: 260px; }
.sheet-load.over { color: var(--danger); font-weight: 700; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-block h3 { font-family: var(--font-brand); font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }
.sheet-rows { display: grid; gap: 8px; }
.sheet-row { display: grid; grid-template-columns: 110px minmax(150px, 1.2fr) 2fr auto; gap: 4px 16px; align-items: start; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--st, var(--accent)); border-radius: 10px; cursor: pointer; }
.sheet-row:hover { border-color: var(--st, var(--accent)); }
.sheet-when { font-weight: 700; font-variant-numeric: tabular-nums; }
.sheet-who strong { margin-right: 6px; }
.sheet-status { display: grid; justify-items: end; gap: 2px; font-size: 12px; }
.sheet-notes { grid-column: 2 / -1; font-size: 13px; background: color-mix(in srgb, var(--highlight) 14%, var(--panel)); padding: 6px 10px; border-radius: 8px; }
.sheet-email { margin: 0; }
.sheet-email input[name=to] { min-width: 280px; }
@media (max-width: 700px) {
  .sheet-row { grid-template-columns: 1fr auto; }
  .sheet-when { grid-column: 1 / -1; }
  .sheet-what { grid-column: 1 / -1; }
  .sheet-status { grid-row: 2; grid-column: 2; }
  .sheet-notes { grid-column: 1 / -1; }
}
@media print {
  body { background: #fff; color: #000; height: auto; display: block; }
  .topbar, .cal-toolbar, #calLegend, #calUnscheduled, .sheet-actions, .sheet-email, .toasts, .drawer, .scrim, #dueBanner { display: none !important; }
  .day-sheet { max-width: none; }
  .sheet-row { break-inside: avoid; box-shadow: none; border-color: #999; }
  .sheet-notes { background: #f2f2f2; }
}

/* Customer sign-off (job panel) */
.signoff summary { cursor: pointer; list-style: none; }
.signoff summary::-webkit-details-marker { display: none; }
.signoff summary h3 { display: inline; }
.signoff summary::after { content: " ▾"; color: var(--muted); }
.signoff[open] summary::after { content: " ▴"; }
.signoff-form { display: grid; gap: 10px; margin-top: 8px; }
.signoff-form label { margin: 0; }
.signature-wrap { position: relative; border: 2px dashed var(--border); border-radius: 12px; background: #fff; }
.signature-pad { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; border-radius: 10px; }
.signature-hint { position: absolute; left: 14px; bottom: 12px; color: #9aa4b2; font-size: 13px; pointer-events: none; border-top: 1px solid #c7ced8; width: calc(100% - 28px); padding-top: 4px; }
.signature-wrap.signed .signature-hint { visibility: hidden; }
.signature-clear { position: absolute; top: 6px; right: 10px; }
.signoff.done .signoff-who { font-weight: 600; margin: 0 0 8px; }
.signoff-img { display: block; max-width: 100%; height: auto; max-height: 160px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.signoff-terms { white-space: pre-wrap; font: 13px/1.5 inherit; font-family: inherit; color: var(--muted); margin: 8px 0 0; }

/* Off-server backup status (Team panel) */
.backup-status { font-size: 13px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); margin: 0 0 14px; }
.backup-status.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); color: var(--ok); font-weight: 600; }
.backup-status.bad { border-color: var(--danger); color: var(--danger); font-weight: 700; background: color-mix(in srgb, var(--danger) 8%, var(--panel)); }

/* Import leads (admins) */
.drawer.wide { width: min(860px, 100vw); }
.import-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.import-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; margin-bottom: 14px; }
.import-column { display: grid; gap: 3px; margin: 0; font-size: 13px; }
.import-column select { margin: 0; }
.import-place { display: grid; gap: 8px; margin-bottom: 14px; }
.import-place .check { align-items: flex-start; }
.import-summary { font-weight: 600; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.import-preview { border-collapse: collapse; width: 100%; font-size: 12px; }
.import-preview th, .import-preview td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.import-preview th { background: var(--bg); position: sticky; top: 0; white-space: nowrap; }
.import-preview tr.skipped td { color: var(--muted); text-decoration: line-through; }
.import-preview tr.skipped td .muted { text-decoration: none; display: block; }
.import-notes { max-width: 260px; white-space: pre-wrap; }
.import-result { margin: 0 0 12px; padding-left: 20px; }

/* Appearance panel */
.theme-pick { margin-bottom: 4px; }
.theme-pick button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); }
.theme-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.preset { display: grid; gap: 6px; justify-items: center; padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 12px; font-weight: 600; }
.preset[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.preset-swatch { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 40px; padding: 5px; border-radius: 7px; border: 1px solid var(--border); }
.preset-swatch i { flex: 1; height: 100%; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.08); }
.preset-swatch i:nth-child(n + 2) { height: 60%; }
.color-form { display: grid; gap: 8px; }
.color-row { display: grid; grid-template-columns: 1fr auto 64px; align-items: center; gap: 10px; }
.color-row span { display: grid; }
.color-row small { color: var(--muted); font-size: 12px; }
.color-row input[type="color"] { width: 52px; height: 34px; padding: 2px; margin: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; }
.appearance-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.image-setting { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.image-thumb { flex-shrink: 0; width: 120px; height: 64px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 10px; background: #fff; overflow: hidden; font-size: 12px; }
.image-setting.dark .image-thumb { background: #00142b; }
.image-thumb.wide { width: 160px; height: 90px; }
.image-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-thumb.wide img { width: 100%; height: 100%; object-fit: cover; }
.image-actions { display: grid; gap: 6px; justify-items: start; }
.dim-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.dim-row input { grid-column: 1; margin: 0; accent-color: var(--accent); }
.danger-link { color: var(--danger); }
/* A background picture shows through the page; panels stay solid so text stays readable. */
body.has-bg { background-size: cover; background-position: center; background-attachment: fixed; }
body.has-bg .board, body.has-bg .calendar, body.has-bg .section { background: transparent; }
.color-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 10px; margin: 0; display: grid; gap: 8px; }
.color-group legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0 4px; }
.look-scope { display: flex; margin: 0 0 12px; }
.look-scope button { flex: 1; }
.look-scope button[aria-selected="true"], .theme-pick button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); }

/* Payments (lead's Shop job box and the job panel) */
.payments-box { display: grid; gap: 6px; }
.paid-tag { font-size: 12px; font-weight: 700; color: #fff; background: var(--ok); padding: 1px 8px; border-radius: 999px; }
.payment-list { list-style: none; margin: 0; padding: 0 0 0 12px; display: grid; gap: 2px; font-size: 13px; }
.payment-list li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.payment-form { flex-wrap: wrap; }
.payment-form input { min-width: 90px; }
.rev-owed { margin-bottom: 16px; }
.rev-owed td.owed { color: var(--danger); font-weight: 700; }
.tag.call { background: #0f766e; }
.tag.referral { background: #b45309; }
.tag.google { background: #1a73e8; }

/* Win-back campaigns */
.winback-form { display: grid; gap: 10px; margin-bottom: 14px; }
.winback-form label, .winback-form fieldset { margin: 0; }
.winback-form fieldset { display: grid; gap: 6px; }
.winback-preview { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.winback-preview:empty { display: none; }
.winback-count { margin: 0; font-weight: 700; }
.winback-preview .bubble { max-width: 100%; }
.followups-form { display: grid; gap: 8px; }
.followups-form label { margin: 0; }

/* Referrals */
.referred-by { margin: 0 0 6px; font-weight: 600; color: var(--ok); }
.refer-btns { flex-wrap: wrap; align-items: center; }
.refer-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.partner-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.partner-form input { flex: 1 1 200px; margin: 0; }
.matrix tr.inactive td { color: var(--muted); }
.spend-form { margin-bottom: 10px; }
.spend-inputs { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.spend-inputs label { margin: 0; font-size: 12px; }
.spend-inputs input { width: 110px; margin: 0; }
.matrix td.good { color: var(--ok); font-weight: 700; }
.matrix td.bad { color: var(--danger); font-weight: 700; }
.rev-grid > .full { grid-column: 1 / -1; }

/* ---------- Analytics (admins) ---------- */
.analytics { overflow: auto; padding: 14px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); gap: 14px; }
.analytics > * { flex-shrink: 0; }
/* Chart colors follow each person's look: the first series is their link color (already set to read
   well on their cards in light and dark), the second their highlight color nudged toward the text color
   for contrast, and the ramp steps the first color down toward the card color. */
.analytics {
  --viz-1: var(--link);
  --viz-2: color-mix(in srgb, var(--highlight) 78%, var(--text));
  --viz-r1: var(--viz-1);
  --viz-r2: color-mix(in srgb, var(--viz-1) 72%, var(--panel));
  --viz-r3: color-mix(in srgb, var(--viz-1) 50%, var(--panel));
  --viz-r4: color-mix(in srgb, var(--viz-1) 32%, var(--panel));
  --viz-grid: color-mix(in srgb, var(--border) 70%, transparent); --viz-axis: var(--border);
  --viz-good: var(--ok); --viz-bad: var(--danger);
}
.an-custom { display: inline-flex; gap: 6px; align-items: center; }
.an-custom input { width: auto; margin: 0; }
.an-body { display: grid; gap: 22px; transition: opacity 0.15s; }
.an-body.loading { opacity: 0.55; }
.an-group { display: grid; gap: 12px; }
.an-group > h3 { font-family: var(--font-brand); font-size: 17px; margin: 0; }
.an-group > .an-note { margin: -6px 0 0; font-size: 13px; }
.an-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.an-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.an-tile .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.an-tile .val { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: 2px; }
.an-tile .sub { font-size: 12px; color: var(--muted); }
.an-tile .delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.an-tile .delta.good { color: var(--viz-good); }
.an-tile .delta.bad { color: var(--viz-bad); }
.an-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.an-stats .an-tile .val { font-size: 20px; }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.an-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; min-width: 0; position: relative; }
.an-card h4 { margin: 0; font-size: 14px; }
.an-card .an-sub { margin: -6px 0 0; font-size: 12px; color: var(--muted); }
.an-card .table-scroll { border-radius: 8px; }
.an-card table.matrix { width: 100%; min-width: 0; }
.an-card details > summary { cursor: pointer; font-size: 12px; color: var(--link); width: fit-content; }
.an-card details[open] > summary { margin-bottom: 8px; }
.an-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.an-legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.an-chart { width: 100%; overflow: visible; display: block; touch-action: pan-y; }
.an-chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.an-chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.an-chart .base { stroke: var(--viz-axis); stroke-width: 1; }
.an-chart .cross { stroke: var(--muted); stroke-width: 1; }
.an-chart rect.mark:hover, .an-chart rect.mark:focus { opacity: 0.8; outline: none; }
.an-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; display: grid; gap: 3px; min-width: 130px; }
.an-tip[hidden] { display: none; }
.an-tip .t { color: var(--muted); font-weight: 600; }
.an-tip .row { display: flex; align-items: center; gap: 8px; }
.an-tip .row b { color: var(--text); font-variant-numeric: tabular-nums; }
.an-tip .row i { width: 12px; height: 2px; display: inline-block; }
.an-tip .row span { color: var(--muted); }
.an-bars { display: grid; gap: 8px; }
.an-bar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.an-bar .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar .track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.an-bar .fill { height: 16px; background: var(--viz-1); border-radius: 0 4px 4px 0; min-width: 2px; flex-shrink: 0; }
.an-bar .amt { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.an-bar .amt small { color: var(--muted); font-weight: 400; }
.an-seg { display: flex; gap: 2px; height: 28px; border-radius: 4px; overflow: hidden; }
.an-seg > div { display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 700; white-space: nowrap; min-width: 0; overflow: hidden; border-radius: 4px; }
.an-seg > div.dark-ink { color: #0b0b0b; }
.an-seg > div.light-ink { color: #ffffff; }
.an-heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; color: var(--muted); }
.an-heat .c { aspect-ratio: 1 / 1; border-radius: 3px; background: var(--viz-1); min-height: 10px; }
.an-heat .c.zero { background: color-mix(in srgb, var(--border) 45%, transparent); }
.an-heat .hl { text-align: center; }
.an-meter { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--viz-1) 18%, var(--panel)); overflow: hidden; }
.an-meter > div { height: 100%; background: var(--viz-1); border-radius: 5px; }
.an-empty { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-grid { grid-template-columns: minmax(0, 1fr); }
  .an-tile .val { font-size: 22px; }
  .an-heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 1px; }
}
.analytics { --viz-none: color-mix(in srgb, var(--muted) 45%, var(--panel)); }

/* ---------- Work timer (job panel) ---------- */
.work-timer #workTotal { color: var(--text); }
.work-timer #workTotal.over { color: var(--warn); }
.progress.over .progress-bar span { background: var(--warn); }
.work-live { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); font-size: 14px; }
.work-clock { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; }
.work-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex-shrink: 0; display: inline-block; box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: work-pulse 1.8s ease-out infinite; }
@keyframes work-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .work-dot { animation: none; } }
.work-done { margin: 0; color: var(--ok); font-weight: 600; font-size: 14px; }
.work-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.work-actions button { min-height: 44px; padding: 0 18px; font-size: 15px; }
.work-actions .work-start { flex: 1; }
.work-log > summary { cursor: pointer; font-size: 13px; color: var(--link); }
.work-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.work-row { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; display: grid; gap: 4px; font-size: 13px; }
.work-row-main { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.work-dur { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.work-flag { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.work-flag.warn { color: var(--warn); }
.work-fix > summary { cursor: pointer; font-size: 12px; color: var(--link); width: fit-content; }
.work-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; margin-top: 8px; }
.work-form.add { border-top: 1px solid var(--border); padding-top: 10px; }
.work-form label { margin: 0; font-size: 12px; }
.work-form input { margin: 0; }
.work-form .span-all { grid-column: 1 / -1; font-size: 13px; }
.work-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--ok); }
.work-badge.done { color: var(--muted); }
.job-chip .work-dot { width: 7px; height: 7px; margin-right: 3px; }

/* Suggested work time from past jobs, under the Work time picker */
.estimate-note { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.estimate-note.learned { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.estimate-note strong { color: var(--text); font-size: 13px; }
.estimate-note .link-btn { margin-left: auto; font-size: 12px; font-weight: 700; }

/* Exact last-opened and last-contacted times on each lead card */
.card-times { display: grid; gap: 1px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-times b { font-weight: 600; color: var(--text); }
.card-times .never { color: var(--warn); }
.card-times .never b { color: var(--warn); }

/* Phones: the whole page scrolls, so the header slides away and the board, calendar and reports get
   the full screen. The lead columns still swipe sideways; each column is as long as its cards. */
@media (max-width: 640px) {
  body.app-page { height: auto; min-height: 100vh; min-height: 100dvh; }
  body.app-page .board { flex: none; align-items: flex-start; }
  body.app-page .column { max-height: none; }
  body.app-page .cards { overflow-y: visible; flex: none; }
  body.app-page .section { flex: none; min-height: 0; }
  body.app-page .revenue, body.app-page .analytics, body.app-page .calendar { overflow: visible; }
  .due-banner { margin: 8px 12px 0; padding: 8px 10px; font-size: 13px; }
}

/* Best time to reach the lead (their answer to the welcome text), on the card */
.best-time { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 4px 0 2px; padding: 4px 8px; border-radius: 6px; font-size: 13px; background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); }
.best-time strong { color: var(--text); }
.best-time .bt-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ok); }
.best-time .bt-note { flex-basis: 100%; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-time.waiting { background: transparent; border-style: dashed; border-color: var(--border); color: var(--muted); font-size: 12px; }
.best-time.waiting .bt-tag { color: var(--muted); }

/* Import card payments (Talech / Elavon export) */
.card-import-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
.ci-chip { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; border: 1px solid var(--border); color: var(--muted); }
.ci-chip.good { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.ci-chip.check { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.ci-columns { margin: 8px 0; }
.ci-columns > summary { cursor: pointer; font-size: 13px; color: var(--link); }
.ci-col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 8px; }
.ci-col-grid label { margin: 0; }
.ci-table { width: 100%; min-width: 640px; }
.ci-table td { vertical-align: middle; }
.ci-table .ci-pick select { margin: 0; min-width: 220px; max-width: 360px; font-size: 13px; }
.ci-table tr.ci-recorded td { color: var(--muted); }
.ci-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.error-text { color: var(--danger); font-weight: 600; }

/* ---------- The dialer (build with CALLS_ENABLED) ---------- */
.call-section .call-now { min-height: 40px; }
.call-live { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; margin-top: 8px; }
.call-live.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); }
.call-live-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.call-clock { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.call-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; max-height: 260px; overflow-y: auto; }
.call-lines li { padding: 4px 8px; border-radius: 8px; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.call-lines li.rep { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.call-lines li b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.call-notes { display: grid; gap: 6px; font-size: 13px; }
.call-summary { margin: 0; font-size: 14px; }
.note-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.note-row > span:first-child { color: var(--muted); font-size: 12px; font-weight: 600; }
.call-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.call-flag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); white-space: nowrap; }
.call-flag.todo { color: var(--link); border-color: color-mix(in srgb, var(--link) 40%, var(--border)); background: color-mix(in srgb, var(--link) 8%, var(--panel)); }
.call-tip { margin: 0; font-size: 13px; color: var(--text); }
.call-score { color: var(--highlight); letter-spacing: 1px; white-space: nowrap; }
.call-history { margin-top: 8px; }
.call-history > summary, .call-transcript > summary { cursor: pointer; font-size: 13px; color: var(--link); }
.call-past { border-top: 1px solid var(--border); padding: 8px 0; display: grid; gap: 6px; }
.call-past-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 13px; }
.call-coaching { margin: 0; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--highlight) 12%, var(--panel)); }
.dialer-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60; width: min(760px, calc(100% - 24px));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--bar); color: var(--bar-text); border: 1px solid var(--bar-border); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.dialer-info { display: grid; gap: 2px; font-size: 13px; min-width: 0; }
.dialer-info .muted { color: var(--bar-muted); }
.dialer-next { color: var(--highlight); font-weight: 700; }
.dialer-actions { display: flex; gap: 6px; }
.dialer-actions button:not(.primary) { background: var(--bar-field); color: var(--bar-text); border-color: var(--bar-border); }
.calls-filter { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.calls-filter select { width: auto; margin: 0; }
.calls-filter label.check { margin: 0; }
.calls-list { display: grid; gap: 8px; }
.call-row { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.call-row.reviewed { opacity: 0.85; }
.call-row > summary { cursor: pointer; list-style: none; padding: 10px 12px; display: grid; gap: 4px; }
.call-row > summary::-webkit-details-marker { display: none; }
.call-row-who { font-size: 14px; }
.call-row-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.call-row-summary { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.call-detail { padding: 0 12px 12px; display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.call-review { display: grid; gap: 8px; }
.call-review label { margin: 0; }
.call-stars { display: flex; gap: 2px; margin-top: 4px; }
.call-stars button { border: none; background: none; font-size: 24px; line-height: 1; padding: 2px 4px; color: var(--highlight); cursor: pointer; }

/* A lead full screen (double-click its card): the sections flow into columns to use the width. */
.drawer-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.full-btn { font-size: 13px; white-space: nowrap; }
.lead-card { -webkit-user-select: none; user-select: none; }
#drawer { transition: width 0.18s ease; }
@media (prefers-reduced-motion: reduce) { #drawer { transition: none; } }
.drawer.full { width: 100vw; border-left: none; box-shadow: none; z-index: 12; }
.drawer.full .drawer-head { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.drawer.full #leadName { font-size: 24px; }
.drawer.full .drawer-body { columns: 3 400px; column-gap: 28px; column-rule: 1px solid var(--border); padding: 8px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left)); }
.drawer.full .drawer-body > * { break-inside: avoid; }
.drawer.full .drawer-body > :first-child { margin-top: 12px; }
@media (max-width: 640px) { .full-btn { display: none; } }

/* Pipelines (admins) */
.pipe-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.pipe-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pipe-name { flex: 1 1 220px; margin: 0; font-weight: 700; font-size: 15px; }
.pipe-count { font-size: 12px; }
.pipe-order { display: flex; gap: 4px; }
.pipe-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pipe-types { display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-type { border-radius: 16px; padding: 5px 11px; font-size: 13px; background: var(--panel); color: var(--text); }
.pipe-type.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.pipe-type small { opacity: 0.75; }
.pipe-type .pipe-elsewhere { color: var(--muted); }
.pipe-who { display: grid; gap: 4px; }
.pipe-who label.check { margin: 0; font-size: 13px; }
.pipe-people { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-left: 22px; }
.pipe-remove { justify-self: start; font-size: 13px; }
.pipe-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* ---------- Time clock, time off, Time & Pay ---------- */
.clock-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.clock-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.clock-pill.on { border-color: color-mix(in srgb, var(--ok) 60%, transparent); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.clock-pill.on .clock-dot, .tc-hero.on .clock-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); animation: work-pulse 2s ease-in-out infinite; }
.tc-state { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.tc-off-form { display: grid; gap: 10px; }
.tc-off-form label, .tp-add-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.tc-off-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tc-off-form button[type="submit"] { justify-self: start; }
.tc-reqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tc-req { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; gap: 3px; justify-items: start; }
.tc-req.status-cancelled { opacity: 0.6; }
.tc-req-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; justify-content: space-between; }
.tc-decision { font-size: 13px; }
.tc-badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.tc-badge.pending { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tc-badge.approved { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tc-badge.denied { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.off-tags { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 0; }
.off-tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 6px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.off-tag.kind-sick { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.week-col .off-tags, .list-day .off-tags { margin: 4px 0; }
.time-pay { overflow: auto; padding: 14px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); gap: 14px; }
.tp-body { display: grid; gap: 14px; }
.tp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tp-pending, .tp-add, .tp-settings { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.tp-pending { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.tp-off-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tp-off { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.tp-off:first-child { border-top: none; }
.tp-off-actions { display: flex; gap: 6px; }
.tp-warn { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); font-size: 13px; }
.tp-table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.tp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tp-table th, .tp-table td { padding: 8px 10px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
.tp-table thead th { border-top: none; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tp-table tfoot th, .tp-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.tp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-name { border: none; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tp-caret { color: var(--muted); width: 10px; }
.tp-role { font-size: 12px; text-transform: capitalize; }
.tp-flag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tp-flag.on { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tp-rate-box { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.tp-rate { width: 76px; padding: 4px 6px; text-align: right; }
.tp-detail > td { background: var(--bg); padding: 10px 14px 14px 28px; }
.tp-detail-body { display: grid; gap: 8px; justify-items: start; }
.tp-punch-actions { white-space: nowrap; }
.link-btn.danger { color: var(--danger); }
.tp-person-off { font-size: 13px; }
.tp-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 8px 0; }
.tp-add-grid label > span { display: flex; align-items: center; gap: 6px; }
.tp-kinds { border: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.tp-kinds legend { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tp-form-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 900px) { .tp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .clock-pill { padding: 5px 10px; font-size: 12px; }
  .tc-off-grid { grid-template-columns: 1fr 1fr; }
  .tp-detail > td { padding-left: 10px; }
}
.time-pay > * { flex-shrink: 0; }
.week-bar-top .progress { flex: 0 0 84px; }

/* ---------- My time: full screen, confirmations, lunch ---------- */
.drawer.tc-panel { width: 100vw; border-left: none; box-shadow: none; z-index: 12; }
.drawer.tc-panel .drawer-head { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.drawer.tc-panel .drawer-body { background: var(--bg); padding: 20px max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.tc-page { max-width: 980px; margin: 0 auto; display: grid; gap: 16px; }
.tc-hero { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); }
.tc-hero.on { border-color: color-mix(in srgb, var(--ok) 55%, var(--border)); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); }
.tc-hero.lunch { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); }
.tc-now { font-size: clamp(36px, 8vw, 56px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.05; }
.tc-date { color: var(--muted); font-weight: 600; }
.tc-hero .tc-state { margin-top: 8px; font-size: 16px; }
.tc-hero.lunch .clock-dot { background: var(--warn); }
.tc-big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.tc-big-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.tc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; width: 100%; }
.tc-action { min-width: 200px; padding: 16px 28px; font-size: 18px; font-weight: 700; border-radius: 14px; border: 1px solid transparent; cursor: pointer; }
.tc-action.go { background: var(--ok); color: #fff; }
.tc-action.stop { background: var(--danger); color: #fff; }
.tc-action.lunch { background: color-mix(in srgb, var(--warn) 18%, var(--panel)); color: var(--text); border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.tc-action.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.tc-action:hover:not(:disabled) { filter: brightness(1.07); }
.tc-action:disabled { opacity: 0.6; cursor: progress; }
.tc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tc-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: grid; gap: 10px; min-width: 0; }
.tc-card h3 { margin: 0; font-size: 15px; }
.tc-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tc-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tc-ev { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 7px 0 7px 18px; position: relative; font-size: 14px; }
.tc-ev::before { content: ""; position: absolute; left: 4px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.tc-ev::after { content: ""; position: absolute; left: 7px; top: 22px; bottom: -8px; width: 2px; background: var(--border); }
.tc-ev:last-child::after { display: none; }
.tc-ev.in::before { background: var(--ok); }
.tc-ev.lunch::before { background: var(--warn); }
.tc-ev.out::before { background: var(--danger); }
.tc-ev-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.tc-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.tc-wd { display: grid; gap: 4px; justify-items: center; font-size: 12px; }
.tc-wd-h { font-weight: 700; font-variant-numeric: tabular-nums; min-height: 16px; }
.tc-wd-bar { width: 100%; max-width: 34px; height: 90px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: flex-end; overflow: hidden; }
.tc-wd-bar span { display: block; width: 100%; background: var(--link); border-radius: 6px 6px 0 0; }
.tc-wd-d { color: var(--muted); font-weight: 600; }
.tc-wd.today .tc-wd-d { color: var(--text); }
.tc-wd.today .tc-wd-bar { border-color: var(--link); }
.clock-pill.lunch { border-color: color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.clock-pill.lunch .clock-dot { background: var(--warn); }
.clock-dialog { width: min(440px, calc(100vw - 32px)); text-align: center; padding: 28px 24px; border-radius: 18px; }
.clock-dialog h2 { margin: 0 0 6px; font-size: 22px; }
.tc-dlg-time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 6px 0; }
.tc-dlg-note { margin: 8px 0 18px; color: var(--text); }
.tc-dlg-actions { display: grid; gap: 10px; }
.tc-dlg-actions .tc-action { width: 100%; min-width: 0; }
.tc-dlg-hint { margin: 10px 0 0; font-size: 13px; }
.tc-dlg-check { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 38px; font-weight: 800; color: #fff; background: var(--ok); }
.tc-dlg-check.lunch { background: var(--warn); }
.tc-dlg-check.stop { background: var(--danger); }
@media (max-width: 720px) {
  .tc-grid { grid-template-columns: 1fr; }
  .tc-actions { flex-direction: column; }
  .tc-action { width: 100%; min-width: 0; }
  .tc-hero { padding: 22px 14px; }
}
.tc-timecard .tc-card-head select { width: auto; margin-left: auto; }
.tc-tc-total { white-space: nowrap; }
.tc-tc-days { display: grid; }
.tc-tc-day { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.tc-tc-day:first-child { border-top: none; }
.tc-tc-date { display: grid; gap: 2px; font-weight: 700; font-size: 14px; }
.tc-tc-date .muted { font-weight: 500; font-size: 12px; }
.tc-tc-punches { display: grid; gap: 6px; min-width: 0; }
.tc-tc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; }
.tc-tc-span { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 160px; }
.tc-tc-hrs { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 70px; }
.tc-tc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tc-tc-row .link-btn { margin-left: auto; }
.tc-fix { display: grid; gap: 10px; padding: 12px; border: 1px solid color-mix(in srgb, var(--link) 45%, var(--border)); border-radius: 12px; background: var(--bg); }
.tc-fix label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.tc-fix label.check { display: flex; }
.tc-fix-title { font-weight: 700; font-size: 14px; }
.tc-corrs { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
@media (max-width: 640px) {
  .tc-tc-day { grid-template-columns: 1fr; gap: 4px; }
  .tc-tc-span { min-width: 0; }
}
.tc-timecard > .link-btn { justify-self: start; }

/* ---------- Time & Pay: days, attendance, schedules ---------- */
.tp-detail > td { padding: 4px 14px 16px 28px; }
.tp-days { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tp-days th, .tp-days td { padding: 9px 12px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
.tp-days thead th { border-top: none; background: color-mix(in srgb, var(--bg) 60%, var(--panel)); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.tp-days td + td, .tp-days th + th { border-left: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.tp-days .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-days tbody tr:hover { background: color-mix(in srgb, var(--link) 5%, transparent); }
.tp-days tr.has-issues .tp-day-date { box-shadow: inset 3px 0 0 var(--danger); }
.tp-days tr.off td { color: var(--muted); }
.tp-day-date { font-weight: 700; white-space: nowrap; }
.tp-day-off { font-style: italic; }
.tp-lunch { white-space: nowrap; }
.tp-day-actions { text-align: right; white-space: nowrap; }
.tp-issues { display: flex; flex-wrap: wrap; gap: 4px; }
.tp-issue { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.tp-issue.long_lunch, .tp-issue.missed_out { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tp-issue.info { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.tp-issue-count { border: none; cursor: pointer; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.tp-ok { font-size: 12px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.tp-day-edit-row > td { background: var(--bg); padding: 10px 12px; }
.tp-day-edit { display: grid; gap: 8px; }
.tp-edit-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.tp-edit-row.flagged { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.tp-edit-row label { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tp-edit-row label.grow { flex: 1; min-width: 160px; }
.tp-edit-row input { font-size: 13px; }
.tp-edit-n { font-weight: 700; font-size: 13px; min-width: 90px; align-self: center; }
.tp-edit-actions { display: flex; gap: 8px; align-items: center; }
.tp-edit-meta { flex-basis: 100%; font-size: 12px; }
.tp-att { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.tp-att-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tp-att-head h3 { margin: 0 0 2px; }
.tp-att-head p { margin: 0; font-size: 13px; }
.tp-att-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.tp-att-tile { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.tp-att-n { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.tp-att-tile.has .tp-att-n { color: var(--danger); }
.tp-att-tile.has.long_lunch .tp-att-n, .tp-att-tile.has.missed_out .tp-att-n { color: var(--warn); }
.tp-att-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.tp-occ { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tp-occ li { display: grid; grid-template-columns: 110px 90px auto 1fr; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.tp-occ li:first-child { border-top: none; }
.tp-occ-date { font-weight: 600; white-space: nowrap; }
.tp-occ-name { border: none; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--link); cursor: pointer; text-align: left; }
.tp-occ-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-ok-line { margin: 0; color: var(--ok); font-weight: 600; font-size: 13px; }
.tp-att > .link-btn { justify-self: start; }
.tp-sched-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tp-sched-table th, .tp-sched-table td { padding: 8px 10px; text-align: left; border-top: 1px solid var(--border); }
.tp-sched-table thead th { border-top: none; font-size: 12px; color: var(--muted); }
.tp-sched-table input[type="time"] { width: auto; }
.tp-dow { display: flex; gap: 4px; }
.tp-dow-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 12px; font-weight: 700; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; }
.tp-dow-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
@media (max-width: 900px) {
  .tp-att-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tp-occ li { grid-template-columns: auto auto 1fr; }
  .tp-occ-detail { grid-column: 1 / -1; white-space: normal; }
}
@media (max-width: 640px) {
  .tp-att-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-detail > td { padding: 4px 6px 12px; }
}
.tp-occ .tp-issue { justify-self: start; }

/* ---------- Weekly pay: sign-off and the pay week ---------- */
.tp-week-nav { display: inline-flex; align-items: center; gap: 6px; }
.tp-week-nav[hidden] { display: none; }
.tp-week-label { font-weight: 700; white-space: nowrap; min-width: 150px; text-align: center; }
.tp-week { background: var(--panel); border: 1px solid color-mix(in srgb, var(--link) 40%, var(--border)); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.tp-week.all { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.tp-week-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tp-week-head h3 { margin: 0 0 2px; }
.tp-week-head p { margin: 0; font-size: 13px; }
.tp-week-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tp-signoffs { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-signoff { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); }
.tp-signoff.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.tp-signoff.changed { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.tp-signoff.waiting { color: var(--muted); }
.tp-week-mail { margin: 0; font-size: 13px; }
.tp-wide { grid-column: span 2; }
.tc-week-ok { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--link) 9%, transparent); }
.tc-week-ok.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.tc-review { text-align: left; border: 1px solid var(--border); border-radius: 12px; margin: 12px 0; overflow: hidden; }
.tc-review-day { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.tc-review-day:first-child { border-top: none; }
.tc-review-date { font-weight: 700; }
.tc-review-spans { color: var(--muted); font-size: 13px; }
.tc-review-hrs { font-weight: 600; font-variant-numeric: tabular-nums; }
.tc-review-total { display: flex; justify-content: space-between; padding: 10px 12px; border-top: 2px solid var(--border); background: var(--bg); font-size: 15px; }
.tc-review-note { font-size: 13px; color: var(--warn); text-align: left; }
.tc-review-check { justify-content: center; margin: 4px 0 14px; font-size: 15px; }
.clock-dialog:has(.tc-review) { width: min(520px, calc(100vw - 24px)); }
@media (max-width: 640px) { .tp-wide { grid-column: auto; } .tc-review-day { grid-template-columns: 1fr auto; } .tc-review-spans { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Search: every lead in a dropdown ---------- */
.search-box { position: relative; flex: 2; min-width: 0; display: flex; }
.search-box input { flex: 1; width: 100%; }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: min(70vh, 560px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28); padding: 6px; min-width: min(520px, calc(100vw - 32px)); }
.search-item { display: grid; gap: 2px; width: 100%; text-align: left; border: none; background: none; border-radius: 9px; padding: 9px 11px; cursor: pointer; color: var(--text); font: inherit; }
.search-item.active { background: color-mix(in srgb, var(--link) 13%, transparent); }
.si-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.si-name { font-weight: 700; font-size: 15px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.si-tag { margin-left: auto; flex-shrink: 0; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.si-tag.active { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); }
.si-tag.customer { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.si-tag.old { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.si-tag.dead { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.si-line { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item mark { background: color-mix(in srgb, var(--highlight) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty, .search-more { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.search-more { border-top: 1px solid var(--border); margin-top: 4px; }
@media (max-width: 640px) { .search-pop { min-width: 0; max-height: 65vh; } .si-tag { font-size: 10px; } }
@media (max-width: 640px) { .filters { position: relative; } .search-box { position: static; } }
/* Geo-lock */
.tc-geo-note { margin-top: 8px; font-size: 13px; color: var(--muted); max-width: 420px; }
.tp-geo { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 4px; margin: 6px 0; display: grid; gap: 8px; }
.tp-geo legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.tp-geo-roles { display: flex; gap: 16px; padding-left: 24px; }
.tp-geo .tp-form-actions a[hidden] { display: none; }
.tp-geo-pin { font-size: 11px; cursor: help; }

/* ---------- The red bar: clock-ins away from the shop (admins) ---------- */
.clock-alarm { --ca: #d32020; background: var(--ca); color: #fff; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); display: grid; gap: 6px; box-shadow: 0 4px 18px rgba(211, 32, 32, 0.45); position: relative; z-index: 5; border-bottom: 3px solid #ffd400; }
.clock-alarm[hidden] { display: none; }
.clock-alarm.flash { animation: ca-flash 0.6s ease-in-out 4; }
@keyframes ca-flash { 50% { background: #ff3b30; box-shadow: 0 0 0 4px #ffd400, 0 4px 24px rgba(255, 59, 48, 0.7); } }
.ca-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ca-icon { width: 30px; height: 30px; border-radius: 50%; background: #ffd400; color: #7a0000; display: grid; place-items: center; font-weight: 900; font-size: 18px; animation: ca-pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes ca-pulse { 50% { transform: scale(1.15); } }
.ca-title { font-size: 16px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; }
.ca-actions { display: inline-flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.ca-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.18); font-size: 14px; }
.ca-text strong { font-weight: 800; }
.ca-btn { border: 1.5px solid rgba(255, 255, 255, 0.85); background: transparent; color: #fff; border-radius: 8px; padding: 5px 12px; font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; }
.ca-btn.solid { background: #fff; color: #b00000; border-color: #fff; }
.ca-btn:hover { filter: brightness(1.1); }
.ca-more { justify-self: start; border: none; background: none; color: #fff; text-decoration: underline; font-weight: 700; cursor: pointer; padding: 0; }
@media (prefers-reduced-motion: reduce) { .clock-alarm.flash, .ca-icon { animation: none; } }
@media (max-width: 640px) { .ca-title { font-size: 14px; } .ca-row { font-size: 13px; } .ca-actions { margin-left: 0; } }
.tc-dlg-warn { margin: -8px 0 16px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; font-size: 14px; }
.tp-geo-mode { display: grid; gap: 4px; padding-left: 24px; }
.tp-geo-mode-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.tp-away { display: grid; gap: 8px; }
.tp-away h4 { margin: 0; color: var(--danger); font-size: 14px; }
.tp-issue.off_site { background: var(--danger); color: #fff; }
.tp-att-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tp-att-tile.has.off_site { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); }
@media (max-width: 900px) { .tp-att-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tp-att-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The app's own "Are you sure?" box */
.ask-dialog { width: min(440px, calc(100vw - 32px)); }
.ask-dialog h2 { margin: 0 0 8px; font-size: 19px; }
.ask-text { margin: 0 0 14px; color: var(--text); }
.ask-dialog textarea { width: 100%; margin-bottom: 12px; }
.ask-checks { display: grid; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.ask-dialog .dialog-actions button { min-width: 96px; }
.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.danger-solid:hover { filter: brightness(1.08); }

/* ---------- Social posts ---------- */
.soc-list { display: grid; gap: 16px; }
.soc-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--panel); }
.soc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.soc-label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.soc-card textarea { font-size: 14px; }
.soc-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.soc-photo { position: relative; padding: 0; width: 104px; height: 104px; border-radius: 10px; overflow: hidden; border: 3px solid transparent; background: var(--bg); cursor: pointer; opacity: 0.45; }
.soc-photo.on { border-color: var(--link); opacity: 1; }
.soc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.soc-phase { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); color: #fff; }
.soc-phase.after { background: var(--ok); }
.soc-platforms { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.soc-platform.off { opacity: 0.6; }
.soc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.soc-done-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.soc-done { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.soc-done.skipped { opacity: 0.65; }
.soc-done-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.soc-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.soc-results li { display: flex; gap: 8px; flex-wrap: wrap; }
.soc-r-name { font-weight: 700; min-width: 120px; }
.soc-results li.failed .soc-r-name, .soc-r-error { color: var(--danger); }
.soc-results li.posted .soc-r-name { color: var(--ok); }
.soc-ok { color: var(--ok); font-weight: 600; }
.soc-job-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.soc-settings { display: grid; gap: 10px; }

.soc-panel-settings > summary { cursor: pointer; list-style: none; }
.soc-panel-settings > summary::-webkit-details-marker { display: none; }
.soc-panel-settings > summary h3 { display: inline; }
.soc-panel-settings > summary::after { content: " ▾"; color: var(--muted); }
.soc-panel-settings[open] > summary::after { content: " ▴"; }
.soc-order { position: absolute; top: 4px; right: 4px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--link); color: #fff; font: 800 12px/22px var(--font-body, sans-serif); text-align: center; }
.soc-order:empty { display: none; }
.soc-two { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; align-items: start; }
.soc-fields { display: grid; gap: 10px; }
@media (max-width: 640px) { .soc-two { grid-template-columns: 1fr; } .soc-preview { max-width: 260px; } }
.soc-preview { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.soc-pv-frame { position: relative; aspect-ratio: 4 / 5; background: #000; }
.soc-pv-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.soc-pv-count { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: rgba(0, 0, 0, 0.6); color: #fff; }
.soc-preview figcaption { padding: 8px 10px 0; font-size: 12px; line-height: 1.4; }
.soc-pv-caption { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.soc-preview .hint { margin: 6px 10px 8px; font-size: 11px; }
.soc-saved { font-size: 12px; margin-left: auto; }
.soc-saved.soc-unsaved { color: var(--danger); }
.soc-posting-note { margin: 0; }
.soc-live { display: grid; gap: 4px; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.soc-live.warn { border-left: 3px solid var(--warn); }
.pill.nostep { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.next-step-box { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border-left: 4px solid var(--link); }
.next-step.urgent { color: var(--danger); }
.next-step.warn { color: var(--warn); }
.next-step .link-btn { padding: 0; }
.last-contact { font-size: 13px; }
.queue-hint { margin: 0 0 6px; }
.dep-pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.dep-pill.taken { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.dep-pill.missing { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.dep-pill.waived { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
/* Marketing and Setup menus in the toolbar */
details.menu { position: relative; flex: 0 0 auto; }
details.menu > summary { list-style: none; cursor: pointer; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); white-space: nowrap; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " ▾"; color: var(--muted); }
details.menu[open] > summary { border-color: var(--accent); }
details.menu > summary:hover { border-color: var(--accent); }
.menu-list { display: none; }
.menu-list.floating { display: grid; position: fixed; z-index: 60; min-width: 190px; padding: 6px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 20, 43, 0.22); }
.menu-list.floating button { text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 6px; width: 100%; }
.menu-list.floating button:hover, .menu-list.floating button:focus-visible { background: var(--bg); }
body:not([data-role="admin"]) .menu-list.floating { display: none; }
body[data-section]:not([data-section="leads"]) .menu-list.floating .lead-only { display: none !important; }

/* ==================================================================================================
   Layout v2: side menu, slim top bar, Overview. Brand colors stay; the side menu is always navy.
   ================================================================================================== */
:root {
  --side: #00142b;
  --side-2: #062344;
  --side-text: #c7d3e4;
  --side-muted: #7d91b0;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(255, 255, 255, 0.1);
  --side-w: 240px;
  --radius: 14px;
  --card-shadow: 0 1px 2px rgba(0, 20, 43, 0.04), 0 4px 14px rgba(0, 20, 43, 0.05);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root[data-theme="dark"] { --side: #030a14; --side-2: #071a33; --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side: #030a14; --side-2: #071a33; --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); } }

.ico { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
button .ico + span, button .ico + text { margin-left: 2px; }

/* ---- the side menu ---- */
body.app-page { padding-left: var(--side-w); }
.sidenav {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 9;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%);
  color: var(--side-text);
  padding: max(16px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); margin-bottom: 8px; }
.side-logo { height: 40px; width: auto; display: block; }
.side-brand-text { display: grid; line-height: 1.25; padding-left: 10px; border-left: 2px solid var(--highlight); }
.side-brand-text span { font: 700 11px var(--font-brand); letter-spacing: 0.12em; text-transform: uppercase; color: #fff; }
.side-brand-text small { font-size: 10.5px; color: var(--side-muted); letter-spacing: 0.04em; }
.side-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; margin: 0 -4px; padding: 0 4px; }
.side-group { font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--side-muted); padding: 16px 10px 6px; }
.side-item {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  border: 0; background: transparent; color: var(--side-text); font: 500 13.5px/1.2 inherit;
  padding: 9px 10px; margin: 1px 0; border-radius: 9px; cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.side-item .ico { width: 17px; height: 17px; opacity: 0.85; }
.side-item:hover { background: var(--side-hover); color: #fff; border: 0; }
.side-item[aria-current="page"] { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--highlight); font-weight: 600; }
.side-item[aria-current="page"] .ico { opacity: 1; color: var(--highlight); }
.side-item .badge { margin-left: auto; }
.side-item:focus-visible { outline: 2px solid var(--highlight); outline-offset: -2px; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, 0.07); padding-top: 10px; margin-top: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 10px 8px; font-size: 13px; color: #fff; font-weight: 600; }
.avatar, .mini-avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; background: color-mix(in srgb, var(--highlight) 22%, transparent); color: var(--highlight); }
.avatar { width: 30px; height: 30px; font-size: 11.5px; }
.avatar:empty { display: none; }
.side-scrim { position: fixed; inset: 0; background: rgba(0, 10, 25, 0.45); z-index: 29; backdrop-filter: blur(2px); }

/* ---- the top bar ---- */
.topbar {
  flex-wrap: nowrap; gap: 14px; min-height: 64px;
  border-bottom: 1px solid var(--border); box-shadow: none;
  padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px;
  position: relative; z-index: 5;
}
.menu-btn { display: none; border: 0 !important; background: none !important; padding: 6px !important; color: var(--bar-text) !important; }
.menu-btn .ico { width: 24px; height: 24px; }
.topbar .brand { flex: 0 0 auto; }
.topbar .brand picture { display: none; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--bar-muted); white-space: nowrap; }
.crumb b { color: var(--bar-text); font: 700 15px var(--font-brand); }
.crumb-sep { opacity: 0.5; }
.topbar .filters { flex: 1 1 auto; max-width: 620px; margin-left: auto; }
.search-box { position: relative; flex: 2; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--bar-muted); pointer-events: none; width: 16px; height: 16px; }
.topbar .search-box input { padding-left: 34px; border-radius: 10px; }
.topbar .actions { flex: 0 0 auto; flex-wrap: nowrap; align-items: center; }
.topbar .actions button { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 8px 13px; font-weight: 600; }
.topbar .actions button.primary { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.todo-btn .badge { margin-left: 2px; }
body[data-role="shop"] .staff-only { display: none !important; }
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* Smooth: screens fade in, panels slide, buttons respond. */
.section-in { animation: sectionIn 0.22s var(--ease); }
@keyframes sectionIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
button { transition: border-color 0.15s, background-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s; }
button:active:not(:disabled) { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .section-in { animation: none; } button:active:not(:disabled) { transform: none; } .sidenav { transition: none !important; } }

/* ---- phones and small tablets ---- */
.bottom-bar { display: none; }
@media (max-width: 900px) {
  body.app-page { padding-left: 0; padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .sidenav { transform: translateX(-102%); transition: transform 0.25s var(--ease); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3); width: min(290px, 84vw); z-index: 30; }
  body.side-open .sidenav { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; min-height: 0; padding-left: max(8px, env(safe-area-inset-left)); }
  .topbar .brand picture { display: block; }
  .topbar .brand { flex: 1 1 auto; gap: 8px; }
  .brand-logo { height: 30px; }
  .crumb #brandCity, .crumb .crumb-sep { display: none; }
  .crumb b { font-size: 14px; }
  .topbar .filters { order: 5; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .topbar .actions { width: auto; margin: 0; padding: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .topbar .actions button:not(.clock-pill) span:not(.badge) { display: none; }
  .sidenav { overflow-y: auto; }
  .side-scroll { flex: none; overflow: visible; }
  .topbar .actions button { padding: 8px 10px; }
  .topbar .actions .todo-btn { display: none; }
  .topbar .actions button:last-child { margin-right: 0; }
  .bottom-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--panel); border-top: 1px solid var(--border); padding: 4px 6px env(safe-area-inset-bottom);
    box-shadow: 0 -4px 16px rgba(0, 20, 43, 0.06);
  }
  .bottom-bar button { position: relative; border: 0; background: none; display: grid; justify-items: center; gap: 2px; padding: 7px 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .bottom-bar button .ico { width: 22px; height: 22px; }
  .bottom-bar button[aria-current="page"] { color: var(--accent); }
  .bottom-bar .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; font-size: 10px; min-width: 17px; }
  .drawer { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

/* ---- Overview ---- */
.overview { overflow-y: auto; }
.ov { padding: 26px 30px 40px; max-width: 1500px; width: 100%; margin: 0 auto; display: grid; gap: 18px; }
.ov-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ov-head h1 { font: 700 25px/1.2 var(--font-brand); letter-spacing: -0.3px; margin: 0 0 4px; }
.ov-head p { margin: 0; color: var(--muted); }
.ov-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-actions button { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.ov-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--card-shadow); min-width: 0; }
.ov-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ov-kpi { text-align: left; cursor: pointer; display: grid; gap: 4px; align-content: start; font: inherit; color: inherit; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s; }
.ov-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 20, 43, 0.08); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.ov-klabel { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ov-klabel .ico { color: var(--accent); opacity: 0.8; }
.ov-kvalue { font: 700 28px/1.15 var(--font-brand); letter-spacing: -0.5px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.ov-trend { font-size: 12px; font-weight: 700; }
.ov-trend span { font-weight: 500; color: var(--muted); }
.ov-trend.good { color: var(--ok); }
.ov-trend.bad { color: var(--danger); }
.ov-trend.flat { font-weight: 500; }
.ov-ksub { font-size: 12px; color: var(--muted); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr); gap: 16px; }
.ov-sechead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.ov-sechead h2 { font-size: 15.5px; margin: 0; }
.ov-sechead .link-btn { font-size: 12.5px; font-weight: 600; padding: 2px 0; }
.ov-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ov-col { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 280px; display: flex; flex-direction: column; gap: 8px; }
.ov-colhead { display: flex; justify-content: space-between; align-items: center; font: 700 12.5px var(--font-brand); }
.ov-colhead .count { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); border-radius: 20px; padding: 1px 8px; font-size: 11px; }
.ov-colvalue { font-size: 11.5px; color: var(--muted); margin-top: -4px; font-weight: 600; }
.ov-lead {
  text-align: left; display: grid; gap: 2px; font: inherit; color: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 10px; padding: 10px 10px 8px;
  box-shadow: 0 1px 3px rgba(0, 20, 43, 0.05); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.ov-lead:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 20, 43, 0.09); border-color: var(--border); }
.ov-lead-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.ov-lead b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-lead small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-lead-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 6px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-size: 11px; color: var(--muted); }
.ov-lead-foot b { color: var(--text); font-size: 11.5px; white-space: nowrap; }
.ov-lead-foot span { min-width: 0; }
.ov-lead-foot .urgent { color: var(--danger); font-weight: 700; }
.ov-lead-foot .warn { color: var(--warn); font-weight: 700; }
.ov-lead-foot .ok { color: var(--ok); font-weight: 700; }
.ov-empty { margin: 8px 2px; }
.ov-more { font-size: 12px; align-self: flex-start; padding: 0 2px; }

/* Lead score and age, on the Overview and on the board. */
.heat { font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em; border-radius: 20px; padding: 2px 7px; white-space: nowrap; }
.heat.hot { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.heat.warm { background: color-mix(in srgb, var(--highlight) 20%, transparent); color: var(--warn); }
.heat.cold { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--link); }
.heat.booked { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.age-fresh { border-left-color: var(--ok) !important; }
.age-day { border-left-color: #e2b100 !important; }
.age-two { border-left-color: #ea7d1a !important; }
.age-stale { border-left-color: var(--danger) !important; }

/* Suggestions: the dark card, like the mockup's assistant panel. */
.ov-suggest { background: linear-gradient(135deg, var(--side) 0%, var(--side-2) 100%); border-color: transparent; color: #fff; }
.ov-suggest h2 { color: #fff; }
.ov-live { font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 20px; background: rgba(255, 173, 67, 0.16); color: var(--highlight); }
.ov-suggest-intro { color: #b9c7da; font-size: 12px; margin: -4px 0 8px; }
.ov-insight { width: 100%; text-align: left; display: flex; gap: 11px; align-items: flex-start; font: inherit; color: #fff; background: none; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); border-radius: 0; padding: 12px 2px; cursor: pointer; }
.ov-insight:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.1); }
.ov-insight b { font-size: 13px; display: block; }
.ov-insight small { display: block; color: #b9c7da; font-size: 11.5px; margin-top: 2px; }
.ov-spark { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 173, 67, 0.18); color: var(--highlight); flex: 0 0 auto; }
.ov-spark .ico { width: 15px; height: 15px; }

.ov-lower { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 16px; }
.ov-table { width: 100%; border-collapse: collapse; }
.ov-table th { text-align: left; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 6px; border-bottom: 1px solid var(--border); font-weight: 700; }
.ov-table td { padding: 11px 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ov-table tr:last-child td { border-bottom: 0; }
.ov-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ov-person { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.mini-avatar { width: 26px; height: 26px; font-size: 10px; }
.ov-conv { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.ov-bar { display: inline-block; width: 70px; height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.ov-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.ov-note { font-size: 11px; color: var(--muted); margin: 10px 0 0; }
.ov-dial { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ov-dialnum { font: 700 30px var(--font-brand); }
.ov-dialnum span { font: 500 13px system-ui, sans-serif; color: var(--muted); }
.ov-dialcopy { color: var(--muted); font-size: 12.5px; }
.ov-dialcopy b { color: var(--text); }
.ov-queue-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.ov-queue-stats b { color: var(--text); }
.ov-dialbtns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ov-dialbtns button { border-radius: 10px; padding: 9px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.ov-callbtn { background: color-mix(in srgb, var(--ok) 13%, var(--panel)) !important; color: var(--ok) !important; border-color: transparent !important; }
.ov-skeleton { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ov-card.sk { height: 120px; background: linear-gradient(90deg, var(--panel) 0%, var(--bg) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 1200px) { .ov-grid, .ov-lower { grid-template-columns: minmax(0, 1fr); } .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ov { padding: 16px 12px 28px; gap: 14px; }
  .ov-head h1 { font-size: 21px; }
  .ov-kpis { gap: 10px; }
  .ov-card { padding: 14px; }
  .ov-kvalue { font-size: 22px; }
  .ov-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ov-col { min-height: 0; }
  .ov-table th:nth-child(3), .ov-table td:nth-child(3), .ov-table th:nth-child(6), .ov-table td:nth-child(6) { display: none; }
  .ov-actions { width: 100%; }
}

/* Board cards: the score, value and how long it's waited. */
.lead-card { border-left: 3px solid var(--border); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.lead-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 20, 43, 0.09); }
.card-score { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-value { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-value.typical { color: var(--muted); font-weight: 600; }
.score-box { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.score-box summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.score-reasons { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.score-reasons li { display: flex; justify-content: space-between; gap: 10px; }
.score-reasons .neg { color: var(--danger); }
.score-form { display: grid; gap: 14px; }
.score-rules { display: grid; gap: 2px; }
.score-rule { display: grid; grid-template-columns: 1fr 84px; align-items: center; gap: 12px; margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; font-weight: 500; color: var(--text); }
.score-rule input { margin: 0; text-align: right; }
.score-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.score-lines .hint { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Leaderboard and a rep's page ---- */
.leaderboard { overflow-y: auto; }
.lb { padding: 26px 30px 40px; max-width: 1500px; width: 100%; margin: 0 auto; display: grid; gap: 18px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lb-top { display: grid; justify-items: center; gap: 4px; text-align: center; cursor: pointer; font: inherit; color: inherit; position: relative; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.lb-top:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 20, 43, 0.08); }
.lb-top.gold { border-top: 4px solid #e5b021; }
.lb-top.silver { border-top: 4px solid #a8b3c2; }
.lb-top.bronze { border-top: 4px solid #c27c46; }
.lb-rank { position: absolute; top: 10px; left: 14px; font: 700 13px var(--font-brand); color: var(--muted); }
.lb-avatar { width: 46px; height: 46px; font-size: 15px; }
.lb-big { font: 700 26px var(--font-brand); font-variant-numeric: tabular-nums; }
.lb-top small { color: var(--muted); font-size: 12px; }
.lb-table th.sorted, .lb-table td.sorted { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.lb-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.lb-row { cursor: pointer; }
.lb-row:hover td { background: var(--bg); }
.lb-pos { font-weight: 700; color: var(--muted); width: 28px; }
.lb-goal { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.lb-defs { margin-top: 12px; font-size: 12.5px; }
.lb-defs summary { cursor: pointer; color: var(--link); font-weight: 600; }
.lb-defs dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0 0; }
.lb-defs dt { font-weight: 700; }
.lb-defs dd { margin: 0; color: var(--muted); }
.rep-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rep-stat { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.rep-stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.rep-stat b { font: 700 21px var(--font-brand); font-variant-numeric: tabular-nums; }
.rep-stat small { font-size: 11.5px; color: var(--muted); }
.rep-goal-top { display: flex; justify-content: space-between; font-size: 14px; }
.rep-goal-bar { height: 10px; border-radius: 10px; background: var(--bg); overflow: hidden; margin: 8px 0; }
.rep-goal-bar i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--highlight)); }
.rep-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 170px; }
.rep-month { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; height: 100%; gap: 4px; }
.rep-month-val { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rep-month-bar { width: 70%; display: flex; align-items: flex-end; background: var(--bg); border-radius: 6px; overflow: hidden; }
.rep-month-bar i { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; }
.rep-month-label { font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) { .lb-podium { grid-template-columns: 1fr; } .lb { padding: 16px 12px 28px; } }

/* AI call score and the suggested next step */
.call-scorecard { margin: 6px 0; }
.call-scorecard summary { cursor: pointer; font-size: 13px; }
.score-pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 20px; }
.score-pill.good { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.score-pill.ok { background: color-mix(in srgb, var(--highlight) 22%, transparent); color: var(--warn); }
.score-pill.low { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.rubric { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 5px; font-size: 12.5px; }
.rubric li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.rubric-dots { display: inline-flex; gap: 3px; }
.rubric-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.rubric-dots i.on { background: var(--accent); }
.call-next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.calls-coach { display: grid; gap: 8px; }
.coach-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.coach-bars li { display: grid; grid-template-columns: minmax(140px, 1fr) 120px 34px; gap: 10px; align-items: center; }
.coach-bars li b { text-align: right; font-variant-numeric: tabular-nums; }
.coach-bars li.weakest span:first-child { color: var(--danger); font-weight: 700; }
.coach-bars .ov-bar { width: 100%; }
.ai-settings { display: grid; gap: 4px; }
.inline-num { width: 64px !important; display: inline-block; margin: 0 4px !important; padding: 4px 6px !important; }

/* Automations */
.auto-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.auto-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.auto-row:last-child { border-bottom: 0; }
.auto-row.off .auto-name b { color: var(--muted); }
.auto-main { display: grid; gap: 3px; min-width: 0; }
.auto-name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.auto-when { font-size: 12.5px; color: var(--muted); }
.auto-needs { font-size: 12px; color: var(--warn); font-weight: 600; }
.auto-tag { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.auto-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; margin: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; border-radius: 24px; background: var(--border); transition: background 0.2s var(--ease); }
.switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s var(--ease); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Admin log */
.audit-filter { margin-bottom: 12px; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 4px; }
.audit-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-row.warn .audit-what { color: var(--danger); }
.audit-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-meta { color: var(--muted); font-size: 11.5px; text-align: right; }
@media (max-width: 640px) { .audit-row { grid-template-columns: 60px 1fr; } .audit-meta { grid-column: 2; text-align: left; } }

/* Overview mini cards: always fit the column. Long names shorten with "…", the score tag drops under the
   name when there's no room, and the next step and amount share the bottom line or stack. */
.ov-col { min-width: 0; }
.ov-lead { width: 100%; min-width: 0; overflow: hidden; box-sizing: border-box; }
.ov-lead-top { flex-wrap: wrap; min-width: 0; }
.ov-lead-top { gap: 3px 6px; }
.ov-lead-top b { flex: 1 1 auto; min-width: 0; }
.ov-lead-top .heat { flex: none; }
.ov-lead small { display: block; min-width: 0; }
.ov-lead-foot { min-width: 0; align-items: baseline; }
.ov-lead-foot span { flex: 1 1 auto; min-width: 0; }
.ov-lead-foot b { flex: none; margin-left: auto; }

/* Mid-size windows: the top bar's buttons go to icons (with their badges) so nothing runs off the edge. */
@media (min-width: 901px) and (max-width: 1180px) {
  .topbar .actions button:not(.clock-pill):not(.primary) span:not(.badge) { display: none; }
  .crumb #brandCity, .crumb .crumb-sep { display: none; }
}
@media (min-width: 901px) and (max-width: 1020px) {
  .topbar .actions button.primary span { display: none; }
}

/* ---- Calendar, in the new look (cards, soft corners, a header like Overview) ---- */
.calendar { padding: 24px 30px 36px; gap: 16px; }
.cal-toolbar { gap: 12px 16px; }
.cal-title { font: 700 25px/1.2 var(--font-brand); letter-spacing: -0.3px; }
.cal-nav { gap: 6px; }
.nav-arrow { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; line-height: 1; border-radius: 10px; font-size: 24px; box-shadow: var(--card-shadow); }
#calTodayBtn { height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 600; box-shadow: var(--card-shadow); }
#shopHoursBtn { height: 38px; border-radius: 10px; font-weight: 600; }
.segmented { border-radius: 11px; padding: 3px; box-shadow: var(--card-shadow); }
.segmented button { border-radius: 8px; padding: 7px 14px; font-size: 13px; }

.cal-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cal-stat { display: grid; gap: 3px; text-align: left; font: inherit; color: inherit; padding: 14px 16px; border-top: 3px solid var(--st, var(--border)); }
button.cal-stat { cursor: pointer; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
button.cal-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 20, 43, 0.08); }
.cal-stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cal-stat-value { font: 700 26px/1.15 var(--font-brand); font-variant-numeric: tabular-nums; }
.cal-stat-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-stat.full { --st: var(--warn); }
.cal-stat.over { --st: var(--danger); }
.cal-stat.over .cal-stat-value { color: var(--danger); }

.cal-legend { gap: 6px; }
.legend-item { padding: 3px 10px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); font-weight: 600; color: var(--text); font-size: 11.5px; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; }
.cal-unscheduled { border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: 12px; background: var(--panel); padding: 12px 14px; box-shadow: var(--card-shadow); }
.waiting-chip { border-radius: 20px; padding: 5px 12px; font-weight: 600; background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }

/* Month */
.cal-month { border-radius: var(--radius); box-shadow: var(--card-shadow); }
.cal-dow { background: var(--panel); padding: 10px 12px; font-size: 11px; letter-spacing: 0.1em; }
.cal-mweek { min-height: 118px; }
.cal-mweek > .cal-cell-top { padding: 8px 8px 4px; }
.cal-cell { transition: background 0.15s; }
.cal-cell.today, .cal-cell-top.today { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.cal-date { font-size: 13px; min-width: 26px; height: 26px; display: inline-grid; place-items: center; padding: 0 7px; }
.cal-cell.today .cal-date, .cal-cell-top.today .cal-date { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.job-chip { border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.bar { margin: 0 8px 4px; }
.off-bar { border-radius: 7px; padding: 4px 9px; }

/* Week and list */
.week-col { border-radius: var(--radius); background: var(--panel); box-shadow: var(--card-shadow); }
.week-col.weekend { background: color-mix(in srgb, var(--bg) 55%, var(--panel)); }
.week-col.today { box-shadow: inset 0 3px 0 var(--accent), var(--card-shadow); }
.week-bar { border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 20, 43, 0.06); }

@media (max-width: 1100px) { .cal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .calendar { padding: 14px 12px 24px; gap: 12px; }
  .cal-title { font-size: 20px; }
  .cal-stats { gap: 10px; }
  .cal-stat { padding: 11px 12px; }
  .cal-stat-value { font-size: 21px; }
}
/* Phones: a compact calendar header, so the days are on screen sooner. */
@media (max-width: 640px) {
  .cal-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
  .cal-toolbar .cal-title { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .cal-toolbar .cal-nav { grid-column: 1; grid-row: 2; }
  .cal-toolbar #calViews { grid-column: 2 / -1; grid-row: 2; justify-self: stretch; display: grid; grid-template-columns: repeat(4, 1fr); }
  .cal-toolbar #calViews button { padding: 7px 2px; font-size: 12px; white-space: nowrap; }
  .cal-toolbar #shopHoursBtn { grid-column: 1 / -1; grid-row: 3; justify-self: start; height: 32px; font-size: 13px; padding: 0 10px; }
  .nav-arrow, #calTodayBtn { height: 36px; }
  .nav-arrow { width: 34px; }
  .cal-stats { gap: 8px; }
  .cal-stat { padding: 9px 11px; gap: 1px; }
  .cal-stat-label { font-size: 11.5px; }
  .cal-stat-value { font-size: 19px; }
  .cal-stat-sub { font-size: 11px; }
  .cal-legend { gap: 4px; }
  .legend-item { padding: 2px 8px; font-size: 10.5px; }
}

/* ---- Leads board, in the new look (a header like Overview, stat cards, soft white columns) ---- */
.lp-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 22px 30px 4px; min-width: 0; }
.lp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.lp-title { min-width: 0; }
.lp-head > * { min-width: 0; }
.lp-title h1 { font: 700 25px/1.2 var(--font-brand); letter-spacing: -0.3px; margin: 0 0 4px; }
.lp-title p { margin: 0; color: var(--muted); font-size: 13.5px; }
.lp-title p[hidden] { display: none; }
.lp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.lp-stats[hidden] { display: none; }
.lp-stats .cal-stat { padding: 12px 16px; }
.lp-stats .cal-stat-value { font-size: 23px; }
.lp-stats .st-open { --st: var(--accent); }
.lp-stats .st-value { --st: var(--ok); }
.lp-stats .st-hot { --st: var(--danger); }
.lp-stats .st-due { --st: var(--warn); }
.lp-stats .st-ok { --st: var(--ok); }

/* Pipeline tabs: a segmented control like the calendar's Month / Week / List. */
.pipeline-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 11px; background: var(--panel); box-shadow: var(--card-shadow); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.pipeline-tabs::-webkit-scrollbar { display: none; }
.pipeline-tab { border: 0; border-radius: 8px; margin: 0; padding: 7px 12px; font-family: inherit; font-weight: 600; font-size: 13px; color: var(--muted); box-shadow: none; }
.pipeline-tab:hover { color: var(--text); background: var(--bg); }
.pipeline-tab[aria-selected="true"], .pipeline-tab.old-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border: 0; box-shadow: none; }
.pipeline-tab .count { margin-left: 6px; padding: 0 7px; border: 0; border-radius: 20px; background: color-mix(in srgb, var(--muted) 14%, transparent); color: inherit; font-size: 11.5px; }
.pipeline-tab[aria-selected="true"] .count { background: color-mix(in srgb, var(--accent-text) 22%, transparent); }
.pipeline-tabs .spacer { flex: 0 0 4px; align-self: stretch; margin: 4px 4px; border-left: 1px solid var(--border); }
.export-link { margin: 0; padding: 6px 12px; border-radius: 8px; border: 0; background: color-mix(in srgb, var(--ok) 11%, transparent); font-size: 13px; }
.export-link:hover { background: color-mix(in srgb, var(--ok) 18%, transparent); }

/* The "texted back / due for a call" line: a card with a colored edge, like the calendar's notices. */
.due-banner { margin: 0; padding: 11px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--warn); box-shadow: var(--card-shadow); font-size: 13.5px; font-weight: 500; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.due-banner:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 20, 43, 0.09); }
.due-banner[hidden] { display: none; }

/* Columns: soft panels with the stage, its count and what it's worth. */
.board { gap: 14px; padding: 16px 30px 24px; }
.column { flex: 0 0 272px; background: color-mix(in srgb, var(--bg) 55%, var(--panel)); border: 1px solid var(--border); border-radius: var(--radius); }
.column.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.column-head { display: grid; gap: 2px; padding: 12px 14px 8px; border-bottom: 0; font-weight: 700; }
.column-title { display: flex; align-items: center; gap: 8px; font: 700 14px var(--font-brand); min-width: 0; }
.column-title > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.column-head .count { margin-left: auto; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; }
.column-value { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-left: 16px; }
.column[data-stage="booked"] .column-head { color: inherit; }
.column[data-stage="booked"] .column-dot { background: var(--ok); }
.column[data-stage="booked"] .count { background: color-mix(in srgb, var(--ok) 13%, var(--panel)); color: var(--ok); }
.column[data-stage="waste"] .column-dot { background: var(--muted); }
.column[data-stage="waste"] .count { background: color-mix(in srgb, var(--muted) 14%, var(--panel)); color: var(--muted); }
.column[data-stage="waste"] .column-head { color: var(--muted); }
.cards { padding: 4px 10px 12px; gap: 10px; }
.empty { margin: 4px 0; padding: 22px 8px; border: 1.5px dashed var(--border); border-radius: 12px; font-size: 12.5px; }

/* Cards: rounder, a little more room, soft shadow. */
.lead-card { border-radius: 12px; padding: 12px 13px; box-shadow: var(--card-shadow); }
.lead-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.lead-card .name { font: 700 14px var(--font-brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lead-card .row > * { min-width: 0; }
.lead-card .row .pill, .lead-card .row .tag { flex: none; white-space: nowrap; }
.lead-card .vehicle { margin-top: 6px; }
.pill { border-radius: 20px; padding: 2px 8px; font-weight: 600; }
.pill.due { background: color-mix(in srgb, var(--danger) 11%, transparent); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.pill.today { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill.promise { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.card-times { border-top-style: solid; margin-top: 8px; padding-top: 8px; }
.best-time { border-radius: 8px; padding: 5px 9px; }

/* Past Customers and Old & Dead show their name in the header now. */
.old-view { padding: 12px 30px 28px; }
.old-view .old-head h2 { display: none; }
.old-view .old-head p { margin-top: 0; }

/* Mid-size windows */
@media (max-width: 1200px) {
  .lp-stats { gap: 10px; }
  .lp-stats .cal-stat { padding: 10px 12px; }
  .lp-stats .cal-stat-value { font-size: 20px; }
}
/* Tablets and phones */
@media (max-width: 900px) {
  .lp-top { padding: 16px 16px 2px; gap: 12px; }
  .board { padding: 12px 16px 16px; }
  .old-view { padding: 10px 16px 24px; }
}
@media (max-width: 640px) {
  .lp-top { padding: 12px 12px 0; gap: 10px; }
  .lp-title h1 { font-size: 20px; margin: 0; }
  .lp-title p { display: none; }
  .lp-head { gap: 8px; }
  .pipeline-tabs { width: 100%; }
  .pipeline-tab { padding: 7px 9px; font-size: 12.5px; flex: none; }
  .pipeline-tab .count { margin-left: 4px; padding: 0 6px; }
  .lp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .lp-stats .cal-stat { padding: 8px 8px 7px; border-top-width: 3px; }
  .lp-stats .cal-stat-label { font-size: 10.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lp-stats .cal-stat-value { font-size: 17px; }
  .lp-stats .cal-stat-sub { display: none; }
  .due-banner { margin: 0; padding: 9px 11px; font-size: 13px; }
  .board { padding: 10px 12px 12px; }
  .column { flex-basis: 85vw; }
  .old-view { padding: 8px 12px 24px; }
}

/* Clock-ins away from the shop (Time & Pay): room for the date and time so it doesn't run into the name. */
.tp-away .tp-occ li { grid-template-columns: 170px 100px auto minmax(0, 1fr); }
.tp-away .tp-occ-date { overflow: hidden; text-overflow: ellipsis; }
.tp-away .tp-occ-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .tp-away .tp-occ li { grid-template-columns: auto auto 1fr; }
  .tp-away .tp-occ-detail { grid-column: 1 / -1; }
}

/* ---- Menu emoji: one per menu item, each with its own little animation on hover or tap ---- */
.emo { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; font-size: 16px; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; transform-origin: 50% 60%; will-change: transform; }
.grp-emo { margin-right: 6px; font-size: 11px; letter-spacing: 0; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
html:not([data-icons="lines"]) .side-item > .ico, html:not([data-icons="lines"]) .bottom-bar button > .ico { display: none; }
html[data-icons="lines"] .emo, html[data-icons="lines"] .grp-emo { display: none; }
.side-item[aria-current="page"] .emo { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--highlight) 55%, transparent)); transform: scale(1.12); }
.bottom-bar .emo { width: 24px; height: 24px; font-size: 20px; }
.bottom-bar button[aria-current="page"] .emo { transform: scale(1.14); }
.bottom-bar button:not([aria-current="page"]) .emo { filter: saturate(0.75); opacity: 0.85; }

/* Items with something waiting (a badge) give a small nudge every few seconds. */
.side-item:has(.badge:not([hidden])) .emo { animation: emo-nudge 7s ease-in-out infinite; }

/* Each animation plays on hover, or once when tapped (.play). */
.side-item:hover .emo[data-anim="pop"], .emo.play[data-anim="pop"] { animation: emo-pop 0.5s var(--ease); }
.side-item:hover .emo[data-anim="hit"], .emo.play[data-anim="hit"] { animation: emo-hit 0.55s var(--ease); }
.side-item:hover .emo[data-anim="flip"], .emo.play[data-anim="flip"] { animation: emo-flip 0.6s var(--ease); }
.side-item:hover .emo[data-anim="ring"], .emo.play[data-anim="ring"] { animation: emo-ring 0.7s ease-in-out; }
.side-item:hover .emo[data-anim="bell"], .emo.play[data-anim="bell"] { animation: emo-bell 0.9s ease-in-out; transform-origin: 50% 8%; }
.side-item:hover .emo[data-anim="jump"], .emo.play[data-anim="jump"] { animation: emo-jump 0.6s var(--ease); }
.side-item:hover .emo[data-anim="rise"], .emo.play[data-anim="rise"] { animation: emo-rise 0.6s var(--ease); }
.side-item:hover .emo[data-anim="sway"], .emo.play[data-anim="sway"] { animation: emo-sway 0.8s ease-in-out; }
.side-item:hover .emo[data-anim="jingle"], .emo.play[data-anim="jingle"] { animation: emo-jingle 0.7s ease-in-out; transform-origin: 50% 100%; }
.side-item:hover .emo[data-anim="flash"], .emo.play[data-anim="flash"] { animation: emo-flash 0.55s ease-out; }
.side-item:hover .emo[data-anim="fly"], .emo.play[data-anim="fly"] { animation: emo-fly 0.7s var(--ease); }
.side-item:hover .emo[data-anim="spin"], .emo.play[data-anim="spin"] { animation: emo-spin 0.7s var(--ease); transform-origin: 50% 50%; }
.side-item:hover .emo[data-anim="zap"], .emo.play[data-anim="zap"] { animation: emo-zap 0.6s steps(1, end); }
.side-item:hover .emo[data-anim="swing"], .emo.play[data-anim="swing"] { animation: emo-swing 0.8s ease-in-out; transform-origin: 20% 10%; }
.side-item:hover .emo[data-anim="flicker"], .emo.play[data-anim="flicker"] { animation: emo-flicker 0.7s ease-in-out; transform-origin: 50% 100%; }
.side-item:hover .emo[data-anim="drop"], .emo.play[data-anim="drop"] { animation: emo-drop 0.6s var(--ease); }
.side-item:hover .emo[data-anim="pulse"], .emo.play[data-anim="pulse"] { animation: emo-pulse 0.7s ease-in-out; }
.side-item:hover .emo[data-anim="wiggle"], .emo.play[data-anim="wiggle"] { animation: emo-wiggle 0.6s ease-in-out; }

@keyframes emo-nudge { 0%, 88%, 100% { transform: none; } 91% { transform: rotate(-14deg) scale(1.1); } 94% { transform: rotate(12deg) scale(1.1); } 97% { transform: rotate(-6deg); } }
@keyframes emo-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 70% { transform: scale(0.92); } 100% { transform: scale(1); } }
@keyframes emo-hit { 0% { transform: scale(1); } 30% { transform: scale(0.8); } 55% { transform: scale(1.25) rotate(8deg); } 75% { transform: scale(0.95) rotate(-4deg); } 100% { transform: none; } }
@keyframes emo-flip { 0% { transform: perspective(80px) rotateX(0); } 50% { transform: perspective(80px) rotateX(-180deg); } 100% { transform: perspective(80px) rotateX(-360deg); } }
@keyframes emo-ring { 0%, 100% { transform: none; } 10%, 30%, 50%, 70% { transform: rotate(-16deg) scale(1.1); } 20%, 40%, 60%, 80% { transform: rotate(16deg) scale(1.1); } }
@keyframes emo-bell { 0%, 100% { transform: none; } 15% { transform: rotate(24deg); } 30% { transform: rotate(-20deg); } 45% { transform: rotate(14deg); } 60% { transform: rotate(-9deg); } 75% { transform: rotate(4deg); } }
@keyframes emo-jump { 0%, 100% { transform: none; } 30% { transform: translateY(-7px) scale(1.12); } 50% { transform: translateY(0) scale(1.15, 0.85); } 70% { transform: translateY(-2px); } }
@keyframes emo-rise { 0% { transform: none; } 45% { transform: translate(3px, -5px) scale(1.15); } 100% { transform: none; } }
@keyframes emo-sway { 0%, 100% { transform: none; } 25% { transform: translateY(-3px) rotate(-12deg); } 50% { transform: translateY(1px) rotate(8deg); } 75% { transform: translateY(-2px) rotate(-5deg); } }
@keyframes emo-jingle { 0%, 100% { transform: none; } 20% { transform: scale(1.1, 0.9); } 40% { transform: translateY(-5px) rotate(-10deg) scale(1.1); } 60% { transform: translateY(-2px) rotate(10deg); } 80% { transform: rotate(-4deg); } }
@keyframes emo-flash { 0% { transform: none; filter: none; } 25% { transform: scale(1.25); filter: brightness(1.9) drop-shadow(0 0 8px #fff); } 100% { transform: none; filter: none; } }
@keyframes emo-fly { 0% { transform: none; opacity: 1; } 40% { transform: translate(14px, -6px) rotate(12deg); opacity: 0; } 41% { transform: translate(-12px, 4px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes emo-spin { from { transform: rotate(0); } to { transform: rotate(-360deg); } }
@keyframes emo-zap { 0%, 100% { transform: none; filter: none; } 15% { transform: scale(1.3) skewX(-8deg); filter: brightness(1.8); } 30% { transform: scale(0.95); filter: none; } 45% { transform: scale(1.2) skewX(6deg); filter: brightness(1.6); } 60% { transform: none; } }
@keyframes emo-swing { 0%, 100% { transform: none; } 25% { transform: rotate(18deg); } 50% { transform: rotate(-12deg); } 75% { transform: rotate(6deg); } }
@keyframes emo-flicker { 0%, 100% { transform: none; } 20% { transform: scale(1.05, 1.2) skewX(4deg); } 40% { transform: scale(0.95, 1.05) skewX(-5deg); } 60% { transform: scale(1.08, 1.25) skewX(3deg); } 80% { transform: scale(1, 1.08); } }
@keyframes emo-drop { 0% { transform: translateY(-9px); opacity: 0; } 50% { transform: translateY(2px); opacity: 1; } 70% { transform: translateY(-2px); } 100% { transform: none; } }
@keyframes emo-pulse { 0%, 100% { transform: none; filter: none; } 50% { transform: scale(1.2); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--highlight) 70%, transparent)); } }
@keyframes emo-wiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-15deg); } 40% { transform: rotate(13deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }

@media (prefers-reduced-motion: reduce) { .emo, .emo.play { animation: none !important; } }
.icons-pick { margin-bottom: 4px; }
.icons-pick button { font-family: inherit; }
.icons-pick button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); }

/* ---- Social: calendar, drafts, the editor with a phone preview ---- */
#socialPanel.drawer.wide { width: min(1120px, 100vw); }
.soc-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.soc-tabs button { white-space: nowrap; }
.soc-empty { padding: 26px 8px; text-align: center; border: 1.5px dashed var(--border); border-radius: 12px; }
.soc-urgent { color: var(--danger); font-weight: 600; }
.soc-cal { display: grid; gap: 14px; }
.soc-plan-list { display: grid; gap: 8px; }
.soc-plan { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: 12px; background: var(--panel); }
.soc-plan.approved { border-left-color: var(--ok); }
.soc-plan-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; border: 0; background: none; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.soc-plan-text { display: grid; gap: 2px; min-width: 0; font-size: 12.5px; }
.soc-plan-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-plan-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.soc-thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; display: inline-grid; place-items: center; background: var(--bg); font-size: 20px; color: var(--muted); }
.soc-thumb.clip { background: #0b1626; color: #fff; }
.soc-done-top .soc-thumb { width: 36px; height: 36px; font-size: 15px; }

.soc-month-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.soc-month-head h3 { margin: 0; min-width: 160px; text-align: center; }
.soc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; }
.soc-dow { background: var(--panel); padding: 6px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.soc-day { background: var(--panel); min-height: 84px; padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.soc-day.other { background: color-mix(in srgb, var(--bg) 60%, var(--panel)); }
.soc-day.other .soc-day-n { opacity: 0.45; }
.soc-day.today { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.soc-day.today .soc-day-n { background: var(--accent); color: var(--accent-text); }
.soc-day-n { align-self: flex-start; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; }
.soc-chip { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--st, var(--muted)); border-radius: 6px; padding: 2px 6px; font-size: 11px; line-height: 1.3; background: color-mix(in srgb, var(--st, var(--muted)) 13%, var(--panel)); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.soc-chip b { font-weight: 700; }
.soc-chip.scheduled { --st: var(--warn); }
.soc-chip.approved { --st: var(--ok); }
.soc-chip.posted { --st: #1f63c6; }
.soc-chip.missed { --st: var(--danger); text-decoration: line-through; }
.soc-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.soc-legend .soc-chip { width: auto; cursor: default; }

.soc-drafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.soc-draft { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); font: inherit; color: inherit; cursor: pointer; box-shadow: var(--card-shadow); transition: transform 0.15s var(--ease); }
.soc-draft:hover { transform: translateY(-1px); }
.soc-draft.missed { border-left: 4px solid var(--danger); }
.soc-draft-text { display: grid; gap: 2px; min-width: 0; font-size: 12.5px; }
.soc-draft-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.soc-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.soc-ed-left { display: grid; gap: 10px; min-width: 0; }
.soc-back { justify-self: start; }
.soc-ed-title { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.soc-status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: color-mix(in srgb, var(--muted) 14%, transparent); }
.soc-status.scheduled { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.soc-status.approved, .soc-status.posted { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.soc-status.failed { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.soc-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13.5px; }
.soc-facts dt { color: var(--muted); font-weight: 600; }
.soc-facts dd { margin: 0; }
.soc-caption-view { margin: 0; white-space: pre-line; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 13.5px; }
.soc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.soc-missed { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); font-size: 13px; }
.soc-cap-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.soc-write { font-size: 13px; padding: 5px 12px; border-radius: 20px; background: color-mix(in srgb, var(--highlight) 18%, var(--panel)); border-color: color-mix(in srgb, var(--highlight) 45%, var(--border)); color: var(--text); font-weight: 600; }

.soc-strip, .soc-grid-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.soc-tile { position: relative; width: 92px; height: 92px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); background: var(--bg); cursor: pointer; flex: none; }
.soc-tile img, .soc-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.soc-tile.on { border-color: var(--link); }
.soc-tile.add { display: grid; place-items: center; border-style: dashed; color: var(--link); font-weight: 700; font-size: 13px; }
.soc-tile .soc-order { top: 4px; left: 4px; right: auto; }
.soc-tile .soc-phase { left: auto; right: 4px; bottom: 4px; }
.soc-phase.clip { background: #0b1626; }
.soc-check { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--link); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.soc-tile-tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: 2px; padding: 3px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); opacity: 0; transition: opacity 0.15s; }
.soc-tile:hover .soc-tile-tools, .soc-tile:focus-within .soc-tile-tools { opacity: 1; }
@media (hover: none) { .soc-tile-tools { opacity: 1; } }
.soc-tile-tools button { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: #111; font-weight: 800; line-height: 1; }
.soc-picker { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--bg) 55%, var(--panel)); max-height: 420px; overflow: auto; }
.soc-picker[hidden] { display: none; }
.soc-picker-tabs { justify-self: start; }
.soc-picker-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.soc-job-group { display: grid; gap: 6px; }
.soc-job-name { font-size: 13px; }
.soc-upload { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px dashed var(--link); color: var(--link); font-weight: 600; font-size: 13px; cursor: pointer; background: var(--panel); }
.soc-style { justify-self: start; }
.soc-reel-box { display: grid; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
.soc-reel-box[hidden] { display: none; }
.soc-render { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.soc-ai { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.soc-ai.off summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.soc-ai-state { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.soc-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.soc-ai-ready { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ok); font-weight: 600; }
.soc-ai-ready video { width: 54px; height: 96px; object-fit: cover; border-radius: 8px; background: #000; }
.soc-ai-actions { display: flex; gap: 8px; align-items: center; }
.soc-when { display: grid; gap: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.soc-when input { max-width: 260px; }
.soc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text); }
.soc-days { width: 70px; }
.soc-settings-wrap { display: grid; gap: 14px; }
.soc-settings h3 { margin: 6px 0 0; }

/* The phone preview */
.soc-editor .soc-preview { position: sticky; top: 0; background: var(--panel); }
.soc-pv-frame { aspect-ratio: 4 / 5; overflow: hidden; }
.soc-preview.reel .soc-pv-frame { aspect-ratio: 9 / 16; }
.soc-pv-stage, .soc-pv-slide, .soc-pv-end { position: absolute; inset: 0; }
.soc-pv-slide { overflow: hidden; animation: socIn 0.45s var(--ease); }
@keyframes socIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.soc-pv-frame .soc-pv-bg { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(14px) brightness(0.7); }
.soc-pv-frame .soc-pv-fg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.soc-pv-slide.zoom .soc-pv-fg { animation: socZoom 2.6s linear both; }
@keyframes socZoom { from { transform: scale(1); } to { transform: scale(1.08); } }
.soc-pv-label { position: absolute; top: 9%; left: 6%; padding: 2px 8px; font: 800 11px var(--font-brand); letter-spacing: 0.06em; background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 4px; }
.soc-pv-ai { position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%); padding: 2px 8px; font-size: 10px; font-weight: 700; background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 4px; }
.soc-pv-hook { position: absolute; top: 17%; left: 8%; right: 8%; text-align: center; font: 800 18px/1.2 var(--font-brand); color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); padding: 6px 8px; background: rgba(0, 0, 0, 0.35); border-radius: 8px; }
.soc-pv-end { display: grid; place-content: center; justify-items: center; gap: 10px; background: #0b1626; color: #fff; text-align: center; padding: 20px; animation: socIn 0.45s var(--ease); }
.soc-pv-end img { width: 70%; max-width: 180px; }
.soc-pv-end-text { font: 700 17px var(--font-brand); }
.soc-pv-phone { color: #f2b134; font-weight: 700; font-size: 15px; }
.soc-pv-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa7b8; font-size: 13px; padding: 20px; text-align: center; }
.soc-pv-real { padding: 10px; display: grid; gap: 6px; }
.soc-pv-real[hidden] { display: none; }
.soc-pv-video { width: 100%; border-radius: 10px; background: #000; max-height: 480px; }
.soc-type-dialog { border: 0; border-radius: 16px; padding: 20px; width: min(520px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.soc-type-dialog::backdrop { background: rgba(0, 10, 25, 0.45); }
.soc-type-dialog h3 { margin: 0 0 12px; }
.soc-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.soc-type { display: grid; justify-items: center; gap: 4px; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); font-weight: 600; font-size: 13px; }
.soc-type:hover { border-color: var(--accent); }
.soc-type-icon { font-size: 26px; }

@media (max-width: 900px) {
  .soc-editor { grid-template-columns: minmax(0, 1fr); }
  .soc-editor .soc-preview { position: static; max-width: 300px; justify-self: center; width: 100%; }
}
@media (max-width: 640px) {
  .soc-row2 { grid-template-columns: minmax(0, 1fr); }
  .soc-day { min-height: 58px; padding: 3px; }
  .soc-chip { font-size: 9.5px; padding: 1px 3px; }
  .soc-chip b { display: none; }
  .soc-dow { padding: 4px; font-size: 9px; }
  .soc-tile { width: 76px; height: 76px; }
  .soc-plan { flex-wrap: wrap; }
  .soc-plan-actions { width: 100%; justify-content: flex-end; }
  .soc-tabs { width: 100%; }
  .soc-tabs button { padding: 7px 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .soc-pv-slide, .soc-pv-end, .soc-pv-slide.zoom .soc-pv-fg { animation: none; } }

/* ---- The customer signing screen: full screen and locked, made for a finger on a phone ---- */
body.signing { overflow: hidden; overscroll-behavior: none; }
body.signing .toasts { z-index: 1001; }
.signoff-start { min-height: 48px; font-size: 16px; }
.sign-screen {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  background: var(--bg); color: var(--text); overscroll-behavior: none; touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  animation: signIn 0.2s var(--ease);
}
@keyframes signIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.sign-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border); flex: none; }
.sign-title { display: grid; min-width: 0; }
.sign-title strong { font: 700 17px var(--font-brand); }
.sign-title span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-btn { min-height: 48px; padding: 0 18px; border-radius: 12px; font-size: 16px; font-weight: 600; background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.sign-cancel { min-height: 40px; font-size: 14px; flex: none; }
.sign-big { min-height: 52px; padding: 0 26px; border-radius: 12px; font-size: 17px; font-weight: 700; }
.sign-big:disabled { opacity: 0.45; }
.sign-screen[data-step="review"] .sign-pad, .sign-screen[data-step="sign"] .sign-review { display: none; }

/* Step 1: review and tick */
.sign-review { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; display: grid; gap: 12px; align-content: start; width: 100%; max-width: 720px; margin: 0 auto; }
.sign-terms { display: grid; gap: 12px; padding: 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.sign-lead { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
.sign-notes p { margin: 4px 0 0; white-space: pre-wrap; font-size: 15px; }
.sign-notes b, .sign-photos b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sign-thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 6px; padding-bottom: 2px; }
.sign-thumbs img { width: 76px; height: 76px; flex: none; object-fit: cover; border-radius: 10px; background: var(--bg); }
.sign-tick { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); font-size: 16px; line-height: 1.4; color: var(--text); font-weight: 500; cursor: pointer; }
.sign-tick:has(input:checked) { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.sign-check { width: 28px; height: 28px; flex: none; margin: 0; accent-color: var(--ok); }
.sign-review > .sign-big { width: 100%; margin-top: 4px; }

/* Step 2: the whole screen is the signing area */
.sign-pad { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.sign-canvas { flex: 1; min-height: 0; width: 100%; display: block; background: #fff; border: 2px dashed #c7ced8; border-radius: 16px; touch-action: none; cursor: crosshair; }
.sign-line { position: absolute; left: 30px; right: 30px; bottom: calc(66px + 20%); display: flex; align-items: flex-end; gap: 8px; color: #9aa4b2; pointer-events: none; }
.sign-line span { font-size: 22px; line-height: 1; }
.sign-line i { flex: 1; border-bottom: 2px solid #c7ced8; }
.sign-line small { position: absolute; left: 30px; top: calc(100% + 6px); font-size: 13px; }
.sign-pad-bar { display: flex; gap: 8px; align-items: center; flex: none; }
.sign-pad-bar .sign-big { margin-left: auto; min-width: 140px; }
.sign-rotate { display: none; margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
@media (orientation: portrait) and (max-width: 600px) {
  .sign-screen[data-step="sign"] .sign-rotate { display: block; }
  .sign-line { bottom: calc(92px + 18%); }
}
/* Phones held sideways: everything compact so the signing area gets the height. */
@media (orientation: landscape) and (max-height: 500px) {
  .sign-head { padding: 4px 12px; }
  .sign-title strong { font-size: 15px; }
  .sign-pad { padding: 6px 10px; gap: 6px; }
  .sign-btn { min-height: 42px; }
  .sign-big { min-height: 44px; }
  .sign-line { bottom: calc(56px + 18%); }
  .sign-review { padding: 10px 14px; }
}

/* Import: the Zoho steps and the "everyone already booked" box */
.import-howto { margin-top: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.import-howto summary { cursor: pointer; font-weight: 600; color: var(--link); }
.import-howto ol { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
.import-booked { margin: 6px 0 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }

/* ---- Imported leads: sortable table, filters, bulk bar ---- */
.imp-filters .imp-search { flex: 1 1 260px; }
.imp-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.imp-sort.on { color: var(--accent); }
.imp-arrow { font-size: 10px; opacity: 0.55; }
.imp-sort.on .imp-arrow { opacity: 1; }
table.imported-table { min-width: 1100px; table-layout: auto; }
.imported-table th.imp-check, .imported-table td.imp-check { width: 36px; text-align: center; }
.imported-table input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.imported-table tr.picked td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.imp-stage { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: color-mix(in srgb, var(--muted) 13%, transparent); }
.imp-stage.stage-booked { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.imp-stage.stage-waste { color: var(--muted); }
.imp-stage.stage-new { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.imp-where { font-size: 12px; font-weight: 600; }
.imp-where.board { color: var(--ok); }
.imp-where.dead, .imp-where.old { color: var(--muted); }
.imp-bulk { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--card-shadow); }
.imp-bulk[hidden] { display: none; }
.imp-bulk select { width: auto; }
.imp-more { display: flex; justify-content: center; }
@media (max-width: 640px) {
  .imp-bulk { gap: 6px; padding: 8px; }
  .imp-bulk button, .imp-bulk select { font-size: 13px; }
}
@media (max-width: 640px) {
  .imp-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .imp-filters label { min-width: 0; font-size: 12px; }
  .imp-filters .imp-search { grid-column: 1 / -1; }
  #importedView #importedIntro { display: none; }
}

/* ---- Sold (left menu): already-sold leads ---- */
.sold { overflow-y: auto; }
.sold-periods { flex-wrap: wrap; }
.sold-stats { margin-top: -2px; }
table.sold-table { min-width: 980px; table-layout: auto; }
.sold-table td { vertical-align: top; white-space: normal; }
.sold-table td.num, .sold-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sold-table th.num .imp-sort { flex-direction: row-reverse; }
.sold-sub { font-size: 12px; margin-top: 2px; }
.sold-services { max-width: 260px; }
.sold-job { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; background: color-mix(in srgb, var(--muted) 13%, transparent); }
.sold-job.scheduled { background: color-mix(in srgb, #1f63c6 13%, transparent); color: #1f63c6; }
.sold-job.in_shop { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.sold-job.ready { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.sold-job.picked_up { color: var(--muted); }
@media (max-width: 640px) {
  body.app-page .sold { overflow: visible; }
  .sold-periods button { padding: 6px 8px; font-size: 12px; }
}

/* Mark as sold (Imported leads, admins) */
.imp-sold-btn { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); color: var(--ok); font-weight: 600; }
.sold-dialog { border: 0; border-radius: 16px; padding: 20px; width: min(460px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.sold-dialog::backdrop { background: rgba(0, 10, 25, 0.45); }
.sold-dialog form { display: grid; gap: 12px; }
.sold-dialog h3 { margin: 0; }
.sold-dialog p { margin: 0; font-size: 13.5px; }
.sold-dialog label { display: grid; gap: 6px; margin: 0; font-weight: 600; font-size: 13px; color: var(--muted); }
.sold-dialog input[type="date"][hidden] { display: none; }
.sold-dialog-actions { justify-content: flex-end; }
