:root {
    --bg: #eef3f9;
    --bg-soft: #f7f9fc;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-soft: rgba(252, 253, 255, 0.96);
    --text: #1f2937;
    --muted: #6b7280;
    --border: #dbe4ee;
    --border-soft: #e7edf4;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    --primary: #2563eb;
    --good: #16a34a;
    --warn: #d97706;
    --orange: #ea580c;
    --bad: #dc2626;
    --chip: #f8fbff;
    --radius: 16px;
    --header-h: 96px;
    --font-sans: Arial, Helvetica, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #f6f9fd 0%, #edf3f9 100%);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 400;
}

body,
button,
input,
select,
textarea,
table,
th,
td,
h1,
h2,
h3,
h4,
h5,
h6,
strong,
b,
summary {
    font-family: var(--font-sans);
    font-weight: 400;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    height: var(--header-h);
    padding: 16px 18px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(246, 249, 253, 0.94);
    backdrop-filter: blur(8px);
}

.brand {
    min-width: 0;
}

.brand__eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.12);
    background: rgba(37, 99, 235, 0.08);
    color: #2155c8;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand__title {
    margin: 10px 0 4px;
    font-size: 28px;
    line-height: 1.08;
}

.brand__sub {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.topbar__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.badge--muted {
    color: var(--muted);
}

.badge--loading {
    border-color: rgba(217, 119, 6, 0.24);
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
    box-shadow: 0 8px 18px rgba(217, 119, 6, 0.12);
}

.badge--pulse {
    animation: badgePulse 1.15s ease-in-out infinite alternate;
}

.layout {
    height: calc(100vh - var(--header-h));
    padding: 12px;
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 390px;
    gap: 12px;
}

.sidebar,
.workspace,
.detailbar {
    min-height: 0;
}

.workspace {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 235px;
    gap: 12px;
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-soft);
}

.panel__title {
    font-size: 15px;
    line-height: 1.25;
}

.panel__hint {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.panel__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.panel__body {
    min-height: 0;
    padding: 12px 14px 14px;
}

.panel__body--map {
    padding: 0;
}

.filtersBody,
.tableBody {
    overflow: hidden;
}

.detailScroll {
    overflow: auto;
    padding-right: 10px;
}

.detailScroll::-webkit-scrollbar {
    width: 8px;
}

.detailScroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.summaryGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.summaryCard {
    min-height: 92px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.summaryCard__label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.summaryCard__value {
    margin-top: 8px;
    font-size: 26px;
    line-height: 1;
}

.summaryCard__meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.controlGroup {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control > span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
}

.control input,
.control select {
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    outline: none;
}

.control input:focus,
.control select:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.customRangeRow {
    display: none;
}

.customRangeRow.is-visible {
    display: grid;
}

.buttonRow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    border-color: #c9d6e5;
    background: #fbfdff;
    text-decoration: none;
}

.btn--primary {
    border-color: #2d6df0;
    background: #2d6df0;
    color: #ffffff;
}

.btn--primary:hover {
    background: #215dd3;
    border-color: #215dd3;
}

.btn.is-disabled,
.btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.55;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #dbeafe;
}

.leaflet-container {
    font-family: var(--font-sans);
}

.mapWatermark,
.mapLegend {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
    padding: 10px 12px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.mapLegend strong,
.mapWatermark strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
}

.legendRow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.legendSwatch,
.legendRing {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(31, 41, 55, 0.14);
}

.legendRing {
    background: rgba(255, 255, 255, 0.6);
}

.tableWrap {
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #ffffff;
}

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

.table thead th {
    padding: 10px 10px;
    text-align: left;
    color: var(--muted);
    background: #f8fbff;
    border-bottom: 1px solid var(--border-soft);
}

.table tbody td {
    padding: 10px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
}

.table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: #f8fbff;
}

.table tbody tr.is-selected {
    background: #eef5ff;
}

.placeCell {
    min-width: 240px;
    line-height: 1.35;
}

.tableFoot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.metricPill,
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(214, 226, 243, 0.96);
    background: var(--chip);
    color: var(--text);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.metricPill--mag {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.08);
    color: #2155c8;
}

