* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* ---- Header ---- */

header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-left {
    flex-shrink: 0;
}

header h1 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.badge-green { background: #052e16; color: #22c55e; border: 1px solid #16a34a33; }

/* ---- Freshness badge ---- */

.freshness-badge {
    flex-shrink: 0;
    font-size: 11px;
    color: #64748b;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: help;
    white-space: nowrap;
}

/* ---- Search bar ---- */

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 10px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: #22c55e;
}

#search-input::placeholder {
    color: #64748b;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-dropdown.active {
    display: block;
}

.search-result {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #33415533;
    font-size: 13px;
}

.search-result:hover {
    background: #334155;
}

.search-result .suburb {
    color: #64748b;
    font-size: 11px;
}

/* ---- Stats bar ---- */

.stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.stat {
    text-align: center;
    padding: 6px 12px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
}

.stat-value { font-size: 20px; font-weight: 700; color: #22c55e; }
.stat-label { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Content layout ---- */

.content {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: calc(100vh - 64px);
    position: relative;
}

.main-area {
    display: grid;
    grid-template-rows: 1fr 1fr;
    overflow: hidden;
}

/* ---- Filters sidebar ---- */

.filters {
    background: #1e293b;
    border-right: 1px solid #334155;
    padding: 16px;
    overflow-y: auto;
}

.filters h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin: 16px 0 8px;
}

.filters h3:first-child { margin-top: 0; }

.filters select,
.filters input[type="range"] {
    width: 100%;
    margin: 4px 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #e2e8f0;
    padding: 8px;
    font-size: 13px;
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-range input {
    flex: 1;
    width: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #e2e8f0;
    padding: 6px 8px;
    font-size: 12px;
}

.filter-range input::placeholder { color: #475569; }
.range-sep { color: #475569; font-size: 12px; }

.btn-apply {
    width: 100%;
    padding: 10px;
    background: #22c55e;
    color: #052e16;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    margin-top: 8px;
}

.btn-apply:hover { background: #16a34a; }

.btn-reset {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: #64748b;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
}

.btn-reset:hover { color: #e2e8f0; border-color: #64748b; }

.btn-export {
    width: 100%;
    padding: 8px;
    background: #1e3a5f;
    color: #60a5fa;
    border: 1px solid #2563eb44;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.btn-export:hover { background: #1e40af33; border-color: #3b82f6; }

/* ---- Map ---- */

#map {
    border-bottom: 1px solid #334155;
    z-index: 0;
}

/* Override MarkerCluster default styles to match dark theme */
.marker-cluster-small {
    background-color: rgba(34, 197, 94, 0.4) !important;
}
.marker-cluster-small div {
    background-color: rgba(34, 197, 94, 0.7) !important;
    color: #fff !important;
}
.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.4) !important;
}
.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.7) !important;
    color: #fff !important;
}
.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.4) !important;
}
.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.7) !important;
    color: #fff !important;
}

/* Map legend */
.map-legend {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
    color: #e2e8f0;
    line-height: 1.8;
}

.legend-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.legend-ring {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 2px solid;
    background: transparent;
}

/* ---- Table ---- */

.table-container {
    overflow: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    flex: 1;
}

thead {
    background: #1e293b;
    position: sticky;
    top: 0;
    z-index: 1;
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #334155;
}

