
:root {
    --bg: #fafaf9;
    --panel: #ffffff;
    --panel-2: #f4f2ed;
    --ink: #1c1c1c;
    --muted: #6b6b6b;
    --rule: #e0ddd6;
    --accent: #1d4ed8;

    /* Coverage scale */
    --cov-deep: #14532d;
    --cov-good: #16a34a;
    --cov-okay: #eab308;
    --cov-thin: #f97316;
    --cov-bad:  #dc2626;
    --cov-zero: #7f1d1d;
    --cov-over: #6b21a8;
    --cov-na:   #d6d3d1;
}
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--rule);
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 32px;
    max-width: 1400px;
    margin: 0 auto;
}
.site-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--ink);
}
.site-nav { display: flex; gap: 16px; flex: 1; }
.site-nav a { color: var(--muted); font-weight: 500; font-size: 14px; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.vintage { color: var(--muted); font-size: 12px; }

.breadcrumb {
    padding: 10px 32px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--rule);
    font-size: 12px;
    color: var(--muted);
    max-width: 1400px;
    margin: 0 auto;
}
.crumb-link { color: var(--muted); }
.crumb-current { color: var(--ink); font-weight: 500; }

main {
    padding: 24px 32px 64px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-intro h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }
.page-intro p { margin: 0 0 24px; color: var(--muted); max-width: 720px; }

.metric-strip {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px 0 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.metric-num {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.metric-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Cards on the index */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 24px;
    color: var(--ink);
    transition: border-color 120ms, transform 120ms;
}
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.card p { margin: 0 0 16px; color: var(--muted); }
.card-cta { color: var(--accent); font-size: 13px; font-weight: 500; }
.card-grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); max-width: 880px; }
.priority-card { display: flex; flex-direction: column; }
.priority-card p { flex: 1; }
.card-badges { display: flex; gap: 10px; margin-bottom: 14px; }
.badge {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--panel-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
}
.badge-num { font-weight: 600; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.badge-label { color: var(--muted); }

/* Tables */
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 4px;
    overflow: auto;
    max-height: calc(100vh - 220px);
    margin-bottom: 12px;
}
table.sortable {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
table.sortable th, table.sortable td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
}
table.sortable th {
    background: var(--panel);
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 2px solid var(--rule);
}
table.sortable th .arrow { color: var(--muted); margin-left: 4px; font-size: 10px; }
table.sortable td.num { text-align: right; }
table.sortable tbody tr.row-link { cursor: pointer; }
table.sortable tbody tr:hover { background: rgba(29, 78, 216, 0.05); }