.chip--good {
    border-color: rgba(22, 163, 74, 0.18);
    background: rgba(22, 163, 74, 0.10);
    color: #166534;
}

.chip--warn {
    border-color: rgba(217, 119, 6, 0.22);
    background: rgba(217, 119, 6, 0.10);
    color: #92400e;
}

.chip--orange {
    border-color: rgba(234, 88, 12, 0.2);
    background: rgba(234, 88, 12, 0.10);
    color: #9a3412;
}

.chip--bad {
    border-color: rgba(220, 38, 38, 0.18);
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
}

.chip--muted {
    color: var(--muted);
}

.chipRow,
.fileGrid,
.linkList {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.emptyState {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 24px 18px;
    text-align: center;
    color: var(--muted);
}

.emptyState h2 {
    margin: 0 0 8px;
    font-size: 28px;
    color: var(--text);
}

.emptyState p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
}

.emptyRow td {
    color: var(--muted);
    padding: 18px 10px;
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.95) 0%, rgba(241, 245, 249, 0.98) 45%, rgba(226, 232, 240, 0.95) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.skeleton--text {
    height: 10px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.detailStack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eventHero {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.8);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.06));
}

.eventHero__eyebrow {
    margin-bottom: 8px;
    color: #2155c8;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eventHero h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.22;
}

.eventHero__meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.statGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.statCard {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.statCard__label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.statCard__value {
    margin-top: 6px;
    font-size: 16px;
    line-height: 1.35;
}

.statCard__sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.detailSection {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--panel-soft);
    overflow: hidden;
}

.detailSection > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    position: relative;
    background: #fbfdff;
}

.detailSection > summary::-webkit-details-marker {
    display: none;
}

