/* ==========================================================================
   WAV CRM
   Warm paper + ink, one forest-green accent. Serif for titles and
   headline figures, sans for everything you work with.
   ========================================================================== */

:root {
  color-scheme: light;
  --font-sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;

  --page: #f4f2ec;
  --surface: #fdfcf9;
  --surface-sunk: #ebe8e0;
  --wash: #efece4;
  --ink: #17181a;
  --ink-2: #4c4a45;
  --muted: #6f6c65;
  --line: #e0dcd2;
  --line-strong: #cbc6ba;

  --accent: #1f5a46;
  --accent-hover: #184a39;
  --accent-ink: #ffffff;
  --accent-text: #1f5a46;
  --accent-soft: #e0ebe4;

  --good: #1d7a3a;
  --good-soft: #dff0e3;
  --warn: #a8481a;
  --warn-soft: #f8e6da;
  --today: #8a6400;
  --danger: #b3261e;

  --chart-fill: #2b6e56;
  --chart-fill-hover: #1f5a46;
  --grid: #e5e1d7;
  --axis: #c3beb2;

  --av-0: #d9e6f5; --av-0-ink: #1e4a7a;
  --av-1: #f6dfcf; --av-1-ink: #7a3a14;
  --av-2: #dcefe2; --av-2-ink: #1d5a33;
  --av-3: #e9e0f5; --av-3-ink: #4b2f7a;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 0 rgba(23, 24, 26, 0.04), 0 1px 3px rgba(23, 24, 26, 0.06);
  --shadow-2: 0 8px 28px rgba(23, 24, 26, 0.12), 0 2px 6px rgba(23, 24, 26, 0.06);
  --shadow-3: 0 24px 64px rgba(23, 24, 26, 0.22);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #121413;
    --surface: #1a1d1b;
    --surface-sunk: #161917;
    --wash: #232724;
    --ink: #edece7;
    --ink-2: #bebcb4;
    --muted: #94918a;
    --line: #2a2e2b;
    --line-strong: #3a3f3b;
    --accent: #3f9673;
    --accent-hover: #4aa781;
    --accent-ink: #08130e;
    --accent-text: #7cc9a6;
    --accent-soft: #1c3229;
    --good: #5cc27e;
    --good-soft: #193323;
    --warn: #f09a6b;
    --warn-soft: #3a2418;
    --today: #e6b94a;
    --danger: #f2857c;
    --chart-fill: #4aa781;
    --chart-fill-hover: #7cc9a6;
    --grid: #262a27;
    --axis: #3a3f3b;
    --av-0: #1f3550; --av-0-ink: #a9cbf2;
    --av-1: #4a2a17; --av-1-ink: #f3bf9b;
    --av-2: #1d3a27; --av-2-ink: #9fdcb3;
    --av-3: #33264a; --av-3-ink: #cbb6f0;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #121413;
  --surface: #1a1d1b;
  --surface-sunk: #161917;
  --wash: #232724;
  --ink: #edece7;
  --ink-2: #bebcb4;
  --muted: #94918a;
  --line: #2a2e2b;
  --line-strong: #3a3f3b;
  --accent: #3f9673;
  --accent-hover: #4aa781;
  --accent-ink: #08130e;
  --accent-text: #7cc9a6;
  --accent-soft: #1c3229;
  --good: #5cc27e;
  --good-soft: #193323;
  --warn: #f09a6b;
  --warn-soft: #3a2418;
  --today: #e6b94a;
  --danger: #f2857c;
  --chart-fill: #4aa781;
  --chart-fill-hover: #7cc9a6;
  --grid: #262a27;
  --axis: #3a3f3b;
  --av-0: #1f3550; --av-0-ink: #a9cbf2;
  --av-1: #4a2a17; --av-1-ink: #f3bf9b;
  --av-2: #1d3a27; --av-2-ink: #9fdcb3;
  --av-3: #33264a; --av-3-ink: #cbb6f0;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-text);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  top: 12px;
}

body.no-scroll {
  overflow: hidden;
}

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  padding: 0 10px;
}

/* The WAV logo has dark lettering; dark mode swaps in a copy with light lettering. */
.brand-logo {
  display: block;
  width: auto;
  height: 32px;
}
.brand-logo--dark {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand-logo--light { display: none; }
  :root:not([data-theme='light']) .brand-logo--dark { display: block; }
}
:root[data-theme='dark'] .brand-logo--light { display: none; }
:root[data-theme='dark'] .brand-logo--dark { display: block; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a,
.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  text-align: left;
}
.nav a:hover,
.nav-btn:hover {
  background: var(--wash);
  color: var(--ink);
}
.nav a[aria-current='page'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
}
.nav a[aria-current='page'] .icon {
  color: var(--accent-text);
}
.nav-text {
  flex: 1;
}
.nav-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-flag {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.storage-note {
  padding: 10px 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.main {
  min-width: 0;
  padding: 34px 40px 56px;
}
.main:focus {
  outline: none;
}

/* ---------- Page header & toolbar ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 22px;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.page-sub {
  margin-top: 8px;
  color: var(--ink-2);
  max-width: 64ch;
}
.page-actions {
  display: flex;
  gap: 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.toolbar-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  max-width: 380px;
}
.search > .icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus-visible {
  border-color: var(--accent);
}
.search kbd {
  position: absolute;
  right: 9px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 11px/18px var(--font-sans);
  color: var(--muted);
}
.search input:focus + kbd,
.search input:not(:placeholder-shown) + kbd {
  display: none;
}

.select select,
.field select {
  height: 36px;
  padding: 0 32px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center / 14px;
  appearance: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover {
  background: var(--wash);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--wash);
  color: var(--ink);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger-text {
  color: var(--danger);
  border-color: transparent;
}
.btn-danger-text:hover {
  color: var(--danger);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
}
.icon-btn:hover:not(:disabled) {
  background: var(--wash);
  color: var(--ink);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
}
.chip .icon {
  color: var(--warn);
}
.chip:hover {
  background: var(--wash);
}
.chip[aria-pressed='true'] {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--ink);
}
.chip-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-sunk);
  box-shadow: inset 0 0 0 1px var(--line);
}
.segmented button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-weight: 500;
}
.segmented button:hover {
  color: var(--ink);
}
.segmented button[aria-checked='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
}

/* ---------- Stage meter (the signature element) ---------- */

.stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.meter {
  display: inline-grid;
  grid-template-columns: repeat(5, 7px);
  gap: 2px;
}
.meter i {
  height: 12px;
  border-radius: 2px;
  background: var(--line);
}
.meter--open i.on {
  background: var(--accent);
}
.meter--won i.on {
  background: var(--good);
}
.meter--lost i.on {
  background: var(--line-strong);
}
.stage-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.stage-label .icon {
  width: 14px;
  height: 14px;
}
.stage--won .stage-label {
  color: var(--good);
}
.stage--lost .stage-label {
  color: var(--muted);
}

.owner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar--0 { background: var(--av-0); color: var(--av-0-ink); }
.avatar--1 { background: var(--av-1); color: var(--av-1-ink); }
.avatar--2 { background: var(--av-2); color: var(--av-2-ink); }
.avatar--3 { background: var(--av-3); color: var(--av-3-ink); }

.due {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.due .icon {
  width: 14px;
  height: 14px;
}
.due--overdue {
  color: var(--warn);
  font-weight: 500;
}
.due--today {
  color: var(--today);
  font-weight: 500;
}
.due--tight {
  gap: 2px;
  font-size: 12px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.table-wrap--flat {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table--compact th,
.table--compact td {
  padding: 9px 8px;
}
.table--compact th:first-child,
.table--compact td:first-child {
  padding-left: 0;
}
.table--compact th:last-child,
.table--compact td:last-child {
  padding-right: 0;
}

.th-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: inherit;
}
.th-btn .icon {
  width: 13px;
  height: 13px;
  opacity: 0.45;
}
.th-btn:hover,
.is-sorted .th-btn {
  color: var(--ink);
}
.is-sorted .th-btn .icon {
  opacity: 1;
}
.num .th-btn {
  flex-direction: row-reverse;
}

.leads-table tbody tr {
  cursor: pointer;
  transition: background-color 0.1s;
}
.leads-table tbody tr:hover {
  background: var(--wash);
}
.row-link {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-align: left;
  color: var(--ink);
}
.cell-sub {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  font-size: 13px;
}
.pager-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pager-pos {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 56px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-title {
  font-family: var(--font-display);
  font-size: 24px;
}
.empty .btn {
  margin-top: 8px;
}
.empty-inline {
  padding: 24px 0;
  color: var(--muted);
}

/* ---------- Pipeline board ---------- */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(236px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: calc(100vh - 230px);
  border-radius: var(--radius);
  background: var(--surface-sunk);
  box-shadow: inset 0 0 0 1px var(--line);
  scroll-snap-align: start;
  transition: box-shadow 0.12s, background-color 0.12s;
}
.col.is-over {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.col-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 12px 8px;
}
.col-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
}
.col--won .col-title {
  color: var(--good);
}
.col--lost .col-title {
  color: var(--muted);
}
.col-title .icon {
  width: 14px;
  height: 14px;
  align-self: center;
}
.col-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.col-total {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 8px 10px;
  overflow-y: auto;
}
.col-empty {
  padding: 22px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.card {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  cursor: grab;
  transition: box-shadow 0.12s, transform 0.12s, opacity 0.12s;
}
.card:hover {
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line-strong);
}
.card:focus-visible {
  box-shadow: var(--focus);
}
.card.is-dragging {
  opacity: 0.4;
}
.col--won .card,
.col--lost .card {
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-sunk));
}
.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.card-company {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.card-value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-contact {
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--muted);
}
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 10px;
  font-size: 12px;
}
.card-foot .avatar {
  width: 22px;
  height: 22px;
  font-size: 9px;
}
.card-age {
  color: var(--muted);
}
.card-foot .due {
  flex-basis: 100%;
}

/* ---------- Analytics ---------- */

.kpis {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 16px;
  background: var(--surface);
}
.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  margin-top: 4px;
}
.kpi--hero {
  background: var(--accent);
  color: var(--accent-ink);
}
.kpi--hero .kpi-label,
.kpi--hero .kpi-foot,
.kpi--hero .muted {
  color: color-mix(in srgb, var(--accent-ink) 78%, transparent);
}
.kpi--hero .kpi-value {
  font-size: 48px;
}
.kpi--hero .kpi-delta,
.kpi--hero .kpi-delta.is-up,
.kpi--hero .kpi-delta.is-down {
  color: var(--accent-ink);
}
.kpi-delta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 500;
}
.kpi-delta .icon {
  width: 13px;
  height: 13px;
}
.kpi-delta.is-up {
  color: var(--good);
}
.kpi-delta.is-down {
  color: var(--warn);
}
.kpi-delta .muted {
  font-weight: 400;
}
.kpi-foot {
  margin-top: auto;
  padding-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.panel {
  min-width: 0;
  padding: 18px 20px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
}
.panel--wide {
  grid-column: 1 / -1;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
}
.panel-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.panel-count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
  font-size: 12.5px;
  text-align: center;
}
.panel-foot {
  padding-top: 12px;
  font-size: 12.5px;
}

