:root {
    --bg: #f4f6f8; --card: #fff; --ink: #1e2733; --muted: #6b7787;
    --line: #e2e8f0; --brand: #2563eb; --brand-ink: #fff;
    --ok: #16a34a; --warn: #d97706; --err: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: var(--ink); color: #fff; }
.topbar .brand { font-weight: 700; }
.topbar nav a { color: #cbd5e1; margin-left: 18px; }
.topbar nav a:hover { color: #fff; }

.container { max-width: 1650px; margin: 22px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { width: 100%; padding: 9px 10px; margin-top: 4px;
    border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink);
    background: #fff; }
label.checkbox { display: flex; align-items: center; gap: 8px; }
label.checkbox input { width: auto; margin: 0; }

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 200px; }
.grow { flex: 1; }

button, .btn { display: inline-block; padding: 9px 14px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font: inherit; cursor: pointer; }
button:hover, .btn:hover { background: #f1f5f9; }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.primary:hover { background: #1d4ed8; }
.btn.danger, button.danger { background: #fff; color: var(--err); border-color: #fecaca; }
.btn.danger:hover, button.danger:hover { background: #fef2f2; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-del { border: none; background: none; color: #cbd5e1; cursor: pointer; font-size: 15px;
    line-height: 1; padding: 4px 6px; border-radius: 6px; }
.row-del:hover { color: var(--err); background: #fef2f2; }

.hint { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.success { color: var(--ok); }

table.results { width: 100%; border-collapse: collapse; }
table.results th, table.results td { text-align: left; padding: 10px 8px;
    border-bottom: 1px solid var(--line); vertical-align: top; }
table.results th { font-size: 12px; text-transform: uppercase; color: var(--muted); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
    background: #eef2f7; color: var(--muted); }
.status-customer { background: #dcfce7; color: #166534; }
.status-prospect { background: #dbeafe; color: #1e40af; }
.status-contacted { background: #fef9c3; color: #854d0e; }
.status-negotiating { background: #ffedd5; color: #9a3412; }
.status-not_interested { background: #fee2e2; color: #991b1b; }

.map { height: 300px; border-radius: 10px; border: 1px solid var(--line); }
.map.tall { height: 560px; }
/* Hide Leaflet Routing Machine's turn-by-turn panel — show only the route line */
.leaflet-routing-container { display: none !important; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 10px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; margin-top: 10px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px)  { .grid-3 { grid-template-columns: 1fr; } }

.company-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.status-box { min-width: 200px; }
.facts dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0 0 16px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
.enrich-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.contacts { list-style: none; padding: 0; margin: 0; }
.contacts li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.notes { margin-top: 20px; }
.saved-flag { font-size: 12px; color: var(--ok); }
.filters { margin-bottom: 12px; }

.results-head { display: flex; align-items: center; gap: 14px; }
.results-head h2 { margin: 0; flex: 1; }

.stat-row { display: flex; gap: 14px; margin-top: 14px; }
.stat { flex: 1; background: #f8fafc; border: 1px solid var(--line);
    border-radius: 10px; padding: 16px; text-align: center; }
.stat-num { font-size: 30px; font-weight: 700; }
.stat-label { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }

pre.code { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px;
    overflow-x: auto; font-size: 12.5px; line-height: 1.5; }

/* ---- Display-status colour system ------------------------------------- */
.dnc-banner { background: #dc2626; color: #fff; font-weight: 800; font-size: 22px;
    letter-spacing: .1em; text-align: center; padding: 16px; border-radius: 10px;
    margin-bottom: 18px; text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(220,38,38,.45); animation: dncpulse 1.6s ease-in-out infinite; }
@keyframes dncpulse { 0%,100% { opacity: 1; } 50% { opacity: .82; } }

.ds-pill { color: #fff !important; }
.ds-pill.ds-dnc { background: #dc2626; }
.ds-pill.ds-customer { background: #16a34a; }
.ds-pill.ds-buyer { background: #0d9488; }
.ds-pill.ds-callback { background: #ea580c; }
.ds-pill.ds-contacted { background: #2563eb; }
.ds-pill.ds-hubspot { background: #7c3aed; }
.ds-pill.ds-none { background: #1f2937; }

/* "In HubSpot" rows get a subtle purple marker */
tr.ds-hubspot td:first-child { box-shadow: inset 4px 0 0 #7c3aed; }

/* DO NOT CONTACT rows stand out red in search + call-back lists */
tr.ds-dnc td { background: #fef2f2; }
tr.ds-dnc a { color: #dc2626; font-weight: 700; }
tr.ds-dnc td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
tr.ds-callback td:first-child { box-shadow: inset 4px 0 0 #ea580c; }

.map-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 4px;
    font-size: 13px; color: var(--muted); }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%;
    margin-right: 5px; vertical-align: middle; border: 1px solid rgba(0,0,0,.25); }

.callback-current { font-size: 12px; color: #ea580c; margin-top: 4px; min-height: 14px; }
.dnc-toggle { margin-top: 10px; color: #dc2626; font-weight: 600; }

.company-logo { max-height: 34px; max-width: 160px; vertical-align: middle;
    margin-bottom: 6px; display: block; }
.desc-block { margin: 4px 0 12px; }
.tech-block { margin-top: 8px; }

.side-col { display: flex; flex-direction: column; gap: 14px; align-self: start; }
.side-col .manual-contact { margin: 0; }
.manual-contact { margin: 4px 0 14px; padding: 10px 12px; background: #f8fafc;
    border: 1px solid var(--line); border-radius: 8px; }
.manual-contact h3 { margin: 0 0 8px; }
.manual-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 8px; }
.manual-fields label { margin: 0; }

/* ---- Reconcile page --------------------------------------------------- */
.reconcile-list { list-style: none; margin: 0; padding: 0; }
.reconcile-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.recon-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.recon-actions { display: flex; gap: 8px; flex: none; }
.recon-candidates { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.cand { display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.recon-result { margin-top: 8px; }
.recon-linked { background: #dcfce7; border: 1px solid #bbf7d0; border-radius: 8px;
    padding: 8px 10px; font-size: 14px; }
.recon-linked .btn { margin-left: 8px; }
.tech-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
    background: #eef2f7; color: #334155; border: 1px solid var(--line); text-decoration: none; }
a.tech-tag:hover { background: #e0e7ff; border-color: #c7d2fe; text-decoration: none; }

.jobs { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.jobs-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.jobs-head h3 { margin: 0; }
.job-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #fff; }
.job-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.job-body { margin-top: 10px; }
.job-form .row { gap: 12px; margin-bottom: 8px; }
.ji-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ji-table th, .ji-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ji-table input, .ji-table select { padding: 5px 7px; margin: 0; }
.ji-table th { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: left; }
.ji-total { font-weight: 700; }
.job-site { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.job-site legend { font-size: 12px; color: var(--muted); padding: 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.job-site.open { background: #f8fafc; }
.job-route { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.job-route-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.job-route-head strong { flex: 1; }
.job-route .jr-map { height: 260px; }
.job-route .jr-list { max-height: 260px; overflow-y: auto; margin: 0; }
.ji-bad td { background: #fef2f2; }
.ji-bad .ji-net::after { content: '  ⚠ check'; color: #dc2626; font-size: 11px; }

.nearby-launch { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.nearby { margin-top: 14px; }
.nearby-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.nearby-head h3 { margin: 0; flex: 1; }
.nearby-head label { margin: 0; }

/* ---- SIC code picker -------------------------------------------------- */
.sic-field { flex: 1 1 100%; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.sic-picker { position: relative; }
.sic-control { display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
.sic-control input { border: none; outline: none; flex: 1; min-width: 200px; padding: 4px; margin: 0; }
.sic-chips { display: contents; }
.sic-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2ff;
    color: #3730a3; border: 1px solid #c7d2fe; border-radius: 6px; padding: 3px 6px; font-size: 12px; max-width: 100%; }
.sic-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.sic-chip button { border: none; background: none; color: #3730a3; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.sic-panel { position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid var(--line);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.sic-group-h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    padding: 9px 10px 4px; position: sticky; top: 0; background: #fff; }
.sic-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.sic-row:hover { background: #f1f5f9; }
.sic-row .sic-check { width: 14px; height: 14px; border: 1px solid #cbd5e1; border-radius: 3px; flex: none; }
.sic-row.sel .sic-check { background: var(--brand); border-color: var(--brand);
    box-shadow: inset 0 0 0 2px #fff; }
.sic-row.sel { background: #eff6ff; }

/* --- Job documents ------------------------------------------------------- */
.job-codd { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.codd-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.codd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.codd-table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
.codd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.codd-table th { position: sticky; top: 0; background: var(--card); border-bottom: 2px solid var(--line);
    padding: 6px 8px; text-align: left; white-space: nowrap; font-size: 12px; }
.codd-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.codd-table tr:hover td { background: #f1f5f9; }
.codd-sn { font-family: monospace; font-size: 12px; }
.job-docs { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.job-docs-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.doc-qr-box { margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line);
    border-radius: 8px; background: #f8fafc; text-align: center; }
.doc-qr-box .qr-canvas { display: inline-block; }
.doc-qr-box .qr-canvas img,
.doc-qr-box .qr-canvas canvas { display: block; }
.doc-qr-box a { word-break: break-all; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { display: flex; gap: 12px; align-items: flex-start;
    border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.doc-thumb { flex: none; width: 56px; height: 56px; border-radius: 6px; object-fit: cover;
    border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
    overflow: hidden; background: #f1f5f9; }
.doc-thumb.doc-ext { font-size: 12px; font-weight: 700; color: #475569; text-decoration: none; }
.doc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.doc-meta > a { word-break: break-word; }
.doc-tag { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.doc-tag select { margin: 0; }
.doc-item .doc-del { flex: none; align-self: center; }

/* ---- Report tabs ------------------------------------------------------- */
.report-tabs { display: flex; gap: 8px; margin-bottom: 14px; }

/* ---- Calendar ---------------------------------------------------------- */
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cal-title { margin: 0; flex: 1; text-align: center; }

.cal-layout { display: grid; grid-template-columns: 1fr 360px; gap: 22px; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }

.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th { text-align: center; padding: 8px 4px; font-size: 12px; text-transform: uppercase;
    color: var(--muted); border-bottom: 2px solid var(--line); }
.cal-grid th.cal-weekend { color: #cbd5e1; }
.cal-grid td { border: 1px solid var(--line); vertical-align: top; padding: 6px 8px;
    height: 90px; transition: background .15s; }
.cal-empty { background: #fafbfc; }
.cal-day:hover { background: #f1f5f9; }
.cal-day.cal-selected { background: #eff6ff; box-shadow: inset 0 0 0 2px var(--brand); }
.cal-today .cal-num { background: var(--brand); color: #fff; border-radius: 50%;
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.cal-past { opacity: .55; }
.cal-future { background: #fff; }
.cal-weekend { background: #fafbfc; }
.cal-num { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.cal-info { font-size: 11px; color: var(--muted); }
.cal-info .cal-jobs { margin-right: 6px; }
.cal-info .cal-kg { font-weight: 600; color: var(--ink); }
.cal-cap-bar { height: 5px; background: #e2e8f0; border-radius: 3px; margin-top: 3px; overflow: hidden; }
.cal-cap-bar-lg { height: 10px; border-radius: 5px; }
.cal-cap-fill { height: 100%; border-radius: 3px; background: var(--ok); transition: width .3s; }
.cal-cap-fill.cap-busy { background: var(--warn); }
.cal-cap-fill.cap-full { background: var(--err); }

.cal-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.cap-sample { display: inline-block; width: 14px; height: 8px; border-radius: 4px; margin-right: 4px; vertical-align: middle; }
.cap-sample.cap-ok { background: var(--ok); }
.cap-sample.cap-busy { background: var(--warn); }
.cap-sample.cap-full { background: var(--err); }

.cal-sidebar { border: 1px solid var(--line); border-radius: 10px; padding: 16px;
    background: #f8fafc; align-self: start; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.cal-sidebar h2 { font-size: 16px; margin: 0 0 12px; }
.cal-side-cap { margin-bottom: 14px; }
.cal-cap-text { font-size: 13px; margin-top: 6px; }

.cal-job-list { display: flex; flex-direction: column; gap: 8px; }
.cal-job-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.cal-job-top { font-weight: 600; font-size: 14px; }
.cal-job-top a { color: var(--brand); }
.cal-job-meta { font-size: 12px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cal-driver { color: var(--muted); }
.cal-job-weight { font-size: 13px; margin-top: 5px; }

/* "not saved" marker on transient search results (added on click-through). */
.muted-pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px;
    background: #f1f5f9; color: #64748b; border: 1px solid var(--line); vertical-align: middle; }

/* ITAD asset log */
.job-itad { margin-top: 18px; }
.itad-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.itad-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 10px; }
.itad-settings label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.itad-settings select { font-size: 13px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); }
.itad-table th { font-size: 12px; }
.itad-table td { font-size: 13px; }
.itad-actions { display: flex; gap: 10px; margin-top: 8px; }
.itad-add-form { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; }
.itad-add-form .row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.itad-add-form label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; min-width: 140px; }
.itad-add-form input, .itad-add-form select { font-size: 13px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); margin-top: 2px; }
.itad-del { background: none; border: none; color: var(--err); cursor: pointer; font-size: 16px; font-weight: 700; }
.itad-msg { margin-left: auto; }
