/* Chicago Home Cleaning: the Chicago CRM styles.
   Same look as the team's other CRM: warm paper background, teal actions,
   blue links, a sticky top bar and a grouped side menu (a drawer on phones).
   Colors are CSS variables only. Light is the default; dark follows the phone
   unless the top bar or Settings sets data-theme. No inline styles anywhere (CSP). */

:root {
  --bg: #f4f2ed;
  --panel: #fdfcfa;
  --panel2: #eeebe4;
  --chip: #eae6dc;
  --line: #e3dfd5;
  --line-strong: #d2ccbe;
  --txt: #2a2924;
  --muted: #7a766c;
  --brand: #0d9d8d;
  --brand-ink: #04201c;
  --ink-brand: #0b7a6e;
  --tint-brand: #e7f6f2;
  --link: #3b6cf0;
  --tint-link: #eaeffb;
  --tint-blue: #e3ecfa;   --ink-blue: #1d4ed8;
  --tint-green: #dff2e3;  --ink-green: #15803d;
  --tint-red: #fbe4e4;    --ink-red: #b91c1c;
  --tint-amber: #fdf0d2;  --ink-amber: #8a6210;
  --tint-purple: #ede9fa; --ink-purple: #6d28d9;
  --tint-cyan: #dff4f7;   --ink-cyan: #0e7490;
  --tint-muted: #eae6dc;  --ink-muted: #6b675e;
  --cl-1: #d6336c; --cl-1t: #fbe9ef;
  --cl-2: #b45309; --cl-2t: #f8eee4;
  --cl-3: #7c3aed; --cl-3t: #efeafb;
  --cl-4: #2f855a; --cl-4t: #e8f2ea;
  --cl-5: #2563eb; --cl-5t: #e8eefb;
  --cl-6: #0e7490; --cl-6t: #e3f3f6;
  --focus: #0d9d8d;
  --top-a: #fdfcfa;
  --top-b: #f4f2ed;
  --shadow: 0 20px 60px rgba(0, 0, 0, .25);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .06);
  --scrim: rgba(15, 23, 42, .45);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237a766c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c;
    --panel: #1d2026;
    --panel2: #262a31;
    --chip: #2a2f37;
    --line: #343941;
    --line-strong: #454b55;
    --txt: #e7e5df;
    --muted: #9b978d;
    --brand: #2eb5a4;
    --brand-ink: #04201c;
    --ink-brand: #5fd3c3;
    --tint-brand: #12332e;
    --link: #7b96ff;
    --tint-link: #1c2540;
    --tint-blue: #1b2a45;   --ink-blue: #8ab0f7;
    --tint-green: #14301f;  --ink-green: #5bd695;
    --tint-red: #3d1d1d;    --ink-red: #f39b9b;
    --tint-amber: #3a2f14;  --ink-amber: #e8c15c;
    --tint-purple: #2a2344; --ink-purple: #b9a5f5;
    --tint-cyan: #123137;   --ink-cyan: #67d3e0;
    --tint-muted: #2a2f37;  --ink-muted: #aaa69c;
    --cl-1: #f06595; --cl-1t: #2c1d24;
    --cl-2: #e8a25c; --cl-2t: #2c241c;
    --cl-3: #a78bfa; --cl-3t: #241f33;
    --cl-4: #5bd695; --cl-4t: #1a2a21;
    --cl-5: #7b96ff; --cl-5t: #1c2338;
    --cl-6: #67d3e0; --cl-6t: #1a2a2e;
    --focus: #2eb5a4;
    --top-a: #1d2026;
    --top-b: #15171c;
    --shadow: 0 20px 60px rgba(0, 0, 0, .6);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
    --scrim: rgba(0, 0, 0, .6);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239b978d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15171c;
  --panel: #1d2026;
  --panel2: #262a31;
  --chip: #2a2f37;
  --line: #343941;
  --line-strong: #454b55;
  --txt: #e7e5df;
  --muted: #9b978d;
  --brand: #2eb5a4;
  --brand-ink: #04201c;
  --ink-brand: #5fd3c3;
  --tint-brand: #12332e;
  --link: #7b96ff;
  --tint-link: #1c2540;
  --tint-blue: #1b2a45;   --ink-blue: #8ab0f7;
  --tint-green: #14301f;  --ink-green: #5bd695;
  --tint-red: #3d1d1d;    --ink-red: #f39b9b;
  --tint-amber: #3a2f14;  --ink-amber: #e8c15c;
  --tint-purple: #2a2344; --ink-purple: #b9a5f5;
  --tint-cyan: #123137;   --ink-cyan: #67d3e0;
  --tint-muted: #2a2f37;  --ink-muted: #aaa69c;
  --cl-1: #f06595; --cl-1t: #2c1d24;
  --cl-2: #e8a25c; --cl-2t: #2c241c;
  --cl-3: #a78bfa; --cl-3t: #241f33;
  --cl-4: #5bd695; --cl-4t: #1a2a21;
  --cl-5: #7b96ff; --cl-5t: #1c2338;
  --cl-6: #67d3e0; --cl-6t: #1a2a2e;
  --focus: #2eb5a4;
  --top-a: #1d2026;
  --top-b: #15171c;
  --shadow: 0 20px 60px rgba(0, 0, 0, .6);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
  --scrim: rgba(0, 0, 0, .6);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239b978d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.na { color: var(--muted); font-weight: 400; font-size: .92em; }
