:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #172b4d;
  --muted: #626f86;
  --line: #dfe1e6;
  --col-bg: #f1f2f4;
  --subtle: #f4f5f7;   /* hover / secondary surface */
  --track-bg: #eef1f6; /* segmented-control & tab tracks */
  --chip: #e9edf3;     /* count chips, due pill */
  --design: #2f6df6;
  --circuit: #13a36b;
  --survey: #8b5cf6;
  --overdue: #c9372c;
  --radius: 8px;
  --shadow: 0 1px 1px rgba(9,30,66,.13), 0 0 1px rgba(9,30,66,.08);
}
* { box-sizing: border-box; }
.site-link { color: var(--circuit); font-weight: 600; text-decoration: none; cursor: pointer; }
.site-link:hover { text-decoration: underline; }
body { margin: 0; font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 20px; width: 34px; height: 34px; display: grid; place-items: center; background: linear-gradient(135deg, var(--design), var(--circuit)); color: #fff; border-radius: 8px; }
.topbar h1 { font-size: 16px; margin: 0; }
.tagline { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.t-design { color: var(--design); }
.t-circuit { color: var(--circuit); }
.t-survey { color: var(--survey); }
.toolbar { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; background: var(--track-bg); border-radius: 8px; padding: 3px; }
.seg-btn { border: 0; background: transparent; padding: 6px 11px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg-btn.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
#search { width: 240px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; outline: none; }
#search:focus { border-color: var(--design); box-shadow: 0 0 0 3px rgba(47,109,246,.12); }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 13px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { background: var(--subtle); }
.btn.primary { background: var(--design); border-color: var(--design); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); background: var(--design); }

/* boards (two stacked) */
#boards { padding: 8px 20px 60px; }
.board { margin-top: 18px; }
.board-head { display: flex; align-items: center; gap: 9px; padding: 6px 2px 10px; }
.board-head h2 { font-size: 15px; margin: 0; }
.board-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.board-head .dot.t-design { background: var(--design); }
.board-head .dot.t-circuit { background: var(--circuit); }
.board-head .dot.t-survey { background: var(--survey); }
.board-sub { font-size: 12px; color: var(--muted); }

/* dashboard */
.dashboard { padding: 16px 2px 40px; }
.dash-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.custom-range input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.dash-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.dash-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.dash-head h3 { margin: 0; font-size: 15px; }
.dash-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.dash-head .muted { margin-left: auto; font-size: 12px; }
.dash-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { background: #f7f8fa; border: 1px solid var(--line); border-radius: 9px; padding: 10px 6px; text-align: center; }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.dash-pie { display: flex; align-items: center; gap: 18px; }
.pie-wrap { position: relative; flex: 0 0 auto; width: 150px; height: 150px; }
.pie { width: 150px; height: 150px; border-radius: 50%; }
.pie-hole { position: absolute; inset: 32px; background: var(--panel); border-radius: 50%; }
.pie-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.pie-center b { font-size: 24px; }
.pie-center small { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.legend { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend .lg-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend b { font-weight: 700; }
.legend i { font-style: normal; color: var(--muted); width: 38px; text-align: right; }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

.cols { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.column { flex: 0 0 256px; width: 256px; background: var(--col-bg); border-radius: 10px; padding: 8px; }
.col-head { display: flex; align-items: center; gap: 7px; padding: 4px 6px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.col-head .count { font-weight: 600; color: var(--muted); background: var(--chip); border-radius: 20px; padding: 0 7px; font-size: 11px; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 24px; border-radius: 8px; }
.column.drop .col-cards { outline: 2px dashed var(--design); outline-offset: 2px; background: rgba(47,109,246,.06); }

.card { position: relative; background: var(--panel); border-radius: var(--radius); padding: 10px 11px; box-shadow: var(--shadow); cursor: pointer; border-left: 3px solid var(--track, var(--design)); }
.card:hover { background: var(--subtle); }
.card.dragging { opacity: .45; }
.card-title { font-size: 13.5px; font-weight: 500; margin-bottom: 8px; line-height: 1.3; }
.card-due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); background: var(--chip); padding: 1px 7px; border-radius: 5px; margin-bottom: 9px; }
.card-due.overdue { color: #fff; background: var(--overdue); }
.card-foot { display: flex; align-items: center; justify-content: space-between; }
.card-key { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.card-key .chk { color: #4bce97; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: #8993a4; }
.avatar.unassigned { background: #c1c7d0; color: #fff; }
.col-empty { color: #97a0af; font-size: 12px; text-align: center; padding: 10px 0; }

/* drawer */
.overlay { position: fixed; inset: 0; background: rgba(9,30,66,.42); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 94vw; background: var(--panel); z-index: 50; box-shadow: -10px 0 30px rgba(9,30,66,.2); overflow-y: auto; padding: 18px 20px 50px; }
.hidden { display: none !important; }
.drawer .close { position: absolute; top: 14px; right: 16px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.drawer h2 { margin: 8px 0 2px; font-size: 16px; }
.badge { color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.kv { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.kv b { color: var(--ink); font-weight: 600; }
.sibling { display: flex; align-items: center; gap: 8px; font-size: 12px; background: var(--subtle); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; }
.section { margin: 14px 0; }
.section > .label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
details.section > summary { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; cursor: pointer; margin-bottom: 8px; }

.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-pill { font-size: 11px; font-weight: 600; padding: 6px 9px; border-radius: 7px; background: var(--track-bg); color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.stage-pill.active { background: var(--design); color: #fff; }
.stage-pill.done { background: #dcefe6; color: var(--circuit); }

label.field { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.intake-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.intake-grid label.field { margin-bottom: 8px; }
.field-link { font-size: 11px; color: var(--design); margin-left: 6px; text-decoration: none; font-weight: 600; }
.field-link:hover { text-decoration: underline; }
label.field input, label.field select, label.field textarea, .modal input, .modal textarea { width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--ink); background: var(--panel); font-family: inherit; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.notes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.note { background: var(--subtle); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.note .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.note-dd > summary { cursor: pointer; list-style: none; color: var(--muted); }
.note-dd > summary::-webkit-details-marker { display: none; }
.note-dd > summary::before { content: '▸ '; color: var(--muted); }
.note-dd[open] > summary::before { content: '▾ '; }
.note-dd > summary .note-preview { color: var(--ink); }
.note-dd[open] > summary .note-preview { color: var(--muted); font-size: 12px; }
.note-dd > .note-text { margin-top: 6px; }
.note-add { display: flex; gap: 8px; }
.note-add input { flex: 1; }
/* Feed entry: summary headline + drill-down with a parsed-quote table. */
.note-dd > summary, .feed-line { display: flex; align-items: baseline; gap: 6px; }
.feed-line { color: var(--ink); }
.feed-icon { flex: none; }
.note-detail { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.note-detail .note-text { margin-top: 0; }
.feed-sub { font-size: 12px; }
.feed-quotes { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.feed-quotes th, .feed-quotes td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.feed-quotes thead th { color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.feed-quotes tbody tr:last-child td { border-bottom: none; }
.feed-quotes td:first-child { font-weight: 600; }
.feed-atts { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-att { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 12px; }
.feed-att:hover { background: var(--subtle); }
.note-convo > summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; }
.note-convo > summary::-webkit-details-marker { display: none; }
.note-convo > summary::before { content: '▸ '; }
.note-convo[open] > summary::before { content: '▾ '; }
.note-convo .note-text { margin-top: 6px; max-height: 320px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 12px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { font-size: 12px; color: var(--muted); padding: 3px 0 3px 10px; border-left: 2px solid var(--line); }

/* modal + toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(9,30,66,.45); z-index: 60; display: grid; place-items: center; }
.modal { background: var(--panel); width: 440px; max-width: 92vw; border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 2px; }
.modal label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.field-group { margin-bottom: 12px; }
.field-group-label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.ck-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ck { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; cursor: pointer; background: var(--panel); }
.ck:hover { background: var(--subtle); }
.ck input { margin: 0; }
.ck .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* vendor pricing table */
.pricing { padding: 18px 20px; }
.pricing-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pricing-head h2 { margin: 0; }
.pricing-head select { margin-left: auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: var(--panel); }
.ptable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable th, .ptable td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable th { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #f7f8fa; position: sticky; top: 0; }
.ptable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ptable th.sortable:hover { color: var(--ink); }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr:hover { background: var(--subtle); }
.ptable .mono { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.ptable .nrc { display: block; font-size: 10.5px; color: var(--muted); }
#geocodeBtn { margin-left: auto; }
.pricing-head select { margin-left: 0; }
.pmap { height: 380px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; background: #e8eef3; z-index: 0; }
.pmap.drawing { cursor: crosshair; box-shadow: 0 0 0 2px var(--design) inset; }
.pmap-fallback { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; }
.pricing-filters { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pricing-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pricing-filters select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--ink); max-width: 220px; }
.pricing-filters input[type="date"] { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--ink); }
.f-speeds { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.speed-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.speed-chip:hover { border-color: var(--design); }
.speed-chip.on { background: var(--design); border-color: var(--design); color: #fff; }
.pricing-filters .filter-spacer { flex: 1 1 auto; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn.active { background: var(--design); border-color: var(--design); color: #fff; }
.radius-wrap { display: inline-flex; align-items: center; gap: 8px; }
.radius-wrap input[type="range"] { width: 120px; accent-color: var(--design); }
.radius-tool { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.radius-addr { width: 180px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--ink); background: var(--panel); }
.radius-mi { width: 54px; padding: 6px 6px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--ink); background: var(--panel); }
.avg-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.avg-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.avg-bw { font-size: 12px; font-weight: 700; color: var(--circuit); text-transform: uppercase; letter-spacing: .3px; }
.avg-mrc { font-size: 26px; font-weight: 700; color: var(--ink); margin: 2px 0; font-variant-numeric: tabular-nums; }
.avg-n { font-size: 11px; color: var(--muted); }
.modal-wide { width: 460px; max-height: 86vh; overflow-y: auto; }
.deck { margin-bottom: 16px; }
.deck-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin-bottom: 7px; }
.deck-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.deck-head .count { font-weight: 600; color: var(--muted); background: var(--chip); border-radius: 20px; padding: 0 7px; font-size: 11px; }
.people-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.people-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.people-list .x { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 4px; }
.people-list .x:hover { color: var(--overdue); }
.people-list li.confirm { flex-direction: column; align-items: stretch; gap: 7px; background: #fff7f6; border: 1px solid #f3c2bd; border-radius: 8px; padding: 9px 11px; }
.people-list li.confirm select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn.danger { background: var(--overdue); border-color: var(--overdue); color: #fff; }
.btn.danger:hover { filter: brightness(1.05); background: var(--overdue); }

/* user admin (Manage users) */
.utable { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.utable th, .utable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.utable th { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.utable .mono { color: var(--muted); font-size: 12px; }
.utable-act { white-space: nowrap; text-align: right; }
.utable-act .btn { padding: 4px 9px; font-size: 12px; margin-left: 6px; }
.u-del { color: var(--overdue); }
.u-del.armed { background: var(--overdue); color: #fff; border-color: var(--overdue); }
.deck-chip { display: inline-block; font-size: 10.5px; font-weight: 700; border: 1px solid; border-radius: 20px; padding: 1px 8px; }
.adduser { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.adduser input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.adduser input[name=name] { flex: 1 1 140px; }
.adduser input[name=email] { flex: 2 1 200px; }
.adduser-decks { display: flex; gap: 6px; flex-wrap: wrap; }

/* board stage editor */
.board-stages-btn { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.stage-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stage-reorder { display: inline-flex; gap: 2px; }
.stage-reorder button { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; width: 24px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1; color: var(--ink); }
.stage-reorder button:disabled { opacity: .35; cursor: default; }
.stage-label { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.stage-core { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--track-bg); border-radius: 20px; padding: 2px 8px; }
.stage-row .x { border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.stage-add { display: flex; gap: 8px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.stage-add input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }

/* circuit quote matrix */
.q-summary { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
.q-summary th, .q-summary td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; }
.q-summary th:first-child, .q-summary td:first-child { text-align: left; }
.q-summary th { background: var(--subtle); color: var(--muted); }
.q-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.q-tab { border: 1px solid var(--line); background: var(--track-bg); border-radius: 7px 7px 0 0; padding: 5px 10px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.q-tab.active { background: var(--panel); color: var(--ink); border-bottom-color: var(--panel); }
.q-panel { display: none; border: 1px solid var(--line); border-radius: 0 8px 8px 8px; padding: 10px; }
.q-panel.active { display: block; }
.q-vhead { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.q-vhead .btn { margin-left: auto; padding: 2px 8px; }
.q-vname { font-weight: 700; font-size: 14px; color: var(--ink); border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; max-width: 220px; background: transparent; }
.q-vname:hover { border-color: var(--line); }
.q-vname:focus { border-color: var(--design); background: var(--panel); outline: none; }
.q-tiers { width: 100%; border-collapse: collapse; font-size: 12px; }
.q-tiers th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 4px; }
.q-tiers td { padding: 2px 4px; }
.q-tiers input { width: 100%; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.q-addrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.q-addrow select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.q-newvendor { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.q-newvendor input { width: 108px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.q-rowlabel { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin: 6px 0 4px; }
.q-delrow { border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 0 2px; }
.q-delrow:hover { color: var(--overdue); }
.q-speed { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; margin-bottom: 6px; }
.q-speed-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.q-speed-top input { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.q-speed-top .q-bw { width: 84px; } .q-speed-top .q-term { width: 62px; }
.q-speed-top input[type=number] { width: 62px; }
.q-lab { font-size: 10px; color: var(--muted); }
.q-snote { width: 100%; margin-top: 5px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.muted { color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px; z-index: 70; box-shadow: var(--shadow); }

/* form error line (login + change password) */
.form-err { color: #c9372c; font-size: 12px; min-height: 16px; margin-top: 8px; }

/* account menu (top-right) */
.acct { position: relative; }
#acctBtn { font-weight: 700; }
.acct-menu { position: absolute; right: 0; top: 110%; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(9,30,66,.18); padding: 6px; z-index: 65; display: flex; flex-direction: column; gap: 2px; }
.acct-menu .btn { border: 0; text-align: left; background: transparent; }
.acct-menu .btn:hover { background: var(--subtle); }
.acct-email { font-size: 12px; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }

/* login screen */
.login-wrap { position: fixed; inset: 0; background: var(--bg); z-index: 80; display: grid; place-items: center; }
.login-card { background: var(--panel); width: 340px; max-width: 90vw; border-radius: 14px; padding: 28px 26px; box-shadow: var(--shadow); border: 1px solid var(--line); text-align: center; }
.login-card .logo { margin: 0 auto 12px; }
.login-card h2 { margin: 0 0 2px; }
.login-card p { margin: 0 0 16px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.login-card input { width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.login-card .btn.primary { width: 100%; margin-top: 4px; padding: 10px; }

/* people deck add row (name + email) + roster email */
.deck-add { flex-wrap: wrap; }
.deck-add input[name="name"] { flex: 1 1 120px; }
.deck-add input[name="email"] { flex: 2 1 180px; }
.people-list .person-email { font-size: 11px; color: var(--muted); margin-left: 6px; }
.people-list li { display: flex; align-items: center; gap: 6px; }
.people-list .person-name { font-weight: 600; }
.people-list .x { margin-left: auto; }

/* "new info" glow — a card (and its new notes) pulses when unseen info arrives;
   opening the card clears it. Ring reuses the card's track color (--track). */
.new-flag { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--track, var(--design)); }
.card.has-new .card-title { padding-right: 42px; }
.card.has-new::after { content: ''; position: absolute; inset: -1px; border-radius: var(--radius); pointer-events: none; box-shadow: 0 0 0 2px var(--track, var(--design)); opacity: 0; animation: cardGlow 1.5s ease-in-out infinite; }
@keyframes cardGlow { 0%, 100% { opacity: 0; } 50% { opacity: .6; } }
.note.note-new { background: #fff8e1; border-color: #f5c518; box-shadow: 0 0 0 2px rgba(245, 197, 24, .35); }

/* ───────────────────────────── dark mode ─────────────────────────────
   Driven by [data-theme="dark"] on <html> (set pre-paint by the head script
   from the stored choice or the OS preference; toggled from the toolbar 🌙).
   Most colors flow from the variables below; the rest are the few hardcoded
   light surfaces that can't ride a variable. */
:root[data-theme="dark"] {
  --bg: #0d1117;
  --panel: #1c2128;
  --col-bg: #161b22;
  --ink: #e6edf3;
  --muted: #9198a1;
  --line: #30363d;
  --subtle: #262c36;
  --track-bg: #161b22;
  --chip: #2a313c;
  --design: #4d8bff;
  --circuit: #2ecc8f;
  --survey: #a78bfa;
  --overdue: #f4664a;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 0 1px rgba(0,0,0,.4);
}
/* Form controls fall back to a white UA background unless a rule sets one — pin them. */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { background: var(--panel); color: var(--ink); border-color: var(--line); }
/* The two remaining #f7f8fa surfaces (stat tiles, sticky table header). */
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .ptable th { background: var(--col-bg); }
/* Active segmented-control button should read a touch lighter than the topbar. */
:root[data-theme="dark"] .seg-btn.active { background: #2a313c; }
/* Map: dark placeholder + dim the raster tiles so they aren't a glaring slab. */
:root[data-theme="dark"] .pmap,
:root[data-theme="dark"] .leaflet-container { background: var(--bg); }
:root[data-theme="dark"] .leaflet-tile { filter: brightness(.75) invert(1) contrast(.9) hue-rotate(180deg) saturate(.6); }
/* Tinted (not pastel) status fills. */
:root[data-theme="dark"] .stage-pill.done { background: rgba(46,204,143,.16); color: var(--circuit); }
:root[data-theme="dark"] .note.note-new { background: rgba(245,197,24,.10); border-color: rgba(245,197,24,.45); }
:root[data-theme="dark"] .people-list li.confirm { background: rgba(244,102,74,.10); border-color: rgba(244,102,74,.40); }
:root[data-theme="dark"] .form-err { color: var(--overdue); }
/* Toast bg is var(--ink) (flips light in dark) — restate it dark. */
:root[data-theme="dark"] .toast { background: #2a313c; color: var(--ink); }
:root[data-theme="dark"] .avatar.unassigned { background: #3a414c; }
/* Slightly stronger overlays over a dark page. */
:root[data-theme="dark"] .overlay,
:root[data-theme="dark"] .modal-wrap { background: rgba(0,0,0,.6); }
