:root {
    /* Slate ink + neutrals */
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-2: #cbd5e1;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --white: #ffffff;

    /* Teal accent */
    --teal: #0d9488;
    --teal-dark: #0f766e;
    --teal-50: #f0fdfa;
    --teal-100: #ccfbf1;
    --teal-800: #115e59;

    /* Accent aliases (legacy var names map onto the teal accent) */
    --blue: #0d9488;
    --blue-dark: #115e59;

    /* Semantic */
    --green: #047857;
    --red: #b91c1c;
    --amber: #b45309;

    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 8px 28px rgba(15, 23, 42, .12);
    color-scheme: light;
}

/* ============================ Dark theme ============================ */
/* Set on <html data-theme="dark">. Almost everything is variable-driven, so re-defining the
   palette flips the whole UI; a handful of hardcoded light tints get dark equivalents below. */
[data-theme="dark"] {
    color-scheme: dark;                 /* dark native date-pickers, dropdowns, scrollbars */
    --ink: #e6eaf2;
    --ink-2: #c3ccda;
    --muted: #8b98ac;
    --line: #2a3547;
    --line-2: #3a4864;
    --bg: #0b111f;
    --surface: #151e30;
    --surface-2: #1c2740;
    --white: #151e30;

    --teal: #14b8a6;
    --teal-dark: #2dd4bf;               /* links + accents, bright enough on dark */
    --teal-50: #0e2b2a;
    --teal-100: #123f3a;
    --teal-800: #7ff0e0;
    --blue: #2dd4bf;
    --blue-dark: #7ff0e0;

    --green: #34d399;
    --red: #f87171;
    --amber: #fbbf24;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
[data-theme="dark"] .ico-blue { background: #16233b; color: #93c5fd; }
[data-theme="dark"] .ico-amber { background: #2a2413; color: #fcd34d; }
[data-theme="dark"] .ico-violet { background: #221c3a; color: #c4b5fd; }
[data-theme="dark"] .msg.success { background: #0f2a1f; border-color: #14532d; }
[data-theme="dark"] .msg.error { background: #2b1414; border-color: #7f1d1d; }
[data-theme="dark"] .msg.warning { background: #2a2210; border-color: #78350f; }
[data-theme="dark"] .note.pinned { background: #241d0f; }
[data-theme="dark"] .soon { background: #241d0f; border-color: #78350f; }
/* Elements that use --ink as a *background* (dark chips on the light UI) must stay dark. */
[data-theme="dark"] .avatar { background: #334155; }
[data-theme="dark"] .ob-bar { background: #10192a; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================ Top bar ============================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    padding: 0 22px;
    height: 60px;
}
.nav-cb { display: none; }

.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 17px; color: var(--ink); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 9px;
    background: var(--teal); color: #fff; font-size: 18px;
}

.nav-toggle {
    display: none; margin-left: auto; cursor: pointer;
    font-size: 24px; color: var(--ink-2); padding: 4px 6px; border-radius: 8px;
}
.nav-toggle:hover { background: var(--surface-2); }

.nav-collapse { display: flex; align-items: center; flex: 1; gap: 18px; }
.mainnav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--ink-2); font-weight: 500; font-size: 14.5px;
    padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav-link.active,
.nav-group.active > .nav-link { background: var(--teal-50); color: var(--teal-dark); }
.caret { font-size: 14px; opacity: .7; }

/* Dropdown groups (Lists, Canvassing) */
.nav-group { position: relative; }
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
    min-width: 210px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.nav-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px;
}
.nav-menu a:hover { background: var(--surface-2); text-decoration: none; }
.nav-menu a i { color: var(--muted); font-size: 18px; }

/* Right cluster */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.campaign-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--teal-50); border: 1px solid var(--teal-100); color: var(--teal-800);
    padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
    max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.campaign-chip:hover { background: var(--teal-100); text-decoration: none; }
.campaign-chip i { font-size: 15px; }

.acct { position: relative; }
.acct > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 8px 5px 5px; border-radius: 24px; border: 1px solid var(--line);
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover { background: var(--surface-2); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
}
.acct-name { font-size: 14px; color: var(--ink-2); font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
    min-width: 220px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
    padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.acct-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.acct-head .muted { font-size: 12px; }
.acct-menu a, .acct-menu .logout button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px;
    background: none; border: none; cursor: pointer; font: inherit; text-align: left;
}
.acct-menu a:hover, .acct-menu .logout button:hover { background: var(--surface-2); text-decoration: none; }
.acct-menu i { color: var(--muted); font-size: 18px; }
.logout { margin: 0; }

/* ============================ Content ============================ */
.content { max-width: 1180px; margin: 0 auto; padding: 28px 24px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { letter-spacing: -.01em; }

/* ====================== Dashboard launchpad ====================== */
.dash-head { margin-bottom: 6px; }
.dash-head h1 { margin-bottom: 2px; }
.dash-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.dash-stat {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 7px 14px; font-size: 13px; color: var(--ink-2);
}
.dash-stat i { color: var(--muted); font-size: 16px; }
.dash-stat strong { color: var(--ink); }

.launch-group { font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
    color: var(--muted); margin: 26px 0 12px; }
.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.launch-card {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 16px 18px; color: var(--ink);
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.launch-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); text-decoration: none; transform: translateY(-1px); }
.launch-ico {
    flex: none; width: 40px; height: 40px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 21px;
}
.launch-card h3 { margin: 0 0 3px; font-size: 15px; }
.launch-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ico-teal { background: var(--teal-50); color: var(--teal-dark); }
.ico-blue { background: #eff6ff; color: #1d4ed8; }
.ico-amber { background: #fffbeb; color: #b45309; }
.ico-violet { background: #f5f3ff; color: #6d28d9; }
.ico-slate { background: var(--surface-2); color: var(--ink-2); }

/* ============================ Cards ============================ */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.card {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 18px 20px; color: var(--ink);
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.card:hover { border-color: var(--line-2); text-decoration: none; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.card h2 { margin: 0 0 6px; font-size: 17px; color: var(--ink); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ============================ Messages ============================ */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.msg { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; }
.msg.success { background: #ecfdf5; color: var(--green); border: 1px solid #a7f3d0; }
.msg.error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.msg.warning { background: #fffbeb; color: var(--amber); border: 1px solid #fde68a; }
.msg.info { background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-100); }

/* ======================== Forms / tables ======================== */
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }

button.primary, .btn {
    background: var(--teal); color: #fff; border: none; border-radius: 8px;
    padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex;
    align-items: center; gap: 7px;
}
button.primary:hover, .btn:hover { background: var(--teal-dark); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn.secondary:hover { background: var(--surface-2); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ============================ Login ============================ */
.login-wrap { max-width: 380px; margin: 9vh auto 0; background: var(--surface); padding: 34px; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.login-wrap h1 { color: var(--ink); text-align: center; }
.subtitle { text-align: center; color: var(--muted); margin-top: 0; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.login-form button { margin-top: 16px; background: var(--teal); color: #fff; border: none; border-radius: 8px; padding: 11px; font-weight: 600; cursor: pointer; }
.login-form button:hover { background: var(--teal-dark); }
.error { color: var(--red); font-size: 14px; }

/* ====================== Utilities & chrome ====================== */
.muted { color: var(--muted); font-size: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.searchbar { display: flex; gap: 8px; margin: 14px 0; max-width: 520px; }
.searchbar input { flex: 1; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 16px; }
.scroll-x { overflow-x: auto; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

td.actions a, td.actions { white-space: nowrap; }
td.actions a { margin-right: 12px; }
a.danger, .danger { color: var(--red); }
.danger-btn { background: var(--red); }
.danger-btn:hover { background: #991b1b; }

/* Stacked forms */
.stacked-form { max-width: 560px; }
.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-weight: 600; font-size: 14px; }
.form-row .errorlist { color: var(--red); font-size: 13px; margin: 4px 0 0; padding-left: 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Column mapping */
.map-table { max-width: 640px; margin-bottom: 24px; }
.map-table select { width: 100%; }

/* Detail */
.detail-grid h2 { font-size: 16px; margin-top: 24px; }
.detail-grid th { width: 220px; }

/* Stat cards */
.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 22px; min-width: 120px; text-align: center; }
.stat .num { display: block; font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat.ok .num { color: var(--green); }
.stat.bad .num { color: var(--red); }

/* Badges */
.badge { display: inline-block; background: var(--teal-100); color: var(--teal-800); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; margin-left: 8px; vertical-align: middle; }
.nav-badge { background: var(--teal); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }

/* Quick Look Up search form */
.lookup-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 22px; }
.lookup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.lookup-grid .form-row { margin-bottom: 0; }
.lookup-form .form-actions { justify-content: flex-end; }

/* List builder */
.builder { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; }
.builder-main h3 { font-size: 15px; margin: 20px 0 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.builder-main h3:first-of-type { border-top: none; padding-top: 0; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.chk { font-size: 13px; font-weight: 400; }
.builder-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; position: sticky; top: 76px; }
.builder-side h3 { font-size: 15px; margin: 14px 0 8px; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.step ul { margin: 4px 0 0 16px; padding: 0; }
.link-btn { background: none; border: none; color: var(--teal-dark); cursor: pointer; padding: 0; font: inherit; font-size: 13px; text-decoration: underline; }
.preview-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.preview-counts > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }
.preview-counts .num { display: block; font-size: 20px; font-weight: 700; color: var(--teal-dark); }
.preview-counts .lbl { font-size: 11px; color: var(--muted); }

/* Vertical criteria fields (VAN-style: label left, control right, stacked) */
.vfields { display: flex; flex-direction: column; gap: 12px; }
.vrow { display: flex; align-items: flex-start; gap: 14px; }
.vrow > label { flex: 0 0 130px; text-align: right; font-weight: 600; font-size: 14px; color: var(--ink-2); padding-top: 8px; }
.vrow > .vctl { flex: 1; min-width: 0; }
.vctl.inline2 { display: flex; gap: 8px; align-items: center; }
.vctl.inline2 > * { flex: 1; }

/* District field: clickable (blue) label toggles dropdown <-> multi-select checkboxes */
.dlabel {
    flex: 0 0 130px; text-align: right; font-weight: 600; font-size: 14px; padding-top: 8px;
    background: none; border: none; cursor: pointer; color: var(--teal-dark);
    text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
    font-family: inherit;
}
.dlabel:hover { color: var(--teal); }
.district-field .dsingle[hidden] { display: none; }
.dmulti { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); }
.dmulti-actions { font-size: 12px; margin-bottom: 6px; }
.dmulti-list { display: flex; flex-wrap: wrap; gap: 6px 16px; max-height: 180px; overflow-y: auto; }
@media (max-width: 700px) { .dlabel { text-align: left; flex-basis: auto; padding-top: 0; } }
.disabled-panel > summary { color: var(--muted); }
.soon { font-size: 11px; font-weight: 600; color: var(--amber); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 1px 8px; margin-left: 8px; }
@media (max-width: 700px) {
  .vrow { flex-direction: column; gap: 4px; }
  .vrow > label { text-align: left; flex-basis: auto; padding-top: 0; }
  .vctl.inline2 { flex-direction: column; align-items: stretch; }
}

/* Accordion panels */
.panels { display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 15px; display: flex; align-items: center; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before { content: "▸"; margin-right: 8px; color: var(--muted); }
.panel[open] > summary::before { content: "▾"; }
.panel .panel-body { padding: 0 16px 16px; }
.panel .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.star { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 16px; color: var(--line-2); line-height: 1; }
.star.on { color: #f59e0b; }
.run-btn { background: var(--green); width: 100%; text-align: center; justify-content: center; }
.run-btn:hover { background: #065f46; }
.preview-btn { width: 100%; }
.preview-counts.big > div { padding: 14px; }
.preview-counts.big .num { font-size: 26px; }
.head-actions { display: flex; gap: 8px; }

/* My List toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.toolbar .tool { border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--ink); cursor: pointer; }
.toolbar a.tool:hover { border-color: var(--teal); text-decoration: none; }
.toolbar .tool.disabled { color: var(--muted); opacity: .55; cursor: not-allowed; }

/* Notes */
.notes-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 22px; }
.notes-block h2 { margin-top: 0; font-size: 16px; }
.note { border-left: 3px solid var(--line); padding: 6px 12px; margin-bottom: 8px; }
.note.pinned { border-left-color: #f59e0b; background: #fffbeb; }
.note-meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.note-form { margin-top: 12px; }
.note-form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; }
.note-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }

/* Engagement chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--teal-50); border: 1px solid var(--teal-100); color: var(--teal-800); border-radius: 14px; padding: 2px 6px 2px 10px; font-size: 13px; }
.chip-x { background: none; border: none; cursor: pointer; color: var(--teal-800); font-size: 15px; line-height: 1; padding: 0 2px; }
.chip-x:hover { color: var(--red); }
.inline-apply { display: flex; gap: 8px; align-items: center; max-width: 420px; }
.inline-apply select { flex: 1; }

/* Voter record */
.record-panels { max-width: 760px; }
.locked { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; margin-left: 6px; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.add-row input, .add-row select { flex: 0 1 auto; }
.add-row input[name="full_line"], .add-row input[name="number"] { flex: 1 1 180px; }
.q-name { min-width: 170px; font-size: 14px; }
.edit-inline { display: inline-block; margin: 0 8px; }
.edit-inline > summary { cursor: pointer; color: var(--teal-dark); font-size: 13px; list-style: none; display: inline; }
.edit-inline > summary::-webkit-details-marker { display: none; }
.edit-inline .add-row { margin-top: 6px; }
.script-text { white-space: pre-wrap; font-size: 14px; margin-top: 6px; }
.script-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }

/* Guided canvass run (mobile-first) */
.canvass-screen { max-width: 620px; }
.canvass-screen .form-row label { font-size: 15px; }
.canvass-screen select, .canvass-screen textarea { padding: 12px; font-size: 16px; }
.btn-big { width: 100%; justify-content: center; padding: 14px; font-size: 17px; }
.run-progress { margin: 8px 0 16px; }
.run-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.run-bar span { display: block; height: 100%; background: var(--teal); }
.run-start { padding: 13px 22px; font-size: 16px; }
.src-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; font-weight: 400; cursor: pointer; }
.src-row:hover { border-color: var(--line-2); }

/* Code-entry outreach launcher */
.code-launch { max-width: 440px; margin: 6vh auto 0; text-align: center; }
.code-launch-ico { width: 52px; height: 52px; font-size: 28px; margin: 0 auto 14px; }
.code-form { display: flex; gap: 8px; margin: 20px 0 8px; }
.code-form input { flex: 1; text-align: center; font-size: 22px; letter-spacing: .18em; text-transform: uppercase; padding: 14px; font-weight: 600; }
.code-form .btn { padding: 0 18px; }
.code-manage { margin-top: 18px; font-size: 13px; }
.call-cta { margin: 0 0 18px; background: var(--green); }
.call-cta:hover { background: #065f46; }

/* Separate outreach shell (MiniVAN / phone-bank — no main app nav) */
.ob-body { margin: 0; background: var(--bg); }
.ob-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; background: var(--ink); color: #fff; padding: 0 16px; height: 54px; }
.ob-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-exit { color: #fff; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ob-exit:hover { text-decoration: underline; color: #fff; }
.ob-main { max-width: 680px; margin: 0 auto; padding: 16px; }
.ob-progress { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }
#cmap { height: 56vh; min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); }
.ob-list { margin-top: 12px; }
.ob-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    padding: 14px 16px; margin-bottom: 8px; color: var(--ink); font-size: 16px; }
.ob-row:hover { border-color: var(--teal); text-decoration: none; }
.ob-row.done { opacity: .6; }
.pin-pop strong { display: block; margin-bottom: 6px; }
.pin-row { display: block; padding: 8px 4px; border-top: 1px solid var(--line); color: var(--teal-dark); font-size: 14px; }
.pin-row.done { color: var(--muted); }

/* Per-voter canvass screen: tabs + branching stepper + big tap targets */
.cv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 8px 0 16px; }
.cv-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px;
    font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.cv-tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px; }
.step-card h3 { margin: 0 0 6px; font-size: 17px; }
.bigbtns { display: flex; flex-direction: column; gap: 10px; }
.bigbtn { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line-2);
    border-radius: 12px; padding: 16px 18px; font: inherit; font-size: 16px; font-weight: 500; color: var(--ink); cursor: pointer; }
.bigbtn:hover { border-color: var(--teal); background: var(--teal-50); }
.bigbtn.next-btn { text-align: center; background: var(--teal); color: #fff; border-color: var(--teal); }
.bigbtn.next-btn:hover { background: var(--teal-dark); }
.bigbtn.good { border-color: #a7f3d0; color: var(--green); }
.bigbtn.ghost { border-style: dashed; color: var(--muted); margin-top: 10px; }
.back-btn { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; padding: 4px 0; margin-bottom: 8px; }
.cantreach { margin-top: 16px; }
.cantreach > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); padding: 8px 0; }
.cantreach .bigbtns { margin-top: 8px; }
.kv { width: 100%; }
.kv td { padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv td:first-child { color: var(--muted); width: 38%; }
.row-done td { color: var(--muted); }

/* Walk packet (print) */
.packet-table { width: 100%; border-collapse: collapse; }
.packet-table th, .packet-table td { font-size: 12px; padding: 5px 8px; border: 1px solid var(--line); }
.markcell { min-width: 70px; }

/* Folders section */
.folder-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; }
.folder-card > h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.folder-card > h2 i { color: var(--teal); }
.folder-card.unfiled > h2 i { color: var(--muted); }
.folder-table { width: auto; min-width: 60%; background: none; border: none; }
.folder-table td { border-bottom: 1px solid var(--line); padding: 8px 14px 8px 0; }
.folder-table tr:last-child td { border-bottom: none; }
.folder-table tbody tr:hover td { background: none; }
.ftype { width: 92px; }
.type-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.type-tag.type-0 { background: var(--teal-50); color: var(--teal-800); }
.type-tag.type-1 { background: #eff6ff; color: #1d4ed8; }
.type-tag.type-2 { background: #f5f3ff; color: #6d28d9; }

/* Save-as type chooser */
.save-type { display: flex; flex-direction: column; gap: 8px; }
.save-type .chk { font-weight: 400; }
.folder-picker .new-folder-input { width: 100%; }

/* Drag-and-drop script builder */
.sortable-el { transition: border-color .12s, opacity .12s; }
.sortable-head { display: flex; align-items: center; gap: 8px; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1; }
.drag-handle:active { cursor: grabbing; }
.sortable-el.dragging { opacity: .5; border-color: var(--teal); box-shadow: var(--shadow); }
details.addel > summary { cursor: pointer; font-weight: 600; padding: 12px 16px; list-style: none; }
details.addel > summary::-webkit-details-marker { display: none; }

/* Outreach roster heading */
.ob-list-head { font-size: 15px; margin: 16px 0 8px; }

/* My Turfs list */
.turf-table .folder-row td { background: var(--surface-2); font-weight: 600; color: var(--ink-2); border-top: 1px solid var(--line); }
.turf-table .folder-row td i { color: var(--muted); margin-right: 4px; }
.turf-table .turf-name { padding-left: 26px; }
.row-actions a { font-size: 18px; color: var(--ink-2); margin-right: 12px; }
.row-actions a:hover { color: var(--teal-dark); text-decoration: none; }

/* Turf cutting */
.turf-cut { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
#turfside { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 76px; }
#turfside h3 { margin: 0 0 8px; font-size: 15px; }
.turf-row { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.turf-row.remaining { font-weight: 600; border-bottom: none; margin-top: 6px; color: var(--teal-dark); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.packet-script .script-block { font-size: 13px; }
.ck { display: inline-block; margin: 0 10px 2px 0; white-space: nowrap; font-size: 12px; }

@media print {
  .topbar, .packet-controls { display: none !important; }
  .content { max-width: none; padding: 0; }
  .script-block { background: none; border: 1px solid #999; }
}

/* Builder side column (VAN-style) */
.builder-side-col { display: flex; flex-direction: column; gap: 12px; }
.step-indicator { margin: 16px 0 8px; }
.step-active { border-color: var(--teal); background: var(--teal-50); }
.preview-hint { text-align: center; margin: 10px 0; }
.side-actions { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.addstep-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.addstep-row .run-btn { flex: 1; }
.addstep { position: relative; }
.addstep > summary { list-style: none; cursor: pointer; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.addstep > summary::-webkit-details-marker { display: none; }
.addstep-menu { position: absolute; z-index: 20; top: 100%; left: 0; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; min-width: 170px; display: flex; flex-direction: column; }
.addstep-menu .link-btn { text-align: left; text-decoration: none; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.addstep-menu .link-btn:hover { background: var(--surface-2); }

/* ============================ Responsive ============================ */
@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; }
  .brand { margin-right: auto; }
  .nav-collapse {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); padding: 8px; max-height: calc(100vh - 60px); overflow-y: auto;
  }
  .nav-cb:checked ~ .nav-collapse { display: flex; }
  .mainnav { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-link { padding: 11px 12px; font-size: 15px; }
  .nav-group { position: static; }
  .nav-group > summary { justify-content: space-between; }
  .nav-menu { position: static; box-shadow: none; border: none; border-radius: 0;
    padding: 2px 0 6px 22px; min-width: 0; }
  .userbox { margin-left: 0; flex-direction: column; align-items: stretch; gap: 8px;
    margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
  .campaign-chip { max-width: none; justify-content: center; }
  .acct { width: 100%; }
  .acct > summary { width: 100%; justify-content: flex-start; border: none; padding: 9px 12px; }
  .acct-menu { position: static; box-shadow: none; border: none; padding: 2px 0 0 22px; min-width: 0; }
}

@media (max-width: 800px) {
  .builder { grid-template-columns: 1fr; }
  .turf-cut { grid-template-columns: 1fr; }
  .builder-side, #turfside { position: static; }
  .content { padding: 20px 16px; }
  .preview-counts { grid-template-columns: repeat(2, 1fr); }
}

/* Bulk Upload hub */
.bulk-sec { margin-top: 16px; }
.bulk-sec .card { max-width: 640px; }
.bulk-sec h2 { font-size: 17px; margin: 0 0 12px; }
.src-choice { display: flex; flex-direction: column; gap: 6px; }
.src-choice .radio { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.src-choice .radio input { width: auto; margin: 0; }

/* Coverage bar (canvass results) */
.cov-bar { display: inline-block; width: 90px; height: 8px; border-radius: 4px;
  background: var(--line); vertical-align: middle; overflow: hidden; margin-right: 6px; }
.cov-fill { display: block; height: 100%; background: var(--teal, #0d9488); border-radius: 4px; }

/* Login tagline (Foundry / Silver Basin Strategies) */
.login-wrap .tagline { margin-top: -6px; margin-bottom: 18px; font-style: italic;
  color: var(--muted, #64748b); font-size: 14px; }

/* Settings — theme picker */
.theme-choice { display: flex; gap: 12px; margin: 8px 0 4px; flex-wrap: wrap; }
.theme-opt { cursor: pointer; }
.theme-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 14px 20px;
  border-radius: var(--radius); border: 2px solid var(--line-2); font-weight: 600; }
.swatch-dark { background: #0b111f; color: #e6eaf2; }
.swatch-light { background: #f1f5f9; color: #0f172a; }
.theme-opt input:checked + .theme-swatch { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }
