/* ----- self-hosted fonts (SIL Open Font License; see fonts/LICENSE-*.txt) */
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/public-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/public-sans-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/manrope-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/manrope-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/playfair-display-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/jost-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/jost-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/jost-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --ink: #17202A;
  --muted: #5A6674;
  --line: #D8DEE4;
  --brand: #1E4D5C;
  --brand-hover: #163C48;
  --brand-ink: #FFFFFF;
  --brand-soft: #E3EDF0;
  --overdue: #B42318;
  --overdue-soft: #FDECEA;
  --today: #A65400;
  --today-soft: #FFF1DE;
  --week: #1F7444;
  --week-soft: #E4F4EA;
  --later: #5A6674;
  --later-soft: #EEF1F4;
  --focus: #2F7FD8;
  --radius: 10px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bar-bg: #1E4D5C;
  --bar-ink: #FFFFFF;
  --bar-border: none;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161B;
    --surface: #182027;
    --surface-2: #1D262E;
    --ink: #E6EBF0;
    --muted: #98A5B2;
    --line: #2B3640;
    --brand: #6BB0C5;
    --brand-hover: #86C2D4;
    --brand-ink: #0E1A1F;
    --brand-soft: #1F3640;
    --overdue: #F07467;
    --overdue-soft: #3A1E1C;
    --today: #F0A24A;
    --today-soft: #3A2A16;
    --week: #5CC48A;
    --week-soft: #183224;
    --later: #98A5B2;
    --later-soft: #232D36;
    --focus: #7DB6F0;
    --bar-bg: #163C48;
    --bar-ink: #FFFFFF;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--font-size, 15px)/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-family: var(--font-head, var(--font)); }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ----- controls */
input, select, textarea {
  font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl, 7px);
  padding: 0.5rem 0.6rem; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 5rem; }
label { display: grid; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { font-weight: 400; color: var(--ink); font-size: 0.95rem; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-ctl, 7px); padding: 0.5rem 0.9rem; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--overdue); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.btn.wide { width: 100%; padding: 0.7rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.form-error { color: var(--overdue); min-height: 1.2em; margin: 0; font-size: 0.9rem; }

/* ----- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: min(380px, 100%); display: grid; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-dlg, 14px); padding: 2rem;
}
.login-card p { margin: -0.5rem 0 0.25rem; }
.login-mark { font-size: 2rem; }

/* ----- top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--bar-bg); color: var(--bar-ink); border-bottom: var(--bar-border);
  padding: 0 1.25rem; min-height: var(--bar-height, 56px);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar-bg); }
.brand { font-weight: 800; white-space: nowrap; }
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs a {
  color: inherit; text-decoration: none; font-weight: 600; opacity: 0.78;
  padding: 1rem 0.75rem; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { opacity: 1; }
.tabs a[aria-current="page"] { opacity: 1; border-bottom-color: currentColor; }
.who { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; font-size: 0.9rem; }
.who .btn { color: inherit; }
.who .btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 0 1rem; padding-top: 0.6rem; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs a { padding: 0.6rem 0.6rem 0.7rem; }
  .who { margin-left: auto; }
  #who-name { display: none; }
}

/* ----- page */
.view { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: 0.3rem 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ----- call list (the call sheet) */
.sheet { display: grid; gap: 2rem; }
.sheet-group > header { display: flex; align-items: baseline; gap: 0.6rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--tone); margin-bottom: 0.25rem; }
.sheet-group > header h2 { color: var(--tone); }
.sheet-group > header .count { font-weight: 800; color: var(--tone); }
.sheet-group.overdue { --tone: var(--overdue); --tone-soft: var(--overdue-soft); }
.sheet-group.today   { --tone: var(--today);   --tone-soft: var(--today-soft); }
.sheet-group.week    { --tone: var(--week);    --tone-soft: var(--week-soft); }
.sheet-group.fresh   { --tone: var(--brand);   --tone-soft: var(--brand-soft); }
.call-row {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.6fr) auto;
  gap: 1rem; align-items: start; padding: 0.9rem 0.25rem; border-bottom: 1px solid var(--line);
}
.call-when { font-weight: 700; color: var(--tone); }
.call-when small { display: block; font-weight: 500; color: var(--muted); }
.call-biz { font-weight: 700; font-size: 1.02rem; }
.call-biz small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.call-contact a.phone { font-weight: 700; font-size: 1.05rem; text-decoration: none; white-space: nowrap; }
.call-contact small { display: block; color: var(--muted); }
.call-note { color: var(--muted); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.call-note strong { color: var(--ink); font-weight: 600; }
.empty { padding: 1.25rem 0.25rem; color: var(--muted); }
@media (max-width: 860px) {
  .call-row { grid-template-columns: 1fr auto; }
  .call-when { grid-column: 1 / -1; display: flex; gap: 0.5rem; align-items: baseline; }
  .call-biz, .call-contact, .call-note { grid-column: 1; }
  .call-row > .btn { grid-column: 2; grid-row: 2; align-self: start; }
}

/* ----- leads table */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 1rem; }
.toolbar label { min-width: 9.5rem; flex: 1 1 9.5rem; }
.toolbar .search { flex: 3 1 16rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--focus); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tr.dnc td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
td.num, th.num { text-align: right; }
.biz-cell { font-weight: 600; min-width: 12rem; }
.nowrap { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.badge.overdue { color: var(--overdue); background: var(--overdue-soft); }
.badge.today { color: var(--today); background: var(--today-soft); }
.badge.week { color: var(--week); background: var(--week-soft); }
.badge.later { color: var(--later); background: var(--later-soft); }

/* ----- dashboard */
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.dash .panel { padding: 1.1rem 1.25rem; }
.dash h2 { margin-bottom: 0.75rem; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 1rem; margin: 0; }
.kv dt { color: var(--muted); padding: 0.3rem 0; border-bottom: 1px dashed var(--line); }
.kv dd { margin: 0; font-weight: 700; text-align: right; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); }
.kv dd.alert { color: var(--overdue); }
.bars { display: grid; gap: 0.45rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 3.2rem; gap: 0.6rem; align-items: center; font-size: 0.88rem; }
.bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 0.7rem; background: var(--later-soft); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.bar-row b { text-align: right; }
.progress { height: 0.6rem; background: var(--later-soft); border-radius: 3px; overflow: hidden; margin-top: 0.6rem; }
.progress i { display: block; height: 100%; background: var(--week); }
.team { margin-top: 1.25rem; }
.team .panel { padding: 0; }
.team h2 { padding: 1.1rem 1.25rem 0.5rem; }
.team tfoot td { font-weight: 700; background: var(--surface-2); }
.team tbody tr { cursor: default; }

