:root {
    color-scheme: dark;
    --bg: #050911;
    --bg-deep: #03070d;
    --panel: #09131f;
    --panel-2: #0b1826;
    --panel-soft: rgba(11, 24, 38, 0.82);
    --line: #1a3145;
    --line-strong: #24465f;
    --text: #f5f8fc;
    --muted: #8da2b5;
    --muted-2: #63798c;
    --blue: #159dff;
    --cyan: #0ed8d1;
    --green: #2bd97f;
    --yellow: #ffca28;
    --orange: #ff8b3d;
    --violet: #b45cff;
    --danger: #ff5a6a;
    --radius: 10px;
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 52% -20%, rgba(12, 88, 145, 0.18), transparent 36rem),
        linear-gradient(180deg, #050a12 0, var(--bg-deep) 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12.5px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
}

button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

svg {
    width: 1.25em;
    height: 1.25em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: 60px;
    padding: 7px clamp(16px, 1.7vw, 30px);
    border-bottom: 1px solid var(--line);
    background: rgba(3, 8, 15, 0.9);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
}

.brand, .system-strip, .country-identity, .source-controls {
    display: flex;
    align-items: center;
}

.brand { gap: 11px; min-width: 0; }

.brand-mark {
    width: 36px;
    height: 40px;
    display: grid;
    place-items: center;
    color: var(--blue);
    filter: drop-shadow(0 0 12px rgba(21, 157, 255, 0.35));
}

