:root {
    color-scheme: light;
    --bg: #f5f7f9;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --surface-strong: #eef2f4;
    --ink: #172126;
    --muted: #66747b;
    --line: #dce4e8;
    --line-strong: #c9d4d9;
    --brand: #166a5b;
    --brand-dark: #0e4d42;
    --brand-soft: #e7f3f0;
    --success: #16705b;
    --success-soft: #e3f5ef;
    --pending: #d7263d;
    --pending-soft: #fdecef;
    --warning: #b16c16;
    --warning-soft: #fff4df;
    --danger: #b4413c;
    --danger-soft: #fdeceb;
    --new: #6651b8;
    --new-soft: #efecff;
    --shadow-sm: 0 2px 8px rgba(18, 37, 45, .08);
    --shadow-md: 0 12px 34px rgba(18, 37, 45, .15);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --sidebar-width: 370px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); width: 100%; height: 100%; transition: grid-template-columns .22s ease; }
@media (min-width: 721px) {
    body.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
    body.sidebar-collapsed .sidebar { overflow: hidden; border-right-width: 0; }
}
.sidebar {
    position: relative;
    z-index: 500;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 30px rgba(23, 33, 38, .05);
}
.brand { display: flex; align-items: center; gap: 14px; padding: 22px 22px 18px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 14px; color: var(--brand); background: var(--brand-soft); }
.brand-mark svg { width: 32px; height: 32px; stroke: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; letter-spacing: -.02em; }
h2 { font-size: 15px; letter-spacing: -.01em; }
h3 { font-size: 14px; }
.eyebrow { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.version, .muted { color: var(--muted); font-size: 11px; }

.control-section, .summary-section { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading.compact { margin-bottom: 12px; }
.icon-button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: .18s ease;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); transform: translateY(-1px); }
.icon-button svg { width: 17px; height: 17px; }

.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span, .field > label { color: var(--muted); font-size: 11px; font-weight: 650; }
.filter-toggle { display: none; }
.more-filters-body { display: contents; }
@media (max-width: 720px) {
    .filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 40px;
        padding: 9px 12px;
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface-soft);
        color: var(--ink);
        font-size: 11.5px;
        font-weight: 650;
    }
    .filter-toggle .chevron { width: 16px; height: 16px; transition: transform .18s ease; }
    .filter-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
    .more-filters-body { display: none; }
    .more-filters-body.open { display: block; }
}
.photo-field input[type="file"] { font-size: 11px; }
.photo-preview { display: block; width: 100%; max-width: 220px; margin-top: 8px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; }
.photo-link { display: inline-block; }
input, select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 106, 91, .12); }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; top: 50%; left: 12px; width: 17px; height: 17px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.input-with-icon input { padding-left: 39px; }