.detailSection > summary::after {
    content: "+";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.detailSection[open] > summary::after {
    content: "–";
}

.detailSection__body {
    padding: 0 14px 14px;
}

.kvGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kvItem {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
}

.kvItem__label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.kvItem__value {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.mono,
.kvItem__value code,
.jsonBlock {
    font-family: var(--font-mono);
}

.fileLink {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    font-size: 11px;
    line-height: 1;
    text-decoration: none;
}

.productGrid {
    display: grid;
    gap: 10px;
}

.productCard {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
}

.productCard__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.productCard__title {
    font-size: 14px;
    line-height: 1.3;
}

.productCard__meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.productCard details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.productCard details summary {
    color: #2155c8;
    cursor: pointer;
    font-size: 12px;
}

.jsonBlock {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    padding: 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #dbeafe;
    font-size: 11px;
    line-height: 1.5;
}

.notice {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #fbfdff;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.notice--error {
    border-color: rgba(252, 165, 165, 0.6);
    background: rgba(254, 242, 242, 0.96);
    color: #991b1b;
}

.popup {
    min-width: 280px;
    max-width: 340px;
}

.popup__titleRow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.popup__title {
    font-size: 14px;
    line-height: 1.35;
}

.popup__meta,
.popup__footer {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.popup__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.popup__cell {
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.popup__cell span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
}

.popup__value {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
}

.leaflet-popup-content-wrapper {
    border-radius: 14px;
}

.leaflet-popup-content {
    margin: 12px;
}

.mutedText {
    color: var(--muted);
}

@media (max-width: 1450px) {
    .layout {
        grid-template-columns: 270px minmax(0, 1fr) 360px;
    }
}

@media (max-width: 1180px) {
    body {
        overflow: auto;
    }

    .layout {
        height: auto;
        grid-template-columns: 1fr;
    }

    .workspace {
        grid-template-rows: 520px auto;
    }

    .detailScroll,
    .filtersBody,
    .tableBody {
        overflow: visible;
    }
}

@media (max-width: 760px) {
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
    }

    .layout {
        padding: 10px;
    }

    .grid2,
    .summaryGrid,
    .statGrid,
    .kvGrid,
    .popup__grid,
    .buttonRow {
        grid-template-columns: 1fr;
    }

    .tableFoot,
    .panel__head,
    .panel__actions,
    .topbar__meta {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }
}


/* --- final dashboard layout and controls patch --- */
:root {
    --header-h: 88px;
    --list-panel-height: 300px;
}

.layout {
    grid-template-columns: 276px minmax(0, 1fr) 410px;
    gap: 10px;
}

.workspace {
    grid-template-rows: minmax(0, 1fr) var(--list-panel-height);
    gap: 10px;
}

.panel__title,
.brand__title,
.brand__sub,
.summaryCard__value,
.summaryCard__label,
.summaryCard__meta,
.control > span,
.statCard__value,
.statCard__label,
.statCard__sub,
h1,
h2,
h3,
h4,
h5,
h6,
strong,
b {
    font-weight: 400;
}

.brand__title {
    font-size: 24px;
    margin-top: 8px;
}

.brand__sub {
    font-size: 13px;
}

.topbar {
    height: var(--header-h);
    padding: 14px 18px 12px;
}

.layout,
.sidebar,
.workspace,
.detailbar,
.mapPanel,
.listPanel,
.detailPanel {
    min-height: 0;
}

.panel__head {
    padding: 12px 14px 10px;
}

.panel__title {
    font-size: 14px;
}

.panel__hint {
    font-size: 11px;
    line-height: 1.35;
}

.panel__body {
    flex: 1 1 auto;
    min-height: 0;
}

.panel__body--map {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
}

.filtersBody,
.tableBody {
    min-height: 0;
    overflow: hidden;
}

.filtersBody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
}

.sidebar .summaryGrid {
    gap: 8px;
    margin-bottom: 0;
}

.sidebar .summaryCard {
    min-height: 82px;
    padding: 10px;
}

.sidebar .summaryCard__label {
    font-size: 10px;
}

.sidebar .summaryCard__value {
    margin-top: 6px;
    font-size: 18px;
    line-height: 1.1;
}

.sidebar .summaryCard__meta {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.35;
}

.filterBlock {
    padding: 10px 10px 0;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #fbfdff;
}

.filterBlock__title {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.controlGroup {
    gap: 8px;
}

.control {
    gap: 5px;
}

.control > span {
    font-size: 10px;
}

.control input,
.control select {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
}

.grid2 {
    gap: 8px;
}

.buttonRow {
    gap: 8px;
}

.btn {
    min-height: 36px;
    padding: 0 11px;
    font-size: 13px;
    font-weight: 400;
}

.chipButtonRow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding-bottom: 10px;
}

.filterChip {
    min-height: 32px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
}

.filterChip:hover {
    border-color: #c9d6e5;
    color: var(--text);
    background: #ffffff;
}

.filterChip.is-active {
    border-color: rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.08);
    color: #2155c8;
}

.panel__actions--stack {
    align-items: flex-end;
    gap: 8px;
}

.panelActionRow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.rangeControl {
    display: grid;
    grid-template-columns: auto minmax(120px, 180px) auto;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.rangeControl input[type="range"] {
    width: 100%;
}

.rangeControl output {
    min-width: 48px;
    text-align: right;
    color: var(--text);
    font-size: 11px;
}

.mapPanel,
.listPanel,
.detailPanel {
    min-height: 0;
}

#map {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 320px;
    background: #dbeafe;
}