.brand-mark svg { width: 34px; height: 34px; stroke-width: 1.35; }
.brand-name { font-size: 18px; font-weight: 760; letter-spacing: 0.025em; line-height: 1.05; }
.brand-name span { color: #dbeeff; }
.brand-subtitle { color: var(--muted); font-size: 10px; margin-top: 2px; }

.system-strip { gap: 0; flex-shrink: 0; }
.system-strip > * { min-height: 32px; display: flex; align-items: center; }
.system-state, .data-readiness, .clock-block, .read-block { padding: 0 14px; border-right: 1px solid var(--line); }
.system-state { color: var(--green); font-weight: 650; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.system-state.error { color: var(--danger); }
.backend-state.checking { color: var(--yellow); }
.backend-state.stale, .backend-state.no-data { color: var(--danger); }
.data-readiness { gap: 6px; color: var(--blue); font-size: 8px; white-space: nowrap; }
.data-readiness.checking { color: var(--yellow); }
.data-readiness.ready { color: var(--green); }
.data-readiness.no-data { color: var(--danger); }
.data-readiness .status-dot { margin-right: 1px; }
.readiness-label { color: currentColor; font-weight: 700; }
.readiness-period { color: var(--muted); }
.readiness-period strong { color: #cfe4f2; font-size: 8.5px; font-weight: 700; }
.readiness-period.ready strong { color: var(--green); }
.clock-block { gap: 8px; }
.clock-label, .read-block span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.read-block { flex-direction: column; align-items: flex-start !important; justify-content: center; padding-right: 16px; }
.read-block time { color: #c6d3df; font-size: 10px; }
.icon-button {
    width: 34px;
    justify-content: center;
    margin-left: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #0b1824;
    transition: border-color .2s, background .2s, transform .2s;
}
.icon-button:hover { border-color: var(--blue); background: #0e2133; }
.icon-button:active { transform: translateY(1px); }
.icon-button.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dashboard {
    width: min(1880px, 100%);
    margin: 0 auto;
    padding: 11px clamp(12px, 1.15vw, 20px) 24px;
}

.error-banner {
    margin-bottom: 10px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 90, 106, .5);
    border-radius: 10px;
    background: rgba(92, 21, 33, .55);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.error-banner strong { display: block; }
.error-banner span { color: #ffb7c0; }
.error-banner button { border: 1px solid rgba(255,255,255,.28); background: transparent; border-radius: 7px; padding: 7px 13px; }

.panel, .metric-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(11, 25, 39, .96), rgba(6, 15, 25, .96));
    box-shadow: inset 0 1px rgba(255, 255, 255, .018), var(--shadow);
}

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

.metric-card {
    position: relative;
    grid-column: span 2;
    min-height: 92px;
    padding: 12px 11px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    overflow: hidden;
}
.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 55%;
    height: 1px;
    background: linear-gradient(90deg, var(--metric-accent), transparent);
    opacity: .7;
}
.metric-card::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -50px;
    bottom: -70px;
    border-radius: 50%;
    background: var(--metric-accent);
    opacity: .045;
    filter: blur(8px);
}
.metric-icon {
    width: 28px;
    height: 30px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: var(--metric-accent);
    background: transparent;
}
.metric-icon svg { width: 22px; height: 22px; filter: drop-shadow(0 0 7px color-mix(in srgb, var(--metric-accent) 24%, transparent)); }
.metric-content { min-width: 0; }
.metric-label { color: #c9d5df; font-size: 10.5px; white-space: nowrap; }
.metric-value { margin-top: 2px; font-size: clamp(20px, 1.45vw, 26px); font-weight: 720; letter-spacing: -.025em; line-height: 1.08; }
.metric-note { margin-top: 4px; color: var(--muted-2); font-size: 8.5px; white-space: nowrap; }
.transport-value { font-size: clamp(15px, 1.05vw, 19px); white-space: nowrap; }
.primary-grid {
    display: grid;
    grid-template-columns: minmax(340px, .68fr) minmax(720px, 1.32fr);
    gap: 9px;
    align-items: stretch;
}

.panel-header {
    min-height: 52px;
    padding: 9px 13px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.panel-header h2, .country-detail h2 { margin: 1px 0 0; font-size: 14px; font-weight: 680; }
.panel-header h2 { display: flex; align-items: center; gap: 8px; }
.panel-header h2 svg { color: var(--blue); }
.eyebrow { color: var(--muted-2); font-size: 8px; font-weight: 720; letter-spacing: .15em; text-transform: uppercase; }
.data-badge { color: var(--green); font-size: 8.5px; padding: 4px 7px; border: 1px solid rgba(43, 217, 127, .25); border-radius: 20px; background: rgba(43, 217, 127, .06); white-space: nowrap; }
.data-badge span { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.data-badge.blue { color: var(--blue); border-color: rgba(21,157,255,.25); background: rgba(21,157,255,.06); }

.map-panel { height: clamp(400px, 42vh, 450px); min-height: 400px; display: flex; flex-direction: column; overflow: hidden; }
.map-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at center, rgba(12, 78, 119, .21), transparent 62%), #040b13; }
.map-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(54,125,168,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(54,125,168,.35) 1px, transparent 1px); background-size: 62px 62px; mask-image: radial-gradient(ellipse, black 20%, transparent 76%); }
.world-map { position: absolute; inset: 3% 2%; width: 96%; height: 94%; filter: drop-shadow(0 8px 20px rgba(0,0,0,.4)); }
.map-land { fill: #102b43; stroke: #1d4b6c; stroke-width: 1.5; }
.map-borders { fill: none; stroke: #1a405b; stroke-width: 1; opacity: .75; }
.map-points circle { stroke: rgba(255,255,255,.6); stroke-width: .5; fill: var(--cyan); opacity: .72; filter: drop-shadow(0 0 4px var(--cyan)); }
.map-placeholder { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: min(350px, calc(100% - 32px)); padding: 13px 17px; border: 1px solid rgba(59, 111, 147, .4); border-radius: 9px; background: rgba(4, 12, 20, .83); backdrop-filter: blur(8px); text-align: center; box-shadow: 0 14px 44px rgba(0,0,0,.45); }
.map-placeholder-icon { width: 29px; height: 29px; margin: 0 auto 5px; display: grid; place-items: center; color: var(--blue); border-radius: 50%; background: rgba(21,157,255,.1); }
.map-placeholder strong { display: block; font-size: 11px; }
.map-placeholder span { display: block; color: var(--muted); font-size: 9px; margin-top: 2px; }
.map-legend { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 13px; padding: 7px 9px; background: rgba(3,9,15,.8); border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; }
.map-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--cyan); }.map-legend i.high { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.map-footer, .panel-footer, .chart-footer { min-height: 38px; padding: 8px 13px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 9px; }
.map-footer strong { color: #c3d0dc; font-weight: 530; }

.ranking-panel { min-width: 0; height: clamp(400px, 42vh, 450px); min-height: 400px; display: flex; flex-direction: column; overflow: hidden; }
.ranking-header-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.compact-select { color: var(--muted); font-size: 9px; display: flex; align-items: center; gap: 6px; }
select, input { border: 1px solid var(--line-strong); border-radius: 7px; background: #07111d; outline: none; transition: border-color .2s, box-shadow .2s; }
select:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,157,255,.1); }
.compact-select select { padding: 5px 22px 5px 7px; }
.table-scroll { width: 100%; overflow: auto; scrollbar-color: #23445e #07101a; scrollbar-width: thin; }
.ranking-scroll { flex: 1; overflow-x: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.data-table th { position: sticky; z-index: 2; top: 0; padding: 8px 7px; color: var(--muted); background: #091520; border-bottom: 1px solid var(--line); font-size: 7.5px; font-weight: 650; letter-spacing: .035em; text-align: right; text-transform: uppercase; white-space: nowrap; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { text-align: left; }
.data-table td { padding: 6px 7px; border-bottom: 1px solid rgba(26,49,69,.64); text-align: right; white-space: nowrap; }
.data-table tbody tr { transition: background .15s; }
.ranking-table { table-layout: fixed; }
.ranking-table th, .ranking-table td { padding-left: 5px; padding-right: 5px; overflow: hidden; text-overflow: ellipsis; }
.ranking-table th:nth-child(2) { width: 154px; }
.ranking-table th:nth-child(3) { width: 42px; }
.ranking-table th:nth-child(7) { width: 68px; }
.ranking-table tbody tr:not(.loading-row) { cursor: pointer; }
.ranking-table tbody tr:hover, .ranking-table tbody tr.selected { background: rgba(21,157,255,.075); }
.ranking-table tbody tr.selected td:first-child { color: var(--blue); box-shadow: inset 2px 0 var(--blue); }
.ranking-table td.country-cell { color: #e7eef5; font-weight: 570; }
.ranking-table td.country-cell .country-flag { display: inline-grid; place-items: center; width: 24px; height: 16px; margin-right: 6px; border: 0; border-radius: 1px; background-color: transparent; color: #96cfff; line-height: 1; vertical-align: -2px; overflow: hidden; }
.ranking-table td.country-cell .country-flag.fi { display: inline-block; background-color: transparent; }
.ranking-table td.country-cell .country-flag.flag-fallback { background: transparent; }
.country-flag.flag-fallback svg { width: 11px; height: 11px; }
.rank-cell { width: 35px; text-align: center !important; }
.sort-button { padding: 0; border: 0; background: transparent; color: inherit; text-transform: inherit; font: inherit; letter-spacing: inherit; white-space: nowrap; }
.sort-button::after { content: "↕"; display: inline-block; margin-left: 4px; color: #456278; }
.sort-button.active { color: #d7e8f5; }.sort-button.active.asc::after { content: "↑"; color: var(--blue); }.sort-button.active.desc::after { content: "↓"; color: var(--blue); }
.trend-cell { min-width: 68px; text-align: center !important; }
.trend-pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 58px; color: var(--muted); font-size: 8px; }
.trend-pill strong { font-size: 9px; font-weight: 720; }
.trend-pill small { color: var(--muted-2); font-size: 7px; }
.trend-pill.up strong { color: var(--green); }
.trend-pill.down strong { color: var(--danger); }
.trend-pill.flat strong { color: var(--muted); }
.trend-pill.unavailable { color: var(--muted-2); font-size: 7.5px; }
.loading-row td, .empty-row td { height: 90px; color: var(--muted); text-align: center !important; }
.loading-row span { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border: 2px solid #345064; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.panel-footer { margin-top: auto; }.row-action-hint { color: #628199; }
.trend-tabs { display: flex; align-items: center; }
.trend-tabs button { min-width: 54px; height: 29px; border: 1px solid var(--line); border-right: 0; background: #08121e; color: var(--muted-2); font-size: 9px; }
.trend-tabs button:first-child { border-radius: 7px 0 0 7px; }.trend-tabs button:nth-child(4) { border-right: 1px solid var(--line); border-radius: 0 7px 7px 0; }
.trend-tabs button.active { color: #dcecff; border-color: rgba(21,157,255,.55); background: rgba(21,157,255,.12); }
.traffic-tabs { display: flex; align-items: center; flex: 0 0 auto; }
.traffic-tabs button { height: 27px; padding: 0 7px; border: 1px solid var(--line); border-right: 0; background: #08121e; color: var(--muted-2); font-size: 8px; }
.traffic-tabs button:first-child { border-radius: 6px 0 0 6px; }
.traffic-tabs button:last-child { border-right: 1px solid var(--line); border-radius: 0 6px 6px 0; }
.traffic-tabs button.active { color: #dcecff; border-color: rgba(21,157,255,.55); background: rgba(21,157,255,.12); }
#historyMessage { color: var(--muted-2); text-align: right; }

.insight-grid { margin-top: 9px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 9px; }
.activity-panel, .top-sources-panel { min-width: 0; min-height: clamp(254px, 28vh, 300px); display: flex; flex-direction: column; overflow: hidden; }
.single-stat { text-align: right; }.single-stat span { color: var(--muted); font-size: 8.5px; display: block; }.single-stat strong { color: var(--cyan); font-size: 16px; }
.bucket-chart { min-height: 161px; flex: 1; padding: 15px 19px 6px; display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(7px, 1.6vw, 24px); align-items: end; }
.bucket-column { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bucket-value { margin-bottom: 4px; color: #dbe7ef; font-weight: 650; font-size: 10px; }
.bucket-bar-wrap { width: min(48px, 70%); height: 92px; display: flex; align-items: flex-end; }
.bucket-bar { position: relative; width: 100%; max-height: 100%; min-height: 4px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--bar-color), color-mix(in srgb, var(--bar-color) 45%, #07111d)); box-shadow: 0 0 14px color-mix(in srgb, var(--bar-color) 16%, transparent); transition: height .5s ease; }
.bucket-label { margin-top: 5px; color: #bed0dd; font-size: 9px; font-weight: 650; }.bucket-share { color: var(--muted-2); font-size: 8px; }
.chart-loading { grid-column: 1/-1; align-self: center; justify-self: center; color: var(--muted); }
.chart-footer { min-height: 39px; }
.chart-footer .single-stat { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.chart-footer .single-stat span { display: inline; }
.chart-footer .single-stat strong { font-size: 12px; }
.leader-list { list-style: none; margin: 0; padding: 1px 12px 6px; flex: 1; overflow: auto; }
.leader-list li { min-height: 38px; display: grid; grid-template-columns: 22px minmax(82px, 1fr) minmax(82px, 1fr) auto; align-items: center; gap: 6px; border-bottom: 1px solid rgba(26,49,69,.58); }
.leader-rank { color: var(--muted-2); font-size: 8.5px; }.leader-call { font-weight: 650; }.leader-country { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }.leader-country .leader-flag { width: 17px; height: 12px; margin-right: 5px; border: 0; border-radius: 1px; vertical-align: -2px; overflow: hidden; }.leader-country .leader-flag.flag-fallback { display: inline-grid; place-items: center; color: #96cfff; }.leader-frames { color: var(--cyan); font-weight: 650; }
.leader-loading { color: var(--muted); display: flex !important; justify-content: center; }

.country-modal { position: fixed; z-index: 100; inset: 0; padding: clamp(8px, 2vw, 24px); display: grid; place-items: center; }
.country-modal-backdrop { position: absolute; inset: 0; background: rgba(1, 5, 10, .82); backdrop-filter: blur(9px); }
.country-modal-dialog { position: relative; z-index: 1; width: min(1480px, 100%); height: min(850px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); margin: 0; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr); align-items: stretch; box-shadow: 0 28px 90px rgba(0,0,0,.7), 0 0 0 1px rgba(21,157,255,.08); animation: modal-in .18s ease-out; }
body.modal-open { overflow: hidden; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.992); } }
.country-detail-header { position: relative; min-width: 0; min-height: 76px; padding: 11px 58px 11px 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(21,157,255,.075), transparent 65%); }
.country-modal-close { position: absolute; top: 12px; right: 13px; width: 32px; height: 32px; padding: 0 0 2px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(7,17,29,.86); color: var(--muted); font-size: 22px; line-height: 1; }
.country-modal-close:hover, .country-modal-close:focus-visible { color: #fff; border-color: var(--blue); background: rgba(21,157,255,.12); outline: none; }
.country-identity { gap: 10px; min-width: 0; }
.country-orb { width: 31px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 2px; background: transparent; color: #d8f1ff; font-size: 9px; font-weight: 800; letter-spacing: .04em; overflow: hidden; }
.country-orb.has-flag { letter-spacing: 0; }
.country-orb .detail-flag { width: 29px; height: 21px; border: 0; border-radius: 1px; overflow: hidden; }
.country-orb .detail-flag.fi { display: inline-block; }
.country-orb .detail-flag.flag-fallback { display: grid; place-items: center; color: #d8f1ff; background: rgba(3, 12, 20, .32); }
.country-detail h2 { font-size: 17px; }.country-detail-header p { margin: 2px 0 0; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-period-control { flex: 0 0 auto; text-align: right; }
.country-period-control > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.country-period-tabs button { min-width: 44px; height: 26px; font-size: 8px; }
.country-metrics { min-width: 0; padding: 10px 14px 9px; border-bottom: 1px solid var(--line); overflow: hidden; }
.country-metrics-head, .country-metrics-row { display: grid; grid-template-columns: minmax(72px, .8fr) repeat(5, minmax(58px, 1fr)); align-items: stretch; column-gap: 5px; }
.country-metrics-head { height: 25px; padding: 0 8px; color: var(--muted-2); font-size: 7.5px; text-transform: uppercase; letter-spacing: .035em; }
.country-metrics-head span { display: flex; align-items: center; }.country-metrics-head span:not(:first-child) { justify-content: center; text-align: center; }
.country-metrics-row { min-height: 46px; margin-bottom: 5px; }
.country-metrics-row > strong, .country-metrics-row > span { min-width: 0; min-height: 46px; padding: 5px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: rgba(5,14,23,.7); text-align: center; }
.country-metrics-row strong { font-size: 10px; letter-spacing: .06em; }
.country-metrics-row span { color: #d7e3ec; font-size: 14px; font-weight: 690; }
.country-metrics-row.mode-all strong { color: #d7e3ec; }
.country-metrics-row.mode-all > * { border-color: rgba(141,162,181,.18); }
.country-metrics-row.mode-rf > * { border-color: rgba(43,217,127,.2); background: rgba(18,62,46,.2); }
.country-metrics-row.mode-rf strong, .country-metrics-row.mode-rf span:last-child { color: var(--green); }
.country-metrics-row.mode-internet > * { border-color: rgba(21,157,255,.2); background: rgba(15,55,84,.2); }
.country-metrics-row.mode-internet strong, .country-metrics-row.mode-internet span:last-child { color: var(--blue); }
.country-metrics-row.unavailable span { color: var(--muted-2); background: rgba(5,14,23,.45); }
.country-period-window { padding: 1px 8px 0; color: var(--muted-2); font-size: 7.5px; text-align: right; }
.source-section { min-width: 0; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.source-toolbar { min-height: 58px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.source-toolbar h3 { margin: 0; font-size: 14px; }.source-toolbar h3 span { color: var(--blue); }.source-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.source-controls { gap: 7px; min-width: 0; }
.search-field { position: relative; }.search-field svg { position: absolute; left: 8px; top: 8px; width: 13px; color: var(--muted); }.search-field input { width: 175px; height: 30px; padding: 5px 8px 5px 27px; font-size: 9px; }
.page-size { color: var(--muted); font-size: 8.5px; display: flex; align-items: center; gap: 5px; }.page-size select { height: 30px; padding: 4px 6px; font-size: 9px; }
.source-scroll { height: auto; min-height: 170px; max-height: none; flex: 1; }
.source-table { min-width: 890px; font-size: 9.5px; }.source-table th:first-child, .source-table td:first-child { text-align: left; }.source-table th:last-child, .source-table td:last-child { text-align: left; }.source-table td { padding-top: 6px; padding-bottom: 6px; }
.source-table td:first-child { color: #9ed5ff; font-weight: 680; }.source-table td.raw-frame { max-width: 310px; overflow: hidden; text-overflow: ellipsis; color: #8fa7b8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8.5px; }
.age-pill { display: inline-block; min-width: 59px; padding: 2px 5px; border-radius: 9px; background: rgba(21,157,255,.06); color: #9ec7e2; text-align: center; }
.pagination { min-height: 42px; padding: 7px 11px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); border-top: 1px solid var(--line); font-size: 8.5px; }.pagination > div { display: flex; align-items: center; gap: 7px; }.pagination button { padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: #0a1723; font-size: 8.5px; }.pagination button:hover:not(:disabled) { border-color: var(--blue); }.pagination button:disabled { opacity: .38; }

.site-footer { width: min(1880px, 100%); margin: 0 auto; padding: 10px clamp(14px, 1.4vw, 26px) 22px; border-top: 1px solid rgba(26,49,69,.45); color: var(--muted-2); font-size: 9px; display: flex; align-items: center; justify-content: space-between; gap: 14px; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.footer-meta { min-width: max-content; flex: 1 0 auto; display: flex; align-items: center; justify-content: flex-start; gap: 16px; }
.footer-meta > span, .footer-meta .visit-counter span { display: flex; align-items: center; gap: 6px; }
.site-footer svg { width: 13px; }
.site-footer .visit-counter { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.visit-counter strong { color: #c6d3df; font-weight: 680; }
.visit-counter i { width: 1px; height: 11px; background: var(--line-strong); }
.visit-counter.unavailable { color: var(--muted-2); }
.footer-system-strip { width: auto; min-width: max-content; flex: 0 0 auto; margin-top: 0; flex-wrap: nowrap; justify-content: flex-end; color: var(--muted-2); font-size: 8px; opacity: .52; transition: opacity .2s; }
.footer-system-strip:hover, .footer-system-strip:focus-within { opacity: .9; }
.footer-system-strip > * { min-height: 25px; }
.footer-system-strip .system-state, .footer-system-strip .data-readiness, .footer-system-strip .clock-block, .footer-system-strip .read-block { padding: 0 9px; }
.footer-system-strip .status-dot { width: 5px; height: 5px; box-shadow: none; }
.footer-system-strip .clock-label, .footer-system-strip .read-block span { font-size: 7px; }
.footer-system-strip .read-block time { font-size: 8px; }
.footer-system-strip .icon-button { width: 27px; height: 25px; min-height: 25px; margin-left: 5px; border-color: transparent; background: transparent; }
.footer-system-strip .icon-button:hover { border-color: var(--line-strong); background: rgba(21,157,255,.06); }

@media (max-width: 1100px) {
    .metric-card { grid-column: span 4; }
}

@media (max-width: 1180px) {
    .primary-grid { grid-template-columns: 1fr; }
    .ranking-panel { max-height: 470px; }
    .ranking-scroll { min-height: 350px; }
}

@media (max-width: 980px) {
    .topbar { align-items: flex-start; }
    .system-strip { flex-wrap: wrap; justify-content: flex-end; }
    .insight-grid { grid-template-columns: 1fr; }
    .ranking-header-controls { flex-wrap: wrap; }
    .footer-meta { flex-wrap: nowrap; }
    .footer-system-strip { flex-wrap: nowrap; }
}

@media (max-width: 720px) {
    body { font-size: 12px; }
    .topbar { position: relative; min-height: auto; flex-direction: column; gap: 7px; }
    .brand-name { font-size: 17px; }.brand-subtitle { font-size: 9px; }
    .system-strip { width: 100%; justify-content: space-between; }.system-state, .data-readiness, .clock-block { padding: 0 7px; }.system-state:first-child { padding-left: 0; }.icon-button { margin-left: 0; }
    .dashboard { padding-top: 9px; }
    .metric-grid { gap: 7px; }.metric-card { grid-column: span 6; min-height: 87px; padding: 10px 8px; }.metric-icon { width: 26px; height: 30px; }.metric-icon svg { width: 19px; height: 19px; }.metric-label { white-space: normal; }.metric-note { display: none; }.metric-value { font-size: 20px; }.transport-value { font-size: 13px; }
    .primary-grid { grid-template-columns: minmax(0, 1fr); }
    .map-panel { height: 360px; min-height: 345px; }.map-stage { min-height: 260px; }.map-footer { flex-direction: column; align-items: flex-start; }
    .ranking-panel { max-height: 450px; }.ranking-scroll { min-height: 330px; overflow-x: auto; }.ranking-table { min-width: 720px; }
    .ranking-header { align-items: flex-start; flex-direction: column; }.ranking-header-controls { width: 100%; justify-content: space-between; }.trend-tabs { overflow: auto; }
    .chart-footer { flex-wrap: wrap; }
    .bucket-chart { gap: 7px; padding-left: 9px; padding-right: 9px; }.bucket-bar-wrap { width: 70%; }.bucket-value { font-size: 10px; }.bucket-label { font-size: 9px; }
    .country-modal { padding: 6px; }
    .country-modal-dialog { width: 100%; height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); }
    .country-detail-header { align-items: flex-start; flex-direction: column; gap: 8px; padding-right: 52px; }.country-period-control { width: 100%; text-align: left; }.country-period-tabs { width: 100%; }.country-period-tabs button { flex: 1; }
    .country-metrics { overflow-x: auto; }
    .country-metrics-head, .country-metrics-row, .country-period-window { min-width: 590px; }
    .source-toolbar { align-items: flex-start; flex-direction: column; }.source-controls { width: 100%; flex-wrap: wrap; }.search-field { flex: 1; }.search-field input { width: 100%; }
    .source-scroll { min-height: 140px; }
    .pagination { flex-direction: column; gap: 6px; }
    .footer-meta { flex-direction: row; align-items: center; gap: 12px; }
    .footer-system-strip { width: auto; justify-content: flex-start; }
}

@media (max-width: 440px) {
    .metric-card { grid-column: span 6; min-height: 84px; }.metric-card:nth-child(n+4) { min-height: 84px; }
    .metric-value { font-size: 18px; }.metric-note { display: none; }
    .panel-header { align-items: flex-start; }.ranking-header { flex-direction: column; }
    .country-metrics-row span { font-size: 13px; }
    .leader-list li { grid-template-columns: 22px 1fr auto; }.leader-country { display: none; }
}

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