.chart-host {
  width: 100%;
  min-height: 240px;
}
.chart {
  display: block;
  overflow: visible;
}
.chart .gridline {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart .baseline {
  stroke: var(--axis);
}
.chart .axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .col-bar {
  fill: var(--chart-fill);
  transition: fill 0.1s;
}
.chart .col-hit {
  fill: transparent;
}
.chart .col-g:hover .col-bar {
  fill: var(--chart-fill-hover);
}
.chart .col-g:hover .col-hit {
  fill: color-mix(in srgb, var(--ink) 4%, transparent);
}

.bars {
  display: grid;
  gap: 4px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 30%) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  border-radius: 6px;
}
.bar-row:hover .bar-fill {
  background: var(--chart-fill-hover);
}
.bar-label {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  line-height: 1.3;
}
.bar-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.bar-track {
  height: 14px;
}
.bar-fill {
  display: block;
  height: 100%;
  width: var(--w);
  border-radius: 0 4px 4px 0;
  background: var(--chart-fill);
  transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.1s;
}
.bar-value {
  min-width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.inline-bar {
  display: inline-block;
  width: 72px;
  height: 8px;
  margin-right: 8px;
  vertical-align: middle;
}
.inline-bar-fill {
  display: block;
  height: 100%;
  width: var(--w);
  min-width: 2px;
  border-radius: 0 3px 3px 0;
  background: var(--chart-fill);
}
.inline-bar-num {
  font-variant-numeric: tabular-nums;
}

.attention {
  display: grid;
}
.attention li + li {
  border-top: 1px solid var(--line);
}
.attention-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) auto 110px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 10px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
}
.attention-row:hover {
  background: var(--wash);
}
.attention-main strong {
  font-weight: 600;
}
.attention-why {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13px;
}
.attention-value {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---------- Drawer ---------- */

#drawer-root:empty {
  display: none;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 20, 19, 0.36);
  animation: fade-in 0.18s ease-out;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.drawer.is-entering {
  animation: slide-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.is-closing .drawer {
  animation: slide-out 0.18s ease-in forwards;
}
.is-closing .drawer-backdrop {
  animation: fade-out 0.18s ease-in forwards;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.drawer-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.drawer-sub {
  color: var(--ink-2);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.drawer-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.contact-actions {
  display: flex;
  gap: 8px;
}
.contact-actions:empty {
  display: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}
.facts dt {
  font-size: 12px;
  color: var(--muted);
}
.facts dd {
  margin-top: 2px;
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  overflow-wrap: anywhere;
}
.fact-wide {
  grid-column: span 3;
}
.fact-money {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
}

.section-title {
  margin-bottom: 10px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.stage-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stage-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13px;
}
.stage-opt .icon {
  width: 14px;
  height: 14px;
}
.stage-opt:hover {
  background: var(--wash);
  color: var(--ink);
}
.stage-opt[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.stage-opt--won[aria-pressed='true'] {
  border-color: var(--good);
  background: var(--good);
  color: var(--surface);
}
.stage-opt--lost[aria-pressed='true'] {
  border-color: var(--muted);
  background: var(--muted);
  color: var(--surface);
}

.note-form textarea,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.note-form textarea {
  display: block;
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
}
.note-form textarea:focus-visible,
.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--accent);
}
.note-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0;
  margin-top: 18px;
}
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding-bottom: 14px;
}
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 12.5px;
  top: 26px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.tl-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--wash);
  color: var(--muted);
}
.tl-dot .icon {
  width: 13px;
  height: 13px;
}
.tl-item--note .tl-dot {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.tl-text {
  padding-top: 3px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tl-item--stage .tl-text {
  color: var(--ink-2);
}
.tl-time {
  font-size: 12px;
  color: var(--muted);
}

/* Form */
.lead-form fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}
.lead-form legend {
  float: left;
  width: 100%;
}
.form-grid {
  clear: both;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 14px;
}
.field {
  display: grid;
  gap: 5px;
  align-content: start;
}
.field--wide {
  grid-column: 1 / -1;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.req {
  color: var(--warn);
}
.field input {
  height: 38px;
  padding: 0 11px;
}
.field select {
  height: 38px;
}
.field [aria-invalid='true'] {
  border-color: var(--danger);
}
.field-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
}
.form-error:empty {
  display: none;
}
.form-error {
  color: var(--danger);
}

/* ---------- Dialog, toast, tooltip ---------- */

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
}
.dialog::backdrop {
  background: rgba(18, 20, 19, 0.4);
}
.dialog-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
}
.dialog-body {
  margin-top: 10px;
  color: var(--ink-2);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--page);
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.is-leaving {
  animation: toast-out 0.16s ease-in forwards;
}
.toast-action {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--page) 16%, transparent);
  color: var(--page);
  font-weight: 600;
}
.toast-action:hover {
  background: color-mix(in srgb, var(--page) 26%, transparent);
}

.tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  max-width: 280px;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--page);
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: var(--shadow-2);
}
.tooltip[hidden] {
  display: none;
}

.noscript {
  padding: 40px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

/* ---------- Touch & phone-only pieces (hidden on desktop) ---------- */

html {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
select,
input,
textarea,
.card,
.leads-table tbody tr {
  touch-action: manipulation;
}
.drawer-body,
.col-body,
.dialog,
.board {
  overscroll-behavior: contain;
}
html:has(body.no-scroll) {
  overflow: hidden;
}
.fab,
.stage-strip,
.touch-hint,
.me-mobile {
  display: none;
}
.filters {
  display: contents;
}

.preview-banner {
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--warn);
}

/* ---------- Boot, sign-in ---------- */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
}
.boot-text {
  color: var(--muted);
}
.boot-error {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 420px;
}
.boot-error .btn {
  margin-top: 8px;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(400px, 100%);
  padding: 32px 28px 28px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--line);
  animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-brand {
  display: flex;
  align-items: center;
  margin-bottom: 26px;
}
.auth-brand .brand-logo {
  height: 40px;
}
.auth-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
}
.auth-sub {
  margin: 8px 0 22px;
  color: var(--ink-2);
}
.auth-form {
  display: grid;
  gap: 14px;
}
.auth-form .form-error {
  margin-bottom: 10px;
}
.btn-block {
  width: 100%;
  height: 40px;
}

/* ---------- Account & team ---------- */

.me-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  text-align: left;
}
.me-btn:hover {
  background: var(--wash);
}
.me-btn .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.me-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.me-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-role {
  font-size: 12px;
  color: var(--muted);
}

.dialog--wide {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dialog .field input,
.dialog .field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
}
.dialog .section-title {
  margin-top: 4px;
}