.status-filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.status-filter-single { grid-template-columns: 1fr; margin-top: 8px; }
.status-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.status-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.status-option:has(input:checked) { border-color: var(--line-strong); color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--pending); }
.status-option.pending .status-dot { background: var(--pending); }
.status-option.completed .status-dot { background: var(--success); }
.status-option.new .status-dot { background: var(--new); }
.status-option.imported .status-dot { background: #b45309; }
.status-option.labels .status-dot { background: var(--brand); }
.status-option.pending:has(input:checked) { border-color: rgba(215, 38, 61, .3); background: var(--pending-soft); }
.status-option.completed:has(input:checked) { border-color: rgba(22, 112, 91, .3); background: var(--success-soft); }
.status-option.new:has(input:checked) { border-color: rgba(102, 81, 184, .3); background: var(--new-soft); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.metric-card { display: grid; gap: 4px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); text-align: center; }
.metric-card span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.metric-card strong { font-size: 17px; letter-spacing: -.02em; }
.metric-card.pending strong { color: var(--pending); }
.metric-card.completed strong { color: var(--success); }
.metric-card.new strong { color: var(--new); }
.count-badge { min-width: 32px; padding: 4px 8px; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; text-align: center; }

.results-section { display: flex; flex: 1; min-height: 0; flex-direction: column; padding: 16px 12px 0; }
.results-heading { padding: 0 8px; }
.business-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px 18px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.business-card {
    width: 100%;
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 12px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease;
}
.business-card:hover, .business-card:focus-visible { border-radius: 10px; background: var(--surface-soft); outline: none; }
.business-card .indicator,
.business-card.pending .indicator { width: 8px; height: 8px; border-radius: 999px; background: var(--pending); box-shadow: 0 0 0 4px rgba(215, 38, 61, .12); }
.business-card.completed .indicator { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 112, 91, .12); }
.business-card.new .indicator { background: var(--new); box-shadow: 0 0 0 4px rgba(102, 81, 184, .12); }
.pending-sync-tag { color: #8a5a12; font-weight: 650; }
.business-main { min-width: 0; }
.business-name { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.business-meta { display: flex; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.business-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.business-card > svg { width: 15px; height: 15px; color: var(--muted); }
.empty-state { display: grid; place-items: center; gap: 8px; min-height: 180px; padding: 28px; color: var(--muted); text-align: center; }
.empty-state svg { width: 34px; height: 34px; }
.empty-state strong { color: var(--ink); font-size: 13px; }
.list-limit { padding: 12px; color: var(--muted); font-size: 10px; text-align: center; }

.sidebar-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 13px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: inherit;
    font-weight: 750;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .52; transform: none; }
.button svg { width: 17px; height: 17px; }
.button.primary { color: #fff; background: var(--brand); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); }
.button.secondary:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.button.ghost { background: transparent; }
.button.danger { color: var(--danger); border-color: #efc9c6; background: var(--danger-soft); }
.button.compact { min-height: 34px; padding: 7px 10px; font-size: 11px; }

.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #dce8e9; }
.map { width: 100%; height: 100%; }
.topbar { position: absolute; z-index: 450; top: 18px; left: 18px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.status-pill { display: flex; align-items: center; gap: 9px; max-width: min(480px, calc(100vw - 470px)); min-height: 38px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.75); border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); color: var(--muted); font-size: 11px; backdrop-filter: blur(14px); }
.pulse { width: 8px; height: 8px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 5px rgba(22, 112, 91, .12); }
.status-pill.loading .pulse { animation: pulse 1.15s infinite; }
.status-pill.error .pulse { background: var(--danger); box-shadow: 0 0 0 5px rgba(180, 65, 60, .12); }
@keyframes pulse { 50% { transform: scale(.65); opacity: .55; } }
.offline-status { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.75); border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); color: #8a5a12; font-size: 11px; font-weight: 650; backdrop-filter: blur(14px); }
.offline-status.offline { color: #8a2620; }
.offline-status.syncing { color: var(--brand-dark); }
.offline-dot { width: 8px; height: 8px; border-radius: 999px; background: #d99a2b; flex: 0 0 auto; }
.offline-status.offline .offline-dot { background: #c14a3f; }
.offline-status.syncing .offline-dot { background: var(--brand); animation: pulse 1.15s infinite; }
.map-control, .map-action {
    border: 1px solid rgba(255,255,255,.8);
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}
.map-control { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.place-search {
    position: absolute;
    top: 74px;
    left: 50%;
    z-index: 440;
    transform: translateX(-50%);
    width: min(480px, calc(100vw - 220px));
}
.place-search-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 999px;
    background: rgba(255,255,255,.97);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}
.place-search-icon { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.place-search-panel input { flex: 1; min-width: 0; border: none; background: transparent; padding: 12px 0; font-size: 13.5px; min-height: auto; }
.place-search-panel input:focus { outline: none; box-shadow: none; border: none; }
.place-search-panel .icon-button.compact { width: 28px; height: 28px; flex: 0 0 auto; border: none; background: none; }
.place-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; max-height: min(320px, 60vh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); }
.place-search-results li { margin: 2px 0; }
.place-search-result { display: block; width: 100%; padding: 9px 10px; border: none; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.place-search-result:hover, .place-search-result:focus-visible { background: var(--surface-soft); outline: none; }
.place-search-result strong { display: block; font-size: 12px; font-weight: 650; color: var(--ink); }
.place-search-result span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-search-empty { padding: 10px; color: var(--muted); font-size: 11.5px; text-align: center; }
.result-status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 999px; background: var(--pending); vertical-align: middle; }
.result-status-dot.pending { background: var(--pending); }
.result-status-dot.completed { background: var(--success); }
.result-status-dot.new { background: var(--new); }

.custom-select { position: relative; }
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.custom-select-trigger:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.custom-select-trigger .chevron { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted); transition: transform .18s ease; }
.custom-select-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.custom-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: min(280px, 50vh);
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.custom-select-list li { margin: 1px 0; }
.custom-select-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: none;
    text-align: left;
    font-size: 12.5px;
    color: var(--ink);
    cursor: pointer;
}
.custom-select-option:hover, .custom-select-option:focus-visible { background: var(--surface-soft); outline: none; }
.custom-select-option.selected { background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; }
.map-actions { position: absolute; z-index: 450; right: 18px; top: 18px; display: flex; gap: 8px; }
.map-action { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 9px 12px; border-radius: 12px; color: var(--ink); font-size: 11px; font-weight: 750; cursor: pointer; transition: .16s ease; }
.map-action:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.map-action.primary { color: #fff; border-color: var(--brand); background: var(--brand); }
.map-action svg { width: 17px; height: 17px; }
.route-summary { position: absolute; z-index: 450; right: 18px; bottom: 28px; display: flex; align-items: center; justify-content: space-between; gap: 22px; min-width: 250px; padding: 14px 14px 14px 17px; border: 1px solid rgba(255,255,255,.8); border-radius: 14px; background: rgba(255,255,255,.95); box-shadow: var(--shadow-md); backdrop-filter: blur(14px); }
.route-summary-main { min-width: 0; }
.route-summary strong { display: block; font-size: 13px; }
.route-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.route-option { min-height: 28px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.route-option.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.route-warning { display: block; max-width: 360px; margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.route-tracking { display: flex; align-items: flex-start; gap: 7px; max-width: 390px; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.route-tracking-dot { width: 8px; height: 8px; margin-top: 3px; flex: 0 0 auto; border-radius: 999px; background: #2878d0; box-shadow: 0 0 0 4px rgba(40,120,208,.12); animation: routeTrackingPulse 1.6s ease-in-out infinite; }
.route-tracking.near .route-tracking-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(22,112,91,.14); }
.route-tracking.poor-accuracy .route-tracking-dot { background: #ba7b24; box-shadow: 0 0 0 4px rgba(186,123,36,.14); animation: none; }
.route-summary.completed { border-color: rgba(22,112,91,.35); background: rgba(239,250,246,.97); }
.route-summary.completed .eyebrow, .route-summary.completed strong { color: var(--success); }
@keyframes routeTrackingPulse { 50% { transform: scale(.72); opacity: .55; } }
.route-dialog { width: min(620px, calc(100vw - 28px)); }
.route-planner-content { display: grid; gap: 12px; }
.route-point-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.route-point-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.swap-route-button { display: grid; place-items: center; width: 38px; height: 38px; margin: -5px auto; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--brand); cursor: pointer; box-shadow: var(--shadow-sm); }
.swap-route-button svg { width: 18px; height: 18px; }
.travel-mode-fieldset { margin: 3px 0 0; padding: 0; border: 0; }
.travel-mode-fieldset legend { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.travel-mode-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.travel-mode-grid label { cursor: pointer; }
.travel-mode-grid input { position: absolute; opacity: 0; pointer-events: none; }
.travel-mode-grid span { display: grid; place-items: center; min-height: 40px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 750; text-align: center; transition: .15s ease; }
.travel-mode-grid input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.travel-mode-grid input:disabled + span { opacity: .45; cursor: not-allowed; }
.travel-mode-grid label:has(input:disabled) { cursor: not-allowed; }
.route-priority-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-planner-note { color: var(--muted); font-size: 10px; line-height: 1.5; }
.route-origin-marker, .route-destination-marker { display: grid; place-items: center; width: 24px; height: 24px; border: 3px solid #fff; border-radius: 999px; box-shadow: 0 2px 9px rgba(23,33,38,.35); }
.route-origin-marker { background: #2878d0; }
.route-destination-marker { background: #b4413c; }
.route-pick-mode .map { cursor: crosshair; }
@media (max-width: 620px) { .travel-mode-grid { grid-template-columns: repeat(3, 1fr); } }

.loading-overlay { position: absolute; z-index: 600; inset: 0; display: grid; place-items: center; background: rgba(245,247,249,.72); backdrop-filter: blur(5px); transition: opacity .25s ease; }
.loading-overlay.dismissed { opacity: 0; pointer-events: none; }
.loader-card { display: flex; align-items: center; gap: 14px; min-width: 280px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); }
.loader-card strong { font-size: 13px; }
.loader-card p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.loading-actions { display: flex; gap: 8px; margin-top: 10px; }
.loading-actions .button { min-height: 30px; padding: 5px 11px; font-size: 11px; }
.spinner { width: 24px; height: 24px; flex: 0 0 auto; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 999px; animation: spin .8s linear infinite; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
.photo-status { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

.business-marker { display: grid; place-items: center; width: 22px; height: 22px; border: 3px solid #fff; border-radius: 999px; background: var(--pending); box-shadow: 0 2px 8px rgba(23, 33, 38, .3); }
.business-marker.pending { background: var(--pending); }
.business-marker.completed { background: var(--success); }
.business-marker.new { background: var(--new); }
.user-location-marker { width: 18px; height: 18px; border: 4px solid #fff; border-radius: 999px; background: #2878d0; box-shadow: 0 0 0 8px rgba(40, 120, 208, .18), 0 3px 10px rgba(23, 33, 38, .3); }
.place-search-marker {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 3px solid #fff;
    border-radius: 999px 999px 999px 7px;
    color: #fff;
    background: #0f766e;
    box-shadow: 0 0 0 5px rgba(15,118,110,.18), 0 9px 22px rgba(23,33,38,.35);
    transform: rotate(-45deg);
}
.place-search-marker svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
    transform: rotate(45deg);
}
.quadrant-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    color: #5a1028;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(23, 33, 38, .22);
    pointer-events: none;
    transform: translateY(-50%);
}
.business-name-label {
    display: inline-block;
    max-width: 180px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(23, 33, 38, .82);
    color: #fff;
    font-size: 10.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 4px rgba(23, 33, 38, .3);
    pointer-events: none;
    transform: translate(16px, -50%);
}
.comuna-label {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 750;
    letter-spacing: .02em;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(23, 33, 38, .22);
    pointer-events: none;
    transform: translateY(-50%);
}
.google-marker-anchor { display: block; transform: translateY(50%); }
.gm-style .gm-style-iw-c { border-radius: 14px; }
.gm-style button { font-family: inherit; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(22, 106, 91, .18); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { color: #fff; background: var(--brand); font-weight: 800; }

.dialog { width: min(560px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 0; overflow: hidden; border: 0; border-radius: var(--radius-lg); background: transparent; box-shadow: var(--shadow-md); }
.dialog::backdrop { background: rgba(13, 25, 30, .45); backdrop-filter: blur(4px); }
.dialog-shell { display: flex; flex-direction: column; max-height: min(760px, calc(100vh - 28px)); background: var(--surface); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 17px; border-bottom: 1px solid var(--line); }
.business-dialog #detailStatusLabel { display: inline-flex; align-items: center; min-height: 23px; margin-bottom: 6px; padding: 4px 8px; border-radius: 999px; }
.business-dialog #detailStatusLabel.pending { color: var(--pending); background: var(--pending-soft); }
.business-dialog #detailStatusLabel.completed { color: var(--success); background: var(--success-soft); }
.business-dialog #detailStatusLabel.new { color: var(--new); background: var(--new-soft); }
.dialog-header h2 { max-width: 450px; font-size: 19px; }
.dialog-content { overflow-y: auto; padding: 20px 22px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 18px; }
.detail-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.detail-grid .full { grid-column: 1 / -1; }
dt { margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 620; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.coordinate-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.coordinate-card strong { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.coordinate-actions { display: flex; gap: 7px; }

.admin-dialog { width: min(760px, calc(100vw - 28px)); }
.admin-login { display: grid; gap: 16px; }
.admin-login p { color: var(--muted); font-size: 12px; line-height: 1.6; }
code { padding: 2px 5px; border-radius: 5px; background: var(--surface-strong); color: var(--brand-dark); }
.admin-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-card { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); text-align: left; text-decoration: none; cursor: pointer; transition: .18s ease; }
.action-card:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.action-card.warning:hover { border-color: var(--warning); background: var(--warning-soft); }
.action-card svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--brand); }
.action-card span { display: grid; gap: 3px; }
.action-card strong { font-size: 12px; }
.action-card small { color: var(--muted); font-size: 10px; }
.file-action { cursor: pointer; }
.history-section { margin-top: 22px; }
.history-list { display: grid; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item strong { font-size: 11px; }
.history-item time { color: var(--muted); font-size: 9px; }
.history-item p { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }

.toast-region { position: fixed; z-index: 2000; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); font-size: 11px; line-height: 1.45; animation: toast-in .2s ease both; }
.toast.success { border-color: #b9ddd2; }
.toast.error { border-color: #efc9c6; }
.toast .toast-icon { width: 9px; height: 9px; margin-top: 4px; border-radius: 999px; background: var(--brand); }
.toast.error .toast-icon { background: var(--danger); }
.toast.success .toast-icon { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-only { display: none; }

@media (max-width: 920px) {
    :root { --sidebar-width: 340px; }
    .map-action span { display: none; }
    .map-action { width: 42px; justify-content: center; padding: 0; }
    .status-pill { max-width: calc(100vw - 430px); }
}

@media (max-width: 720px) {
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        z-index: 900;
        inset: 0 auto 0 0;
        width: min(360px, calc(100vw - 44px));
        transform: translateX(-102%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open { transform: translateX(0); }
    .map-stage { width: 100%; height: 100%; }
    .mobile-only { display: grid; }
    .topbar { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; flex-wrap: wrap; }
    .status-pill { max-width: calc(100vw - 68px); overflow: hidden; }
    .status-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .offline-status { max-width: calc(100vw - 68px); overflow: hidden; }
    .offline-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .place-search { top: max(64px, calc(12px + env(safe-area-inset-top) + 84px)); left: 12px; right: 12px; width: auto; transform: none; }
    .map-actions { top: auto; right: 12px; bottom: max(18px, env(safe-area-inset-bottom)); flex-direction: column; }
    .route-summary { right: 64px; left: 12px; bottom: max(18px, env(safe-area-inset-bottom)); min-width: 0; }
    .dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); }
    .dialog-shell { max-height: calc(100vh - 18px); }
    .dialog-header, .dialog-content { padding-right: 17px; padding-left: 17px; }
    .dialog-actions { padding-right: 17px; padding-left: 17px; }
    .detail-grid, .form-grid, .admin-actions-grid { grid-template-columns: 1fr; }
    .detail-grid .full, .form-grid .full { grid-column: auto; }
    .coordinate-card { align-items: stretch; flex-direction: column; }
    .coordinate-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================================================================
   Geovisor 4.3 · mapa territorial, móvil y estabilidad visual
   ================================================================ */
:root {
    --wine: #7a1734;
}

html, body {
    min-height: 100%;
    overscroll-behavior: none;
    touch-action: manipulation;
}

.app-shell {
    height: 100vh;
    min-height: 0;
}

@supports (height: 100dvh) {
    .app-shell { height: 100dvh; }
}

.map-stage {
    isolation: isolate;
    contain: layout paint;
    background: #e8ecef;
}

.map {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    outline: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Evita parpadeos de composición sobre el lienzo vectorial de Google. */
.status-pill,
.map-control,
.map-action,
.route-summary,
.loading-overlay,
.dialog::backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.status-pill,
.map-control,
.map-action,
.route-summary {
    background: rgba(255, 255, 255, .97);
}

/* Cuadrantes vino y puntos comerciales diferenciados por estado. */
.business-marker {
    --marker-color: var(--pending);
    --marker-glow: rgba(215, 38, 61, .24);
    --marker-shadow: rgba(151, 17, 36, .4);
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    background: var(--marker-color);
    box-shadow: 0 2px 8px var(--marker-shadow), 0 0 0 1px var(--marker-glow);
}

.business-marker.pending {
    --marker-color: var(--pending);
    --marker-glow: rgba(215, 38, 61, .24);
    --marker-shadow: rgba(151, 17, 36, .4);
}
.business-marker.completed {
    --marker-color: var(--success);
    --marker-glow: rgba(22, 112, 91, .22);
    --marker-shadow: rgba(11, 82, 66, .4);
}
.business-marker.new {
    --marker-color: var(--new);
    --marker-glow: rgba(102, 81, 184, .24);
    --marker-shadow: rgba(70, 49, 151, .42);
}
.business-marker.search-focus-marker {
    position: relative;
    width: 30px;
    height: 30px;
    border-width: 4px;
    box-shadow: 0 3px 12px var(--marker-shadow), 0 0 0 8px var(--marker-glow);
}
.business-marker.search-focus-marker::after {
    position: absolute;
    inset: -10px;
    border: 3px solid var(--marker-color);
    border-radius: 999px;
    content: "";
    opacity: .72;
    animation: search-focus-pulse 1.5s ease-out infinite;
}
@keyframes search-focus-pulse {
    0% { opacity: .9; transform: scale(.7); }
    100% { opacity: 0; transform: scale(1.45); }
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(122, 23, 52, .2);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    color: #fff;
    background: var(--wine);
    border: 2px solid rgba(255, 255, 255, .9);
    font-weight: 800;
}

/* La posición se actualiza con filtro anti-jitter desde TypeScript. */
.user-location-marker,
.google-marker-anchor {
    animation: none !important;
    transition: none !important;
    will-change: auto;
}

.sidebar-backdrop {
    position: fixed;
    z-index: 850;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(14, 20, 24, .44);
    cursor: default;
}

body.sidebar-open { overflow: hidden; }

@media (hover: none) and (pointer: coarse) {
    .button:hover,
    .icon-button:hover,
    .map-action:hover,
    .action-card:hover {
        transform: none;
    }

    .button,
    .icon-button,
    .map-control,
    .map-action,
    .status-option,
    .route-option,
    .swap-route-button {
        min-height: 44px;
    }
}

@media (max-width: 920px) {
    .status-pill { max-width: calc(100vw - 410px); }
}

@media (max-width: 720px) {
    html, body {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .app-shell,
    .map-stage {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
    }

    @supports (height: 100svh) {
        .app-shell,
        .map-stage {
            height: 100svh;
            min-height: 100svh;
        }
    }

    .sidebar {
        inset: 0 auto 0 0;
        width: min(400px, calc(100vw - 24px));
        max-width: none;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        border-right: 0;
        border-radius: 0 18px 18px 0;
        transform: translate3d(-105%, 0, 0);
        transition: transform .22s cubic-bezier(.2, .8, .2, 1);
        box-shadow: 18px 0 50px rgba(18, 26, 31, .24);
        contain: layout paint;
    }

    .sidebar.open { transform: translate3d(0, 0, 0); }
    .brand { padding: 17px 18px 14px; }
    .brand-mark { width: 40px; height: 40px; }
    .control-section, .summary-section { padding: 14px 16px; }
    .results-section { padding: 13px 10px 0; }
    .sidebar-footer {
        grid-template-columns: 1fr 1fr;
        padding: 11px 12px calc(11px + env(safe-area-inset-bottom));
    }

    input, select, textarea { font-size: 16px; }
    .field { margin-bottom: 12px; }
    .status-option { min-height: 42px; }
    .metric-card { min-height: 58px; }
    .business-card { min-height: 54px; padding: 11px 9px; }
    .business-name { font-size: 13px; }
    .business-meta { font-size: 11px; }

    .topbar {
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
        left: 10px;
        gap: 7px;
    }

    .map-control {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
        border-radius: 14px;
    }

    .status-pill {
        min-width: 0;
        max-width: none;
        flex: 1;
        min-height: 46px;
        padding: 10px 13px;
        border-radius: 14px;
        font-size: 12px;
    }

    .map-actions {
        top: auto;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 10px;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding: 7px;
        border: 1px solid rgba(255,255,255,.9);
        border-radius: 17px;
        background: rgba(255,255,255,.97);
        box-shadow: 0 10px 30px rgba(23,33,38,.18);
    }

    .map-action {
        width: 100%;
        min-width: 0;
        height: 48px;
        min-height: 48px;
        padding: 0;
        border-color: transparent;
        border-radius: 12px;
        background: transparent;
        box-shadow: none;
    }

    .map-action.primary {
        border-color: var(--brand);
        background: var(--brand);
    }

    .map-action svg { width: 21px; height: 21px; }
    .map-action span { display: none; }

    .route-summary {
        right: 10px;
        bottom: calc(82px + env(safe-area-inset-bottom));
        left: 10px;
        width: auto;
        min-width: 0;
        max-height: 37svh;
        align-items: flex-start;
        gap: 10px;
        overflow-y: auto;
        padding: 13px 12px 13px 15px;
        border-radius: 16px;
    }

    .route-summary strong { font-size: 14px; }
    .route-tracking, .route-warning { max-width: none; font-size: 10px; }
    .route-options { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
    .route-option { flex: 0 0 auto; min-height: 36px; }

    .loading-overlay { padding: 16px; background: rgba(245,247,249,.92); }
    .loader-card { width: min(100%, 360px); min-width: 0; }

    .dialog {
        inset: auto 0 0;
        width: 100%;
        max-width: none;
        max-height: 92vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
    }

    @supports (height: 100svh) {
        .dialog { max-height: 92svh; }
    }

    .dialog-shell {
        max-height: inherit;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .dialog-header {
        position: sticky;
        z-index: 2;
        top: 0;
        padding: 17px 16px 14px;
        background: var(--surface);
    }

    .dialog-content {
        padding: 16px;
        overscroll-behavior: contain;
    }

    .dialog-actions {
        position: sticky;
        z-index: 2;
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }

    .dialog-actions .button { width: 100%; min-height: 46px; }
    .dialog-actions .button:only-child { grid-column: 1 / -1; }
    .route-dialog .dialog-actions { grid-template-columns: 1fr 1fr; }
    .travel-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .travel-mode-grid span { min-height: 46px; font-size: 11px; }
    .route-point-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .route-point-actions .button { min-width: 0; }
    .detail-grid, .form-grid, .admin-actions-grid { gap: 10px; }
    .coordinate-actions { grid-template-columns: 1fr; }

    .toast-region {
        right: 10px;
        bottom: calc(86px + env(safe-area-inset-bottom));
        left: 10px;
        width: auto;
    }
}

@media (max-width: 420px) {
    .sidebar { width: calc(100vw - 12px); }
    .brand { padding-right: 14px; padding-left: 14px; }
    .control-section, .summary-section { padding-right: 13px; padding-left: 13px; }
    .status-filter { grid-template-columns: 1fr; }
    .status-option { justify-content: flex-start; padding-inline: 13px; }
    .metric-grid { gap: 6px; }
    .dialog-actions { grid-template-columns: 1fr; }
    .dialog-actions .button { grid-column: 1; }
    .route-point-actions { grid-template-columns: 1fr; }
    .coordinate-actions { grid-template-columns: 1fr; }
}

@media (max-width: 720px) and (max-height: 520px) and (orientation: landscape) {
    .sidebar { width: min(430px, 58vw); }
    .brand { padding-block: 10px; }
    .control-section, .summary-section { padding-block: 10px; }
    .summary-section { display: none; }
    .map-actions {
        top: 64px;
        right: 10px;
        bottom: auto;
        left: auto;
        grid-template-columns: 48px;
        width: auto;
    }
    .route-summary {
        right: 72px;
        bottom: 10px;
        left: 10px;
        max-height: 44vh;
    }
    .toast-region { bottom: 10px; }
    .dialog { max-height: 96vh; }
}


/* 4.5.0 — vista inicial territorial y fluidez en escritorio. */
@media (hover: hover) and (pointer: fine) {
    .map-stage,
    .map {
        backface-visibility: hidden;
        transform: translateZ(0);
    }

    /* No se fuerzan capas sobre los nodos internos de Google Maps: aplicar
       transformaciones a todos sus divs provoca artefactos y saltos en PC. */
    .gm-style {
        text-rendering: optimizeLegibility;
    }
}

/* 4.7.0 — panel desplazable, privacidad por rol y cámara estable. */
.sidebar {
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.brand,
.control-section,
.summary-section,
.sidebar-footer {
    min-width: 0;
}

.results-section {
    min-height: 0;
    overflow: hidden;
}

.results-heading {
    flex: 0 0 auto;
}

.business-list {
    min-height: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.business-list:focus-visible {
    outline: 2px solid rgba(122, 23, 52, .35);
    outline-offset: -2px;
    border-radius: 10px;
}

.business-list::-webkit-scrollbar { width: 10px; }
.business-list::-webkit-scrollbar-track { background: transparent; }
.business-list::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: #b6c2c7;
    background-clip: padding-box;
}
.business-list::-webkit-scrollbar-thumb:hover { background-color: #8e9da4; }

/* Los elementos administrativos no ocupan espacio hasta que la sesión
   autenticada los habilita desde TypeScript. */
[data-admin-only][hidden] { display: none !important; }
[data-surveyor-only][hidden] { display: none !important; }

.admin-privacy-note {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

/* Evita capas de composición innecesarias en Google Maps de escritorio. */
@media (hover: hover) and (pointer: fine) {
    .map-stage,
    .map {
        transform: none !important;
        backface-visibility: visible;
        will-change: auto;
    }
}

@media (max-width: 720px) {
    .sidebar {
        display: grid;
        grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .results-section {
        min-height: 150px;
    }

    .business-list {
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }
}

@media (min-width: 721px) and (max-height: 760px) {
    .brand { padding-block: 14px 12px; }
    .control-section, .summary-section { padding-block: 12px; }
    .section-heading { margin-bottom: 10px; }
    .field { margin-bottom: 10px; }
    .results-section { padding-top: 10px; }
}

/* Áreas explícitas: al ocultar resumen/exportaciones para el rol de campo,
   la lista conserva toda la altura disponible y su propio desplazamiento. */
.sidebar {
    grid-template-areas:
        "brand"
        "controls"
        "summary"
        "validations"
        "results"
        "footer";
}
.brand { grid-area: brand; }
.control-section { grid-area: controls; }
.summary-section { grid-area: summary; }
.validation-section { grid-area: validations; }
.results-section { grid-area: results; }
.sidebar-footer { grid-area: footer; }


/* Administración 4.8: acceso elegante y descargas restauradas */
.admin-dialog { width: min(900px, calc(100vw - 28px)); }
.admin-shell { max-height: min(820px, calc(100vh - 28px)); }
.admin-dialog-header { position: relative; z-index: 2; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.admin-login-view { display: grid; grid-template-columns: minmax(270px, .9fr) minmax(330px, 1.1fr); min-height: 440px; overflow: hidden; background: var(--surface); }
.admin-login-hero { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 440px; padding: 34px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #54202d 0%, #7b263b 48%, #a33b50 100%); }
.admin-login-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.18), transparent 32%), linear-gradient(180deg, transparent 38%, rgba(37,8,17,.3)); }
.admin-login-orbit { position: absolute; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; }
.admin-login-orbit.orbit-one { top: -95px; right: -75px; width: 290px; height: 290px; }
.admin-login-orbit.orbit-two { top: 38px; right: 24px; width: 145px; height: 145px; }
.admin-login-emblem { position: absolute; top: 42px; left: 34px; display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid rgba(255,255,255,.28); border-radius: 22px; background: rgba(255,255,255,.13); box-shadow: inset 0 1px rgba(255,255,255,.22), 0 18px 40px rgba(42,7,17,.2); backdrop-filter: blur(10px); }
.admin-login-emblem svg { width: 38px; height: 38px; stroke-width: 1.7; }
.admin-login-hero-copy, .admin-security-chips { position: relative; z-index: 1; }
.admin-login-hero-copy { display: grid; gap: 8px; }
.admin-kicker { width: fit-content; padding: 5px 9px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(255,255,255,.1); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.admin-login-hero-copy strong { max-width: 280px; font-size: 27px; line-height: 1.08; letter-spacing: -.035em; }
.admin-login-hero-copy p { max-width: 300px; color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.6; }
.admin-security-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 24px; }
.admin-security-chips span { padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 9px; font-weight: 700; }
.admin-login-form-panel { display: flex; flex-direction: column; justify-content: center; padding: 38px 42px; }
.admin-login-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; }
.admin-login-mini-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #7b263b; background: #f7e9ed; }
.admin-login-mini-icon svg { width: 21px; height: 21px; }
.admin-login-heading h3 { font-size: 21px; letter-spacing: -.025em; }
.admin-login-description { margin-bottom: 23px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.admin-password-field { margin-bottom: 10px; }
.password-control { position: relative; }
.password-control input { min-height: 48px; padding-left: 43px; padding-right: 47px; border-radius: 12px; }
.password-leading-icon { position: absolute; top: 50%; left: 14px; z-index: 1; width: 18px; height: 18px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.password-toggle { position: absolute; top: 50%; right: 7px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover { color: #7b263b; background: #f7e9ed; }
.password-toggle svg { width: 18px; height: 18px; }
.admin-login-message { margin: 2px 0 10px; padding: 9px 11px; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); font-size: 10px; line-height: 1.4; }
.admin-login-message.error { color: #8d2f2a; background: var(--danger-soft); }
.admin-login-button { position: relative; min-height: 48px; margin-top: 4px; overflow: hidden; border-radius: 12px; background: linear-gradient(135deg, #6e2335, #96364a); box-shadow: 0 9px 20px rgba(123,38,59,.2); }
.admin-login-button:hover { background: linear-gradient(135deg, #622030, #862f42); }
.admin-login-button-icon { display: grid; place-items: center; }
.admin-login-button-icon svg { width: 18px; height: 18px; }
.admin-login-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 999px; animation: spin .7s linear infinite; }
.admin-login-button[aria-busy="true"] .admin-login-button-icon { display: none; }
.admin-login-button[aria-busy="true"] .admin-login-spinner { display: block; }
.admin-login-footnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.admin-login-footnote svg { width: 16px; height: 16px; flex: 0 0 auto; color: #7b263b; }
.admin-panel-view { padding: 22px; background: #f5f7f8; }
.admin-welcome-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; margin-bottom: 14px; padding: 16px 18px; border: 1px solid #dfe6e8; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(26,45,52,.05); }
.admin-welcome-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--brand); background: var(--brand-soft); }
.admin-welcome-icon svg { width: 22px; height: 22px; }
.admin-welcome-card h3 { margin-bottom: 3px; }
.admin-welcome-card p:not(.eyebrow) { color: var(--muted); font-size: 10px; }
.admin-session-badge { padding: 5px 9px; border-radius: 999px; color: #0e5d4d; background: #e4f4ef; font-size: 9px; font-weight: 800; }
.admin-download-section, .admin-project-section, .admin-panel-view > .history-section { margin-top: 14px; padding: 18px; border: 1px solid #dfe6e8; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(26,45,52,.045); }
.admin-project-section { padding-top: 18px; }
.admin-section-heading { align-items: flex-end; }
.project-switcher { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.project-switcher .field { flex: 1; margin-bottom: 0; }
.project-switcher select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 11px; background: #fff; font: inherit; }
.project-switcher .button { flex: 0 0 auto; }
.admin-export-scope { max-width: 240px; overflow: hidden; padding: 5px 9px; border-radius: 999px; color: #6d2636; background: #f7e9ed; font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.admin-download-grid { grid-template-columns: 1fr 1fr; }
.download-card { position: relative; min-height: 82px; padding: 15px; overflow: hidden; }
.download-card::after { display: none; }
.action-card-icon { position: relative; z-index: 1; display: grid !important; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; }
.csv-card .action-card-icon { color: #116451; background: #e3f5ef; }
.geojson-card .action-card-icon { color: #7b263b; background: #f7e9ed; }
.action-card-icon svg { width: 21px; height: 21px; color: inherit; }
.download-card > span:nth-child(2) { position: relative; z-index: 1; }
.download-card .action-arrow { position: relative; z-index: 1; width: 18px; height: 18px; margin-left: auto; color: var(--muted); }
.admin-download-note { margin-top: 9px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.logout-card:hover { border-color: var(--danger); background: var(--danger-soft); }
.admin-actions-grid .action-card { min-height: 72px; border-color: #dfe6e8; border-radius: 13px; box-shadow: 0 1px 2px rgba(26,45,52,.025); }
.admin-actions-grid .action-card:hover { border-color: #93c8bc; background: #f7fbfa; box-shadow: 0 8px 20px rgba(22,106,91,.08); }
.admin-actions-grid .action-card { touch-action: manipulation; }
.admin-actions-grid .action-card:active { transform: translateY(0) scale(.99); transition-duration: .06s; }
.admin-actions-grid .action-card > svg:first-child { width: 40px; height: 40px; padding: 9px; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.admin-panel-view > .history-section { max-height: none; }

@media (max-width: 700px) {
    .admin-dialog { width: min(100vw - 18px, 560px); max-height: calc(100dvh - 18px); }
    .admin-shell { max-height: calc(100dvh - 18px); }
    .admin-login-view { grid-template-columns: 1fr; min-height: 0; overflow-y: auto; }
    .admin-login-hero { min-height: 180px; justify-content: flex-end; padding: 24px; }
    .admin-login-emblem { top: 22px; left: 24px; width: 50px; height: 50px; border-radius: 16px; }
    .admin-login-emblem svg { width: 28px; height: 28px; }
    .admin-login-hero-copy strong { max-width: none; font-size: 21px; }
    .admin-login-hero-copy p, .admin-security-chips { display: none; }
    .admin-login-form-panel { padding: 25px 22px calc(25px + env(safe-area-inset-bottom)); }
    .admin-download-grid, .admin-actions-grid { grid-template-columns: 1fr; }
    .admin-welcome-card { grid-template-columns: auto 1fr; }
    .admin-session-badge { grid-column: 1 / -1; width: fit-content; margin-left: 55px; }
    .admin-export-scope { max-width: 150px; }
}

@media (max-width: 410px) {
    .admin-dialog-header { padding: 16px; }
    .admin-dialog-header h2 { font-size: 16px; }
    .admin-login-form-panel { padding: 22px 18px; }
    .admin-panel-view { padding: 16px; }
}

@media (max-width: 700px) {
    .admin-dialog {
        inset: auto 9px 9px;
        width: auto;
        max-width: none;
        margin: 0;
        border-radius: 20px;
    }
}

/* Acceso general obligatorio · v5.1 · cristal oscuro */
.access-page {
    --spot-x: 72vw;
    --spot-y: 18vh;
    margin: 0;
    min-height: 100dvh;
    overflow: hidden;
    color: #f7f7f8;
    background: #030306;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.access-page * { box-sizing: border-box; }
.access-experience { position: relative; display: grid; place-items: center; min-height: 100dvh; overflow: hidden; isolation: isolate; background: radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(255,255,255,.075), transparent 21rem), linear-gradient(145deg, #020204 0%, #06060a 48%, #020204 100%); }
.access-atmosphere, .access-atmosphere > span { position: absolute; pointer-events: none; }
.access-atmosphere { inset: 0; z-index: -2; overflow: hidden; }
.access-beam { top: -42%; left: 47%; width: 13vw; min-width: 130px; height: 190%; transform: rotate(34deg); transform-origin: center; filter: blur(26px); mix-blend-mode: screen; }
.access-beam-primary { background: linear-gradient(90deg, transparent, rgba(255,255,255,.24), rgba(255,255,255,.045), transparent); animation: accessBeamDrift 11s ease-in-out infinite alternate; }
.access-beam-secondary { left: 59%; width: 5vw; min-width: 65px; opacity: .52; background: linear-gradient(90deg, transparent, rgba(156,111,128,.16), transparent); animation: accessBeamDriftSecondary 15s ease-in-out infinite alternate; }
.access-halo { border-radius: 999px; filter: blur(2px); }
.access-halo-one { top: 13%; left: 50%; width: 420px; height: 420px; margin-left: -210px; background: radial-gradient(circle, rgba(255,255,255,.075), rgba(83,47,62,.035) 48%, transparent 72%); animation: accessHaloPulse 7s ease-in-out infinite; }
.access-halo-two { right: -14%; bottom: -34%; width: 52vw; height: 52vw; border: 1px solid rgba(255,255,255,.035); background: radial-gradient(circle, rgba(106,29,55,.08), transparent 65%); }
.access-vignette { inset: 0; box-shadow: inset 0 0 220px 90px rgba(0,0,0,.86); }
.access-grain { inset: -50%; opacity: .035; background-image: repeating-radial-gradient(circle at 30% 20%, #fff 0 .5px, transparent .7px 3px); background-size: 8px 8px; animation: accessGrain .5s steps(2) infinite; }
.access-shell { width: min(100%, 460px); padding: max(28px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); }
.access-brandline { display: flex; align-items: center; justify-content: center; gap: 11px; margin: 0 auto 20px; color: rgba(255,255,255,.72); }
.access-brand-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.055); box-shadow: inset 0 1px rgba(255,255,255,.08); backdrop-filter: blur(14px); }
.access-brand-icon svg { width: 22px; height: 22px; fill: rgba(255,255,255,.88); }
.access-brand-icon circle { fill: #07070a; stroke: rgba(255,255,255,.84); stroke-width: 1.7; }
.access-brand-copy { display: grid; line-height: 1.15; }
.access-brand-copy small { color: rgba(255,255,255,.42); font-size: 8px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.access-brand-copy strong { margin-top: 3px; color: rgba(255,255,255,.9); font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.access-card { position: relative; width: 100%; padding: 34px 34px 28px; overflow: hidden; border: 1px solid rgba(255,255,255,.105); border-radius: 34px; background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.035) 44%, rgba(255,255,255,.055)); box-shadow: 0 42px 100px rgba(0,0,0,.64), inset 0 1px rgba(255,255,255,.105), inset 0 -1px rgba(255,255,255,.025); backdrop-filter: blur(30px) saturate(115%); -webkit-backdrop-filter: blur(30px) saturate(115%); }
.access-card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: radial-gradient(circle at 74% 0%, rgba(255,255,255,.105), transparent 35%), linear-gradient(165deg, rgba(112,80,94,.07), transparent 55%); }
.access-card-shine { position: absolute; top: -150px; right: -94px; width: 270px; height: 390px; transform: rotate(35deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.055), transparent); filter: blur(10px); animation: accessCardShine 9s ease-in-out infinite alternate; }
.access-heading { position: relative; z-index: 1; margin-bottom: 28px; text-align: center; }
.access-status-mark { position: relative; display: block; width: 38px; height: 38px; margin: 0 auto 13px; animation: accessMarkRotate 14s linear infinite; }
.access-status-mark i { position: absolute; top: 1px; left: 17px; width: 4px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.86); transform-origin: 2px 18px; box-shadow: 0 0 8px rgba(255,255,255,.25); }
.access-status-mark i:nth-child(1) { transform: rotate(0deg); opacity: 1; }
.access-status-mark i:nth-child(2) { transform: rotate(30deg); opacity: .92; }
.access-status-mark i:nth-child(3) { transform: rotate(60deg); opacity: .84; }
.access-status-mark i:nth-child(4) { transform: rotate(90deg); opacity: .76; }
.access-status-mark i:nth-child(5) { transform: rotate(120deg); opacity: .68; }
.access-status-mark i:nth-child(6) { transform: rotate(150deg); opacity: .60; }
.access-status-mark i:nth-child(7) { transform: rotate(180deg); opacity: .52; }
.access-status-mark i:nth-child(8) { transform: rotate(210deg); opacity: .44; }
.access-status-mark i:nth-child(9) { transform: rotate(240deg); opacity: .36; }
.access-status-mark i:nth-child(10) { transform: rotate(270deg); opacity: .28; }
.access-status-mark i:nth-child(11) { transform: rotate(300deg); opacity: .22; }
.access-status-mark i:nth-child(12) { transform: rotate(330deg); opacity: .16; }
.access-kicker { margin: 0 0 7px; color: rgba(255,255,255,.43); font-size: 9px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.access-heading h1 { margin: 0; color: #fff; font-size: 29px; font-weight: 680; line-height: 1.12; letter-spacing: -.035em; }
.access-heading > p:last-child { max-width: 300px; margin: 10px auto 0; color: rgba(255,255,255,.48); font-size: 11px; line-height: 1.6; }
.access-form { position: relative; z-index: 1; display: grid; gap: 17px; }
.access-field { display: grid; gap: 7px; }
.access-field > span:first-child { padding-left: 3px; color: rgba(255,255,255,.53); font-size: 9px; font-weight: 720; letter-spacing: .04em; }
.access-input-wrap { position: relative; display: flex; align-items: center; min-height: 51px; border: 1px solid rgba(255,255,255,.075); border-radius: 14px; background: rgba(255,255,255,.07); box-shadow: inset 0 1px rgba(255,255,255,.035), 0 12px 28px rgba(0,0,0,.1); transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease; }
.access-input-wrap:focus-within { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.105); box-shadow: 0 0 0 3px rgba(255,255,255,.045), inset 0 1px rgba(255,255,255,.055), 0 16px 32px rgba(0,0,0,.18); transform: translateY(-1px); }
.access-input-wrap > svg { width: 17px; height: 17px; margin-left: 15px; flex: 0 0 auto; color: rgba(255,255,255,.36); fill: none; stroke: currentColor; stroke-width: 1.65; }
.access-input-wrap input { width: 100%; height: 49px; min-width: 0; padding: 0 48px 0 11px; border: 0; outline: 0; color: rgba(255,255,255,.94); background: transparent; font: inherit; font-size: 13px; caret-color: #fff; }
.access-input-wrap input::placeholder { color: rgba(255,255,255,.27); }
.access-input-wrap input:-webkit-autofill, .access-input-wrap input:-webkit-autofill:hover, .access-input-wrap input:-webkit-autofill:focus { -webkit-text-fill-color: rgba(255,255,255,.94); box-shadow: 0 0 0 1000px #28272c inset; transition: background-color 9999s ease-out; }
.access-password-toggle { position: absolute; right: 7px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; color: rgba(255,255,255,.4); background: transparent; cursor: pointer; transition: color .18s ease, background .18s ease; }
.access-password-toggle:hover, .access-password-toggle:focus-visible { color: rgba(255,255,255,.9); background: rgba(255,255,255,.075); outline: none; }
.access-password-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.access-password-toggle .eye-closed { display: none; }
.access-password-toggle.is-visible .eye-open { display: none; }
.access-password-toggle.is-visible .eye-closed { display: block; }
.access-error { display: flex; align-items: flex-start; gap: 9px; margin: -2px 0 0; padding: 10px 11px; border: 1px solid rgba(235,91,105,.24); border-radius: 11px; color: #ffb4bc; background: rgba(185,39,56,.12); font-size: 10px; line-height: 1.45; }
.access-error span { display: grid; place-items: center; width: 17px; height: 17px; flex: 0 0 auto; border-radius: 50%; color: #140508; background: #ff939f; font-size: 10px; font-weight: 900; }
.access-card.has-error { animation: accessErrorShake .42s ease; }
.access-submit { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 50px; margin-top: 3px; padding: 0 17px 0 20px; overflow: hidden; border: 1px solid rgba(255,255,255,.72); border-radius: 14px; color: #08080a; background: linear-gradient(180deg, #fff, #e9e7e9); box-shadow: 0 13px 34px rgba(0,0,0,.32), inset 0 1px #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .01em; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.access-submit::before { content: ""; position: absolute; inset: 0; transform: translateX(-110%); background: linear-gradient(105deg, transparent 25%, rgba(126,63,86,.13) 50%, transparent 75%); transition: transform .6s ease; }
.access-submit:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(0,0,0,.42), inset 0 1px #fff; }
.access-submit:hover::before { transform: translateX(110%); }
.access-submit:active { transform: translateY(0); }
.access-submit:focus-visible { outline: 3px solid rgba(255,255,255,.18); outline-offset: 3px; }
.access-submit:disabled { cursor: wait; filter: brightness(.8); }
.access-submit svg { position: relative; z-index: 1; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.85; }
.access-submit-label { position: relative; z-index: 1; justify-self: center; padding-left: 18px; }
.access-submit-loader { position: absolute; left: 50%; top: 50%; display: none; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2px solid rgba(0,0,0,.2); border-top-color: #08080a; border-radius: 50%; animation: accessMarkRotate .7s linear infinite; }
.access-submit.is-loading .access-submit-label, .access-submit.is-loading > svg { opacity: 0; }
.access-submit.is-loading .access-submit-loader { display: block; }
.access-divider { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 22px 0 15px; }
.access-divider span { height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.13)); }
.access-divider span:last-child { background: linear-gradient(90deg, rgba(255,255,255,.13), transparent); }
.access-divider i { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.28); }
.access-security { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,.33); font-size: 9px; line-height: 1.45; text-align: center; }
.access-security svg { width: 15px; height: 15px; flex: 0 0 auto; color: rgba(255,255,255,.5); fill: none; stroke: currentColor; stroke-width: 1.7; }
.access-version { margin: 17px 0 0; color: rgba(255,255,255,.25); font-size: 9px; letter-spacing: .07em; text-align: center; }
@keyframes accessBeamDrift { from { transform: translate3d(-6vw, -2vh, 0) rotate(34deg); opacity: .58; } to { transform: translate3d(8vw, 4vh, 0) rotate(34deg); opacity: .95; } }
@keyframes accessBeamDriftSecondary { from { transform: translate3d(4vw, -2vh, 0) rotate(34deg); } to { transform: translate3d(-7vw, 3vh, 0) rotate(34deg); } }
@keyframes accessHaloPulse { 0%,100% { transform: scale(.92); opacity: .58; } 50% { transform: scale(1.08); opacity: .9; } }
@keyframes accessCardShine { from { transform: translateX(-40px) rotate(35deg); opacity: .35; } to { transform: translateX(80px) rotate(35deg); opacity: .8; } }
@keyframes accessMarkRotate { to { transform: rotate(360deg); } }
@keyframes accessGrain { 0% { transform: translate(0,0); } 25% { transform: translate(2%,-1%); } 50% { transform: translate(-1%,2%); } 75% { transform: translate(1%,1%); } 100% { transform: translate(-2%,-1%); } }
@keyframes accessErrorShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 55% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@media (max-width: 520px) {
    .access-shell { padding-right: 16px; padding-left: 16px; }
    .access-brandline { margin-bottom: 15px; }
    .access-card { padding: 30px 22px 24px; border-radius: 27px; }
    .access-heading { margin-bottom: 25px; }
    .access-heading h1 { font-size: 27px; }
    .access-input-wrap input { font-size: 16px; }
    .access-security { align-items: flex-start; }
}
@media (max-height: 680px) and (min-width: 521px) {
    .access-shell { padding-top: 18px; padding-bottom: 18px; }
    .access-brandline { margin-bottom: 10px; }
    .access-card { padding-top: 25px; padding-bottom: 22px; }
    .access-heading { margin-bottom: 20px; }
    .access-status-mark { margin-bottom: 8px; }
    .access-form { gap: 13px; }
    .access-divider { margin-top: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .access-beam, .access-halo, .access-card-shine, .access-status-mark, .access-grain { animation: none !important; }
    .access-submit, .access-input-wrap { transition: none; }
}
.general-logout-form { margin-left: auto; }
.sidebar-close-button { margin-left: auto; }
.general-logout-button { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.general-logout-button:hover { color: #7b263b; border-color: #dec2ca; background: #fbf1f4; }
.general-logout-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sidebar-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 900px) {
    .access-page { overflow: auto; }
    .access-layout { grid-template-columns: 1fr; }
    .access-visual { display: none; }
    .access-panel { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
    .access-card { width: min(100%, 470px); padding: 0; }
    .access-mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(48px, 12vh, 90px); }
    .access-mobile-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #7b263b; background: #f1e4e8; }
    .access-mobile-icon svg { width: 28px; height: 28px; fill: currentColor; }
    .access-mobile-icon circle { fill: #fff; }
    .access-mobile-brand span:last-child { display: grid; }
    .access-mobile-brand small { color: #7f8b93; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
    .access-mobile-brand strong { margin-top: 2px; font-size: 17px; }
}

@media (max-width: 520px) {
    .access-panel { align-items: start; padding-right: 18px; padding-left: 18px; }
    .access-mobile-brand { margin-bottom: 54px; }
    .access-heading { margin-bottom: 28px; }
    .access-heading h2 { font-size: 30px; }
    .access-input-wrap { min-height: 54px; }
    .access-input-wrap input { font-size: 16px; }
    .access-security { justify-content: center; text-align: center; }
}

/* Paleta operativa final. Se mantiene al final para que ningún tema anterior
   reemplace los estados: pendiente rojo, levantado verde y nuevo morado. */
.status-option.pending .status-dot,
.result-status-dot.pending,
.business-card.pending .indicator,
.business-marker.pending {
    background-color: #d7263d !important;
}

.status-option.completed .status-dot,
.result-status-dot.completed,
.business-card.completed .indicator,
.business-marker.completed {
    background-color: #16705b !important;
}

.status-option.new .status-dot,
.result-status-dot.new,
.business-card.new .indicator,
.business-marker.new {
    background-color: #6651b8 !important;
}

.metric-card.pending strong,
.business-dialog #detailStatusLabel.pending { color: #d7263d !important; }
.metric-card.completed strong,
.business-dialog #detailStatusLabel.completed { color: #16705b !important; }
.metric-card.new strong,
.business-dialog #detailStatusLabel.new { color: #6651b8 !important; }

/* Ajustes operativos: solo Pendientes y Levantados. Los negocios agregados
   en campo continúan dentro de Pendientes, pero conservan el morado como
   identificación visual para reconocer dónde se creó cada registro nuevo. */
.status-filter:not(.status-filter-single) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.business-dialog #detailStatusLabel.new {
    color: #6651b8 !important;
    background: #f0edff !important;
}

/* Etiquetas territoriales más legibles, sin tapar innecesariamente el mapa. */
.quadrant-label,
.comuna-label {
    max-width: 190px;
    padding: 4px 9px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .96);
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(23, 33, 38, .24);
}
.quadrant-label.is-caba {
    color: #075985;
    background: rgba(239, 248, 255, .96);
    border-color: rgba(2, 132, 199, .24);
}

/* El contenedor de Google Maps queda aislado de los paneles para reducir
   repintados al abrir/cerrar filtros y mantener el desplazamiento fluido. */
#map,
.map-stage {
    contain: layout paint;
}
.google-marker-anchor,
.business-marker,
.business-name-label,
.quadrant-label,
.comuna-label {
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

@media (max-width: 420px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-card { padding-inline: 5px; }
    .metric-card span { font-size: 8px; }
}

/* 5.6.0 — devolución de calidad y visibilidad exclusiva por asignación. */
.validation-section {
    min-height: 0;
    max-height: 210px;
    padding: 12px 16px;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: #fbfcfc;
}
.validation-section .section-heading { margin-bottom: 8px; }
.validation-list,
.admin-validation-list {
    display: grid;
    gap: 7px;
    min-height: 0;
    max-height: 150px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}
.admin-validation-list { max-height: 280px; margin-top: 12px; }
.validation-card {
    display: grid;
    gap: 5px;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #dfe6e8;
    border-left: 4px solid #94a3b8;
    border-radius: 11px;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.validation-card:hover,
.validation-card:focus-visible {
    border-color: #9ebeb6;
    outline: none;
    box-shadow: 0 6px 18px rgba(26, 45, 52, .08);
    transform: translateY(-1px);
}
.validation-card.is-approved { border-left-color: #16705b; }
.validation-card.is-recovery { border-left-color: #d97706; }
.validation-card.is-cancelled { border-left-color: #b42318; }
.validation-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.validation-card-heading strong {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.validation-card-meta,
.validation-card-note {
    display: block;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}
.validation-card-note {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.validation-empty {
    padding: 12px;
    border: 1px dashed #cfd9dc;
    border-radius: 10px;
    color: var(--muted);
    background: #fff;
    font-size: 9px;
    line-height: 1.5;
}
.review-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    color: #52616a;
    background: #edf1f3;
    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}
.review-status.approved { color: #0e5d4d; background: #e1f3ed; }
.review-status.recovery { color: #8a5005; background: #fff0d8; }
.review-status.cancelled { color: #922d27; background: #fce6e4; }
.review-feedback,
.review-editor {
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid #dfe6e8;
    border-radius: 12px;
    background: #f8fafb;
}
.review-feedback-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}
.review-feedback p {
    color: var(--ink);
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
}
.review-feedback small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 8px;
}
.review-editor {
    border-color: #d7e4e1;
    background: #f5faf8;
}
.review-editor-grid { display: grid; gap: 2px; }
.review-editor .section-heading { margin-bottom: 12px; }
.review-editor .button { justify-self: end; }
.admin-validation-section {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid #dfe6e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(26,45,52,.045);
}
.compact-select {
    min-height: 34px;
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: 9px;
}

@media (max-width: 720px) {
    .validation-section { max-height: 180px; }
    .validation-list { max-height: 125px; }
    .review-feedback-heading { align-items: flex-start; flex-direction: column; }
}

/* ─────────────────────────────────────────────────────────────────────────
   ORIGEN DEL PADRÓN (prefijo del folio)

   Los folios llegan como "CL - 1178548" o "AR - 613". CL se pinta azul y
   AR café, tanto en el punto del mapa como en el indicador de la tarjeta.

   Regla de prioridad: el verde de "levantado" manda siempre. Por eso todos
   los selectores llevan :not(.completed) — así el avance del operativo
   nunca queda tapado por el color de origen. Este bloque va al final del
   archivo y usa un selector más específico que el de la paleta operativa
   (.business-marker.pending) para poder ganarle a su !important.
   ───────────────────────────────────────────────────────────────────────── */
:root {
    --origin-cl: #1d4ed8;
    --origin-cl-soft: #e8efff;
    --origin-ar: #7b4b2a;
    --origin-ar-soft: #f5ebe1;
}

/* Puntos del mapa */
.business-marker.origin-cl:not(.completed) {
    --marker-color: var(--origin-cl);
    --marker-glow: rgba(29, 78, 216, .24);
    --marker-shadow: rgba(23, 58, 160, .42);
    background-color: var(--origin-cl) !important;
}
.business-marker.origin-ar:not(.completed) {
    --marker-color: var(--origin-ar);
    --marker-glow: rgba(123, 75, 42, .24);
    --marker-shadow: rgba(88, 52, 28, .42);
    background-color: var(--origin-ar) !important;
}

/* Indicador de la tarjeta en la lista */
.business-card.origin-cl:not(.completed) .indicator {
    background-color: var(--origin-cl) !important;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .14);
}
.business-card.origin-ar:not(.completed) .indicator {
    background-color: var(--origin-ar) !important;
    box-shadow: 0 0 0 4px rgba(123, 75, 42, .14);
}

/* Folio visible para encuestador y administrador */
.business-folio {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .2px;
}
.business-folio.is-cl { background: var(--origin-cl-soft); color: var(--origin-cl); }
.business-folio.is-ar { background: var(--origin-ar-soft); color: var(--origin-ar); }

/* Folio dentro del diálogo de detalle */
.business-dialog #detailId {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.business-dialog #detailId.is-cl { color: var(--origin-cl); }
.business-dialog #detailId.is-ar { color: var(--origin-ar); }