.offscreen { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel2); color: var(--txt);
  font-weight: 700; font-size: 13px; line-height: 1.2;
  cursor: pointer; text-align: center; white-space: nowrap;
  transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { background: var(--tint-red); color: var(--ink-red); border-color: var(--ink-red); }
.btn.danger:hover { background: var(--tint-red); filter: brightness(.97); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.linkish {
  background: none; border: 0; padding: 0; color: var(--link); font-weight: 700; cursor: pointer;
  min-height: 40px; text-align: left;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--panel2); color: var(--txt); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel2); color: var(--txt); font-size: 16px; outline: none;
  transition: border-color .12s;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 32px; background-image: var(--chev); background-repeat: no-repeat;
  background-position: right 10px center;
}
select:hover { border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--brand); }
.field { margin-bottom: 14px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fields > * { min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; color: var(--muted); font-size: 13px; font-weight: 600; margin: 0; cursor: pointer; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.form-actions > .btn { flex: 1 1 auto; }
.error-box {
  background: var(--tint-red); color: var(--ink-red); border: 1px solid var(--ink-red);
  border-radius: 10px; padding: 10px 12px; font-weight: 600; margin-bottom: 12px;
}
.note-box {
  background: var(--tint-amber); color: var(--ink-amber); border-radius: 10px;
  padding: 10px 12px; font-weight: 600; margin-bottom: 12px;
}

/* ---------------------------------------------------------------- pills */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700; line-height: 1.4;
  background: var(--chip); color: var(--ink-muted); white-space: nowrap;
}
.b-blue { background: var(--tint-link); color: var(--link); }
.b-green { background: var(--tint-green); color: var(--ink-green); }
.b-red { background: var(--tint-red); color: var(--ink-red); }
.b-amber { background: var(--tint-amber); color: var(--ink-amber); }
.b-brass { background: var(--tint-brand); color: var(--ink-brand); }
.b-navy { background: var(--tint-purple); color: var(--ink-purple); }
.b-muted { background: var(--chip); color: var(--ink-muted); }
.b-dashed { background: transparent; border: 1.5px dashed var(--ink-red); color: var(--ink-red); padding: 2px 9px; }

/* ----------------------------------------------------------------- shell */
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-weight: 700; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 10px 22px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(180deg, var(--top-a), var(--top-b));
  border-bottom: 1px solid var(--line);
}
.hamburger { display: none; border: 1px solid var(--line); background: var(--panel2); color: var(--txt); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--txt); font-weight: 800; min-width: 0; }
.brand img { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: 0 0 16px rgba(13, 157, 141, .3); }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; letter-spacing: -.01em; }
.gs { position: relative; flex: 0 1 320px; min-width: 0; margin-left: 8px; }
.gs input { min-height: 36px; padding: 7px 12px 7px 34px; font-size: 13px; border-radius: 10px; }
.gs svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.gs-res {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70; min-width: 280px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18); padding: 6px; max-height: 60vh; overflow-y: auto;
  animation: popIn .12s ease-out;
}
.gs-h { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 8px 4px; }
.gs-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 7px 8px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer;
}
.gs-row:hover, .gs-row:focus-visible { background: var(--panel2); }
.gs-row .grow { flex: 1 1 auto; min-width: 0; }
.gs-row .strong { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-row .row-sub { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-empty { padding: 12px 8px; color: var(--muted); font-weight: 600; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rolebadge { padding: 3px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--chip); color: var(--txt); white-space: nowrap; }
.who { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 220px; }
.tb-theme { border: 1px solid var(--line); background: var(--panel2); color: var(--txt); }
.tb-logout { min-height: 36px; }

.shell { display: flex; min-height: calc(100vh - 61px); }
.side { width: 210px; flex: none; border-right: 1px solid var(--line); padding: 16px 12px; }
.nav-scrim { display: none; }
.side .nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 9px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--muted); font-weight: 600;
}
.side .nav-item:hover { background: var(--panel2); color: var(--txt); }
.side .nav-item[aria-current="page"] { background: var(--panel2); color: var(--txt); font-weight: 700; }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-grp { margin-top: 10px; }
.nav-grp-h {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 4px;
  color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.nav-grp-items { margin-left: 18px; padding-left: 8px; border-left: 1px solid var(--line); }
.side .nav-grp-items .nav-item { min-height: 36px; padding: 7px 10px; font-size: 13px; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--ink-red); color: var(--panel); font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.main { flex: 1 1 auto; min-width: 0; max-width: 1180px; padding: 24px 30px 48px; outline: none; }
.bottom { display: none; }

/* Phones and small tablets: the side menu becomes a drawer behind the top-bar button. */
@media (max-width: 899px) {
  .hamburger { display: inline-flex; }
  .topbar { gap: 8px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); min-height: 56px; }
  .brand { gap: 8px; }
  .brand img { width: 24px; height: 24px; border-radius: 7px; }
  .brand-name { font-size: 15px; }
  .rolebadge { display: none; }
  .who { display: none; }
  .tb-right { gap: 6px; }
  .tb-logout { padding: 6px 10px; }
  .shell { display: block; min-height: 0; }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: 78vw; max-width: 280px;
    background: var(--panel); border-right: 1px solid var(--line); box-shadow: 6px 0 24px rgba(0, 0, 0, .18);
    padding: calc(20px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto; transform: translateX(-102%); transition: transform .22s ease; visibility: hidden;
  }
  .side.open { transform: none; visibility: visible; }
  .side .nav-item { min-height: 44px; }
  .side .nav-grp-items .nav-item { min-height: 44px; font-size: 14px; }
  .nav-scrim.show { display: block; position: fixed; inset: 0; z-index: 75; background: var(--scrim); }
  .main { padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); max-width: 100%; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; font-size: 13px; padding: 8px 12px; }
  .icon-btn { width: 44px; height: 44px; }
}
@media (max-width: 599px) {
  .gs { display: none; }
  .tb-logout { display: none; }   /* Log out stays in the menu, under Settings */
}