.tableBody {
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

.tableWrap {
    flex: 1 1 auto;
    height: auto;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

.tableWrap::-webkit-scrollbar,
.detailScroll::-webkit-scrollbar,
.jsonBlock::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.tableWrap::-webkit-scrollbar-thumb,
.detailScroll::-webkit-scrollbar-thumb,
.jsonBlock::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.table {
    min-width: 100%;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 11px;
}

.table tbody td {
    font-size: 12px;
}

.detailScroll {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable both-edges;
    padding-right: 8px;
}

.detailPanel .panel__body {
    padding-top: 10px;
}

.emptyState {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tableFoot {
    margin-top: 8px;
    font-size: 11px;
}

.mapWatermark,
.mapLegend {
    font-size: 11px;
}

.badge {
    font-size: 12px;
}

@media (max-width: 1450px) {
    .layout {
        grid-template-columns: 264px minmax(0, 1fr) 388px;
    }

    .rangeControl {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .rangeControl output {
        text-align: left;
    }
}

@media (max-width: 1180px) {
    body {
        overflow: auto;
    }

    .layout {
        height: auto;
        grid-template-columns: 1fr;
    }

    .workspace {
        grid-template-rows: 480px var(--list-panel-height);
    }

    .filtersBody,
    .tableBody,
    .detailScroll {
        overflow: visible;
    }
}

@media (max-width: 760px) {
    .chipButtonRow,
    .grid2,
    .summaryGrid,
    .buttonRow {
        grid-template-columns: 1fr;
    }

    .panel__actions--stack,
    .panelActionRow,
    .topbar__meta {
        align-items: flex-start;
        justify-content: flex-start;
    }
}


/* --- final polish patch: right detail scrolling, source note outside map, all-data option --- */
.detailbar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.detailPanel {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.detailPanel .panel__head {
    flex: 0 0 auto;
}

.detailPanel .panel__body,
.detailScroll {
    flex: 1 1 auto;
    min-height: 0;
}

.detailScroll {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}

.panel__body--map {
    display: flex;
    flex-direction: column;
}

.mapSourceNote {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(248, 251, 255, 0.95);
    color: var(--text);
    font-size: 11px;
    line-height: 1.4;
}

.mapSourceNote__title {
    color: #2155c8;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.mapSourceNote__text {
    color: var(--muted);
}

#map {
    min-height: 0;
}

@media (max-width: 1180px) {
    .detailbar {
        height: auto;
    }

    .detailPanel {
        height: auto;
    }
}

/* --- final cache, notes, and compact size controls patch --- */
:root {
    --list-panel-height: 320px;
}

.sidebar .summaryCard {
    min-height: 88px;
    padding: 11px;
}

.sidebar .summaryCard__label {
    font-size: 11px;
}

.sidebar .summaryCard__value {
    font-size: 20px;
}

.sidebar .summaryCard__meta {
    font-size: 10.5px;
    line-height: 1.45;
}

.filterBlock__title,
.control > span {
    font-size: 11px;
}

.control input,
.control select {
    min-height: 38px;
    font-size: 13.5px;
}

.filterChip {
    min-height: 34px;
    font-size: 12.5px;
}

.filtersBody {
    gap: 12px;
}

.controlGroup {
    gap: 9px;
}

.buttonRow {
    gap: 9px;
}

.sidebarNote {
    margin-top: auto;
    padding: 12px 12px 13px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #fbfdff;
}

.sidebarNote__title {
    margin-bottom: 6px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.3;
}

.sidebarNote__text {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.55;
}

.panelActionRow--tight {
    align-items: center;
}

.iconControl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #fbfdff;
}

.iconBtn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    font-weight: 400;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.iconBtn:hover {
    border-color: #c8d4e4;
    background: #f9fbff;
}

.iconBtn:active {
    transform: translateY(1px);
}

.iconBtn:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

#limitInput:disabled {
    background: #f5f8fc;
    color: var(--muted);
    cursor: not-allowed;
}

.tableFoot {
    gap: 10px;
}

@media (max-width: 1450px) {
    .iconControl {
        order: -1;
    }
}

@media (max-width: 760px) {
    .panelActionRow--tight {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .iconControl {
        justify-content: center;
    }
}

/* --- final compatibility and draggable divider patch --- */
:root {
    --map-panel-min-height: 300px;
    --workspace-resizer-height: 18px;
    --list-panel-height: 320px;
}

.layout {
    grid-template-columns: 286px minmax(0, 1fr) 402px;
}

.workspace {
    gap: 0;
    grid-template-rows: minmax(var(--map-panel-min-height), 1fr) var(--workspace-resizer-height) var(--list-panel-height);
}

.mapPanel {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-width: 0;
}

.listPanel {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top-width: 0;
}

.workspaceResizer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -1px 0;
    cursor: row-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    z-index: 3;
}

.workspaceResizer::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    background: var(--border);
}

.workspaceResizer__handle {
    position: relative;
    width: 58px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #c9d6e5;
    border-radius: 999px;
    background: rgba(248, 251, 255, 0.98);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    cursor: row-resize;
}

.workspaceResizer__handle span,
.workspaceResizer__handle::before,
.workspaceResizer__handle::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 1.5px;
    border-radius: 999px;
    background: #9fb3c8;
}