.team-list {
  margin: 18px 0 22px;
  border-top: 1px solid var(--line);
}
.team-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.team-row.is-inactive .team-main,
.team-row.is-inactive .avatar {
  opacity: 0.55;
}
.team-main {
  display: grid;
  min-width: 0;
}
.team-main strong {
  font-weight: 600;
}
.role-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}
.role-pill--admin {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.team-actions {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.team-actions:empty {
  display: none;
}
.access-form {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}
.access-form .dialog-actions {
  margin-top: 4px;
}
.team-form .hint {
  margin-top: 2px;
}
.team-form .dialog-actions {
  margin-top: 12px;
}

.data-zone {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.data-row strong {
  font-weight: 600;
}

.password-form {
  display: grid;
  gap: 2px;
  margin-top: 16px;
}
.password-form .dialog-actions {
  justify-content: space-between;
  margin-top: 10px;
}

/* ---------- Motion ---------- */

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes slide-out { to { transform: translateX(32px); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(6px); opacity: 0; } }
@keyframes rise {
  from { transform: translateY(6px); opacity: 0; }
}

#view > * {
  animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
#view > *:nth-child(2) { animation-delay: 0.03s; }
#view > *:nth-child(3) { animation-delay: 0.06s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi--hero {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .main {
    padding: 26px 24px 48px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .toolbar-hint {
    display: none;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    gap: 2px;
    padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--page) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
  .brand,
  .storage-note,
  .nav-count,
  .me-text,
  [data-theme-toggle] .nav-text,
  [data-reset] {
    display: none;
  }
  body.has-account [data-theme-toggle] {
    display: none;
  }
  .nav {
    flex: 1 1 auto;
    flex-direction: row;
    gap: 2px;
  }
  .sidebar-foot {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 2px;
    margin: 0;
  }
  .nav a,
  .nav-btn,
  .me-btn {
    position: relative;
    flex: 1 1 0;
    min-width: 62px;
    height: 54px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
  }
  .nav a .icon,
  .nav-btn .icon {
    width: 22px;
    height: 22px;
  }
  .nav a[aria-current='page'],
  .nav a[aria-current='page']:hover {
    box-shadow: none;
    background: none;
    color: var(--accent-text);
  }
  .nav a[aria-current='page'] .icon {
    stroke-width: 2.1;
  }
  .nav-text {
    flex: none;
  }
  .nav-flag {
    position: absolute;
    top: 7px;
    right: calc(50% - 16px);
  }
  .me-btn .avatar {
    width: 24px;
    height: 24px;
    font-size: 9px;
  }
  .me-mobile {
    display: block;
  }
  .team-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .role-pill {
    grid-column: 2;
    justify-self: start;
  }
  .data-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* iOS zooms into any field under 16px; keep every input at 16px on phones. */
  input,
  select,
  textarea,
  .search input,
  .select select,
  .field input,
  .field select,
  .note-form textarea {
    font-size: 16px;
  }
  .desktop-only {
    display: none !important;
  }

  .main {
    padding: calc(16px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      calc(150px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .page-head {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
  }
  .page-head > div:first-child {
    flex: 1 1 0;
    min-width: 0;
  }
  .page-title {
    font-size: 32px;
  }
  .page-sub {
    margin-top: 4px;
    font-size: 13px;
  }
  .page-actions {
    flex: 0 0 auto;
  }
  .btn-collapse {
    width: 44px;
    padding: 0;
  }
  .btn-collapse .btn-label {
    display: none;
  }
  .toolbar {
    margin-bottom: 12px;
  }
  .search {
    flex: 1 1 100%;
    max-width: none;
  }
  .search kbd {
    display: none;
  }
  .select {
    flex: 1 1 140px;
  }
  .select select {
    width: 100%;
  }
  /* Pipeline: search and owner share one row */
  .toolbar:not(:has(.filters)) .search {
    flex: 1 1 0;
  }
  .toolbar:not(:has(.filters)) .select {
    flex: 0 0 40%;
  }
  /* Leads: filters scroll sideways on one line instead of stacking */
  .filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar {
    display: none;
  }
  .filters .select,
  .filters .chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .filters .select select {
    width: auto;
  }

  .fab {
    display: grid;
    place-items: center;
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 29;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 10px 24px rgba(23, 24, 26, 0.22), 0 2px 6px rgba(23, 24, 26, 0.12);
    transition: transform 0.12s;
  }
  .fab .icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
  }
  .segmented {
    width: 100%;
  }
  .segmented button {
    flex: 1;
    padding: 0 6px;
  }

  /* Leads table becomes stacked cards */
  .leads-table thead {
    display: none;
  }
  .leads-table,
  .leads-table tbody,
  .leads-table tr,
  .leads-table td {
    display: block;
  }
  .leads-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 14px 14px;
    border-bottom: 1px solid var(--line);
  }
  .leads-table tbody tr:last-child {
    border-bottom: 0;
  }
  .leads-table td {
    padding: 0;
    border: 0;
  }
  .leads-table td[data-label='Lead'] {
    grid-column: 1;
  }
  .leads-table td[data-label='Value'] {
    grid-column: 2;
    grid-row: 1;
    font-weight: 600;
  }
  .leads-table td[data-label='Stage'],
  .leads-table td[data-label='Owner'] {
    grid-column: 1 / -1;
  }
  .leads-table td[data-label='Source'],
  .leads-table td[data-label='Last contact'] {
    display: none;
  }
  .leads-table td[data-label='Follow-up'] {
    grid-column: 1 / -1;
    font-size: 13px;
  }
  .leads-table td[data-label='Follow-up']::before {
    content: 'Follow-up: ';
    color: var(--muted);
  }

  /* Pipeline: one stage per screen, swipe between them; the strip shows where you are. */
  .stage-strip {
    display: flex;
    gap: 6px;
    margin: 0 -16px 8px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .stage-strip::-webkit-scrollbar {
    display: none;
  }
  .strip-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
  }
  .strip-btn[aria-current='true'] {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--page);
  }
  .strip-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.65;
  }
  .touch-hint {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--muted);
  }
  .board {
    grid-auto-columns: calc(100% - 28px);
    gap: 10px;
    margin: 0 -16px;
    padding: 0 16px 4px;
    scroll-padding: 0 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .board::-webkit-scrollbar {
    display: none;
  }
  .col {
    height: var(--board-h, calc(100dvh - 300px));
    min-height: 0;
    max-height: none;
    scroll-snap-stop: always;
  }
  .card {
    padding: 13px 14px;
  }
  .card-foot .due {
    font-size: 12.5px;
  }

  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .kpi-value {
    font-size: 28px;
  }
  .kpi--hero .kpi-value {
    font-size: 40px;
  }
  .panel {
    padding: 16px;
  }
  .bar-row {
    grid-template-columns: 88px 1fr auto;
    gap: 10px;
  }
  .attention-row {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
  }
  .attention-why {
    grid-column: 1;
    grid-row: 2;
  }
  .attention-owner {
    display: none;
  }
  .attention-value {
    grid-column: 2;
    grid-row: 1;
  }

  /* Lead panel: full-screen sheet that rises from the bottom */
  .drawer {
    left: 0;
    width: 100%;
    height: 100dvh;
    bottom: auto;
  }
  .drawer.is-entering {
    animation: sheet-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .is-closing .drawer {
    animation: sheet-out 0.2s ease-in forwards;
  }
  .drawer-head,
  .drawer-body,
  .drawer-foot {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .drawer-head {
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-bottom: 14px;
  }
  .drawer-title {
    font-size: 28px;
  }
  .drawer-body {
    padding-top: 16px;
    gap: 22px;
  }
  .drawer-foot {
    padding-top: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .drawer-foot .btn {
    flex: 1;
  }
  .contact-actions .btn {
    flex: 1;
  }

  /* Dialogs (team, account, confirm) become bottom sheets */
  .dialog,
  .dialog--wide {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    padding: 18px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
    animation: sheet-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .dialog-actions .btn {
    flex: 1;
  }
  .password-form .dialog-actions {
    flex-direction: column-reverse;
  }
  .password-form .dialog-actions .btn {
    flex: none;
    width: 100%;
  }

  .auth-card {
    padding: 26px 20px 22px;
  }
  .leads-table tr {
    padding: 15px 14px;
  }
  .row-link {
    font-size: 15px;
  }
  .facts {
    grid-template-columns: 1fr 1fr;
  }
  .fact-wide {
    grid-column: 1 / -1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .toasts {
    bottom: calc(146px + env(safe-area-inset-bottom));
    width: calc(100vw - 32px);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(40px);
    opacity: 0;
  }
}

/* ---------- Touch screens: bigger targets, press feedback, no sticky hover ---------- */

@media (pointer: coarse) {
  .btn {
    height: 44px;
  }
  .btn-sm {
    height: 38px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
  .chip,
  .select select,
  .search input {
    height: 44px;
  }
  .segmented button {
    height: 36px;
  }
  .stage-opt {
    height: 40px;
    padding: 0 14px;
  }
  .th-btn {
    padding: 8px 0;
  }
  .bar-row {
    padding: 8px 0;
  }
  .leads-table tbody tr:hover,
  .attention-row:hover,
  .nav a:hover,
  .nav-btn:hover,
  .me-btn:hover {
    background: none;
  }
  .card:hover {
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  }
  .btn,
  .chip,
  .stage-opt,
  .strip-btn,
  .card,
  .fab {
    transition: transform 0.1s, background-color 0.12s, box-shadow 0.12s;
  }
  .btn:active,
  .chip:active,
  .stage-opt:active,
  .strip-btn:active,
  .fab:active {
    transform: scale(0.96);
  }
  .card:active {
    transform: scale(0.985);
  }
  .leads-table tbody tr:active,
  .attention-row:active,
  .nav a:active,
  .nav-btn:active,
  .me-btn:active {
    background: var(--wash);
  }
}

/* ==========================================================================
   Customers
   ========================================================================== */

:root {
  --tag-new-bg: var(--av-0); --tag-new-ink: var(--av-0-ink);
  --tag-repeat-bg: var(--av-2); --tag-repeat-ink: var(--av-2-ink);
  --tag-vip-bg: #f5e9c8; --tag-vip-ink: #6e5000;
  --tag-overdue-bg: var(--warn-soft); --tag-overdue-ink: var(--warn);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --tag-vip-bg: #3a3016; --tag-vip-ink: #ecc96a;
  }
}
:root[data-theme='dark'] {
  --tag-vip-bg: #3a3016; --tag-vip-ink: #ecc96a;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag--new-lead { background: var(--tag-new-bg); color: var(--tag-new-ink); }
.tag--repeat { background: var(--tag-repeat-bg); color: var(--tag-repeat-ink); }
.tag--vip { background: var(--tag-vip-bg); color: var(--tag-vip-ink); }
.tag--overdue { background: var(--tag-overdue-bg); color: var(--tag-overdue-ink); }
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tag-chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--page);
}
.tag-chip[aria-pressed='true'] .chip-count {
  color: inherit;
  opacity: 0.7;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-check {
  position: relative;
}
.tag-check input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.tag-check span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
}
.tag-check input:checked + span {
  border-color: transparent;
  font-weight: 600;
}
.tag-check--new-lead input:checked + span { background: var(--tag-new-bg); color: var(--tag-new-ink); }
.tag-check--repeat input:checked + span { background: var(--tag-repeat-bg); color: var(--tag-repeat-ink); }
.tag-check--vip input:checked + span { background: var(--tag-vip-bg); color: var(--tag-vip-ink); }
.tag-check--overdue input:checked + span { background: var(--tag-overdue-bg); color: var(--tag-overdue-ink); }
.tag-check input:checked + span::before {
  content: '\2713';
}
.tag-check input:focus-visible + span {
  box-shadow: var(--focus);
}

/* Customer list */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.customer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 0.12s, transform 0.12s;
}
.customer-card:hover {
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line-strong);
}
.cc-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.cc-photo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-sunk);
}
.cc-photo--initials {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
  font-size: 14px;
}
.cc-name {
  display: grid;
  min-width: 0;
}
.cc-name strong {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-value {
  display: grid;
  justify-items: end;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cc-value small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.cc-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--ink-2);
  font-size: 13px;
}
.cc-line .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--muted);
}
.cc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.cc-foot .due {
  font-size: 12.5px;
}
.cc-next,
.cc-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cc-next .icon,
.cc-key .icon {
  width: 13px;
  height: 13px;
}
.cc-key {
  margin-left: auto;
  color: var(--accent-text);
}

