:root {
  color-scheme: light dark;
  --teal: #1bb3d2;
  --teal-dark: #0b86a0;
  --ink: #10202b;
  --ink-2: #1b3140;
  --gray: #787878;
  --bg: #eef2f4;
  --card: #ffffff;
  --header-bg: #10202b;
  --text: #12202b;
  --muted: #5f6b73;
  --line: #d5dde2;
  --ok: #1a7f37;
  --bad: #c62828;
  --warn-bg: #fff4d6;
  --warn-text: #6b4b00;
  --chip-bg: #e6f6fa;
  --chip-text: #00596b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1720;
    --card: #152633;
    --header-bg: #10202b;
    --text: #eef2f3;
    --muted: #9aa6ad;
    --line: #28404f;
    --teal-dark: #3ccae6;
    --ok: #4cc26b;
    --bad: #ef7b7b;
    --warn-bg: #3a3112;
    --warn-text: #f1d37a;
    --chip-bg: #1b3a43;
    --chip-text: #8fdcee;
  }
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.top {
  background: var(--header-bg);
  padding: calc(8px + env(safe-area-inset-top, 0)) 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo { height: 42px; max-width: 55vw; object-fit: contain; display: block; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); text-align: right; }

.nav {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  padding: 0 12px;
  overflow-x: auto;
}
.nav a {
  padding: 14px 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.nav a.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

main { max-width: 860px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0 0 10px; line-height: 1.5; }
a { color: var(--teal-dark); }
.muted { color: var(--muted); font-size: 14px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 14px; margin-bottom: 6px; display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card.narrow { max-width: 420px; margin: 24px auto; }

.btn, .btn-secondary {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  color: var(--teal-dark);
  border: 1px solid var(--line);
}
.btn.full { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-link {
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  color: var(--teal-dark);
  cursor: pointer;
  padding: 6px;
}

label.stack { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; flex: none; }

.banner { padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.banner.error { background: rgba(198, 40, 40, 0.12); color: var(--bad); }
.banner.info { background: var(--chip-bg); color: var(--chip-text); }

/* Lists */
.search-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search-row input[type="search"] { flex: 1; min-width: 200px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.row:hover { border-color: var(--teal); }
.row .title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
}
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* Detail pages */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dt { margin-top: 10px; } }

/* Forms */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.field { grid-column: span 2; }
.field.half { grid-column: span 1; }
@media (max-width: 600px) { .field.half { grid-column: span 2; } }
.field > label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field.checkbox { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.field.checkbox label { margin: 0; }
.secret-wrap { display: flex; gap: 8px; }
.form-actions { grid-column: span 2; display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 140px; }
.form-banner { grid-column: span 2; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  background: #1d2327;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

/* Area list */
.area-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.area-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.area-num { width: 24px; text-align: center; color: var(--muted); font-size: 13px; flex: none; }
.area-name { flex: 1; overflow-wrap: anywhere; }
.area-row input[type="text"] { padding: 6px 8px; }
.area-actions { display: flex; gap: 2px; flex: none; }
button.icon {
  font: inherit; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
button.icon:hover:not(:disabled) { background: var(--chip-bg); color: var(--teal-dark); }
button.icon:disabled { opacity: 0.3; cursor: default; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form select, .inline-form input { flex: 1; min-width: 0; }
.inline-form .btn-secondary { flex: none; }

/* Work orders */
.title-line { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-secondary.danger { color: var(--bad); }
.lines { margin: 8px 0; }
.line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line .grow { flex: 1; min-width: 0; }
.line .strong { font-weight: 700; overflow-wrap: anywhere; }
.line .sub { color: var(--muted); font-size: 14px; }
.line .amt { font-weight: 700; white-space: nowrap; }
.line .form { width: 100%; }
.totals { margin: 12px 0 0 auto; max-width: 340px; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.totals .grand { font-weight: 800; font-size: 17px; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; }
details.add { margin-top: 12px; border: 1px dashed var(--line); border-radius: 10px; padding: 4px 12px 12px; }
details.add > summary { cursor: pointer; font-weight: 700; color: var(--teal-dark); padding: 8px 0; }
h2.spaced { margin-top: 20px; }
.multicheck { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.static { padding: 10px 0; font-weight: 600; }

/* Crew screens: bigger touch targets */
.btn.big { display: block; width: 100%; font-size: 19px; padding: 18px 20px; }
.row.job { padding: 14px 16px; }
.row.job .title { font-size: 17px; }

/* Photo slots */
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.photo-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-slot .thumb { width: 100%; max-height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.photo-actions .btn-secondary { width: 100%; }
.photo-status { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.photo-status.ok { color: var(--teal-dark); font-weight: 700; }
.photo-status.bad { color: #b3261e; font-weight: 700; }

/* Office review: photos fill their column and grow to their own height */
.photo-pair > .thumb { width: 100%; height: auto; max-height: none; display: block; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.photo-ph { display: flex; align-items: center; justify-content: center; min-height: 120px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }

.card.inner { box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 0; margin-top: 18px; background: transparent; }

.company-logo { display: block; max-width: 260px; max-height: 120px; margin: 8px 0 12px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--line); }

.inline-field { display: inline-flex; align-items: center; gap: 8px; }
.inline-field label { margin: 0; font-weight: 700; }
.inline-field input { width: auto; }
label.line.check { cursor: pointer; align-items: center; }

/* keep line breaks typed in notes and numbered lists */
.kv dd, .sub, .card p { white-space: pre-line; }

/* shows transparency in the logo preview */
.logo-preview { display: inline-block; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 12px; background: repeating-conic-gradient(#d9dee2 0% 25%, #fff 0% 50%) 50% / 14px 14px; }
.logo-preview .company-logo { margin: 0; background: transparent; border: 0; padding: 8px; }

/* ---- Match the website: navy header, Archivo headings, cyan buttons ---- */
h1, h2, h3, .page-head h1 { font-family: 'Archivo', 'Arial Narrow', Arial, sans-serif; font-stretch: 88%; letter-spacing: -0.01em; }
h1 { font-weight: 800; }
h2 { font-weight: 750; }
.top { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.top .who { color: #c3ccd3; }
.top .btn-link { color: #7fd6e8; }
.top .btn-secondary { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.nav { background: var(--ink-2); border-bottom: 0; }
.nav a { color: #c3ccd3; }
.nav a:hover { color: #fff; }
.nav a.active { color: #fff; border-bottom-color: var(--teal); }
.btn { color: var(--ink); font-family: 'Archivo', 'Arial Narrow', Arial, sans-serif; font-stretch: 92%; letter-spacing: 0.01em; }
.btn:hover:not(:disabled) { background: #43c6e2; }
.btn-secondary { border-color: var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--teal); }
.card { border-radius: 10px; }
:focus-visible { outline: 3px solid #f5b301; outline-offset: 2px; }
.banner.success { background: rgba(26, 127, 55, 0.12); color: var(--ok); }

/* Calendar */
.cal-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-bar .cal-title { flex: 1; text-align: center; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.cal-grid.cal-dow { border-bottom: 0; }
.cal-dow div { background: var(--card); text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0; }
.cal-day { background: var(--card); color: inherit; text-decoration: none; min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-day:hover { background: var(--chip-bg); }
.cal-day.other { opacity: 0.45; }
.cal-day.today .cal-num { background: var(--teal); color: #10202b; border-radius: 999px; padding: 0 6px; }
.cal-day.sel { outline: 2px solid var(--teal-dark); outline-offset: -2px; }
.cal-num { font-size: 13px; font-weight: 700; align-self: flex-start; }
.cal-pill { display: block; font-size: 11px; line-height: 1.3; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--chip-bg); color: var(--chip-text); }
.cal-pill.visit { background: var(--warn-bg); color: var(--warn-text); }
.cal-pill.recurring, .chip.recurring { background: #ede3fb; color: #4b2a8a; }
.cal-pill.done { opacity: 0.55; text-decoration: line-through; }
.cal-more { font-size: 11px; color: var(--muted); }
.cal-count { display: none; }
.cal-legend { margin-top: 10px; display: flex; gap: 6px; align-items: center; font-size: 12px; }
.row.cal-done { opacity: 0.65; }
@media (max-width: 700px) {
  .cal-day { min-height: 54px; align-items: center; }
  .cal-pill, .cal-more { display: none; }
  .cal-count { display: inline-block; font-size: 11px; font-weight: 700; background: var(--teal); color: #10202b; border-radius: 999px; padding: 0 7px; }
}

.site-notes { display: inline-block; background: #10202b; color: #f5b301; font-weight: 600; white-space: pre-wrap; padding: 6px 10px; border-radius: 6px; }

@media (prefers-color-scheme: dark) { .cal-pill.recurring, .chip.recurring { background: #3b2a5e; color: #d9c6ff; } }

.cal-pill.nocharge, .chip.nocharge { background: #fde2e1; color: #9b1c1c; }
@media (prefers-color-scheme: dark) { .cal-pill.nocharge, .chip.nocharge { background: #5a2323; color: #ffc9c7; } }

.service-icon{display:block;width:96px;height:96px;object-fit:contain;margin:.5rem 0;border-radius:8px}

.home-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.home-head h2 { margin: 0 0 8px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 6px; }
.home-tile { border: 1px solid var(--line, #2a3b47); border-radius: 10px; padding: 10px 12px; }
.home-num { font-size: clamp(20px, 6vw, 24px); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.home-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.home-tile.total { border-color: var(--teal); }
.home-tile.good .home-num { color: var(--teal-dark); }
.home-tile.bad .home-num { color: #b3261e; }
.month-rates { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.month-rate { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.home-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.bars { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bar-name { font-weight: 600; overflow-wrap: anywhere; }
.bar-val { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; margin-top: 4px; background: rgba(127,127,127,.15); border-radius: 0 4px 4px 0; }
.bar-fill { height: 100%; background: var(--teal); border-radius: 0 4px 4px 0; }
.bar-row:hover .bar-fill { filter: brightness(1.15); }

/* Promotional emails: customer pick list */
.promo-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.promo-row input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.promo-row.disabled { opacity: .55; cursor: default; }
