:root {
  --bg: #f6f7fb; --card: #fff; --line: #e3e6ee; --line-strong: #cfd4e0;
  --ink: #0d1433; --text: #333b52; --muted: #6a7389;
  --brand: #533afd; --brand-dark: #4530d4; --brand-soft: #efecff;
  --green: #0e7a4b; --green-soft: #e3f6ec; --red: #b42318; --red-soft: #fdecea;
  --amber: #96560a; --amber-soft: #fdf1dc; --pink: #ef4d76;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3, .brand, .num { font-family: "Instrument Sans", Inter, sans-serif; color: var(--ink); margin: 0; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 20px; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: var(--brand); display: inline-block; position: relative; }
.mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }

.btn { border: 1px solid var(--line-strong); background: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.big { padding: 12px 18px; font-size: 15px; width: 100%; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 600; }

input, select, textarea { border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .row:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { min-height: 78px; resize: vertical; }
label { display: grid; gap: 5px; font-weight: 600; color: var(--ink); font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; width: min(380px, 100%); display: grid; gap: 14px; }

.topbar { display: flex; align-items: center; gap: 20px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--brand-soft); color: var(--brand-dark); }
.tab .count { margin-left: 6px; font-size: 12px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; color: var(--muted); }
.right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.banner { background: var(--amber-soft); color: var(--amber); padding: 8px 20px; font-weight: 600; font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 16px 20px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi .num { font-size: 24px; font-weight: 700; line-height: 1.15; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi.alert { border-color: var(--pink); background: #fff5f7; } .kpi.alert .num { color: #c2244f; }

.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 16px; padding: 16px 20px 40px; align-items: start; }
.page { padding: 16px 20px 40px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
#detail { position: sticky; top: 72px; display: grid; gap: 12px; max-height: calc(100vh - 88px); overflow-y: auto; align-content: start; }

.group { margin-bottom: 14px; }
.group-head { display: flex; align-items: center; gap: 8px; font-family: "Instrument Sans", sans-serif; font-weight: 600; color: var(--ink); margin: 0 4px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.group-head .n { color: var(--muted); font-weight: 500; }
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #fafbff; }
.row.sel { background: var(--brand-soft); }
.row.next .pos { color: #fff; background: var(--brand); border-radius: 8px; padding: 2px 0; }
.row.dim { opacity: .55; }
.pos { font-family: "Instrument Sans", sans-serif; font-weight: 700; color: var(--muted); text-align: center; }
.row .name { font-weight: 600; color: var(--ink); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.row .meta b { display: block; color: var(--ink); font-weight: 600; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #eef0f5; color: #3d4663; white-space: nowrap; }
.chip.c0 { background: #efecff; color: #4530d4; } .chip.c1 { background: #e3f6ec; color: #0e7a4b; } .chip.c2 { background: #fdf1dc; color: #96560a; }
.chip.c3 { background: #e0f0ff; color: #0b5cab; } .chip.c4 { background: #fde8ef; color: #b3204d; } .chip.c5 { background: #e6f5f5; color: #0c6b6b; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.badge.red { background: var(--red-soft); color: var(--red); } .badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.grey { background: #eef0f5; color: var(--muted); } .badge.purple { background: var(--brand-soft); color: var(--brand-dark); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { margin-bottom: 4px; }

.lead-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lead-name { font-size: 22px; font-weight: 700; margin-top: 6px; }
.phone { font-family: "Instrument Sans", sans-serif; font-size: 18px; font-weight: 600; color: var(--ink); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0 14px; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.step { display: flex; gap: 10px; align-items: center; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.step i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.dispo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { margin-top: 12px; }
.script { white-space: pre-wrap; font-size: 13px; background: #fafbff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.log { display: grid; gap: 8px; margin-top: 10px; font-size: 13px; }
.log > div { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.log .txt { white-space: pre-wrap; }
.timer { font-family: "Instrument Sans", sans-serif; font-weight: 700; color: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: "Instrument Sans", sans-serif; font-weight: 600; }
.scroll { overflow-x: auto; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.form .wide { grid-column: 1 / -1; }
.copy { display: flex; gap: 6px; }
.copy input { font-size: 12px; font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); grid-template-columns: none; }
.switch input { width: auto; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; } #detail { position: static; order: -1; max-height: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); padding: 12px 16px 0; } .split, .page { padding: 12px 16px 32px; }
  .form { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; }
}

/* admin page */
.sub { margin: 4px 0 0; }
.card.warn { background: var(--amber-soft); border-color: #f0d49a; color: var(--amber); }
tr.off td { opacity: .55; }
td.chips { max-width: 360px; } td.chips .chip { margin: 0 2px 4px 0; }
td.actions { white-space: nowrap; text-align: right; }
th.ctr, td.ctr { text-align: center; vertical-align: middle; }
th .role { font-weight: 500; text-transform: none; letter-spacing: 0; }
.tick { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }
.matrix td { vertical-align: middle; }
fieldset.checks { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
fieldset.checks legend { font-weight: 600; color: var(--ink); font-size: 13px; padding: 0 6px; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.switch input[type=checkbox] { accent-color: var(--brand); }
.waits { display: grid; gap: 8px; margin: 12px 0; }
.wait { display: grid; grid-template-columns: minmax(0, 1fr) 80px 110px auto; gap: 8px; align-items: center; }
label.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
label.inline input { width: 90px; }
ol.order { margin: 10px 0 0; padding-left: 20px; color: var(--ink); display: grid; gap: 4px; }
@media (max-width: 860px) { .wait { grid-template-columns: 1fr 1fr; } .wait .muted { grid-column: 1 / -1; } }
.brand img { display: block; height: 26px; width: auto; }
.brand .product { font-size: 13px; font-weight: 600; color: var(--muted); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; }

/* stats calendar */
.calnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calnav select { width: auto; padding: 6px 10px; }
.calmonth { font-family: "Instrument Sans", sans-serif; color: var(--ink); min-width: 132px; text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fafbff; }
.tile .num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.tile .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { margin: 16px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-head span { padding-left: 4px; }
.cal-cell { min-height: 104px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 10px; text-align: left; display: flex; flex-direction: column; gap: 1px; cursor: pointer; color: var(--text); }
.cal-cell.blank { border: 0; background: none; cursor: default; }
.cal-cell:hover:not(.blank) { border-color: var(--brand); }
.cal-cell.has { background: #fafbff; }
.cal-cell.today .dn { background: var(--ink); color: #fff; }
.cal-cell.sel { border-color: var(--brand); background: var(--brand-soft); outline: 1px solid var(--brand); }
.cal-cell.future { opacity: .45; }
.cal-cell .dn { font-size: 12px; font-weight: 600; color: var(--muted); align-self: flex-start; border-radius: 6px; padding: 0 6px; margin-left: -4px; }
.cal-cell .big { font-family: "Instrument Sans", sans-serif; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.cal-cell .cap { font-size: 11px; color: var(--muted); margin-top: -3px; }
.cal-cell .bar { height: 4px; border-radius: 4px; background: var(--line); margin: 4px 0; overflow: hidden; display: block; }
.cal-cell .bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.cal-cell .mini { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell .mini.good { color: var(--green); font-weight: 600; }
.cal-cell .none { font-size: 12px; color: var(--line-strong); margin-top: 6px; }
@media (max-width: 860px) { .cal-cell { min-height: 70px; padding: 6px; } .cal-cell .mini, .cal-cell .cap, .cal-cell .bar { display: none; } .cal-cell .big { font-size: 17px; } }

/* ---------- colour: navy + one purple; red, green and amber only where they mean something ---------- */
:root { --bg: #f1f3f8; --navy: #061b31; --line: #dfe3ec; --line-strong: #c6ccda; }
.topbar { background: var(--navy); border-bottom: 0; }
.topbar .brand .product { color: #b9c4dc; border-left-color: #3a4a66; }
.topbar .tab { color: #c3cde2; }
.topbar .tab:hover { color: #fff; background: #12294a; }
.topbar .tab.active { background: var(--brand); color: #fff; }
.topbar .tab .count { background: #12294a; border-color: #2c4062; color: #fff; font-weight: 700; }
.topbar .tab.active .count { background: #fff; border-color: #fff; color: var(--brand-dark); }
.topbar .muted { color: #b9c4dc; }
.topbar .btn.ghost { color: #c3cde2; } .topbar .btn.ghost:hover { color: #fff; border-color: #3a4a66; }
.topbar .btn.small:not(.ghost) { background: #12294a; border-color: #3a4a66; color: #fff; } .topbar .btn.small:not(.ghost):hover { border-color: #fff; }
.topbar .badge.purple { background: var(--brand); color: #fff; }
.banner { background: var(--amber-soft); color: #7a4a00; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner .btn { background: #fff; border-color: #d9b56a; color: #7a4a00; }

/* number tiles: white, with one filled tile for the number that matters and red only when a lead is waiting */
.kpi { background: #fff; border: 1px solid var(--line); padding: 14px 16px; }
.kpi .num { color: var(--navy); } .kpi .lbl { font-weight: 600; color: var(--muted); }
.kpi.k-purple { background: var(--brand); border-color: var(--brand); } .kpi.k-purple .num, .kpi.k-purple .lbl { color: #fff; }
.kpi.k-green .num { color: var(--green); }
.kpi.alert { background: var(--red-soft); border-color: #f0a29b; } .kpi.alert .num, .kpi.alert .lbl { color: var(--red); }

/* call list */
.group-head { padding: 0 4px; margin: 0 0 8px; color: var(--navy); }
.group-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.g-closed .group-head i { background: var(--line-strong); }
.group-head .n { color: var(--muted); background: #e4e7f0; border-radius: 99px; padding: 0 8px; font-weight: 700; }
.pos { background: #eef0f5; border-radius: 8px; padding: 2px 0; color: #3d4663; }
.row.next .pos { background: var(--brand); color: #fff; }
.row .meta b { color: var(--navy); }
.row:hover { background: #f6f7fb; }
.row.sel { background: var(--brand-soft); }
.chip, .chip.c0, .chip.c1, .chip.c2, .chip.c3, .chip.c4, .chip.c5 { background: #e8ebf3; color: #2a3350; }

/* outcome buttons: neutral until chosen */
.dispo .btn { background: #fff; border-color: var(--line-strong); color: var(--navy); }
.dispo .btn:hover { border-color: var(--brand); }
.dispo .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.dispo .btn.o-booked.on { background: var(--green); border-color: var(--green); }
.dispo .btn.o-dnc.on { background: var(--red); border-color: var(--red); }
.step i { background: var(--navy); }
.lead-name { color: var(--navy); }
.script { background: #f6f7fb; border-color: var(--line); }

/* promotion for this lead's source */
.promo { background: var(--brand-soft); border: 1px solid #cfc8ff; border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.promo .plabel { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-dark); }
.promo .ptitle { font-family: "Instrument Sans", sans-serif; font-size: 17px; font-weight: 700; color: var(--navy); line-height: 1.3; margin-top: 2px; }
.promo .pdetails { font-size: 13px; color: var(--text); margin-top: 4px; white-space: pre-wrap; }
.promo.none { background: #f6f7fb; border-color: var(--line); border-style: dashed; color: var(--muted); font-size: 13px; }
td .ptitle { font-weight: 600; color: var(--navy); } td .pdetails { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
tr.editing td { background: #f6f7fb; }

/* tables and tiles */
th { background: #f1f3f8; color: #3d4663; border-bottom: 0; } th:first-child { border-radius: 8px 0 0 8px; } th:last-child { border-radius: 0 8px 8px 0; }
.card h2 { color: var(--navy); }
.tile { background: #f6f7fb; border-color: var(--line); } .tile .num { color: var(--navy); }
.tile.t-green .num { color: var(--green); }
.page { grid-template-columns: minmax(0, 1fr); }

/* calendar: one colour, darker purple = more calls */
.cal-head span { color: #3d4663; }
.cal-cell.has.h1 { background: #f1efff; border-color: #dcd7ff; } .cal-cell.has.h2 { background: #ddd8ff; border-color: #c4bcff; }
.cal-cell.has.h3 { background: #b9afff; border-color: #a195ff; } .cal-cell.has.h4 { background: var(--brand); border-color: var(--brand); }
.cal-cell.h1 .mini.good, .cal-cell.h2 .mini.good, .cal-cell.h3 .mini.good { color: var(--navy); font-weight: 600; }
.cal-cell.h3 .mini, .cal-cell.h3 .cap, .cal-cell.h3 .dn { color: #1d1470; }
.cal-cell.h4 .big, .cal-cell.h4 .mini, .cal-cell.h4 .cap, .cal-cell.h4 .dn, .cal-cell.h4 .mini.good { color: #fff; }
.cal-cell .bar { display: none; }
.cal-cell.today .dn { background: var(--navy); color: #fff; }
.cal-cell.sel { outline: 3px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
.cal-cell:not(.has):not(.blank) { background: #f6f7fb; }
.login { background: var(--navy); }

/* ---------- phone layout ---------- */
.ico, .sheet-bar, .nextup, .cal-cell .bk { display: none; }
@media (max-width: 860px) {
  html { -webkit-text-size-adjust: 100%; }
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px; }                 /* stops iOS zooming into fields */
  .btn { min-height: 44px; } .btn.small { min-height: 38px; padding: 6px 12px; }

  /* top bar: logo and three quiet controls */
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; flex-wrap: nowrap; }
  .topbar .brand img { height: 24px; }
  .topbar .brand .product, #who, .topbar .t { display: none; }
  .topbar .right { gap: 6px; }
  .topbar #sound { font-size: 18px; padding: 4px 8px; }

  /* tabs become a bottom bar within thumb reach */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--navy); border-top: 1px solid #1c3050;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-wrap: nowrap; }
  .topbar .tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; font-size: 11px; border-radius: 12px; position: relative; min-height: 52px; color: #9fb0cf; }
  .ico { display: block; width: 23px; height: 23px; }
  .tab .tl { font-size: 0; } .tab .tl::after { content: attr(data-short); font-size: 11px; font-weight: 600; }
  .topbar .tab .count { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; font-size: 10.5px; min-width: 18px; text-align: center; padding: 0 5px; background: var(--brand); border-color: var(--brand); color: #fff; }
  .topbar .tab.active .count { background: #fff; border-color: #fff; color: var(--brand-dark); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); width: max-content; text-align: center; }
  .banner { padding: 6px 14px; font-size: 12px; } .banner .btn { min-height: 32px; }

  /* number tiles: three in a row, two rows */
  .kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 14px 2px; }
  .kpi { padding: 10px 11px; min-width: 0; }
  .kpi .num { font-size: 21px; } .kpi .lbl { font-size: 11px; line-height: 1.25; }

  .split, .page { padding: 12px 14px 24px; gap: 12px; }
  .card { padding: 15px; border-radius: 16px; }

  /* the next call, big enough to hit without looking */
  .nextup { display: grid; gap: 3px; width: 100%; text-align: left; border: 0; border-radius: 18px; padding: 16px; margin-bottom: 14px; background: var(--navy); color: #fff; cursor: pointer; }
  .nu-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .nu-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #b8adff; }
  .nu-name { font-family: "Instrument Sans", sans-serif; font-size: 24px; font-weight: 700; line-height: 1.2; }
  .nu-sub { color: #c3cde2; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nu-go { margin-top: 12px; background: var(--brand); border-radius: 12px; padding: 13px 16px; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
  .nu-go svg { width: 20px; height: 20px; }

  .row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; padding: 13px 12px; min-height: 64px; }
  .row .name { font-size: 15px; gap: 6px; }
  .row .meta { font-size: 12px; }
  .row .sub { font-size: 12.5px; }

  /* lead panel: full-screen sheet that slides up over the list */
  #detail { position: fixed; inset: 0; z-index: 30; order: 0; max-height: none; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
    padding: 0 14px calc(28px + env(safe-area-inset-bottom)); gap: 12px; transform: translateY(102%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s; }
  body.sheet { overflow: hidden; }
  body.sheet #detail { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
  .sheet-bar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 2; margin: 0 -14px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: var(--navy); color: #c3cde2; font-size: 13px; font-weight: 600; }
  .sheet-back { display: flex; align-items: center; gap: 4px; background: #12294a; border: 0; color: #fff; font-weight: 700; font-size: 14px; padding: 9px 14px 9px 8px; border-radius: 10px; min-height: 40px; }
  .sheet-back svg { width: 18px; height: 18px; }
  .lead-name { font-size: 26px; } .phone { font-size: 19px; }
  .dispo .btn { min-height: 54px; font-size: 15px; }
  #openBtn, #saveBtn { min-height: 54px; font-size: 16px; border-radius: 14px; }
  #saveBtn:disabled { opacity: 1; background: #b9b3ee; border-color: #b9b3ee; }
  textarea { min-height: 96px; }

  /* tables that turn into cards */
  table.stack, table.stack tbody { display: block; }
  table.stack tr:first-child { display: none; }
  table.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; text-align: left; max-width: none; }
  table.stack td.st-title { font-weight: 600; font-size: 15px; grid-column: 1; grid-row: 1; }
  table.stack td.st-when { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; font-size: 13px; }
  table.stack td.st-empty { display: none; }
  table.stack td[data-l] { font-size: 13px; color: var(--ink); font-family: Inter, sans-serif; font-weight: 500; }
  table.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-weight: 500; }
  table.stack td.actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; } table.stack td.actions .btn { flex: 1; }
  table.stack td.muted { grid-column: 1 / -1; }
  tr:not(:first-child):hover td { background: none; }

  /* wide tables: scroll sideways, first column stays put */
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .card .scroll { margin: 0 -15px; padding: 0 15px; -webkit-overflow-scrolling: touch; }
  table.stack td.st-full { grid-column: 1 / -1; }
  table.stack td.st-side { text-align: right; }
  .scroll table:not(.stack) { min-width: 560px; }
  .scroll table:not(.stack) td:first-child, .scroll table:not(.stack) th:first-child { position: sticky; left: 0; z-index: 1; }
  .scroll table:not(.stack) td:first-child { background: #fff; }
  th, td { padding: 9px 8px; font-size: 13px; }
  td .chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

  /* stats */
  .headrow { align-items: flex-start; }
  .calnav { width: 100%; } .calnav select { flex: 1 1 100%; } .calmonth { flex: 1; }
  .calnav .btn.small { min-width: 44px; min-height: 44px; font-size: 18px; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tile { padding: 9px 10px; } .tile .num { font-size: 19px; } .tile .lbl { font-size: 11px; line-height: 1.3; }
  .cal-head, .cal { gap: 4px; } .cal-head span { text-align: center; padding: 0; font-size: 10.5px; }
  .cal-cell { min-height: 62px; padding: 5px 2px; border-radius: 10px; align-items: center; text-align: center; gap: 0; }
  .cal-cell .dn { align-self: center; margin: 0; font-size: 10.5px; padding: 0 5px; }
  .cal-cell .big { font-size: 18px; }
  .cal-cell .none { display: none; }
  .cal-cell .bk { display: block; font-size: 10px; font-weight: 700; color: var(--navy); background: #ffffffb3; border-radius: 99px; padding: 0 5px; margin-top: 1px; }
  .cal-cell.h4 .bk { background: #fff; color: var(--brand-dark); }

  /* admin */
  .matrix { min-width: 0 !important; }
  .wait { grid-template-columns: 1fr 1.2fr auto; } .wait .muted { grid-column: 1 / -1; }
  .copy { flex-direction: column; } .copy .btn { align-self: flex-start; }
  .headrow > .btn.primary { width: 100%; }
  .login-card { padding: 24px 20px; border-radius: 22px; }
}
@media (max-width: 380px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { #detail, body.sheet #detail { transition: none; } }

/* offers from the reports portal */
.promo .phow { font-size: 12px; color: var(--muted); margin-top: 8px; }
.offerlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.offerlist li { display: grid; gap: 1px; font-size: 13px; padding-top: 8px; border-top: 1px solid #d9d4ff; }
.offerlist li b { color: var(--navy); } .offerlist li span { color: var(--text); }
.alloffers { margin-top: 10px; font-size: 13px; } .alloffers summary { color: var(--brand-dark); }
.promo.none .offerlist li { border-top-color: var(--line); }
details.synced { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.synced[open] summary { margin-bottom: 8px; }

/* pipeline stage + nurture day */
.stage { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 99px; border: 1px solid #b9b0ff; color: var(--brand-dark); background: #fff; white-space: nowrap; }
.nday { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--navy); color: #fff; white-space: nowrap; }
.nday.over { background: #e4e7f0; color: var(--muted); }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 12px; }
.stagebar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stagepill { border: 1px solid var(--line-strong); background: #fff; border-radius: 99px; padding: 5px 12px; font-weight: 600; color: var(--navy); cursor: pointer; font-size: 13px; }
.stagepill b { color: var(--muted); margin-left: 4px; } .stagepill:hover { border-color: var(--brand); }
.stagepill.on { background: var(--brand); border-color: var(--brand); color: #fff; } .stagepill.on b { color: #fff; }
table.leads tr[data-lead] { cursor: pointer; } table.leads td { vertical-align: middle; }

/* admin overview */
.tiles.home { grid-template-columns: repeat(6, minmax(0, 1fr)); } .tiles.home .tile { background: #fff; padding: 14px 16px; } .tiles.home .tile .num { font-size: 26px; }
.tile.t-red { background: var(--red-soft); border-color: #f0a29b; } .tile.t-red .num, .tile.t-red .lbl { color: var(--red); }
.alerts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.alerts li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.alerts li:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; } .dot.red { background: var(--red); } .dot.amber { background: #d99a1c; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-top: 12px; }
.person { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.pname { font-family: "Instrument Sans", sans-serif; font-size: 16px; color: var(--navy); }
.pnow { color: var(--ink); } .pstats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); } .pstats b { color: var(--navy); }
.bad, .pstats .bad b { color: var(--red); font-weight: 700; }
@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; } .filters input { grid-column: 1 / -1; }
  .tiles.home { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tiles.home .tile { padding: 10px 11px; } .tiles.home .tile .num { font-size: 21px; }
  .people { grid-template-columns: 1fr; }
  .alerts li { grid-template-columns: auto 1fr; } .alerts li .btn { grid-column: 2; justify-self: start; }
  .tab .tl::after { font-size: 10.5px; }
  .row .name .stage, .row .name .nday { font-size: 11px; }
}