/* Customer profile */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -6px 0 12px -4px;
  padding: 6px 8px 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
}
.back-link:hover {
  background: var(--wash);
  color: var(--ink);
}
.cust-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 18px;
}
.cust-hero-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.cust-name {
  overflow-wrap: anywhere;
}
.cust-hero .page-sub {
  margin-top: -2px;
}
.cust-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cust-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
}
.cstat {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
}
.cstat-label {
  font-size: 12.5px;
  color: var(--ink-2);
}
.cstat-value {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.15;
}
.cstat--warn .cstat-value {
  color: var(--warn);
}

.cust-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}
.cust-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.panel-title .icon {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  vertical-align: -2px;
  color: var(--accent-text);
}

/* Access card: what the crew needs on site */
.access-card {
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line), inset 3px 0 0 var(--accent);
}
.gate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}
.gate-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.gate .gate-label {
  flex-basis: 100%;
}
.gate-code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.gate .btn {
  margin-left: auto;
}
.instructions {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}
.instructions-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warn);
}
.instructions-label .icon {
  width: 14px;
  height: 14px;
}
.instructions p,
.access-detail p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.access-detail {
  margin-top: 12px;
}

.facts--stack {
  grid-template-columns: 1fr;
  gap: 12px;
}
.facts--stack a {
  color: var(--ink);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.service-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.service-list li:last-child {
  border-bottom: 0;
}
.service-name {
  font-weight: 600;
}
.service-meta {
  grid-row: 2;
  font-size: 12.5px;
  color: var(--muted);
}
.service-total {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Jobs */
.job-list li + li {
  border-top: 1px solid var(--line);
}
.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  padding: 12px 0;
}
.job-main {
  display: grid;
  min-width: 0;
}
.job-main strong {
  font-weight: 600;
}
.job-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
}
.job-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.job-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 500;
}
.job-status .icon {
  width: 13px;
  height: 13px;
}
.job-status--paid { color: var(--good); }
.job-status--unpaid { color: var(--warn); }
.job-status--scheduled { color: var(--accent-text); }
.job-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.job-actions .icon-btn {
  margin-left: auto;
  color: var(--muted);
}
.job-form {
  margin-bottom: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}
.job-form .dialog-actions {
  margin-top: 8px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-weight: 500;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Form bits shared by customer + job forms */
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  resize: vertical;
}
.field textarea:focus-visible {
  border-color: var(--accent);
}
.form-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 14px;
}
.customer-form fieldset {
  border: 0;
  padding: 0;
  margin: 16px 0 0;
  min-width: 0;
}
.customer-form legend {
  float: left;
  width: 100%;
}
.customer-sheet .dialog-actions {
  margin-top: 18px;
}
.customer-sheet .dialog-actions [data-delete] {
  margin-right: auto;
}

/* Photos */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--surface-sunk);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.photo-thumb:hover img {
  transform: scale(1.04);
}
.photo-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
}
.photo-empty .icon {
  width: 26px;
  height: 26px;
}
.photo-empty:hover {
  background: var(--wash);
  color: var(--ink-2);
}

/* Lightbox */
.dialog.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: #0b0c0c;
  color: #f2f1ec;
  overflow: hidden;
  animation: fade-in 0.18s ease-out;
}
.lightbox::backdrop {
  background: #0b0c0c;
}
.lb-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: linear-gradient(rgba(11, 12, 12, 0.85), rgba(11, 12, 12, 0));
}
.lb-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-count {
  margin-left: 6px;
  font-weight: 400;
  opacity: 0.7;
}
.lb-btn {
  color: #f2f1ec;
}
.lb-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.lb-stage {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 60px 12px calc(56px + env(safe-area-inset-bottom));
  touch-action: pan-y;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}
.lb-stage figcaption {
  position: absolute;
  inset: auto 0 calc(14px + env(safe-area-inset-bottom));
  padding: 0 16px;
  text-align: center;
  font-size: 13px;
  opacity: 0.85;
}
.lb-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateY(-50%);
}
.lb-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}
.lb-prev { left: max(10px, env(safe-area-inset-left)); }
.lb-next { right: max(10px, env(safe-area-inset-right)); }
.lb-nav .icon {
  width: 22px;
  height: 22px;
}

@media (max-width: 1180px) {
  .cust-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .cust-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .customer-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tag-filter {
    flex-wrap: nowrap;
    margin: 0 -16px 12px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tag-filter::-webkit-scrollbar {
    display: none;
  }
  .tag-filter .chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .cust-hero {
    margin-bottom: 14px;
  }
  .cust-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 6px;
    width: 100%;
  }
  .cust-actions .btn {
    flex-direction: column;
    gap: 3px;
    height: 58px;
    padding: 0 4px;
    font-size: 12px;
  }
  .cust-actions .btn .icon {
    width: 18px;
    height: 18px;
  }
  .cust-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cstat:first-child {
    grid-column: 1 / -1;
  }
  .cstat-value {
    font-size: 22px;
  }
  .gate-code {
    font-size: 26px;
  }
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .lb-nav {
    display: none;
  }
  /* Six items in the bottom bar now: tighten them a little */
  .nav a,
  .nav-btn,
  .me-btn {
    min-width: 54px;
    font-size: 10.5px;
  }
  .dialog.lightbox {
    border-radius: 0;
    animation: fade-in 0.18s ease-out;
  }
}

@media (pointer: coarse) {
  .customer-card:hover {
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  }
  .customer-card:active {
    transform: scale(0.985);
  }
  .photo-thumb:hover img {
    transform: none;
  }
  .tag-check span {
    height: 40px;
  }
}

/* ==========================================================================
   Calendar
   ========================================================================== */

:root {
  --st-quoted-bg: #f5ecd3; --st-quoted-ink: #6e5000; --st-quoted-edge: #c79a2b;
  --st-scheduled-bg: var(--av-0); --st-scheduled-ink: var(--av-0-ink); --st-scheduled-edge: #3f78b8;
  --st-in_progress-bg: var(--accent-soft); --st-in_progress-ink: var(--accent-text); --st-in_progress-edge: var(--accent);
  --st-completed-bg: var(--surface-sunk); --st-completed-ink: var(--muted); --st-completed-edge: var(--line-strong);
  --rain: #3f78b8;
  --wet: color-mix(in srgb, #3f78b8 7%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --st-quoted-bg: #3a3016; --st-quoted-ink: #ecc96a; --st-quoted-edge: #b48a2a;
    --st-scheduled-edge: #6aa0dc;
    --rain: #8bb8ea;
    --wet: color-mix(in srgb, #6aa0dc 9%, transparent);
  }
}
:root[data-theme='dark'] {
  --st-quoted-bg: #3a3016; --st-quoted-ink: #ecc96a; --st-quoted-edge: #b48a2a;
  --st-scheduled-edge: #6aa0dc;
  --rain: #8bb8ea;
  --wet: color-mix(in srgb, #6aa0dc 9%, transparent);
}

/* Toolbar */
.cal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cal-period {
  margin-left: 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
  white-space: nowrap;
}
.cal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend--quoted i { background: var(--st-quoted-bg); box-shadow: inset 0 0 0 1.5px var(--st-quoted-edge); }
.legend--scheduled i { background: var(--st-scheduled-edge); }
.legend--in_progress i { background: var(--st-in_progress-edge); }
.legend--completed i { background: var(--st-completed-edge); }
.legend[aria-pressed='false'] {
  color: var(--muted);
  background: none;
  text-decoration: line-through;
}
.legend[aria-pressed='false'] i {
  opacity: 0.35;
}
.cal-hint,
.cal-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--wash);
  color: var(--ink-2);
  font-size: 13px;
}
.cal-hint[hidden] {
  display: none;
}
.cal-hint .icon,
.cal-note .icon {
  margin-top: 2px;
  color: var(--accent-text);
}
.cal-note {
  max-width: 860px;
  margin: 14px 0 0;
}

/* Status pills (calendar + customer profile) */
.jstatus {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--st-scheduled-bg);
  color: var(--st-scheduled-ink);
}
.jstatus .icon {
  width: 12px;
  height: 12px;
}
.jstatus--quoted { background: var(--st-quoted-bg); color: var(--st-quoted-ink); }
.jstatus--in_progress { background: var(--st-in_progress-bg); color: var(--st-in_progress-ink); }
.jstatus--completed { background: var(--st-completed-bg); color: var(--st-completed-ink); }