.workspaceResizer__handle span {
    top: 50%;
    transform: translateY(-50%);
}

.workspaceResizer__handle::before {
    top: calc(50% - 4px);
}

.workspaceResizer__handle::after {
    top: calc(50% + 2px);
}

.workspaceResizer__handle:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

.workspaceResizer.is-active .workspaceResizer__handle,
.workspaceResizer:hover .workspaceResizer__handle {
    border-color: rgba(37, 99, 235, 0.26);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.10);
}

body.is-resizing-panels,
body.is-resizing-panels * {
    cursor: row-resize !important;
}

.sidebar .panel__title {
    font-size: 15px;
}

.sidebar .panel__hint,
.sidebar .filterBlock__title,
.sidebar .control > span {
    font-size: 11.5px;
}

.sidebar .summaryCard__label {
    font-size: 11.5px;
}

.sidebar .summaryCard__value {
    font-size: 22px;
}

.sidebar .summaryCard__meta {
    font-size: 11px;
}

.sidebar .control input,
.sidebar .control select,
.sidebar .btn {
    font-size: 14px;
}

.sidebar .filterChip {
    font-size: 13px;
}

.sidebarNote__title {
    font-size: 12.5px;
}

.sidebarNote__text {
    font-size: 11.75px;
}

@media (max-width: 1450px) {
    .layout {
        grid-template-columns: 270px minmax(0, 1fr) 388px;
    }
}

@media (max-width: 1180px) {
    .workspace {
        gap: 10px;
        grid-template-rows: 480px auto auto;
    }

    .mapPanel,
    .listPanel {
        border-radius: var(--radius);
        border-width: 1px;
    }

    .workspaceResizer {
        display: none;
    }
}


/* --- final v5 polish: map search dock, no result limit field, stronger sidebar copy --- */
.panel__head--mapbar {
    align-items: center;
}

.panel__actions--mapbar {
    align-items: center;
    gap: 10px;
}

.mapSearch {
    min-width: min(340px, 42vw);
    display: inline-flex;
    align-items: center;
}

.mapSearch input {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
}

.mapSearch input:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    outline: none;
}

.catalogRangeNote {
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #fbfdff;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.sidebar .panel__hint,
.sidebar .filterBlock__title,
.sidebar .control > span,
.sidebar .summaryCard__label,
.sidebar .summaryCard__meta,
.sidebarNote__text,
.catalogRangeNote {
    font-size: 12px;
}

.sidebar .control input,
.sidebar .control select,
.sidebar .btn,
.sidebar .filterChip {
    font-size: 14.5px;
}

.sidebar .summaryCard__value {
    font-size: 24px;
}

@media (max-width: 1180px) {
    .panel__actions--mapbar {
        width: 100%;
        justify-content: flex-start;
    }

    .mapSearch {
        min-width: 0;
        width: 100%;
    }
}

/* --- final v10 layout, side resizers, and form fixes --- */
:root {
    --sidebar-left-width: 280px;
    --sidebar-right-width: 360px;
    --side-resizer-width: 18px;
}

.layout {
    grid-template-columns: var(--sidebar-left-width) var(--side-resizer-width) minmax(0, 1fr) var(--side-resizer-width) var(--sidebar-right-width);
    gap: 0;
}

.sidebar,
.workspace,
.detailbar {
    min-width: 0;
}

.sidebar,
.detailbar {
    overflow: hidden;
}

.sideResizer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.sideResizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: var(--border);
}

.sideResizer__handle {
    position: relative;
    width: 12px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #c9d6e5;
    border-radius: 999px;
    background: rgba(248, 251, 255, 0.98);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    cursor: col-resize;
}