/* ------------------------------------------------------------ page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > * { min-width: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seg {
  display: inline-flex; max-width: 100%; margin-bottom: 16px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
}
.seg button {
  flex: 0 1 auto; min-width: 0; min-height: 36px; padding: 7px 16px;
  border: 0; border-radius: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--chip); color: var(--txt); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.seg .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink-red); color: var(--panel);
  font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.seg button[aria-pressed="true"] .count { background: var(--brand-ink); color: var(--brand); }
/* Inside forms and cards a choice row fills the width. */
.seg.small, .step .seg, .card .seg { display: flex; }
.seg.small button, .step .seg button, .card .seg button { flex: 1 1 0; }
.search-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-row input { flex: 1 1 220px; }
.chips { display: flex; gap: 8px; }
.chip {
  min-height: 40px; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--panel); font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted);
}
.chip:hover { color: var(--txt); }
.chip[aria-pressed="true"] { background: var(--tint-brand); color: var(--ink-brand); border-color: var(--brand); }

/* ----------------------------------------------------------------- cards */
.list { display: grid; gap: 10px; }
.card {
  position: relative; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; overflow-wrap: anywhere;
}
.card[data-act] { cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.card[data-act]:hover { box-shadow: var(--shadow-sm); }
.list > .card, .card.acc { border-radius: 12px; padding: 13px 16px; }
.acc-brass { border-left: 4px solid var(--brand); }
.acc-blue { border-left: 4px solid var(--link); }
.acc-green { border-left: 4px solid var(--ink-green); }
.acc-red { border-left: 4px solid var(--ink-red); }
.acc-amber { border-left: 4px solid var(--ink-amber); }
.acc-muted { border-left: 4px solid var(--line-strong); }
.acc-unassigned { border-left: 4px dashed var(--ink-red); }
.cl-1, .dash-card.cl-1 { border-left: 4px solid var(--cl-1); background: var(--cl-1t); }
.cl-2, .dash-card.cl-2 { border-left: 4px solid var(--cl-2); background: var(--cl-2t); }
.cl-3, .dash-card.cl-3 { border-left: 4px solid var(--cl-3); background: var(--cl-3t); }
.cl-4, .dash-card.cl-4 { border-left: 4px solid var(--cl-4); background: var(--cl-4t); }
.cl-5, .dash-card.cl-5 { border-left: 4px solid var(--cl-5); background: var(--cl-5t); }
.cl-6, .dash-card.cl-6 { border-left: 4px solid var(--cl-6); background: var(--cl-6t); }
.is-cancelled { opacity: .6; }
.is-cancelled .v-name { text-decoration: line-through; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-weight: 600; }
.empty .btn { margin-top: 12px; }
.load-more { margin-top: 12px; }

/* lead cards */
.lead-top, .v-top, .c-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.lead-name, .c-name { font-size: 15px; font-weight: 700; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.age { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.age.late { color: var(--ink-red); }
.lead-sub, .v-sub, .c-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.price-line { margin-top: 6px; font-weight: 700; color: var(--txt); font-size: 13px; }
.card .badges { margin-top: 8px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-actions > .btn { flex: 0 1 auto; }
.card-actions.apart { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.why { margin-top: 6px; font-size: 12px; color: var(--ink-red); font-weight: 650; }

/* visit cards */
.v-time { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 74px; }
.v-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.v-price { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.v-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.v-cleaner { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--muted); }
.cl-1 .dot, .dot.cl-1 { background: var(--cl-1); }
.cl-2 .dot, .dot.cl-2 { background: var(--cl-2); }
.cl-3 .dot, .dot.cl-3 { background: var(--cl-3); }
.cl-4 .dot, .dot.cl-4 { background: var(--cl-4); }
.cl-5 .dot, .dot.cl-5 { background: var(--cl-5); }
.cl-6 .dot, .dot.cl-6 { background: var(--cl-6); }
.c-next { flex: none; font-size: 12px; font-weight: 700; color: var(--ink-brand); }

/* schedule */
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.week-nav .range { flex: 1 1 auto; font-weight: 700; min-width: 0; color: var(--muted); font-size: 13px; }
.group { margin-bottom: 20px; }
.group-head {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 0 2px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.group-head .n {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--chip);
  color: var(--txt); display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0; font-size: 10px; font-weight: 800;
}
.group-head.alert { color: var(--ink-red); }
.group-head.today { color: var(--ink-brand); }
.day-empty { color: var(--muted); font-size: 13px; padding: 4px 2px 0; }
.day-empty.quiet { margin: -8px 0 20px; }

/* ------------------------------------------------------------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  display: block; position: relative; min-width: 0; color: var(--txt);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  transition: box-shadow .12s;
}
a.kpi:hover { box-shadow: var(--shadow-sm); }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-val { font-size: 28px; font-weight: 800; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-val.warn { color: var(--ink-amber); }
.kpi-val.bad { color: var(--ink-red); }
.kpi-val.good { color: var(--ink-green); }
.kpi-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.panel { margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head a { font-weight: 600; font-size: 13px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dash-card {
  display: block; width: 100%; min-width: 0; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: 12px; padding: 11px 13px; font-size: 12.5px; line-height: 1.5; color: var(--txt);
  transition: box-shadow .12s;
}
.dash-card:hover { box-shadow: var(--shadow-sm); }
.dash-card.acc-unassigned { border-left-style: dashed; border-left-color: var(--ink-red); background: var(--panel); }
.dash-day { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .01em; }
.dash-client { font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-sub { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.dash-foot .v-cleaner { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-un { color: var(--ink-red); font-weight: 700; font-size: 12px; }
.dash-more { margin-top: 10px; color: var(--muted); font-size: 12px; }
.lead-rows { display: grid; gap: 8px; }
.lead-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 9px 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px;
  background: var(--panel); text-align: left; cursor: pointer; color: var(--txt);
}
.lead-row:hover { box-shadow: var(--shadow-sm); }
.lead-row.late { border-left-color: var(--ink-red); }
.lead-row .grow { flex: 1 1 auto; min-width: 0; }
.lead-row .strong { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row .row-sub { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px; align-items: start; }
@media (max-width: 1099px) {
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-val { font-size: 24px; }
}

/* ------------------------------------------------------- detail sections */
.hero { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; min-width: 0; }
.hero-main { flex: 1 1 auto; min-width: 0; }
.hero-title { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.hero-sub { color: var(--muted); margin-top: 2px; }
.hero-price { flex: none; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 4px; }
.actions > .btn { flex: 0 1 auto; }
/* Facts are dealt into boxed groups, spaced out, like the booking card on the other CRM. */
.section {
  margin-top: 12px; padding: 14px 16px; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel2);
}
.sec-title {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.kv { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 9px 16px; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.quote-box {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.5;
}
.copy-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.copy-row > .btn { flex: 0 1 auto; }
.danger-box {
  margin-top: 16px; border: 1px solid var(--ink-red); background: var(--tint-red);
  border-radius: 12px; padding: 12px 15px; display: flex; gap: 8px; flex-wrap: wrap;
}
.danger-box > .btn { flex: 0 1 auto; background: var(--panel); }
.danger-note { flex: 1 1 100%; color: var(--ink-red); font-weight: 700; font-size: 12px; }
.prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.price-tile { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel); }
.price-tile .t { font-size: 11px; color: var(--muted); font-weight: 700; }
.price-tile .v { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.price-tile.on { border-color: var(--brand); background: var(--tint-brand); }
.mini-list { display: grid; gap: 6px; }
.mini-row {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; cursor: pointer;
  color: var(--txt);
}
.mini-row:hover { border-color: var(--brand); }
.mini-row > * { min-width: 0; }
.mini-row .grow { flex: 1 1 auto; overflow-wrap: anywhere; }
.mini-row .strong { font-weight: 700; }
/* Visit and plan rows: date, title and pills stack in the left column; the
   price keeps its own column, so nothing overlaps at 375px. */
.mini-row .row-sub { display: block; color: var(--muted); font-size: 12.5px; }
.mini-row .row-pills { margin-top: 4px; }
.mini-row .row-price { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.hist { display: grid; gap: 8px; }
.hist-row { font-size: 13px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; }
.hist-row .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-row .what { font-weight: 650; overflow-wrap: anywhere; }
.hist-row .detail { grid-column: 2; color: var(--muted); overflow-wrap: anywhere; }
.notes { display: grid; gap: 10px; margin-top: 10px; }
.note { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.note .meta { font-size: 12px; color: var(--muted); font-weight: 650; }
.note .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: grid; gap: 8px; }
.pay-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.pay-row .grow { flex: 1 1 auto; min-width: 0; }
.pay-row.void .grow { text-decoration: line-through; color: var(--muted); }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.methods label { margin: 0; }
.methods input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.methods span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--line); font-weight: 700; color: var(--txt); cursor: pointer; background: var(--panel2);
}
.methods input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.methods input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint-wrap { position: relative; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-row label { margin-bottom: 5px; }
/* A 19px circle inside a 40px tap target, like the (i) on the other CRM. */
.info {
  width: 40px; height: 40px; margin: -10px -10px -4px -10px; border: 0; border-radius: 50%; padding: 0;
  background: radial-gradient(circle, var(--panel2) 0 9px, var(--line-strong) 9px 10px, transparent 10.5px);
  color: var(--muted); font-weight: 800; font-size: 11px; cursor: pointer; flex: none;
}
.info:hover { color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); background: var(--panel2); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }

/* -------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; background: var(--panel2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tbody tr:hover th { background: var(--panel2); }
td.half { color: var(--ink-brand); font-weight: 700; }
/* Phones: one card per size, every price labelled; no sideways scroll. */
@media (max-width: 599px) {
  .rate-table { min-width: 0; }
  .rate-table thead { display: none; }
  .rate-table, .rate-table tbody, .rate-table tr, .rate-table th, .rate-table td { display: block; }
  .rate-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .rate-table tr:last-child { border-bottom: 0; }
  .rate-table th[scope="row"] { padding: 0 0 6px; border: 0; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--txt); background: none; }
  .rate-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .rate-table td::before { content: attr(data-label); color: var(--muted); font-weight: 650; text-align: left; }
  tbody tr:hover td, tbody tr:hover th { background: none; }
}

/* --------------------------------------------------------- booking form */
.book-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.steps { display: grid; gap: 14px; min-width: 0; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-weight: 700; font-size: 15px; }
.step-n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--tint-brand); color: var(--ink-brand);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none;
}
.price-col { position: sticky; top: 80px; }
.price-col .quote { font-size: 16px; font-weight: 700; margin: 6px 0 14px; }
.picked {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px;
  background: var(--tint-brand); color: var(--ink-brand); font-weight: 700; border: 1px solid var(--brand);
}
.picked .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.results { display: grid; gap: 6px; margin-top: 8px; }
.results:empty { display: none; }
@media (max-width: 899px) {
  .book-layout { grid-template-columns: minmax(0, 1fr); }
  .price-col { position: static; }
}

/* ------------------------------------------------------ settings page */
.more-list { display: grid; gap: 10px; margin-bottom: 16px; }
.more-item { display: flex; align-items: center; justify-content: space-between; min-height: 56px; font-weight: 700; color: var(--txt); }
.more-item .go { color: var(--link); font-weight: 600; font-size: 13px; }
.stack { display: grid; gap: 12px; }

/* --------------------------------------------------------- modal, dialog */
.modal, .dialog-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.dialog-wrap { z-index: 2100; align-items: center; }
.scrim { position: fixed; inset: 0; background: var(--scrim); }
.sheet {
  position: relative; width: 100%; max-width: 720px; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
  animation: modalIn .14s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.sheet-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 22px;
  border-bottom: 1px solid var(--line); min-height: 60px; flex: none;
}
.sheet-head h2 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 800; }
.sheet-body { padding: 18px 22px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-body > .section:first-child { margin-top: 0; }
.dialog {
  position: relative; width: 100%; max-width: 420px; background: var(--panel);
  border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px;
  animation: modalIn .14s ease-out;
}
.dialog .msg { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.dialog.danger { border-top: 5px solid var(--ink-red); }
.dialog.danger .msg { color: var(--ink-red); }
.dialog .form-actions { margin-top: 18px; }
.dialog textarea { margin-top: 12px; min-height: 140px; }
body.locked { overflow: hidden; }
@media (max-width: 599px) {
  .modal { padding: 0; align-items: stretch; overflow: hidden; }
  .sheet { max-width: none; max-height: none; height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); animation: none; }
  .sheet-head { padding-left: 16px; }
  .sheet-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .methods { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .kv dt:first-child { margin-top: 0; }
  .card-actions > .btn, .actions > .btn, .copy-row > .btn { flex: 1 1 140px; }
  .seg { display: flex; }
  .seg button { flex: 1 1 0; padding: 7px 8px; }
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 2200;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 16px; border-radius: 12px;
  background: var(--txt); color: var(--bg); box-shadow: var(--shadow); font-weight: 650;
}
.toast.error { background: var(--ink-red); color: var(--panel); }
.toast .btn { background: transparent; color: inherit; border-color: currentColor; min-height: 36px; }
.toast-msg { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* -------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.login { width: 380px; max-width: 100%; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 6px; }
.login-brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 16px rgba(13, 157, 141, .35); }
.login-brand .name { font-weight: 800; font-size: 22px; color: var(--txt); letter-spacing: -.01em; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.login-card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px 22px; }
.login-card h2 { margin-bottom: 14px; font-size: 16px; }
.login-card .btn.primary { min-height: 46px; font-size: 14px; }

/* -------------------------------------------------------- desktop tweaks */
@media (min-width: 900px) and (pointer: fine) {
  input, select, textarea { font-size: 14px; min-height: 40px; }
  .btn.sm { min-height: 32px; }
}

/* ------------------------------------------------------------ utilities */
.mt { margin-top: 12px; }
.strong { font-weight: 700; }
tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--txt); font-weight: 700; background: none; }
.hist-row .linkish { min-height: 0; padding: 0 4px; font-size: 13px; }
.copy-area { width: 100%; }
.seg + label, .seg.small + label { margin-top: 4px; }
.step .seg { margin-bottom: 12px; }
.step .seg:last-child { margin-bottom: 0; }

/* Wide screens: lead and client cards sit two or three across, like the other CRM's card grids. */
@media (min-width: 1100px) {
  #lead-list > .list, #client-list > .list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); align-items: start; }
}
/* Fields inside a grouped box stand out from the box. */
.section input, .section select, .section textarea { background: var(--panel); }
.section .seg { background: var(--panel); }
/* The name never gives way to the search box; the search shrinks first. */
@media (min-width: 400px) {
  .brand { flex: none; }
}