/* Job chips (month cells + week "any time" row) */
.jchip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  height: 22px;
  padding: 0 6px 0 7px;
  border: 0;
  border-left: 3px solid var(--st-scheduled-edge);
  border-radius: 5px;
  background: var(--st-scheduled-bg);
  color: var(--st-scheduled-ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.jchip-time {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.jchip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jchip-wx {
  display: inline-flex;
  margin-left: auto;
  color: var(--rain);
}
.jchip-wx .icon {
  width: 12px;
  height: 12px;
}
.jchip--quoted { background: var(--st-quoted-bg); color: var(--st-quoted-ink); border-left-style: dashed; border-left-color: var(--st-quoted-edge); }
.jchip--in_progress { background: var(--st-in_progress-bg); color: var(--st-in_progress-ink); border-left-color: var(--st-in_progress-edge); }
.jchip--completed { background: var(--st-completed-bg); color: var(--st-completed-ink); border-left-color: var(--st-completed-edge); }
.jchip--completed .jchip-name,
.wk-job.jchip--completed .wk-name {
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.jchip:hover,
.wk-job:hover,
.agenda-item:hover {
  filter: brightness(0.97);
}
.is-dragging {
  opacity: 0.4;
}

/* Weather */
.wx {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wx .icon {
  width: 15px;
  height: 15px;
}
.wx--watch { color: var(--today); }
.wx--bad { color: var(--rain); }
.wx-rain {
  margin-left: 4px;
  color: var(--rain);
}

.wx-advice {
  max-width: 860px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--av-0);
  color: var(--av-0-ink);
}
.wx-advice--watch {
  background: color-mix(in srgb, var(--today) 14%, var(--surface));
  color: var(--ink);
}
.wx-advice-head {
  display: flex;
  gap: 10px;
}
.wx-advice-head .icon {
  width: 22px;
  height: 22px;
  margin-top: 1px;
}
.wx-advice-head p {
  display: grid;
}
.wx-advice-head span {
  font-size: 13px;
  opacity: 0.85;
}
.wx-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-left: 32px;
}
.wx-options-label {
  font-size: 12.5px;
  font-weight: 600;
}
.wx-move {
  height: 32px;
  border-color: transparent;
  color: var(--ink);
}
.wx-move .icon {
  color: var(--accent-text);
}

/* Reminders */
.cal-alerts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  align-items: start;
  gap: 10px;
  margin-bottom: 18px;
}
.cal-alerts[hidden] {
  display: none;
}
.alert-group {
  padding: 12px 14px 6px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.alert-group--stale {
  border-left-color: var(--warn);
}
.alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}
.alert-title .icon {
  color: var(--accent-text);
}
.alert-group--stale .alert-title .icon {
  color: var(--warn);
}
.alert-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 0;
}
.alert-row + .alert-row {
  border-top: 1px solid var(--line);
}
.alert-main {
  display: grid;
  min-width: 0;
}
.alert-main span {
  color: var(--muted);
  font-size: 13px;
}
.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Day view */
.day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 860px;
  margin-bottom: 14px;
}
.day-title {
  font-size: 18px;
  font-weight: 600;
}
.day-wx {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.day-wx .wx {
  font-size: 13px;
}
.day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.day-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  max-width: 860px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}
.dstat {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  background: var(--surface);
}
.dstat span {
  color: var(--muted);
  font-size: 12px;
}
.dstat strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
}
.day-conflict {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 860px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 500;
}
.stops {
  display: grid;
  max-width: 860px;
}
.stops-sub {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 42px;
  padding: 8px 0 8px 18px;
  border-left: 2px dashed var(--line-strong);
  color: var(--muted);
  font-size: 12.5px;
}
.leg .icon {
  width: 15px;
  height: 15px;
}
.leg--home {
  padding-top: 0;
  border-left-color: transparent;
}
.stop {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--st-scheduled-edge);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.stop--quoted { border-left-color: var(--st-quoted-edge); border-left-style: dashed; }
.stop--in_progress { border-left-color: var(--st-in_progress-edge); }
.stop--completed { border-left-color: var(--st-completed-edge); background: var(--surface-sunk); box-shadow: none; }
.stop--conflict {
  border-color: var(--warn);
  border-left-color: var(--warn);
}
.stop + .stop {
  margin-top: 10px;
}
.stop-time {
  display: grid;
  align-content: start;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}
.stop-time strong {
  font-size: 15px;
}
.stop-time span {
  color: var(--muted);
  font-size: 12.5px;
}
.stop-time .stop-dur {
  margin-top: 4px;
  color: var(--ink-2);
}
.stop-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.stop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.stop-title {
  font-size: 15px;
  font-weight: 600;
}
.stop-title .link-btn {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.stop-title .link-btn:hover {
  text-decoration: underline;
}
.stop-who,
.stop-addr {
  color: var(--ink-2);
  font-size: 13px;
}
.stop-who a {
  color: inherit;
}
.stop-who a:first-child {
  color: var(--ink);
  font-weight: 600;
}
.stop-addr,
.stop-note,
.stop-warn,
.stop-reminded {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.stop-addr .icon,
.stop-note .icon,
.stop-warn .icon,
.stop-reminded .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.stop-gate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}
.stop-note {
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--ink);
  font-size: 13px;
}
.stop-note .icon {
  margin-top: 2px;
  color: var(--warn);
}
.stop-note span {
  flex: 1;
}
.stop-warn {
  color: var(--warn);
  font-size: 13px;
  font-weight: 500;
}
.stop-warn .icon {
  color: var(--warn);
}
.stop-reminded {
  color: var(--good);
  font-size: 12.5px;
  font-weight: 500;
}
.stop-reminded .icon {
  color: var(--good);
}
.stop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 0 -10px;
}
.stop-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.empty--cal {
  max-width: 860px;
}

/* Week view (desktop grid) */
.week {
  --hours: 10;
  --hour-px: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.week-head,
.week-allday,
.week-grid {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
}
.week-head {
  border-bottom: 1px solid var(--line);
}
.week-day {
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 8px 10px;
  border-left: 1px solid var(--line);
}
.week-date {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
}
.week-date span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.week-date strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
}
.week-date:hover strong {
  color: var(--accent-text);
}
.week-day.is-today .week-date strong {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 20px;
}
.week-load {
  min-height: 16px;
  color: var(--muted);
  font-size: 11.5px;
}
.week-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.week-allday {
  border-bottom: 1px solid var(--line);
}
.week-allday-cell {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 34px;
  padding: 4px;
  border-left: 1px solid var(--line);
}
.week-grid {
  position: relative;
  max-height: max(320px, min(calc(100vh - 330px), calc(var(--hours) * var(--hour-px))));
  overflow-y: auto;
}
.week-hours {
  position: relative;
  height: calc(var(--hours) * var(--hour-px));
}
.week-hours span {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.week-hours span:first-child {
  transform: none;
}
.week-col {
  position: relative;
  height: calc(var(--hours) * var(--hour-px));
  border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 100% var(--hour-px);
  cursor: copy;
}
.week-col.is-today {
  background-color: color-mix(in srgb, var(--accent) 4%, transparent);
}
.week-col.is-wet {
  background-color: var(--wet);
}
.week-col.is-over,
.week-allday-cell.is-over,
.mcell.is-over {
  background-color: var(--accent-soft);
}
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  height: 2px;
  background: var(--danger);
  pointer-events: none;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.wk-job {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 3px 6px;
  border: 0;
  border-left: 3px solid var(--st-scheduled-edge);
  border-radius: 6px;
  background: var(--st-scheduled-bg);
  color: var(--st-scheduled-ink);
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--surface);
  cursor: pointer;
}
.wk-job.jchip--quoted { background: var(--st-quoted-bg); color: var(--st-quoted-ink); border-left: 3px dashed var(--st-quoted-edge); }
.wk-job.jchip--in_progress { background: var(--st-in_progress-bg); color: var(--st-in_progress-ink); border-left-color: var(--st-in_progress-edge); }
.wk-job.jchip--completed { background: var(--st-completed-bg); color: var(--st-completed-ink); border-left-color: var(--st-completed-edge); }
.wk-job.is-conflict {
  box-shadow: 0 0 0 1px var(--surface), inset 0 0 0 1.5px var(--warn);
}
.wk-time {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wk-time .icon {
  width: 12px;
  height: 12px;
  color: var(--warn);
}
.wk-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wk-service {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wk-job.is-short {
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.wk-job.is-short .wk-service {
  display: none;
}
.wk-travel {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 5px 5px 0 0;
  background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--muted) 16%, transparent) 4px 6px);
  color: var(--muted);
  font-size: 10.5px;
  pointer-events: none;
  overflow: hidden;
}
.wk-travel span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.wk-travel .icon {
  width: 11px;
  height: 11px;
}
.drop-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 4;
  padding: 2px 6px;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