.sideResizer__handle span,
.sideResizer__handle::before,
.sideResizer__handle::after {
    content: "";
    position: absolute;
    width: 1.5px;
    height: 18px;
    border-radius: 999px;
    background: #9fb3c8;
}

.sideResizer__handle span {
    left: 50%;
    transform: translateX(-50%);
}

.sideResizer__handle::before {
    left: calc(50% - 4px);
}

.sideResizer__handle::after {
    left: calc(50% + 2px);
}

.sideResizer__handle:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

.sideResizer.is-active .sideResizer__handle,
.sideResizer:hover .sideResizer__handle {
    border-color: rgba(37, 99, 235, 0.26);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.10);
}

.customRangeRow[hidden] {
    display: none !important;
}

#startDate,
#endDate {
    font-variant-numeric: tabular-nums;
}

.detailSection > summary,
.productCard > summary {
    cursor: pointer;
}

.productCard {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #fbfdff;
    margin-bottom: 10px;
}

.productCard > summary {
    padding: 10px 12px;
    list-style: none;
}

.productCard > summary::-webkit-details-marker {
    display: none;
}

.productCard__body {
    padding: 0 12px 12px;
}

.fileLink--muted {
    color: var(--muted);
}

@media (max-width: 1280px) {
    .layout {
        grid-template-columns: 260px 14px minmax(0, 1fr) 14px 330px;
    }
}

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sideResizer {
        display: none;
    }
}

/* --- final v12 popup, detail formatting, and date polish --- */
.pill,
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    margin: 2px 6px 2px 0;
    border-radius: 999px;
    border: 1px solid rgba(214, 226, 243, 0.96);
    background: var(--chip);
    color: var(--text);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.pill--primary,
.metricPill--mag {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.08);
    color: #2155c8;
}

#startDate,
#endDate {
    color-scheme: light;
    font-variant-numeric: tabular-nums;
}

.popupCard {
    min-width: 276px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popupCard__title {
    font-size: 15px;
    line-height: 1.35;
    color: var(--text);
}

.popupCard__chips,
.popupCard__products,
.heroCard__chips,
.fileLinks {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.popupMetaGrid,
.detailGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.popupMetaGrid > div,
.detailCell {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.popupMetaGrid strong,
.detailCell__label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
}

.popupMetaGrid span,
.detailCell__value {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text);
    word-break: break-word;
}

.detailCell__sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.popupCard__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.popupCard__links a,
.popupCard__links .popupActionBtn,
.fileLinks .fileLink,
.fileLinks .popupActionBtn {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: #2155c8;
    font-size: 11px;
    line-height: 1;
    text-decoration: none;
}

.popupCard__links a:hover,
.popupCard__links .popupActionBtn:hover,
.fileLinks .fileLink:hover,
.fileLinks .popupActionBtn:hover {
    text-decoration: none;
    border-color: rgba(37, 99, 235, 0.18);
    background: #f8fbff;
}

.popup__footer {
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fbff;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.popup__footer--error {
    background: rgba(254, 242, 242, 0.96);
    color: #991b1b;
}

.earthquakePopup .leaflet-popup-content-wrapper {
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
}

.earthquakePopup .leaflet-popup-content {
    margin: 14px;
}

.heroCard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(191, 219, 254, 0.85);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(14, 165, 233, 0.06));
}

.heroCard__eyebrow {
    color: #2155c8;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.heroCard__title {
    font-size: 20px;
    line-height: 1.25;
    color: var(--text);
}

.heroCard__meta {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.detailSection > summary,
.productCard > summary {
    font-size: 14px;
    line-height: 1.35;
}

.detailSection__body,
.productCard__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.table td .pill {
    margin-right: 4px;
}

@media (max-width: 760px) {
    .popupMetaGrid,
    .detailGrid {
        grid-template-columns: 1fr;
    }
}


@keyframes badgePulse {
    from { transform: translateY(0); box-shadow: 0 8px 18px rgba(217, 119, 6, 0.10); }
    to { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(217, 119, 6, 0.18); }
}