.empty { padding: 24px; text-align: center; color: var(--muted); font-style: italic; }
.empty-section { color: var(--muted); font-style: italic; padding: 8px 0; }
.table-cap-note { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.show-all { background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 2px 6px; cursor: pointer; }

/* Coverage pills */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}
.pill.cov-deep { background: var(--cov-deep); }
.pill.cov-good { background: var(--cov-good); }
.pill.cov-okay { background: var(--cov-okay); color: #1c1c1c; }
.pill.cov-thin { background: var(--cov-thin); }
.pill.cov-bad  { background: var(--cov-bad); }
.pill.cov-zero { background: var(--cov-zero); }
.pill.cov-over { background: var(--cov-over); }
.pill.cov-na   { background: var(--cov-na); color: #1c1c1c; }

/* Gap colorization */
td.gap-pos  { color: var(--cov-bad); }
td.gap-zero { color: var(--muted); }
td.gap-neg  { color: var(--cov-over); }

/* Detail pages */
.detail-header h1 { margin: 0 0 4px; font-size: 26px; font-weight: 600; }
.detail-subtitle { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.detail-section { margin-top: 32px; }
.detail-section h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.detail-counts {
    list-style: none;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.7;
    max-width: 720px;
}
.detail-counts li { font-variant-numeric: tabular-nums; }
.detail-counts strong { display: inline-block; min-width: 220px; color: var(--ink); font-weight: 600; }
.metric-footnote {
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
    margin-top: 6px;
    line-height: 1.5;
    max-width: 720px;
}

/* Map */
.map-controls { padding: 8px 0 16px; }
.map-controls label { font-size: 12px; color: var(--muted); margin-right: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.map-controls select { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 4px; font-size: 13px; min-width: 280px; }

.map-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 980px) { .map-layout { grid-template-columns: 1fr; } }

.map-pane { position: relative; }
.map {
    width: 100%;
    height: 600px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: #fff;
}
.map-legend {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255,255,255,0.94);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.map-legend h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.map-legend ul { list-style: none; margin: 0; padding: 0; }
.map-legend li { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.1); }
.swatch.cov-deep { background: var(--cov-deep); }
.swatch.cov-good { background: var(--cov-good); }
.swatch.cov-okay { background: var(--cov-okay); }
.swatch.cov-thin { background: var(--cov-thin); }
.swatch.cov-bad  { background: var(--cov-bad); }
.swatch.cov-zero { background: var(--cov-zero); }
.swatch.cov-over { background: var(--cov-over); }
.swatch.cov-na   { background: var(--cov-na); }

.sidebar {
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 16px;
}
.sidebar h3 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}
.top-gap-list { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.top-gap-item { padding: 10px 0; border-bottom: 1px solid var(--rule); counter-increment: rank; }
.top-gap-item:last-child { border-bottom: none; }
.top-gap-link { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; color: var(--ink); }
.top-gap-link::before { content: counter(rank) "."; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 18px; }
.top-gap-name { flex: 1; }
.top-gap-gap { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--cov-bad); }
.top-gap-meta { display: flex; gap: 8px; font-size: 11px; color: var(--muted); padding-left: 24px; padding-top: 2px; }
.top-gap-meta .pill { font-size: 10px; padding: 1px 5px; }

/* Industry */
.industry-toggle { padding: 8px 0 16px; font-size: 13px; }
.industry-note { padding: 16px; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; color: var(--muted); margin-top: 12px; max-width: 720px; }

/* Charts */
.chart-wrap { background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: 16px; margin-bottom: 16px; }

/* Methodology footer */
footer.methodology {
    padding: 24px 32px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--rule);
    background: var(--panel-2);
    margin-top: 48px;
}
footer.methodology h3 { margin: 0 0 8px; font-size: 13px; color: var(--ink); font-weight: 600; }
footer.methodology ul { margin: 0 0 12px 16px; padding: 0; max-width: 880px; }
footer.methodology li { margin-bottom: 6px; }
footer.methodology code { background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 2px; }

/* Priority CD picker */
.muted-inline { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.naics-tag {
    display: inline-block;
    background: var(--panel-2);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    margin-right: 2px;
}
.naics-tag-n { color: var(--muted); }

/* Worklist builder */
.detail-help { color: var(--muted); font-size: 13px; max-width: 760px; margin: 8px 0 0; }
.warn-text { color: var(--cov-bad); }
.wl-section { }
.wl-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    padding: 12px 14px;
    background: var(--panel-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    margin-bottom: 12px;
}
.wl-control-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wl-control-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.wl-bulk-btn, .wl-group-btn, .wl-export-btn {
    font: inherit;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--panel);
    color: var(--ink);
    cursor: pointer;
}
.wl-bulk-btn:hover, .wl-group-btn:hover, .wl-export-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}
.wl-group-shortcuts { gap: 6px; max-width: 720px; }
.wl-btn-n, .wl-tag-n { color: var(--muted); }
.wl-band-box { font-size: 12px; display: inline-flex; align-items: center; gap: 3px; }
.wl-band-filter { gap: 10px; }
.wl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wl-table th, .wl-table td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}
.wl-table thead th {
    position: sticky; top: 0;
    background: var(--panel);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    border-bottom: 2px solid var(--rule);
    user-select: none;
}
.wl-table th .arrow { font-size: 9px; margin-left: 3px; color: var(--accent); }
.wl-table code { font-size: 12px; background: rgba(0,0,0,0.04); padding: 1px 3px; border-radius: 2px; }
.wl-cb-cell { width: 32px; text-align: center; }
.wl-row-filtered { opacity: 0.4; }
.url-cell { max-width: 360px; }
.url-preview {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    font-size: 11px;
    color: var(--accent);
}
.kw-pending {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b45309;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0 3px;
    margin-left: 4px;
}
.wl-selection-count { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.wl-export-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.wl-export-btn { padding: 6px 14px; font-size: 13px; }
.wl-export-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.wl-export-status { font-size: 12px; color: var(--accent); min-height: 1.2em; margin: 4px 0 0; }