/* Agenda (week on phones, and the picked day under the phone month grid) */
.agenda {
  display: grid;
  gap: 10px;
}
.agenda-day {
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.agenda-day.is-today {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: inset 3px 0 0 var(--accent);
}
.agenda-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.agenda-date {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
}
.agenda-date strong {
  font-size: 15px;
}
.agenda-date span {
  color: var(--muted);
}
.agenda-load {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.agenda-head .icon-btn {
  margin-right: -6px;
}
.agenda-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.agenda-leg {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 6px 10px;
  color: var(--muted);
  font-size: 12px;
}
.agenda-leg .icon {
  width: 13px;
  height: 13px;
}
.agenda-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid var(--st-scheduled-edge);
  border-radius: 8px;
  background: var(--st-scheduled-bg);
  color: var(--ink);
  text-align: left;
}
.agenda-item.jchip--quoted { background: var(--st-quoted-bg); border-left: 3px dashed var(--st-quoted-edge); }
.agenda-item.jchip--in_progress { background: var(--st-in_progress-bg); border-left-color: var(--st-in_progress-edge); }
.agenda-item.jchip--completed { background: var(--st-completed-bg); border-left-color: var(--st-completed-edge); color: var(--muted); }
.agenda-item.is-conflict {
  box-shadow: inset 0 0 0 1.5px var(--warn);
}
.agenda-time {
  display: grid;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.agenda-time small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}
.agenda-what {
  display: grid;
  min-width: 0;
}
.agenda-what span {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agenda-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}
.agenda-status .icon {
  width: 13px;
  height: 13px;
  color: var(--warn);
}
.agenda-empty {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.agenda-wx {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--av-0);
  color: var(--av-0-ink);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

/* Month view */
.month {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.month-head,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.month-head {
  border-bottom: 1px solid var(--line);
}
.month-head span {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mcell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  min-width: 0;
  min-height: 118px;
  padding: 6px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.month-grid > .mcell:nth-child(-n + 7) {
  border-top: 0;
}
.month-grid > .mcell:nth-child(7n + 1) {
  border-left: 0;
}
.mcell.is-other {
  background: var(--surface-sunk);
}
.mcell.is-other .mcell-num {
  color: var(--muted);
}
.mcell.is-wet {
  background-color: var(--wet);
}
.mcell-top {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mcell-num {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mcell-num:hover {
  background: var(--wash);
}
.mcell.is-today .mcell-num {
  background: var(--accent);
  color: var(--accent-ink);
}
.mcell-top .wx {
  margin-left: auto;
}
.mcell-add {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  opacity: 0;
}
.mcell-top .wx + .mcell-add {
  margin-left: 0;
}
.mcell-num + .mcell-add {
  margin-left: auto;
}
.mcell:hover .mcell-add,
.mcell-add:focus-visible {
  opacity: 1;
}
.mcell-add:hover {
  background: var(--wash);
  color: var(--ink);
}
.mcell-jobs {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
}
.mcell-more {
  justify-self: start;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
}
.mcell-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  height: 6px;
}
.mcell-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--st-scheduled-edge);
}
.mcell-dots .dot--quoted { background: var(--st-quoted-edge); }
.mcell-dots .dot--in_progress { background: var(--st-in_progress-edge); }
.mcell-dots .dot--completed { background: var(--st-completed-edge); }

.month--compact {
  margin-bottom: 12px;
}
.month--compact .month-head span {
  padding: 6px 0;
  text-align: center;
}
.month--compact .mcell {
  grid-template-rows: auto 6px;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-height: 50px;
  padding: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--ink);
}
.month--compact .mcell.is-other {
  background: none;
}
.month--compact .mcell.is-other .mcell-num {
  opacity: 0.45;
}
.month--compact .mcell.is-wet {
  background: var(--wet);
}
.month--compact .mcell-num {
  pointer-events: none;
}
.month--compact .mcell.is-picked .mcell-num {
  background: var(--ink);
  color: var(--surface);
}
.month--compact .mcell.is-today.is-picked .mcell-num {
  background: var(--accent);
  color: var(--accent-ink);
}
.month--compact .mcell.is-today:not(.is-picked) .mcell-num {
  background: none;
  color: var(--accent-text);
}

/* Job sheet */
.job-for {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}
.job-for .icon {
  color: var(--accent-text);
}
.job-sheet-form > .field {
  margin-bottom: 14px;
}
.status-field {
  margin-bottom: 14px;
  padding: 0;
  border: 0;
}
.status-pick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.status-opt {
  position: relative;
}
.status-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.status-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.status-opt input:focus-visible + span {
  box-shadow: var(--focus);
}
.status-opt input:checked + span {
  font-weight: 600;
}
.status-opt--quoted input:checked + span { background: var(--st-quoted-bg); color: var(--st-quoted-ink); border-color: var(--st-quoted-edge); }
.status-opt--scheduled input:checked + span { background: var(--st-scheduled-bg); color: var(--st-scheduled-ink); border-color: var(--st-scheduled-edge); }
.status-opt--in_progress input:checked + span { background: var(--st-in_progress-bg); color: var(--st-in_progress-ink); border-color: var(--st-in_progress-edge); }
.status-opt--completed input:checked + span { background: var(--st-completed-bg); color: var(--ink); border-color: var(--ink-2); }
.job-insight {
  display: grid;
  gap: 6px;
}
.job-insight:empty {
  display: none;
}
.insight {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: 13px;
}
.insight .icon {
  margin-top: 2px;
  color: var(--accent-text);
}
.insight--watch .icon {
  color: var(--today);
}
.insight--bad {
  background: var(--warn-soft);
  color: var(--ink);
}
.insight--bad .icon,
.insight-warn {
  color: var(--warn);
}

/* Settings sheet */
.sched-form fieldset {
  margin-bottom: 16px;
  padding: 0;
  border: 0;
}
.sched-form .hint {
  margin-top: 6px;
}
.feed-box {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.feed-url {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font: 12.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.account-team {
  border-top: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .wk-service {
    display: none;
  }
}

@media (max-width: 760px) {
  /* The bottom bar holds the main tabs; Team lives in the Account sheet on phones. */
  .sidebar [data-team] {
    display: none;
  }
  .cal-bar {
    gap: 10px;
  }
  .cal-nav {
    width: 100%;
  }
  .cal-period {
    order: -1;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cal-bar .segmented {
    width: 100%;
  }
  .cal-bar .segmented button {
    flex: 1;
    height: 36px;
  }
  .cal-filters {
    flex-wrap: nowrap;
    margin: 0 -16px 12px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .cal-filters::-webkit-scrollbar {
    display: none;
  }
  .legend {
    flex: none;
    height: 34px;
  }
  .alert-row {
    align-items: stretch;
  }
  .alert-actions {
    width: 100%;
  }
  .alert-actions .btn {
    flex: 1;
    height: 40px;
  }
  .day-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dstat strong {
    font-size: 19px;
  }
  .stop {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 12px;
  }
  .stop-time {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
  }
  .stop-time .stop-dur {
    margin: 0;
  }
  .stop-time .stop-dur::before {
    content: '· ';
  }
  .stop-price {
    grid-column: 2;
    grid-row: 1;
  }
  .stop-main {
    grid-column: 1 / -1;
  }
  .stop-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 6px 0 0;
  }
  .stop-actions .btn {
    height: 40px;
    border: 1px solid var(--line);
  }
  .leg {
    margin-left: 22px;
  }
  .wx-options {
    padding-left: 0;
  }
  .wx-move {
    height: 38px;
  }
  .status-pick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-opt span {
    height: 42px;
  }
  .feed-box {
    flex-direction: column;
  }
  .feed-actions .btn {
    flex: 1;
    height: 42px;
  }
}

@media (pointer: coarse) {
  .mcell-add {
    opacity: 1;
  }
  .agenda-item:active,
  .jchip:active {
    transform: scale(0.985);
  }
}
.alert-more {
  margin: 2px 0 8px;
  font-size: 13px;
}
.day-wx:only-child {
  font-weight: 600;
}
.job-sheet-form {
  margin-top: 10px;
}

/* ==========================================================================
   Estimates
   ========================================================================== */

.phone-only {
  display: none !important;
}

/* Status pills */
.estatus {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.estatus--sent { background: var(--st-scheduled-bg); color: var(--st-scheduled-ink); }
.estatus--accepted { background: var(--good-soft); color: var(--good); }
.estatus--declined,
.estatus--expired { background: var(--warn-soft); color: var(--warn); }

/* List */
.est-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.est-list li + li {
  border-top: 1px solid var(--line);
}
.est-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 130px 96px 110px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
}
.est-row:hover {
  background: var(--wash);
}
.est-num {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.est-who {
  display: grid;
  min-width: 0;
}
.est-who span,
.est-date small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.est-date {
  display: grid;
  font-size: 13px;
}
.est-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Customer profile panel */
.est-mini li + li {
  border-top: 1px solid var(--line);
}
.est-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: var(--ink);
  text-decoration: none;
}
.est-mini-row > span:first-child {
  display: grid;
  min-width: 0;
}
.est-mini-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Builder */
.eb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 18px;
}
.eb-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.eb-main > .panel,
.eb-main [data-sections] > .panel {
  margin: 0;
}
[data-sections] {
  display: grid;
  gap: 14px;
}
.eb-side {
  position: sticky;
  top: 18px;
}
.eb-bar {
  display: none;
}
.eb-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.eb-customer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.eb-customer .field {
  flex: 1;
}
.eb-customer select {
  width: 100%;
}
.eb-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  color: var(--ink-2);
  font-size: 13px;
}
.eb-address:empty {
  display: none;
}
.eb-address .icon {
  color: var(--muted);
}
.eb-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--ink);
}
.eb-note .icon {
  color: var(--warn);
}

.svc-pick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.svc-opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.svc-opt > .icon {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--accent-text);
}
.svc-opt span {
  display: grid;
  gap: 2px;
}
.svc-opt small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.svc-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
.svc-check .icon {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}
.svc-opt:hover {
  border-color: var(--accent);
}
.svc-opt[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.svc-opt[aria-pressed='true'] .svc-check {
  display: grid;
}

.eb-svc .panel-title .icon {
  color: var(--accent-text);
}
.eb-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px 12px;
  margin-bottom: 14px;
}
.eb-fields select {
  width: 100%;
}
.unit-input {
  display: flex;
  align-items: center;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.unit-input:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus);
}
.unit-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: none;
  font-variant-numeric: tabular-nums;
}
.unit-input input:focus-visible {
  box-shadow: none;
  outline: none;
}
.unit-input span {
  flex: none;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.unit-input--pre span:first-child {
  padding-right: 0;
}
.field .unit-input input {
  height: 100%;
  border: 0;
}
.eb-diff {
  margin-bottom: 14px;
}
.eb-diff .segmented {
  flex-wrap: wrap;
}
.eb-diff .hint {
  margin-top: 6px;
}
.eb-extras {
  margin-bottom: 14px;
}
.eb-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.eb-suggest .chip {
  height: 32px;
  font-size: 12.5px;
}
.eb-suggest .chip .icon {
  color: var(--accent-text);
}
.eb-extra {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 6px;
  margin-top: 8px;
}
.eb-extra--other {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 120px auto;
}
.eb-extra > input {
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.eb-extra > input:focus-visible {
  border-color: var(--accent);
}
.eb-extra .icon-btn {
  color: var(--muted);
}
.eb-price {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}
.eb-math {
  display: grid;
  align-content: start;
  gap: 4px;
  font-size: 13px;
}
.eb-math > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.eb-min {
  color: var(--today) !important;
  font-weight: 500;
}
.eb-final {
  display: grid;
  gap: 10px;
}
.eb-final > div:first-child {
  display: grid;
}
.eb-final strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
}
.eb-final small {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.eb-final small .icon {
  width: 13px;
  height: 13px;
}
.eb-final .link-btn {
  margin-top: 4px;
  font-size: 12.5px;
}

.eb-summary {
  margin: 0;
}
.eb-lines {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.eb-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.eb-lines li.is-extra {
  padding-left: 12px;
  color: var(--ink-2);
  font-size: 13px;
}
.eb-totals,
.ed-totals dl {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.eb-totals > div,
.ed-totals dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.eb-totals dt {
  color: var(--ink-2);
}
.eb-disc dd,
.eb-disc dt {
  color: var(--good) !important;
}
.eb-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.eb-total dt {
  color: var(--ink) !important;
  font-weight: 600;
}
.eb-total dd {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
}
.eb-time {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.eb-adjust {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.eb-adjust summary {
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.eb-adjust .check {
  font-size: 13px;
  font-weight: 400;
}
.eb-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.eb-actions .btn-primary {
  flex: 1;
}
.eb .form-error:empty {
  display: none;
}
[data-descriptions] {
  display: grid;
}
.eb textarea {
  width: 100%;
}

/* Estimate page */
.est-head .page-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.est-actions {
  flex-wrap: wrap;
}
.est-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--st-scheduled-edge);
  border-radius: var(--radius);
  background: var(--surface);
}
.est-banner > .icon {
  color: var(--st-scheduled-edge);
}
.est-banner p {
  flex: 1;
  min-width: 200px;
}
.est-banner--accepted {
  border-left-color: var(--good);
  background: var(--good-soft);
}
.est-banner--accepted > .icon {
  color: var(--good);
}
.est-banner--declined {
  border-left-color: var(--warn);
}
.est-banner--declined > .icon {
  color: var(--warn);
}
.est-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 18px;
}
.est-aside {
  display: grid;
  gap: 12px;
}
.est-aside .panel {
  margin: 0;
}
.est-aside .panel-title {
  margin-bottom: 8px;
}
.est-aside .btn {
  justify-content: flex-start;
  width: 100%;
}
.est-notes {
  color: var(--ink-2);
  white-space: pre-wrap;
}
.est-status-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.est-status-btns .chip {
  height: 32px;
}
.est-status-btns .chip[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.send-btns {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

/* The paper document (always light, like a printed page) */
.paper {
  min-width: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-2);
}
.estimate-doc {
  --ed-ink: #18222e;
  --ed-muted: #5d6874;
  --ed-line: #e3e7ec;
  --ed-navy: #143a5c;
  --ed-teal: #1b9aae;
  padding: 48px 52px 40px;
  color: var(--ed-ink);
  font-size: 14px;
  line-height: 1.55;
}
.ed-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--ed-navy);
}
.ed-logo {
  display: block;
  width: auto;
  height: 48px;
  margin-bottom: 12px;
}
.ed-from {
  display: grid;
  color: var(--ed-muted);
  font-size: 13px;
}
.ed-from strong {
  color: var(--ed-ink);
  font-size: 15px;
}
.ed-meta {
  text-align: right;
}
.ed-title {
  margin-bottom: 10px;
  color: var(--ed-navy);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.ed-meta dl {
  display: grid;
  gap: 2px;
  font-size: 13px;
}
.ed-meta dl > div {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.ed-meta dt {
  color: var(--ed-muted);
}
.ed-meta dd {
  min-width: 120px;
  font-weight: 600;
}
.ed-for {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 48px;
  padding: 22px 0;
}
.ed-for h2,
.ed-terms h2 {
  width: 100%;
  margin-bottom: 4px;
  color: var(--ed-teal);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ed-contact {
  color: var(--ed-muted);
}
.ed-intro {
  margin-bottom: 22px;
  font-size: 15px;
}
.ed-stamp {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 12px;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ed-stamp--accepted { color: #1d7a3a; }
.ed-stamp--declined { color: #a8481a; }
.ed-table {
  width: 100%;
  border-collapse: collapse;
}
.ed-table th {
  padding: 10px 0;
  border-bottom: 1px solid var(--ed-ink);
  color: var(--ed-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}
.ed-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--ed-line);
  vertical-align: top;
}
.ed-table td strong {
  font-size: 15px;
}
.ed-table td p {
  max-width: 62ch;
  margin-top: 4px;
  color: var(--ed-muted);
}
.ed-table .ed-extra td {
  padding: 8px 0 8px 18px;
}
.ed-table .ed-extra td strong {
  font-size: 14px;
  font-weight: 500;
}
.ed-table .ed-extra td.ed-amt {
  padding-left: 0;
}
.ed-amt {
  width: 120px;
  font-variant-numeric: tabular-nums;
  text-align: right !important;
  white-space: nowrap;
}
.ed-totals {
  display: grid;
  justify-items: end;
  margin: 18px 0 28px;
}
.ed-totals dl {
  width: min(100%, 300px);
  border-top: 0;
}
.ed-totals dt {
  color: var(--ed-muted);
}
.ed-discount dt,
.ed-discount dd {
  color: #1d7a3a !important;
}
.ed-total {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 2px solid var(--ed-navy);
}
.ed-total dt {
  color: var(--ed-ink) !important;
  font-weight: 700;
}
.ed-total dd {
  color: var(--ed-navy);
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
}
.ed-time {
  margin-top: 8px;
  color: var(--ed-muted);
  font-size: 13px;
}
.ed-terms {
  padding: 16px 18px;
  border-radius: 6px;
  background: #f4f7f9;
  color: var(--ed-muted);
  font-size: 13px;
}
.ed-sign {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-top: 40px;
}
.ed-sign div {
  display: grid;
  gap: 4px;
}
.ed-sign span {
  height: 32px;
  border-bottom: 1px solid var(--ed-ink);
}
.ed-sign small {
  color: var(--ed-muted);
}
.ed-foot {
  margin-top: 32px;
  color: var(--ed-muted);
  font-size: 13px;
  text-align: center;
}

/* Customer's page (estimate.html) */
.public-estimate {
  background: var(--page);
}
.pe {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.pe-loading {
  padding: 80px 0;
  color: var(--muted);
  text-align: center;
}
.pe-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--ink-2);
}
.pe-accept {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px 24px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.pe-accept h2 {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}
.pe-accept p {
  color: var(--ink-2);
}
.pe-accept .field input {
  width: 100%;
}
.pe-accept .check,
.pe-accept .form-error,
.pe-btns {
  grid-column: 1 / -1;
}
.pe-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pe-btns .btn-primary {
  min-width: 220px;
  height: 46px;
  font-size: 15px;
}
.pe-done {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.pe-done > .icon {
  width: 22px;
  height: 22px;
  color: var(--muted);
}
.pe-done--yes {
  border-color: color-mix(in srgb, var(--good) 40%, var(--line));
  background: var(--good-soft);
}
.pe-done--yes > .icon {
  color: var(--good);
}
.pe-done p {
  margin-top: 2px;
  color: var(--ink-2);
}
.pe-error {
  margin-top: 60px;
}

/* Pricing sheet */
.pricing-form fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}
.pricing-form > .hint {
  margin-bottom: 14px;
}
.pricing-form textarea {
  width: 100%;
}
.ai-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.ai-section .section-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-section .section-title .icon {
  color: var(--accent-text);
}
.ai-on,
.ai-off {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
}
.ai-on { background: var(--good-soft); color: var(--good); }
.ai-off { background: var(--surface-sunk); color: var(--muted); }
.ai-section .hint {
  margin-bottom: 10px;
}

@media (max-width: 1180px) {
  .eb {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .svc-pick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .est-layout {
    grid-template-columns: 1fr;
  }
  .est-aside {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 960px) {
  .eb {
    grid-template-columns: 1fr;
  }
  .eb-side {
    position: static;
  }
  .est-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
  }
  .est-num {
    grid-column: 1;
  }
  .est-who {
    grid-column: 1;
  }
  .est-date {
    display: none;
  }
  .est-row .estatus {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .est-total {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .phone-only {
    display: flex !important;
  }
  /* The bottom bar holds the main tabs; Analytics opens from Account on phones. */
  .nav a[data-nav='analytics'] {
    display: none;
  }
  .svc-pick {
    grid-template-columns: 1fr;
  }
  .svc-opt {
    padding: 12px 40px 12px 12px;
  }
  .eb-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .eb-price {
    grid-template-columns: 1fr;
  }
  .eb-extra,
  .eb-extra--other {
    grid-template-columns: minmax(0, 1fr) 100px auto;
  }
  .eb-extra--other > input:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .eb-actions {
    display: none;
  }
  /* A total that stays in view while you scroll the form. */
  .eb-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(63px + env(safe-area-inset-bottom));
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .eb-bar > div {
    display: grid;
    line-height: 1.1;
  }
  .eb-bar span {
    color: var(--muted);
    font-size: 12px;
  }
  .eb-bar strong {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 26px;
  }
  .eb-bar .btn {
    height: 44px;
    padding: 0 18px;
  }
  .est-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .est-actions .btn {
    flex-direction: column;
    gap: 3px;
    height: 56px;
    padding: 0 4px;
    font-size: 12px;
  }
  .estimate-doc {
    padding: 24px 18px;
    font-size: 13.5px;
  }
  .ed-head {
    flex-direction: column;
  }
  .ed-meta {
    text-align: left;
  }
  .ed-meta dl > div {
    justify-content: flex-start;
  }
  .ed-meta dd {
    min-width: 0;
  }
  .ed-title {
    font-size: 36px;
  }
  .ed-amt {
    width: 90px;
  }
  .ed-sign {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .pe {
    padding: 14px 12px 48px;
  }
  .pe-accept {
    grid-template-columns: 1fr;
  }
  .pe-btns .btn {
    flex: 1;
  }
}


/* ==========================================================================
   Canvassing map
   ========================================================================== */

body.route-map .main {
  padding: 0;
}
.mapx {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface-sunk);
}
.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #e8e6df;
}
.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.mapx[data-mode='pin'] .map-canvas,
.mapx[data-mode='draw'] .map-canvas {
  cursor: crosshair;
}
.leaflet-container {
  font: inherit;
}
.leaflet-control-attribution {
  font-size: 10.5px;
}
.area-label {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  color: #17181a;
  font-weight: 600;
  font-size: 12px;
}
.area-label::before {
  display: none;
}

/* Search + chips across the top */
.map-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 76px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  max-width: 560px;
  pointer-events: none;
}
.map-top > * {
  pointer-events: auto;
}
.map-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 6px 0 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.map-search > .icon {
  color: var(--muted);
}
.map-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: 16px;
}
.map-search input:focus-visible {
  box-shadow: none;
  outline: none;
}
.map-search:focus-within {
  box-shadow: var(--shadow-2), 0 0 0 2px var(--accent);
}
.map-results {
  max-height: 50vh;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.map-results-h {
  padding: 10px 14px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.map-result {
  display: grid;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
}
.map-result span {
  color: var(--muted);
  font-size: 13px;
}
.map-result:hover {
  background: var(--wash);
}
.map-result--go {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-text);
  font-weight: 600;
}
.map-result--go span {
  color: inherit;
  font-size: 14px;
}
.map-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.map-chips::-webkit-scrollbar {
  display: none;
}
.map-chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 2px 6px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
.map-chip[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}
.map-chip[aria-pressed='true'] .chip-count {
  color: inherit;
}
.map-chip--cb-overdue .chip-count {
  color: var(--danger);
  font-weight: 700;
}
.map-chip--select {
  padding: 0 4px 0 0;
}
.map-chip--select select {
  height: 40px;
  max-width: 200px;
  padding: 0 30px 0 14px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  font-weight: 600;
}

/* Floating buttons */
.map-fabs {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: grid;
  gap: 8px;
}
.map-fab {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  color: var(--ink);
}
.map-fab .icon {
  width: 22px;
  height: 22px;
}
.map-fab[aria-pressed='true'],
.mapx[data-mode='pin'] [data-act='pin'],
.mapx[data-mode='draw'] [data-act='draw'] {
  background: var(--accent);
  color: var(--accent-ink);
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  margin-bottom: 24px;
}

/* Instructions while dropping a pin or drawing */
.map-modebar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  width: min(560px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transform: translateX(-50%);
}
.map-modebar p {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.map-modebar p .icon {
  color: var(--accent-text);
}
.map-modebar-btns {
  display: flex;
  gap: 6px;
}
.map-modebar .btn {
  height: 42px;
  padding: 0 16px;
}

/* List view */
.map-list {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1001;
  width: min(420px, 100%);
  overflow-y: auto;
  background: var(--page);
  box-shadow: var(--shadow-3);
}
.map-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--page);
}
.map-list-head h2 {
  flex: 1;
  font-size: 16px;
}
.map-rows {
  padding: 6px 8px 24px;
}
.map-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
}
.map-row:hover {
  background: var(--wash);
}
.map-row + * {
  border-top: 1px solid var(--line);
}
.map-row-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.map-row-main strong {
  font-size: 15px;
}
.map-row-main > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-row-cb,
.map-row-next {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.map-row-cb .icon,
.map-row-next .icon {
  width: 13px;
  height: 13px;
}
.map-row-cb--overdue { color: var(--danger) !important; }
.map-row-cb--today { color: var(--warn) !important; }
.map-row-next { color: var(--good) !important; }
.map-row-meta {
  display: grid;
  justify-items: end;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: right;
}
.map-row-meta small {
  color: var(--muted);
}

.dot {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot, #999);
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.25);
}

/* Property panel: a side panel on computers, a bottom sheet on phones */
.pp {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: 420px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: pp-in 0.18s ease-out;
}
@keyframes pp-in {
  from { transform: translateX(24px); }
}
.pp-grip {
  display: none;
}
.pp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 16px 10px 20px;
}
.pp-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.05;
}
.pp-sub {
  margin-top: 3px;
  color: var(--muted);
}
.pp-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 28px;
  overscroll-behavior: contain;
}
.pp-statusline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: var(--wash);
  font-weight: 600;
}
.pp-pill .dot {
  background: var(--dot);
}
.pp-owner {
  color: var(--ink-2);
  font-weight: 500;
}
.pp-flag {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--wash);
  font-size: 14px;
}
.pp-flag .icon {
  margin-top: 2px;
}
.pp-flag--dnc { background: #111; color: #fff; }
.pp-flag--booked { background: var(--good-soft); color: var(--ink); }
.pp-flag--booked .icon { color: var(--good); }
.pp-flag--cb-overdue { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.pp-flag--cb-overdue .icon { color: var(--danger); }
.pp-flag--cb-today,
.pp-flag--cb-upcoming { background: var(--warn-soft); }
.pp-flag--cb-today .icon,
.pp-flag--cb-upcoming .icon { color: var(--warn); }

.pp-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 18px;
}
.pp-act {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-left: 6px solid var(--dot);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}
.pp-act .icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--ink-2);
}
.pp-act:hover {
  background: var(--wash);
}
.pp-act:active {
  transform: scale(0.98);
}
.pp-act--dnc {
  border-left-color: #111;
}

.pp-sec {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.pp-sec h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pp-dl {
  display: grid;
  gap: 6px;
}
.pp-dl > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
}
.pp-dl dt {
  color: var(--muted);
}
.pp-dl dd {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  white-space: pre-wrap;
}
.pp-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.pp-cust a {
  font-size: 16px;
  font-weight: 600;
}
.pp-jobs {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pp-jobs li + li {
  border-top: 1px solid var(--line);
}
.pp-jobs a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
}
.pp-jobs a > span:first-child {
  display: grid;
}
.pp-jobs small {
  color: var(--muted);
}
.pp-jobs a > span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pp-unpaid {
  color: var(--warn);
}
.pp-note {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.pp-note input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.pp-note .btn {
  height: 42px;
}
.pp-history {
  display: grid;
  gap: 12px;
}
.pp-visit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.pp-visit .dot {
  margin-top: 3px;
}
.pp-visit time {
  color: var(--muted);
  font-size: 12.5px;
}
.pp-visit-notes {
  margin-top: 2px;
  white-space: pre-wrap;
}
.pp-visit-meta {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13px;
}
.pp-draft .form-grid {
  margin-bottom: 8px;
}
.pp-draft .hint {
  margin-bottom: 10px;
}
.pp-services {
  margin: 4px 0 12px;
  padding: 0;
  border: 0;
}
.pp-form .check {
  margin-top: 4px;
}

/* Sheets used from the map */
.menu-list {
  display: grid;
  gap: 4px;
  margin: 8px 0 12px;
}
.menu-list .btn {
  justify-content: flex-start;
  height: 48px;
}
.legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.legend-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-filter {
  display: grid;
  gap: 2px;
  margin: 8px 0 12px;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}
.status-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.status-row span:not(.chip-count) {
  flex: 1;
}
.stset {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.stset-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
}
.stset-row input[type='color'] {
  width: 52px;
  height: 42px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.stset-row input[type='text'] {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.area-form input[type='color'] {
  width: 64px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.cs-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 14px;
}
.cs-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cs-custom input {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.cs-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.cs-tile {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.cs-tile span {
  color: var(--muted);
  font-size: 12.5px;
}
.cs-tile strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}
.cs-tile small {
  color: var(--muted);
  font-size: 12px;
}
.cs-table {
  margin-bottom: 10px;
}

/* Offline / syncing pill */
.net-status {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  font-weight: 600;
  transform: translateX(-50%);
  pointer-events: none;
}
.net-status[hidden] {
  display: none;
}
.net-status--offline {
  background: #7a3a14;
  color: #fff;
}
body:not(.route-map) .net-status {
  top: auto;
  bottom: 24px;
}

@media (max-width: 960px) {
  .cs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  /* Phone tab bar: Map first; Pipeline and Analytics live under More. */
  .nav a[data-nav='pipeline'],
  .nav a[data-nav='analytics'] {
    display: none;
  }
  .nav a[data-nav='map'] { order: -2; }
  .nav a[data-nav='leads'] { order: 5; }

  .mapx {
    height: calc(100dvh - 63px - env(safe-area-inset-bottom));
  }
  .map-top {
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    right: 70px;
  }
  .map-fabs {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
  }
  .map-fab {
    width: 50px;
    height: 50px;
  }
  .leaflet-bottom.leaflet-left .leaflet-control-zoom {
    display: none;
  }
  .map-list {
    width: 100%;
    z-index: 1050;
  }
  .map-modebar {
    bottom: 12px;
  }
  .pp {
    top: auto;
    left: 0;
    width: auto;
    max-height: min(78dvh, calc(100dvh - 60px));
    bottom: calc(62px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    animation: pp-up 0.2s ease-out;
  }
  @keyframes pp-up {
    from { transform: translateY(40px); }
  }
  .pp-grip {
    display: block;
    width: 40px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: var(--line-strong);
  }
  .pp-head {
    padding: 8px 12px 6px 16px;
  }
  .pp-title {
    font-size: 24px;
  }
  .pp-body {
    padding: 0 16px calc(20px + env(safe-area-inset-bottom));
  }
  .pp-act {
    min-height: 64px;
    font-size: 15px;
  }
  body:not(.route-map) .net-status {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media print {
  .pp,
  .net-status {
    display: none !important;
  }
}
/* Printing an estimate: only the paper document, edge to edge. */
@media print {
  @page {
    margin: 12mm;
  }
  body {
    background: #fff !important;
  }
  body * {
    visibility: hidden;
  }
  .estimate-doc,
  .estimate-doc * {
    visibility: visible;
  }
  .paper {
    box-shadow: none !important;
  }
  .estimate-doc {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
  }
  .sidebar,
  .fab,
  .toasts,
  .pe-bar,
  .pe-accept {
    display: none !important;
  }
}

/* Dropdowns everywhere keep their arrow, whatever background rule wins. */
.field select,
.select select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  appearance: none;
}
/* The page area takes focus after navigation for screen readers; it shouldn't draw a ring. */
.main:focus-visible {
  box-shadow: none;
}

/* Keep the map buttons clear of the property panel on wider screens. */
@media (min-width: 761px) {
  body.pp-open .map-fabs {
    right: 432px;
  }
}