/* ----- settings */
.settings { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.settings .panel { padding: 1.25rem; display: grid; gap: 0.9rem; }
.settings .span { grid-column: 1 / -1; }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.lists-grid textarea { min-height: 11rem; font-size: 0.88rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.row > label { flex: 1 1 10rem; }
.users td, .users th { vertical-align: middle; }
.users tbody tr { cursor: default; }

/* ----- editor dialog */
.editor {
  width: min(900px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-dlg, 14px);
  background: var(--surface); color: var(--ink);
}
.editor::backdrop { background: rgba(10, 16, 22, 0.5); }
.editor-body { display: flex; flex-direction: column; max-height: calc(100dvh - 1.5rem); }
.ed-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.1rem 1.4rem 0.9rem; border-bottom: 1px solid var(--line); }
.ed-head p { margin: 0.2rem 0 0; }
.ed-phone { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.ed-phone a.btn { text-decoration: none; }
.ed-tabs { display: flex; gap: 0.25rem; padding: 0 1.4rem; border-bottom: 1px solid var(--line); }
.ed-tabs button { all: unset; cursor: pointer; padding: 0.7rem 0.6rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.ed-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.ed-tabs button:focus-visible { outline: 2px solid var(--focus); }
.ed-scroll { overflow-y: auto; flex: 1; }
.ed-body { padding: 1.1rem 1.4rem; display: grid; gap: 1.25rem; }
.ed-body fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ed-body legend { font-weight: 700; padding: 0; margin-bottom: 0.6rem; font-size: 0.95rem; }
.full { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.chips .btn { font-size: 0.8rem; padding: 0.2rem 0.55rem; font-weight: 500; }
.ed-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding: 0.9rem 1.4rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.ed-foot .spacer { flex: 1; }
.ed-foot .form-error { flex: 1 1 100%; order: -1; }
.ed-foot .form-error:empty { display: none; }

/* log form + timeline */
.log-form { margin: 1.1rem 1.4rem 0; padding: 1rem 1.1rem; background: var(--brand-soft); border-radius: 10px; display: grid; gap: 0.8rem; }
.log-form .grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.log-form .form-error:empty { display: none; }
.row.end { justify-content: flex-end; }
.timeline { padding: 1.1rem 1.4rem 1.4rem; }
.timeline h3 { margin-bottom: 0.4rem; }
.timeline.wide { padding: 0 1.25rem; }
.call-item { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.call-item:last-child { border-bottom: 0; }
.ci-when { font-weight: 700; font-size: 0.9rem; }
.ci-outcome { font-weight: 600; }
.call-item.needs-outcome .ci-when { color: var(--today); }
.ci-notes { margin: 0.35rem 0 0; white-space: pre-wrap; font-size: 0.92rem; }
.ci-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.ci-slot:not(:empty) { margin-top: 0.6rem; }
.ci-slot audio { width: 100%; max-width: 480px; }
.inline-edit { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; }
.linkish { all: unset; cursor: pointer; font-weight: 700; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.linkish:focus-visible { outline: 2px solid var(--focus); }
@media (max-width: 600px) { .call-item { grid-template-columns: 1fr; gap: 0.25rem; } }
.link-results { display: grid; gap: 0.4rem; }
.link-hit { all: unset; cursor: pointer; display: grid; gap: 0.1rem; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 8px; }
.link-hit:hover, .link-hit:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--ink); }
label.check input { width: auto; }

/* ----- toast */
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 1rem);
  background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ----- small layout refinements */
.page-head .row { flex-wrap: nowrap; }
.page-head .row > label { flex: 0 1 15rem; }
@media (max-width: 560px) { .page-head .row { flex-wrap: wrap; } .page-head .row > label { flex: 1 1 100%; } }
.ed-foot .form-error:empty { display: none; }
.settings .panel > div:last-child { justify-self: start; }

/* ----- v2 additions */
.notice { padding: 0.9rem 1.1rem; margin: 0 0 1.25rem; }
.call-actions { display: flex; gap: 0.4rem; align-items: start; }
@media (max-width: 860px) { .call-row > .call-actions { grid-column: 2; grid-row: 2; flex-direction: column; } }
.sync-line { margin: -0.75rem 0 1rem; }
tr.total td { font-weight: 700; background: var(--surface-2); }
.users input.ext { width: 6rem; }
.users input[type="email"] { min-width: 14rem; }
.add-user { display: grid; gap: 0.75rem; margin-top: 0.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.login-card details { border-top: 1px solid var(--line); padding-top: 0.9rem; }
.login-card summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.login-card details form { display: grid; gap: 0.9rem; margin-top: 0.9rem; }
.login-card .form-error:empty { display: none; }
a.btn { text-decoration: none; display: inline-block; text-align: center; }
.log-form .grid { align-items: start; }
.users select { min-width: 7.5rem; }
label.file-btn { display: inline-block; color: var(--ink); font-size: 0.95rem; }
@media (max-width: 600px) { .log-form { margin: 0.9rem 0.9rem 0; } .timeline { padding: 1rem 0.9rem; } .ed-head, .ed-body, .ed-foot { padding-left: 0.9rem; padding-right: 0.9rem; } .ed-tabs { padding: 0 0.9rem; } }

/* ----- v3: trawler, duplicates, transcripts */
.nav-count { display: inline-block; min-width: 1.3rem; padding: 0 0.35rem; margin-left: 0.2rem; border-radius: 999px; background: var(--bar-ink); color: var(--bar-bg); font-size: 0.75rem; font-weight: 800; text-align: center; }
.subtabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0.5rem 0 1.25rem; }
.subtabs button { all: unset; cursor: pointer; padding: 0.65rem 0.7rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.subtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.subtabs button:focus-visible { outline: 2px solid var(--focus); }
.run-banner { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 1rem; margin-bottom: 1rem; border-color: var(--brand); }
.run-banner > div { flex: 1; }
.spinner { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.toolbar.bulk { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.9rem; }
.toolbar.bulk label { flex: 0 1 auto; min-width: 0; }
.toolbar.bulk select { width: auto; }
.prospects { display: grid; gap: 1rem; }
.prospect { padding: 1rem 1.15rem; display: grid; gap: 0.75rem; }
.prospect header { display: flex; gap: 0.75rem; align-items: start; }
.prospect header input.sel { width: 1.1rem; height: 1.1rem; margin-top: 0.25rem; flex: none; }
.p-title { flex: 1; display: grid; gap: 0.15rem; }
.p-title h3 { font-size: 1.1rem; }
.p-brief { margin: 0; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; font-size: 0.92rem; }
.p-grid h4 { margin: 0 0 0.3rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.p-grid a { word-break: break-all; }
.prospect footer { align-items: center; border-top: 1px solid var(--line); padding-top: 0.75rem; }
label.inline { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; }
label.inline select { width: auto; }
.dup-box { border: 1px solid var(--today); background: var(--today-soft); border-radius: 8px; padding: 0.7rem 0.9rem; display: grid; gap: 0.4rem; margin: 0 1.4rem 0.9rem; }
.prospect .dup-box, .p-slot .dup-box { margin: 0; }
.dup-box.blocking { border-color: var(--overdue); background: var(--overdue-soft); }
.dup-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; }
.dup-group { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; display: grid; gap: 0.5rem; }
.dup-lead { display: flex; gap: 0.6rem; align-items: start; font-weight: 400; color: var(--ink); font-size: 0.95rem; }
.dup-lead input { width: auto; margin-top: 0.3rem; }
.ci-ai { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.4rem; }
.ai-box { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 0.75rem 0.9rem; display: grid; gap: 0.5rem; }
.ai-box p { margin: 0; white-space: pre-wrap; }
.transcript { white-space: pre-wrap; font: 0.88rem/1.55 var(--font); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 0.9rem; max-height: 22rem; overflow-y: auto; margin: 0.5rem 0 0.25rem; }
.suggest-table { font-size: 0.88rem; }
.suggest-table td, .suggest-table th { padding: 0.35rem 0.5rem; }
.suggest-table input { width: auto; }
.suggest-table tbody tr { cursor: default; }
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.profile { padding: 1rem 1.15rem; display: grid; gap: 0.6rem; }
.profile header { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.profile header h3 { flex: 1; font-size: 1.05rem; }
.profile .kv dd { text-align: left; font-weight: 500; }
.profile .kv { grid-template-columns: 7.5rem 1fr; }

#dup-warning:empty { display: none; }
#dup-warning .dup-box { margin: 0; }

/* ----- non-production banner */
body[data-env]:not([data-env="production"]):not([data-env=""])::after {
  content: attr(data-env); position: fixed; z-index: 100; right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  padding: 0.3rem 0.7rem; border-radius: 6px; background: #B42318; color: #fff; font: 800 0.8rem/1 var(--font);
  text-transform: uppercase; letter-spacing: 0.08em; pointer-events: none;
}
body[data-env]:not([data-env="production"]):not([data-env=""]) .topbar { background: repeating-linear-gradient(135deg, var(--bar-bg) 0 18px, color-mix(in srgb, var(--bar-bg) 85%, #B42318) 18px 36px); }

/* ----- logo */
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; flex: none; }
.login-logo { height: 120px; width: auto; justify-self: start; }
@media (max-width: 760px) { .brand-logo { height: 34px; } }


/* ----- email to lead */
.mail-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: center; background: var(--brand-soft); border-radius: 10px; padding: 0.9rem 1rem; }
.mail-addr { font-size: 0.95rem; word-break: break-all; background: var(--surface); padding: 0.15rem 0.4rem; border-radius: 5px; border: 1px solid var(--line); }
.mail-head { display: grid; gap: 0.15rem; margin-bottom: 0.4rem; word-break: break-word; }
.email-item .ci-outcome { word-break: break-word; }

/* ----- user access */
.access-row td { background: var(--surface-2); }
.access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.access-grid fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0; display: grid; gap: 0.5rem; }
.access-grid legend { font-weight: 700; font-size: 0.85rem; padding: 0 0.3rem; }
.access-item { align-items: flex-start; }
.access-item input { margin-top: 0.25rem; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.access-item input[type="checkbox"] { flex: none; width: 1.05rem; height: 1.05rem; }
.access-form { max-width: min(860px, calc(100vw - 5rem)); position: sticky; left: 0; }
.access-row td { white-space: normal; }

/* ===================================================================== themes
   Each user picks one under Settings → Appearance. "Classic" (no data-theme on <html>) follows the
   device's light/dark setting; the others are fixed. The same blocks style the preview cards. */
[data-theme] { background: var(--bg); color: var(--ink); font-family: var(--font); }
[data-theme="classic"] {
  color-scheme: light; --bg: #F3F5F7; --surface: #FFFFFF; --surface-2: #F8FAFB; --ink: #17202A; --muted: #5A6674; --line: #D8DEE4;
  --brand: #1E4D5C; --brand-hover: #163C48; --brand-ink: #FFFFFF; --brand-soft: #E3EDF0;
  --overdue: #B42318; --overdue-soft: #FDECEA; --today: #A65400; --today-soft: #FFF1DE; --week: #1F7444; --week-soft: #E4F4EA; --later: #5A6674; --later-soft: #EEF1F4;
  --bar-bg: #1E4D5C; --bar-ink: #FFFFFF; --bar-border: none;
}
[data-theme="light"] {
  color-scheme: light; --bg: #F6F8FA; --surface: #FFFFFF; --surface-2: #F9FAFB; --ink: #0F172A; --muted: #5B6472; --line: #E2E6EB;
  --brand: #1477A8; --brand-hover: #0F5F87; --brand-ink: #FFFFFF; --brand-soft: #E6F3F9; --focus: #2F7FD8;
  --overdue: #B42318; --overdue-soft: #FDECEA; --today: #A65400; --today-soft: #FFF1DE; --week: #1F7444; --week-soft: #E4F4EA; --later: #5B6472; --later-soft: #EEF1F4;
  --bar-bg: #FFFFFF; --bar-ink: #0F172A; --bar-border: 1px solid #E2E6EB;
}
[data-theme="dark"] {
  color-scheme: dark; --bg: #0E1318; --surface: #161D24; --surface-2: #1B242C; --ink: #E6ECF1; --muted: #96A3AF; --line: #27313B;
  --brand: #5CC0E6; --brand-hover: #7ACDEC; --brand-ink: #06222E; --brand-soft: #17323D; --focus: #7DB6F0;
  --overdue: #F07467; --overdue-soft: #3A1E1C; --today: #F0A24A; --today-soft: #3A2A16; --week: #5CC48A; --week-soft: #183224; --later: #96A3AF; --later-soft: #222C35;
  --bar-bg: #0A0F13; --bar-ink: #E6ECF1; --bar-border: 1px solid #1E272F;
}
[data-theme="modern"] {
  color-scheme: light; --bg: #F4F4F8; --surface: #FFFFFF; --surface-2: #F8F8FC; --ink: #14141B; --muted: #646475; --line: #E4E4EE;
  --brand: #5146E5; --brand-hover: #3F35C9; --brand-ink: #FFFFFF; --brand-soft: #ECEBFD; --focus: #5146E5;
  --overdue: #C2312A; --overdue-soft: #FDECEB; --today: #B25E00; --today-soft: #FFF1DE; --week: #17804E; --week-soft: #E3F5EB; --later: #646475; --later-soft: #EFEFF5;
  --bar-bg: #14141B; --bar-ink: #FFFFFF; --bar-border: none;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; --radius: 16px; --r-ctl: 10px; --r-dlg: 20px;
}
[data-theme="calming"] {
  color-scheme: light; --bg: #F2F0E9; --surface: #FBFAF6; --surface-2: #F5F3EC; --ink: #2E3A33; --muted: #6A776E; --line: #DDD9CD;
  --brand: #4E7B66; --brand-hover: #3E6453; --brand-ink: #FFFFFF; --brand-soft: #E1EBE3; --focus: #4E7B66;
  --overdue: #A8483B; --overdue-soft: #F6E4E0; --today: #946319; --today-soft: #F5ECD9; --week: #3F7656; --week-soft: #E1EEE5; --later: #6A776E; --later-soft: #ECEAE2;
  --bar-bg: #E5ECE4; --bar-ink: #2E3A33; --bar-border: 1px solid #D5DECF;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; --radius: 18px; --r-ctl: 12px; --r-dlg: 22px;
}
[data-theme="vogue"] {
  color-scheme: light; --bg: #FAF7F3; --surface: #FFFFFF; --surface-2: #F6F1EC; --ink: #121212; --muted: #6E6862; --line: #E7E0D8;
  --brand: #121212; --brand-hover: #000000; --brand-ink: #FAF7F3; --brand-soft: #F2E6E0; --focus: #9F6B5B;
  --overdue: #9F2A2A; --overdue-soft: #F6E3E1; --today: #8C5A1C; --today-soft: #F4EAD9; --week: #2F5D46; --week-soft: #E2EDE6; --later: #6E6862; --later-soft: #EFEAE4;
  --bar-bg: #121212; --bar-ink: #FAF7F3; --bar-border: none;
  --font: "Jost", "Helvetica Neue", Arial, sans-serif; --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --radius: 2px; --r-ctl: 0px; --r-dlg: 2px;
}
[data-theme="streamlined"] {
  color-scheme: light; --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F7F8FA; --ink: #111827; --muted: #6B7280; --line: #E5E7EB;
  --brand: #0F766E; --brand-hover: #115E59; --brand-ink: #FFFFFF; --brand-soft: #E6F4F2; --focus: #0F766E;
  --overdue: #B91C1C; --overdue-soft: #FEECEC; --today: #A85A00; --today-soft: #FFF3E0; --week: #15803D; --week-soft: #E7F6EC; --later: #6B7280; --later-soft: #F1F3F5;
  --bar-bg: #FFFFFF; --bar-ink: #111827; --bar-border: 1px solid #E5E7EB; --bar-height: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --font-size: 14px;
  --radius: 6px; --r-ctl: 5px; --r-dlg: 8px;
}
html[data-theme="streamlined"] { font-size: 14px; }
html[data-theme="streamlined"] .view { padding-top: 1.25rem; }
html[data-theme="vogue"] h1 { font-weight: 700; letter-spacing: 0; }
html[data-theme="vogue"] .tabs a, html[data-theme="vogue"] .subtabs button, html[data-theme="vogue"] .ed-tabs button { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.76rem; }
html[data-theme="vogue"] .btn { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
html[data-theme="vogue"] .brand span { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
html[data-theme="modern"] .panel, html[data-theme="modern"] .call-row { box-shadow: 0 1px 2px rgba(20, 20, 27, 0.04); }
html[data-theme="modern"] .panel { border-color: transparent; box-shadow: 0 1px 3px rgba(20, 20, 27, 0.06), 0 1px 2px rgba(20, 20, 27, 0.04); }
html[data-theme="calming"] .sheet-group > header { border-bottom-width: 1px; }

/* ----- appearance picker */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.9rem; }
.theme-card { all: unset; cursor: pointer; display: grid; gap: 0.45rem; border-radius: 12px; padding: 0.5rem; border: 2px solid transparent; }
.theme-card:hover { background: var(--surface-2); }
.theme-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-card[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.theme-card .tc-name { font-weight: 700; display: flex; justify-content: space-between; align-items: center; color: var(--ink); }
.theme-card .tc-desc { font-size: 0.82rem; color: var(--muted); }
.theme-preview { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); height: 118px; display: grid; grid-template-rows: 22px 1fr; font-size: 11px; }
.tp-bar { background: var(--bar-bg); color: var(--bar-ink); border-bottom: var(--bar-border); display: flex; align-items: center; gap: 6px; padding: 0 8px; font-weight: 700; font-size: 10px; }
.tp-bar i { width: 10px; height: 10px; border-radius: 3px; background: #35A7D3; display: inline-block; }
.tp-bar span { opacity: 0.7; font-weight: 500; }
.tp-body { padding: 8px; display: grid; gap: 6px; align-content: start; }
.tp-title { font-family: var(--font-head, var(--font)); font-weight: 800; font-size: 13px; color: var(--ink); }
.tp-row { background: var(--surface); border: 1px solid var(--line); border-radius: min(var(--radius, 10px), 8px); padding: 5px 6px; display: flex; gap: 5px; align-items: center; color: var(--ink); }
.tp-row b { flex: 1; font-weight: 600; }
.tp-badge { border-radius: 999px; padding: 1px 6px; font-size: 9px; font-weight: 700; }
.tp-badge.o { background: var(--overdue-soft); color: var(--overdue); } .tp-badge.t { background: var(--today-soft); color: var(--today); } .tp-badge.w { background: var(--week-soft); color: var(--week); }
.tp-btn { background: var(--brand); color: var(--brand-ink); border-radius: var(--r-ctl, 6px); padding: 2px 7px; font-weight: 700; font-size: 9px; }
.tp-auto { display: grid; grid-template-columns: 1fr 1fr; height: 100%; }
.settings #appearance > .theme-grid { justify-self: stretch; }
.theme-card { grid-template-rows: 118px auto auto; align-content: start; }
.tp-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ===================================================================== Adam Mode
   Fair dinkum outback: red dust, gum-leaf greens, rusty corrugated iron, the Southern Cross, and a little rifle cursor. */
@font-face { font-family: "Rye"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/rye-latin-400-normal.woff2") format("woff2"); }
[data-theme="adam"] {
  color-scheme: light; --bg: #EFDDBE; --surface: #FFF8EA; --surface-2: #F7EBD3; --ink: #3A2414; --muted: #7A5A3E; --line: #D9BE93;
  --brand: #A8431E; --brand-hover: #8A3415; --brand-ink: #FFF4DE; --brand-soft: #F6DCC4; --focus: #A8431E;
  --overdue: #A3261B; --overdue-soft: #F7D9CF; --today: #8A6200; --today-soft: #FBEBB8; --week: #3F6B3A; --week-soft: #DCE9D2; --later: #7A5A3E; --later-soft: #EEDFC6;
  --bar-bg: #7C3A1A; --bar-ink: #FFF4DE; --bar-border: 3px solid #3F2A1A;
  --bar-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='56' viewBox='0 0 120 56'%3E%3Cg fill='%23FFF4D6' opacity='0.85'%3E%3Ccircle cx='60' cy='10' r='2.2'/%3E%3Ccircle cx='60' cy='44' r='2.4'/%3E%3Ccircle cx='44' cy='27' r='2'/%3E%3Ccircle cx='76' cy='24' r='1.8'/%3E%3Ccircle cx='68' cy='33' r='1.1'/%3E%3C/g%3E%3C/svg%3E") right 15rem center / 110px 52px no-repeat, repeating-linear-gradient(90deg, rgba(255,255,255,0.07) 0 6px, rgba(0,0,0,0.10) 6px 12px), linear-gradient(180deg, #8C4320, #6E3215);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; --font-head: "Rye", Georgia, serif;
  --radius: 12px; --r-ctl: 9px; --r-dlg: 16px;
}
html[data-theme="adam"] body { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='260' viewBox='0 0 1600 260' preserveAspectRatio='xMidYMax slice'%3E%3Cpath d='M0 200 L180 185 L260 150 L300 120 L520 118 L560 150 L640 170 L900 175 L980 160 L1040 140 L1180 138 L1230 165 L1600 180 L1600 260 L0 260 Z' fill='%23B5502B' opacity='0.55'/%3E%3Cpath d='M0 230 Q400 205 800 222 T1600 215 L1600 260 L0 260 Z' fill='%238E3B1E' opacity='0.6'/%3E%3Cg fill='%233F2A1A' opacity='0.55'%3E%3Cpath d='M1330 230 C1332 200 1328 175 1338 150 L1344 150 C1338 178 1342 205 1342 230 Z'/%3E%3Cpath d='M1338 162 C1320 150 1300 152 1292 160 M1341 170 C1360 156 1378 158 1386 166' stroke='%233F2A1A' stroke-width='4' fill='none'/%3E%3C/g%3E%3Cg fill='%235F7F5A' opacity='0.6'%3E%3Cellipse cx='1300' cy='150' rx='30' ry='16'/%3E%3Cellipse cx='1340' cy='132' rx='34' ry='18'/%3E%3Cellipse cx='1382' cy='152' rx='28' ry='14'/%3E%3Cellipse cx='1360' cy='118' rx='22' ry='12'/%3E%3C/g%3E%3C/svg%3E") center bottom / 100% 260px no-repeat fixed, linear-gradient(180deg, #F3E5C7 0%, #EFD6AE 60%, #E9C597 100%) fixed; }
html[data-theme="adam"] .topbar, html[data-theme="adam"] body::before { background: var(--bar-image); }
html[data-theme="adam"] .brand span { font-family: var(--font-head); font-size: 1.15rem; letter-spacing: 0.02em; }
html[data-theme="adam"] .brand span::after { content: " 🦘"; }
html[data-theme="adam"] h1 { font-weight: 400; letter-spacing: 0.01em; color: #5A2A12; }
html[data-theme="adam"] h2, html[data-theme="adam"] h3 { font-weight: 400; letter-spacing: 0.02em; }
html[data-theme="adam"] .panel, html[data-theme="adam"] .call-row { background-color: rgba(255, 248, 234, 0.92); }
html[data-theme="adam"] .panel { border: 2px solid var(--line); box-shadow: 3px 3px 0 rgba(90, 42, 18, 0.18); }
html[data-theme="adam"] .btn.primary { box-shadow: 0 2px 0 #5A2A12; text-shadow: 0 1px 0 rgba(0,0,0,0.25); }
html[data-theme="adam"] .sheet-group > header { border-bottom-style: dashed; }
html[data-theme="adam"] .tabs a[aria-current="page"] { border-bottom-color: #F2C14E; }
/* The rifle cursor everywhere, except where you type. */
html[data-theme="adam"], html[data-theme="adam"] * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='rotate%2845 16 16%29' stroke='%231b1208' stroke-width='0.7' stroke-linejoin='round'%3E%3Crect x='0.5' y='14.6' width='17' height='2.2' fill='%233b3b3b'/%3E%3Crect x='1' y='13.2' width='1.3' height='1.6' fill='%233b3b3b'/%3E%3Crect x='13.5' y='10.6' width='8.5' height='2.5' rx='1.2' fill='%23262626'/%3E%3Crect x='15.5' y='12.9' width='1' height='1.8' fill='%23262626'/%3E%3Crect x='19.5' y='12.9' width='1' height='1.8' fill='%23262626'/%3E%3Crect x='15' y='13.8' width='7.5' height='4' rx='0.6' fill='%234a4a4a'/%3E%3Cpath d='M22 14 L29 13.4 L31.6 14.8 L31.6 20.6 L28.3 20.2 L23.6 17.9 L22 18.2 Z' fill='%239a5527'/%3E%3Cpath d='M18.6 17.8 q0.4 2.6 2.6 2.4' fill='none'/%3E%3C/g%3E%3C/svg%3E") 5 5, crosshair !important; }
html[data-theme="adam"] input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
html[data-theme="adam"] textarea, html[data-theme="adam"] select { cursor: text !important; }
html[data-theme="adam"] select { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='rotate%2845 16 16%29' stroke='%231b1208' stroke-width='0.7' stroke-linejoin='round'%3E%3Crect x='0.5' y='14.6' width='17' height='2.2' fill='%233b3b3b'/%3E%3Crect x='1' y='13.2' width='1.3' height='1.6' fill='%233b3b3b'/%3E%3Crect x='13.5' y='10.6' width='8.5' height='2.5' rx='1.2' fill='%23262626'/%3E%3Crect x='15.5' y='12.9' width='1' height='1.8' fill='%23262626'/%3E%3Crect x='19.5' y='12.9' width='1' height='1.8' fill='%23262626'/%3E%3Crect x='15' y='13.8' width='7.5' height='4' rx='0.6' fill='%234a4a4a'/%3E%3Cpath d='M22 14 L29 13.4 L31.6 14.8 L31.6 20.6 L28.3 20.2 L23.6 17.9 L22 18.2 Z' fill='%239a5527'/%3E%3Cpath d='M18.6 17.8 q0.4 2.6 2.6 2.4' fill='none'/%3E%3C/g%3E%3C/svg%3E") 5 5, crosshair !important; }
[data-theme="adam"] .tp-bar { background: var(--bar-image); }
[data-theme="adam"].theme-preview { background: linear-gradient(180deg, #F3E5C7, #E9C597); }

/* ----- on/off switch */
.switch { position: relative; display: inline-block; width: 2.4rem; height: 1.35rem; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 0.17rem; left: 0.17rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch input:checked + span { background: var(--week); }
.switch input:checked + span::after { transform: translateX(1.05rem); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + span { opacity: 0.45; }
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after { transition: none; } }