th:hover { color: #e2e8f0; }

/* Phase 18: Sort indicators — show which column is sorted and in which direction */
th.sort-asc::after { content: ' \25B2'; font-size: 8px; color: #22c55e; }
th.sort-desc::after { content: ' \25BC'; font-size: 8px; color: #22c55e; }

td {
    padding: 8px 12px;
    border-bottom: 1px solid #1e293b;
}

tr { cursor: pointer; }
tr:hover { background: #1e293b80; }

.score-cell { font-weight: 700; font-size: 14px; }
.score-high { color: #22c55e; }
.score-mid { color: #f59e0b; }
.score-low { color: #ef4444; }

.for-sale-badge {
    background: #422006;
    color: #f59e0b;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.opp-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 3px;
}

.opp-gf { background: #052e16; color: #22c55e; }
.opp-sub { background: #1e1b4b; color: #818cf8; }
.opp-mu { background: #4c0519; color: #fb7185; }
.opp-other { background: #1e3a5f; color: #60a5fa; }

/* ---- Pagination ---- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 12px;
    background: #1e293b;
    border-top: 1px solid #334155;
    flex-shrink: 0;
}

.page-btn {
    background: #334155;
    color: #e2e8f0;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.page-btn:hover:not(:disabled) { background: #475569; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

.page-info {
    font-size: 12px;
    color: #94a3b8;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }

.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-size: 14px;
}

/* ---- Property detail panel ---- */

.detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 440px;
    height: 100%;
    background: #1e293b;
    border-left: 1px solid #334155;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.detail-panel.hidden {
    transform: translateX(100%);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
    gap: 8px;
}

.detail-header h2 {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.detail-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-nav {
    background: #334155;
    color: #e2e8f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

.btn-nav:hover { background: #475569; }

.btn-close {
    background: #334155;
    color: #e2e8f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.btn-close:hover { background: #475569; }

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
}

.detail-section {
    margin-bottom: 16px;
}

.detail-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #334155;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.detail-label { color: #94a3b8; }
.detail-value { font-weight: 600; text-align: right; }

.detail-score {
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
}

.detail-score-value {
    font-size: 36px;
    font-weight: 700;
}

.detail-score-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-score-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* ---- Generate Planning Report button (Phase 26) ---- */
/* Prominent button in the score section that opens a printable
   planning report in a new tab. Uses the green accent color from
   the dashboard theme to draw attention. */

.btn-report {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.btn-report:hover {
    background: #047857;
}

/* ---- Score breakdown bars ---- */

.score-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    cursor: help;
}

.score-bar-label {
    flex-shrink: 0;
    width: 100px;
    font-size: 11px;
    color: #94a3b8;
    text-align: right;
}

.score-bar-track {
    flex: 1;
    height: 8px;
    background: #0f172a;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.score-bar-value {
    flex-shrink: 0;
    width: 65px;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

/* ---- Assessment cards (Phase 8 — 21 types) ---- */

.detail-opp-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.detail-opp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.detail-opp-title {
    font-weight: 600;
    font-size: 13px;
}

.detail-opp-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-suitable { color: #22c55e; }
.status-unsuitable { color: #64748b; }

/* Category badges */
.cat-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-residential { background: #052e16; color: #22c55e; }
.cat-commercial { background: #1e1b4b; color: #818cf8; }
.cat-investment { background: #422006; color: #f59e0b; }
.cat-rural { background: #1a2e05; color: #a3e635; }
.cat-tourism { background: #4c0519; color: #fb7185; }
.cat-strategic { background: #1e3a5f; color: #60a5fa; }
.cat-feasibility { background: #312e81; color: #a78bfa; }

/* Assessment detail reasons/blockers */
.opp-details {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #33415566;
    font-size: 11px;
}

.opp-reason {
    color: #94a3b8;
    padding: 1px 0;
}

.opp-reason::before {
    content: '+ ';
    color: #22c55e;
}

.opp-blocker {
    color: #94a3b8;
    padding: 1px 0;
}

.opp-blocker::before {
    content: '- ';
    color: #ef4444;
}

.hazard-tag {
    display: inline-block;
    background: #450a0a;
    color: #fca5a5;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 2px 2px 0;
}

/* Phase 14: Hazard type-specific colors */
.hazard-item { margin-bottom: 6px; }
.hazard-flood { background: #172554; color: #93c5fd; }      /* Blue — water */
.hazard-fault { background: #450a0a; color: #fca5a5; }      /* Red — severe */
.hazard-liquefaction { background: #431407; color: #fdba74; } /* Orange — ground */
.hazard-landslide { background: #3b1f0b; color: #d4a574; }  /* Brown — earth */
.hazard-tsunami { background: #134e4a; color: #5eead4; }    /* Teal — coastal */
.hazard-coastal_erosion { background: #134e4a; color: #5eead4; }
.hazard-other { background: #1e293b; color: #94a3b8; }      /* Grey — unknown */
.hazard-implication {
    display: block;
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
    padding-left: 2px;
}

/* ---- Heritage badges (Phase 16) ---- */
.heritage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.heritage-badge {
    display: inline-block;
    background: #422006;
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.heritage-name {
    font-size: 12px;
    color: #e2e8f0;
    font-weight: 500;
}
.heritage-ref {
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}
.heritage-warning {
    margin-top: 8px;
    padding: 6px 10px;
    background: #451a03;
    border-left: 3px solid #f59e0b;
    color: #fbbf24;
    font-size: 11px;
    border-radius: 0 4px 4px 0;
}

/* ---- Contamination badges (Phase 16) ---- */
.contam-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.contam-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.contam-active { background: #450a0a; color: #ef4444; }
.contam-remediated { background: #052e16; color: #22c55e; }
.contam-name {
    font-size: 12px;
    color: #e2e8f0;
}
.contam-desc {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 1px;
}
.contam-ref {
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}

/* ---- Consent pathway badges (Phase 17) ---- */
.consent-row {
    padding: 6px 0;
    border-bottom: 1px solid #1e293b;
}
.consent-row:last-child { border-bottom: none; }
.consent-activity {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 3px;
}
.consent-status-line {
    display: flex;
    align-items: center;
    gap: 8px;
}
.consent-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
/* Green — no consent needed, just build it */
.consent-permitted { background: #052e16; color: #22c55e; }
/* Blue — consent granted if standards met */
.consent-controlled { background: #172554; color: #60a5fa; }
/* Amber — assessed on listed matters only */
.consent-rd { background: #422006; color: #f59e0b; }
/* Orange — full assessment, outcome uncertain */
.consent-discretionary { background: #431407; color: #fb923c; }
/* Red — very unlikely to be granted */
.consent-nc { background: #450a0a; color: #ef4444; }
/* Dark red — cannot be done */
.consent-prohibited { background: #450a0a; color: #dc2626; font-style: italic; }
.consent-conditions {
    font-size: 10px;
    color: #64748b;
    margin-top: 2px;
    padding-left: 2px;
}
.consent-ref {
    font-size: 9px;
    color: #475569;
    font-style: italic;
}

/* ---- Freshness popup ---- */
#freshness-popup {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 12px 16px;
    width: 240px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.freshness-popup-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #334155;
}
.freshness-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 12px;
}
.freshness-layer-name { color: #e2e8f0; }
.freshness-layer-ago {
    color: #22c55e;
    font-weight: 600;
    font-size: 11px;
}

/* ---- Days on market badge ---- */
.dom-badge {
    display: inline-block;
    background: #1e293b;
    color: #94a3b8;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ---- Discount % below CV badge ---- */
.discount-badge {
    display: inline-block;
    background: #052e16;
    color: #22c55e;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ---- Phase 11: Zone change banner ---- */
.zone-change-banner {
    background: #422006;
    color: #fbbf24;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    border: 1px solid #854d0e;
}

/* ---- Phase 12: Score transparency ---- */

/* "/100" text next to the big score number — smaller and muted */
.score-max {
    font-size: 18px;
    color: #64748b;
    font-weight: 400;
}

/* "/ 30" text on score breakdown bars — muted so the actual value stands out */
.score-bar-max {
    color: #475569;
    font-weight: 400;
    font-size: 10px;
}

/* Help icon — circle with "?" that shows a tooltip on hover */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #334155;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
}

.help-icon:hover {
    background: #475569;
    color: #e2e8f0;
}

/* Tooltip uses the native title attribute — works everywhere.
   For richer tooltips, we'd use a JS library, but title="" is
   simple and accessible (screen readers announce it). The \n
   characters in the title create line breaks in most browsers. */

/* Suitable assessment cards — green accent bar + subtle tint.
   These are the "you should pay attention to this" cards. */
.detail-opp-card.suitable {
    border-color: #16a34a;
    border-left: 4px solid #22c55e;
    background: #052e1680;
}

/* Checkmark icon before "SUITABLE" card titles */
.suitable-check {
    color: #22c55e;
    font-weight: 700;
    font-size: 14px;
}

/* Score bar rows — show pointer cursor to hint at the tooltip */
/* (merged with definition above — cursor: help added there) */

/* ---- Phase 18: UX Quick Wins ---- */

/* Focus rings — visible on keyboard navigation, hidden on mouse click */
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
tr:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Nav button disabled state — clearly greyed out */
.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading spinner — replaces plain "Loading..." text */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #334155;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Retry button — shown when data loading fails */
.btn-retry {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.btn-retry:hover { background: #475569; }

/* Empty state suggestion text */
.empty-hint {
    font-size: 12px;
    color: #475569;
    margin-top: 8px;
}

/* ---- Phase 21: Data Quality / Coverage ---- */

/* Warning banner for stub-council properties */
.dq-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-left: 4px solid #f59e0b;
    color: #fbbf24;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* Completeness bar — thin horizontal progress bar */
.dq-completeness {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dq-completeness-bar {
    flex: 1;
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}
.dq-completeness-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.dq-completeness-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

/* Layer grid — 2 columns of dot + label rows */
.dq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}
.dq-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.dq-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dq-present { background: #22c55e; }
.dq-stale   { background: #f59e0b; }
.dq-missing { background: #ef4444; }
.dq-na      { background: #475569; }
.dq-layer-label {
    font-size: 12px;
    color: #94a3b8;
}

/* ---- Phase 25: Infrastructure badges ---- */
/* Color-coded badges showing service availability for each utility.
   Green = fully connected, amber = partial/on-site, red = none, grey = unknown */

.infra-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.infra-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.infra-good {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.infra-partial {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.infra-none {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.infra-unknown {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.infra-note {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
}

/* ---- Phase 19: Focus rings (accessibility) ---- */
/* :focus-visible fires on keyboard focus but not mouse clicks,
   so power users get clear navigation without annoying click rings. */

:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Remove the default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ---- Phase 19: Mobile filter toggle button ---- */
/* Hidden on desktop, visible on mobile. Sits in the top-left of the
   content area and opens the filter sidebar as a slide-out drawer. */

.filter-toggle {
    display: none;   /* Hidden on desktop */
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 90;  /* Below detail-panel (z-index:100) */
    background: #22c55e;
    color: #052e16;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.filter-toggle:hover { background: #16a34a; }

/* Dark overlay behind sidebar on mobile */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    z-index: 149;
    transition: background 0.3s ease;
}
.filter-overlay-active {
    background: rgba(0,0,0,0.5);
}

/* ---- Phase 19: Responsive breakpoints ---- */

/* TABLET (≤1024px): Single column layout, sidebar becomes slide-out drawer */
@media (max-width: 1024px) {
    /* Header: wrap items, reduce padding */
    header {
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 10px;
    }

    .search-container {
        order: 3;
        max-width: none;
        width: 100%;
    }

    .freshness-badge { order: 4; }

    /* Content: single column instead of sidebar + main */
    .content {
        grid-template-columns: 1fr;
        height: auto;
    }

    /* Sidebar: hidden by default, slides from left */
    .filters {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .filters.filters-open {
        transform: translateX(0);
    }

    /* Show the filter toggle button */
    .filter-toggle { display: block; }

    /* Main area: map + table stack vertically, fill screen */
    .main-area {
        height: calc(100vh - 60px);
        grid-template-rows: 50% 50%;
    }

    /* Detail panel: wider on tablet */
    .detail-panel {
        width: 380px;
    }

    /* Stats: 2x2 grid */
    .stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
}

/* PHONE (≤768px): Fully stacked, detail panel full-width */
@media (max-width: 768px) {
    header {
        padding: 8px 12px;
        gap: 8px;
    }

    header h1 { font-size: 16px; }

    .stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        width: 100%;
    }

    .stat {
        padding: 4px 8px;
    }

    .stat-value { font-size: 16px; }
    .stat-label { font-size: 9px; }

    /* Main area: map gets more space */
    .main-area {
        height: calc(100vh - 110px);
        grid-template-rows: 55% 45%;
    }

    /* Table: hide less important columns (shifted +1 for compare col) */
    th:nth-child(1),  /* Compare */
    td:nth-child(1),
    th:nth-child(4),  /* Council */
    td:nth-child(4),
    th:nth-child(6),  /* Zone */
    td:nth-child(6) {
        display: none;
    }

    /* Smaller table text */
    table { font-size: 12px; }
    th { padding: 8px 8px; font-size: 10px; }
    td { padding: 6px 8px; }

    /* Detail panel: full width overlay */
    .detail-panel {
        width: 100%;
    }

    .detail-header h2 { font-size: 13px; }
    .detail-content { padding: 12px; font-size: 12px; }

    /* Pagination simplified */
    .page-info { font-size: 11px; }
    .page-btn { padding: 6px 10px; font-size: 11px; }

    .freshness-badge { display: none; }
}

/* ---- Compare column ---- */
.compare-col {
    width: 30px;
    text-align: center;
    padding: 4px !important;
}

.compare-col input[type="checkbox"] {
    cursor: pointer;
    accent-color: #22c55e;
}

/* ---- PDF download button ---- */
.btn-pdf {
    display: inline-block;
    margin-top: 6px;
    margin-left: 6px;
    padding: 8px 20px;
    background: #1e3a5f;
    color: #60a5fa;
    border: 1px solid #2563eb44;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-pdf:hover {
    background: #1e40af33;
    border-color: #3b82f6;
}

.btn-indepth {
    display: inline-block;
    margin-top: 6px;
    margin-left: 6px;
    padding: 8px 20px;
    background: #422006;
    color: #fbbf24;
    border: 1px solid #f59e0b44;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-indepth:hover {
    background: #78350f;
    border-color: #f59e0b;
}

/* ---- Chart button in header ---- */
.btn-chart {
    flex-shrink: 0;
    padding: 6px 14px;
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-chart:hover {
    color: #e2e8f0;
    border-color: #64748b;
}

/* ---- Score Distribution Chart Modal ---- */
.chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-modal.hidden {
    display: none;
}

.chart-container {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
}

#score-chart {
    height: 300px !important;
}

/* ---- Comparison Panel ---- */
.comparison-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    border-top: 2px solid #22c55e;
    z-index: 120;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.comparison-panel.hidden {
    display: none;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.comparison-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.comparison-content {
    overflow-y: auto;
    padding: 16px 20px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.comparison-table th,
.comparison-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #334155;
    text-align: center;
}

.comparison-table th {
    background: #0f172a;
    position: static;
    cursor: default;
}

.compare-label {
    text-align: left !important;
    color: #94a3b8;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ---- Print styles ---- */
@media print {
    header,
    .filters,
    #map,
    .pagination,
    .filter-toggle,
    .comparison-panel,
    .chart-modal,
    .btn-report,
    .btn-pdf,
    .btn-close,
    .btn-nav,
    .compare-col,
    .freshness-badge,
    .btn-chart {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .content {
        display: block;
        height: auto;
    }

    .main-area {
        display: block;
        height: auto;
    }

    .table-container {
        overflow: visible;
    }

    table {
        font-size: 11px;
        color: #000;
    }

    thead {
        background: #f0f0f0;
        position: static;
    }

    th {
        color: #333;
        border-bottom: 2px solid #333;
    }

    td {
        border-bottom: 1px solid #ddd;
    }

    tr:hover {
        background: none;
    }

    .score-high { color: #059669; }
    .score-mid { color: #d97706; }
    .score-low { color: #dc2626; }

    .for-sale-badge { border: 1px solid #d97706; background: #fff; color: #d97706; }
    .opp-badge { border: 1px solid #999; background: #fff; color: #333; }

    .detail-panel {
        position: static;
        width: 100%;
        height: auto;
        transform: none;
        box-shadow: none;
        border: none;
        background: #fff;
        color: #000;
        page-break-before: always;
    }

    .detail-panel.hidden {
        display: none;
    }

    .detail-content {
        color: #000;
    }

    .detail-section h3 {
        color: #333;
        border-bottom: 1px solid #ddd;
    }

    .detail-score {
        background: #f5f5f5;
        border-color: #ddd;
    }

    .detail-opp-card {
        background: #f9f9f9;
        border-color: #ddd;
    }
}

/* SMALL PHONE (≤480px): Maximum compression */
@media (max-width: 480px) {
    header h1 { font-size: 14px; }
    .badge { font-size: 9px; padding: 1px 6px; }

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 3px;
    }
    .stat { padding: 3px 6px; }
    .stat-value { font-size: 14px; }

    .main-area {
        height: calc(100vh - 100px);
    }

    /* Hide even more table columns on tiny screens — shifted by 1 for compare col */
    th:nth-child(5),  /* Land m2 */
    td:nth-child(5),
    th:nth-child(7),  /* Opportunity */
    td:nth-child(7) {
        display: none;
    }

    .filter-toggle {
        padding: 8px 14px;
        font-size: 12px;
    }

    .detail-section h3 { font-size: 10px; }
    .dq-grid { grid-template-columns: 1fr; }

    .btn-chart { display: none; }
    .compare-col { display: none; }
}

/* ---- Feasibility Table ---- */
.feas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin: 6px 0;
}
.feas-table thead th {
    background: #1e293b;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    text-align: right;
    padding: 5px 6px;
    border-bottom: 1px solid #334155;
}
.feas-table thead th:first-child {
    text-align: left;
}
.feas-table tbody td {
    padding: 5px 6px;
    text-align: right;
    color: #cbd5e1;
    border-bottom: 1px solid #1e293b;
}
.feas-table tbody td:first-child {
    text-align: left;
}
.feas-table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.02);
}
.feas-tier {
    text-transform: capitalize;
    font-weight: 600;
    color: #f59e0b;
}
.feas-notes {
    margin-top: 8px;
    font-size: 10px;
    color: #64748b;
}
.feas-note {
    padding: 2px 0;
}
.feas-note::before {
    content: '\2022 ';
    color: #475569;
}
.feas-disclaimer {
    margin-top: 8px;
    font-size: 10px;
    color: #64748b;
    font-style: italic;
    border-top: 1px solid #1e293b;
    padding-top: 6px;
}

/* ---- UIV (Urban Intensification Variation) callout ---- */
/* Amber-toned callout box for properties upzoned under the UIV.
   Visually distinct from the zone-change-banner (which is a simple
   notification) — this is more prominent because UIV upzoning has
   major development implications. */
.uiv-callout {
    background: #422006;
    border-left: 4px solid #f59e0b;
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-size: 12px;
    color: #fbbf24;
    line-height: 1.5;
}
