:root {
  --ink: #17312f;
  --muted: #6f7f7c;
  --line: #dce6e2;
  --paper: #fff;
  --glass: rgb(255 255 255 / 78%);
  --canvas: #eaf3f2;
  --brand: #0b766d;
  --brand-dark: #075c55;
  --boys: #2878b5;
  --girls: #c75b8b;
  --mixed: #d98e22;
  --surface-soft: #f8faf9;
  --premium-glow: rgb(85 199 185 / 32%);
  --surface-hover: #f2f8f6;
  --shadow: rgb(20 54 48 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

[data-theme="dark"] {
  --ink: #e6f0ed;
  --muted: #9eb0ac;
  --line: #2c4541;
  --paper: #142724;
  --glass: rgb(20 39 36 / 76%);
  --canvas: #0b1715;
  --brand: #55c7b9;
  --brand-dark: #8bd9cf;
  --surface-soft: #1a302c;
  --premium-glow: rgb(85 199 185 / 24%);
  --surface-hover: #203a35;
  --shadow: rgb(0 0 0 / 32%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-columns: 390px 1fr; height: 100%; min-height: 0; overflow: hidden; background: radial-gradient(circle at 62% 8%, var(--premium-glow), transparent 32%), var(--canvas); transition: grid-template-columns .28s cubic-bezier(.22, 1, .36, 1); }
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: color-mix(in srgb, var(--paper) 92%, transparent); box-shadow: 8px 0 30px var(--shadow); backdrop-filter: blur(18px); z-index: 1000; }
.app-shell.list-collapsed .school-list,
.app-shell.list-collapsed .sidebar-footer { display: none; }
.app-shell.list-collapsed .controls { border-bottom: 0; }
.brand { display: flex; gap: 13px; align-items: center; padding: 25px 24px 20px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 16%, var(--paper)); }
.brand-mark svg { width: 25px; fill: var(--brand); }
.eyebrow { margin: 0 0 2px; color: var(--brand); font-size: 11px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.controls { position: relative; z-index: 10; padding: 0 24px 16px; border-bottom: 1px solid var(--line); }
.search-wrap { position: relative; display: block; }
.search-wrap svg { position: absolute; top: 12px; left: 13px; width: 19px; fill: var(--muted); }
.search-wrap input { width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: var(--surface-soft); color: var(--ink); }
.search-wrap input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(11 118 109 / 12%); }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.filter-control > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
select { width: 100%; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--paper); color: var(--ink); font-size: 13px; }
.multi-select { position: relative; }
.multi-select.is-open { z-index: 30; }
.multi-select-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 12px; cursor: pointer; }
.multi-select-trigger:hover, .multi-select.is-open .multi-select-trigger { border-color: var(--brand); }
.multi-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-menu { position: static; width: 100%; margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 10px 28px var(--shadow); }
.multi-select-search { width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: var(--surface-soft); color: var(--ink); font-size: 12px; }
.multi-select-options { max-height: 190px; overflow-y: auto; margin: 6px 0; }
.multi-select-option { display: flex; gap: 8px; align-items: center; padding: 7px 5px; border-radius: 6px; color: var(--ink); font-size: 12px; cursor: pointer; }
.multi-select-option:hover { background: var(--surface-hover); }
.multi-select-option input { accent-color: var(--brand); }
.multi-select-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding-top: 6px; border-top: 1px solid var(--line); }
.multi-select-actions button { min-height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--brand); font-size: 10px; font-weight: 800; cursor: pointer; }
.summary-row { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; }
.summary-row p { margin: 0; color: var(--muted); font-size: 13px; }
.summary-row strong { color: var(--ink); }
.text-button { border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; }
.school-list { position: relative; z-index: 1; flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px; scrollbar-width: thin; }
.school-card { position: relative; display: grid; grid-template-columns: 4px 1fr 18px; gap: 12px; align-items: center; width: 100%; padding: 13px 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 8px; text-align: left; background: transparent; cursor: pointer; }
.school-card:hover, .school-card:focus-visible, .school-card.is-previewed { background: var(--surface-hover); outline: none; }
.card-color { align-self: stretch; border-radius: 3px; background: var(--mixed); }
.card-copy { display: flex; flex-direction: column; min-width: 0; }
.school-name { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.school-name-ar { overflow: hidden; margin-top: 3px; color: var(--ink); opacity: .8; font-size: 13px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.school-meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.chevron { width: 16px; fill: #99aaa6; }
.sidebar-footer { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; text-align: center; }
[dir="rtl"] .sidebar,
[dir="rtl"] .school-card,
[dir="rtl"] .analysis-panel,
[dir="rtl"] .popup-title,
[dir="rtl"] .popup-meta { text-align: right; }
[dir="rtl"] .search-wrap svg { right: 13px; left: auto; }
[dir="rtl"] .search-wrap input { padding: 0 42px 0 14px; }
[dir="rtl"] .school-card { grid-template-columns: 18px 1fr 4px; }
[dir="rtl"] .card-color { grid-column: 3; }
[dir="rtl"] .card-copy { grid-column: 2; }
[dir="rtl"] .chevron { grid-column: 1; transform: rotate(180deg); }
[dir="rtl"] .school-name-ar { text-align: right; }
[dir="rtl"] .map-actions { direction: rtl; }
[dir="rtl"] .legend { direction: rtl; }
[dir="rtl"] .leaflet-popup-content { direction: rtl; text-align: right; }
.map-panel, #map { position: relative; width: 100%; height: 100%; min-height: 0; }
.map-panel { overflow: hidden; }
#ambient-canvas { position: absolute; z-index: 640; inset: 0; width: 100%; height: 100%; opacity: .58; mix-blend-mode: screen; pointer-events: none; }
.map-panel::before { content: ""; position: absolute; z-index: 630; inset: 0; background: radial-gradient(circle at 73% 16%, rgb(85 199 185 / 18%), transparent 26%), linear-gradient(120deg, rgb(255 255 255 / 16%), transparent 26%, rgb(5 84 78 / 12%)); pointer-events: none; }
.map-actions { position: absolute; z-index: 850; top: 16px; right: 16px; display: flex; gap: 8px; }
.action-button, .icon-button { display: flex; gap: 7px; align-items: center; min-height: 40px; padding: 0 13px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 12px; background: var(--glass); box-shadow: 0 10px 28px var(--shadow); backdrop-filter: blur(18px); font-size: 12px; font-weight: 700; cursor: pointer; }
.action-button:hover, .icon-button:hover { background: var(--paper); color: var(--brand); }
.action-button svg, .icon-button svg { width: 17px; fill: currentColor; }
.ask-ai-button { position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); color: var(--brand); }
.ask-ai-button::after { content: ""; position: absolute; inset: -80% auto -80% -45%; width: 42%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 55%), transparent); transform: rotate(18deg); animation: ask-ai-shine 3.2s ease-in-out infinite; pointer-events: none; }
.ask-ai-button svg { filter: drop-shadow(0 0 8px rgb(85 199 185 / 35%)); }
.icon-button { justify-content: center; width: 40px; padding: 0; }
.theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: block; }
[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.86) contrast(1.08) saturate(.9); }
.legend { position: absolute; z-index: 800; right: 16px; bottom: 24px; display: flex; gap: 13px; padding: 10px 13px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 12px; background: var(--glass); box-shadow: 0 10px 28px var(--shadow); backdrop-filter: blur(18px); color: var(--ink); font-size: 11px; font-weight: 650; }
.map-hud { position: absolute; z-index: 845; left: 18px; top: 18px; display: grid; gap: 3px; padding: 12px 15px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 16px; background: var(--glass); box-shadow: 0 14px 34px var(--shadow); backdrop-filter: blur(18px); pointer-events: none; }
.map-hud span { color: var(--brand); font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.map-hud strong { color: var(--ink); font-size: 20px; letter-spacing: -.03em; }
.legend span { display: flex; gap: 5px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.boys { background: var(--boys); } .girls { background: var(--girls); } .mixed { background: var(--mixed); }
.mobile-only { display: none; }
.school-marker { display: grid; place-items: center; width: 28px; height: 28px; border: 3px solid white; border-radius: 50% 50% 50% 0; box-shadow: 0 2px 7px rgb(0 0 0 / 28%); transform: rotate(-45deg); }
.school-marker::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: white; transform: rotate(45deg); }
.marker-boys { background: var(--boys); } .marker-girls { background: var(--girls); } .marker-mixed { background: var(--mixed); }
.school-preview-marker { width: 42px; height: 42px; border: 3px solid #fff; border-radius: 999px; background: rgb(85 199 185 / 28%); box-shadow: 0 0 0 10px rgb(85 199 185 / 18%), 0 8px 22px rgb(0 0 0 / 25%); animation: preview-pulse 1.25s ease-out infinite; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 7px 24px var(--shadow); }
.leaflet-popup-content { margin: 16px 18px; min-width: 220px; }
.popup-type { display: inline-block; margin-bottom: 7px; padding: 3px 7px; border-radius: 5px; background: #e7f3f0; color: var(--brand); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.popup-title { margin: 0 0 5px; font-size: 15px; }
.popup-ar { margin: 0 0 10px; color: #50625f; font-size: 14px; }
.popup-meta { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.popup-link { display: inline-block; color: var(--brand); font-size: 12px; font-weight: 750; text-decoration: none; }
.empty-state { padding: 40px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.analysis-panel { position: fixed; z-index: 1100; top: 0; right: 0; display: flex; flex-direction: column; width: min(460px, 100%); height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; overflow: hidden; border-left: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: color-mix(in srgb, var(--paper) 88%, transparent); box-shadow: -20px 0 50px var(--shadow); backdrop-filter: blur(24px); transform: translateX(105%); transition: transform .25s ease; }
.analysis-panel.is-open { transform: translateX(0); }
.chat-panel { position: fixed; z-index: 1120; right: 18px; bottom: 18px; display: flex; flex-direction: column; width: min(420px, calc(100% - 36px)); height: min(620px, calc(100vh - 36px)); overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--paper) 92%, transparent); box-shadow: 0 22px 70px var(--shadow); backdrop-filter: blur(24px); opacity: 0; pointer-events: none; transform: translateY(22px) scale(.97); transition: opacity .24s ease, transform .24s cubic-bezier(.22, 1, .36, 1); }
.chat-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 18% 0%, rgb(85 199 185 / 18%), transparent 42%); }
.chat-header h2 { margin: 0; font-size: 18px; }
.chat-body { flex: 1; display: flex; flex-direction: column; gap: 9px; min-height: 0; overflow-y: auto; padding: 14px; }
.chat-message { max-width: 88%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); color: var(--ink); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.chat-message.user { align-self: flex-end; border-color: var(--brand); background: var(--brand); color: #fff; }
.chat-message.bot { align-self: flex-start; }
.chat-suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 0 14px 10px; }
.chat-suggestions button { flex: none; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--brand); font-size: 11px; font-weight: 750; cursor: pointer; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--paper); }
.chat-form input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--surface-soft); color: var(--ink); font-size: 13px; }
.chat-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(11 118 109 / 12%); }
[dir="rtl"] .chat-panel { right: auto; left: 18px; text-align: right; }
[dir="rtl"] .chat-message.user { align-self: flex-start; }
[dir="rtl"] .chat-message.bot { align-self: flex-end; }
.analysis-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 22px 17px; border-bottom: 1px solid var(--line); }
.analysis-header h2 { margin: 0; font-size: 20px; }
.close-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: 25px; line-height: 1; cursor: pointer; }
.analysis-scroll { flex: 1 1 auto; min-height: 0; height: 0; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; padding: 18px 12px 42px 18px; scrollbar-gutter: stable; scrollbar-color: var(--brand) var(--surface-soft); scrollbar-width: auto; }
.analysis-scroll::-webkit-scrollbar { width: 13px; }
.analysis-scroll::-webkit-scrollbar-track { border-left: 1px solid var(--line); background: var(--surface-soft); }
.analysis-scroll::-webkit-scrollbar-thumb { border: 3px solid var(--surface-soft); border-radius: 10px; background: var(--brand); }
.analysis-scroll::-webkit-scrollbar-thumb:hover { background: var(--brand-dark); }
.analysis-scroll-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); background: var(--paper); }
.analysis-scroll-controls button { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--brand); font-size: 11px; font-weight: 800; cursor: pointer; }
.analysis-scroll-controls button:hover { border-color: var(--brand); background: var(--paper); }
.scroll-hint { display: flex; align-items: center; justify-content: space-between; margin: -18px -12px 12px -18px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--brand); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; transition: opacity .2s ease; }
.scroll-hint.is-hidden { opacity: 0; pointer-events: none; }
.analysis-tabs { position: sticky; z-index: 2; top: -18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 14px -2px; padding: 8px 2px; background: var(--paper); }
.analysis-tab { min-height: 40px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; }
.analysis-tab:hover { border-color: var(--brand); color: var(--brand); }
.analysis-tab.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.analysis-section { display: none; }
.analysis-section.is-active { display: block; }
.kpi-grid.analysis-section.is-active { display: grid; }
.view-switch.analysis-section.is-active { display: grid; }
.analysis-intro, .analysis-note { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.analysis-intro strong, .analysis-note h3 { display: block; margin: 0 0 5px; font-size: 13px; }
.analysis-intro p, .analysis-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.analysis-note p + p { margin-top: 9px; }
.view-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0; padding: 4px; border-radius: 10px; background: var(--surface-soft); }
.view-switch-three { grid-template-columns: repeat(3, 1fr); }
.view-switch-four { grid-template-columns: repeat(4, 1fr); }
.view-option { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.view-option.is-active { background: var(--paper); color: var(--brand); box-shadow: 0 2px 8px var(--shadow); }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.kpi-card { display: flex; flex-direction: column; min-height: 96px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.kpi-card span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card strong { margin-top: auto; font-size: 25px; letter-spacing: -.03em; }
.kpi-card small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chart-card { margin-top: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; }
.chart-heading h3 { margin: 0; font-size: 14px; }
.chart-heading p { margin: 3px 0 14px; color: var(--muted); font-size: 11px; }
.bar-row + .bar-row { margin-top: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 11px; }
.bar-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label strong { flex: none; font-variant-numeric: tabular-nums; }
.bar-label small { color: var(--muted); font-weight: 500; }
.bar-track { height: 7px; overflow: hidden; border-radius: 9px; background: var(--surface-soft); }
.bar-track span { display: block; height: 100%; min-width: 2px; border-radius: inherit; }
.chart-empty { color: var(--muted); font-size: 12px; text-align: center; }
.analysis-note { margin-top: 12px; }
.tool-card { margin-top: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.button-row-three { grid-template-columns: repeat(3, 1fr); }
.tool-button { min-height: 38px; padding: 7px 9px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 750; cursor: pointer; }
.tool-button:hover { background: var(--brand-dark); }
.tool-button.secondary { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
.tool-button.secondary:hover { border-color: var(--brand); color: var(--brand); }
.tool-button:disabled { opacity: .55; cursor: wait; }
.tool-field { display: block; margin-top: 9px; }
.tool-field > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.tool-field input, .tool-field select { width: 100%; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--paper); color: var(--ink); font-size: 13px; }
.tool-field input + select { margin-top: 6px; }
.tool-field input:focus, .tool-field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(11 118 109 / 12%); }
.tool-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tool-divider { height: 1px; margin: 14px 0; background: var(--line); }
.compact-heading p { margin-bottom: 5px; }
.tool-status { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.result-list { display: grid; gap: 6px; margin-top: 9px; }
.nearest-result { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.nearest-result strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.nearest-result span { color: var(--muted); font-size: 10px; }
.nearest-result button { border: 0; background: none; color: var(--brand); font-size: 10px; font-weight: 800; cursor: pointer; }
.network-result { min-height: 46px; margin-top: 10px; padding: 10px; border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: 11px; line-height: 1.5; }
.network-result strong { color: var(--ink); }
.network-result.is-error { background: #fff0f0; color: #a13a3a; }
[data-theme="dark"] .network-result.is-error { background: #3c2020; color: #ffb4b4; }
.origin-marker { width: 22px; height: 22px; border: 4px solid #fff; border-radius: 50%; background: #111827; box-shadow: 0 2px 8px rgb(0 0 0 / 35%); }
.hub-marker { display: grid; place-items: center; width: 30px; height: 30px; border: 3px solid #fff; border-radius: 50%; background: #7c3aed; box-shadow: 0 2px 8px rgb(0 0 0 / 35%); color: #fff; font-size: 11px; font-weight: 850; }
.hex-label { color: #fff; font-size: 10px; font-weight: 850; text-shadow: 0 1px 3px #000; }
.density-column-wrap { display: grid !important; place-items: start center; min-height: 24px; padding-top: 5px; overflow: visible !important; border: 1px solid rgb(255 255 255 / 75%) !important; border-radius: 5px 5px 2px 2px !important; background: linear-gradient(90deg, #08756c 0 58%, #05544e 58%) !important; box-shadow: 8px 7px 0 rgb(5 64 60 / 42%), 0 9px 14px rgb(0 0 0 / 28%); color: #fff; font-size: 10px; font-weight: 850; transform-origin: bottom; }
.density-column-wrap::before { content: ""; position: absolute; top: -7px; left: -1px; width: 34px; height: 10px; border: 1px solid rgb(255 255 255 / 70%); border-radius: 50%; background: #55c7b9; }
.density-column-wrap span { position: relative; z-index: 1; text-shadow: 0 1px 2px #000; }
.map-pick-active #map { cursor: crosshair; }
.fit-notice { position: absolute; z-index: 900; left: 50%; bottom: 22px; max-width: 430px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); box-shadow: 0 5px 20px var(--shadow); color: var(--ink); font-size: 11px; transform: translateX(-50%); pointer-events: none; }
.location-status { position: absolute; z-index: 1050; top: 68px; right: 16px; max-width: 340px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); box-shadow: 0 5px 20px var(--shadow); color: var(--ink); font-size: 11px; line-height: 1.45; }
.location-status.is-error { border-color: #d16b6b; color: #9c2929; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: absolute; inset: 0 42px 0 0; transform: translateX(-110%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-only { display: flex; width: 40px; padding: 0; justify-content: center; }
  .map-actions { left: 12px; right: 12px; top: 12px; flex-wrap: wrap; }
  .action-button { padding: 0 9px; }
  #locate-me { display: none; }
  .legend { right: 10px; bottom: 28px; }
  .analysis-panel { width: calc(100% - 26px); }
  .view-option { font-size: 10px; }
  .button-row-three { grid-template-columns: 1fr; }
}

/* Motion system: subtle feedback without changing Leaflet architecture. */
.school-card {
  transition: background .18s ease, transform .24s cubic-bezier(.22, 1, .36, 1), box-shadow .24s ease;
  animation: card-enter .38s cubic-bezier(.22, 1, .36, 1) both;
}
.school-card:hover, .school-card:focus-visible {
  box-shadow: 0 5px 15px var(--shadow);
  transform: translateX(3px);
}
.action-button, .icon-button, .analysis-tab, .view-option, .tool-button {
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .22s cubic-bezier(.22, 1, .36, 1), box-shadow .22s ease;
}
.action-button:hover, .icon-button:hover, .tool-button:hover {
  box-shadow: 0 8px 22px var(--shadow);
  transform: translateY(-2px);
}
.action-button:active, .icon-button:active, .tool-button:active { transform: translateY(0) scale(.97); }
.analysis-tab:hover, .view-option:hover { transform: translateY(-1px); }
.analysis-panel { opacity: .98; transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .3s ease; }
.analysis-section.is-active { animation: section-enter .35s cubic-bezier(.22, 1, .36, 1) both; }
.school-marker {
  transition: filter .18s ease, box-shadow .18s ease;
  animation: marker-enter .42s cubic-bezier(.22, 1, .36, 1) both;
}
.leaflet-marker-icon:hover .school-marker { filter: brightness(1.08); box-shadow: 0 5px 14px rgb(0 0 0 / 36%); }
.leaflet-marker-cluster { transition: filter .18s ease; }
.leaflet-marker-cluster:hover { filter: brightness(1.08); }
.tool-button { position: relative; }
.tool-button:disabled { opacity: .75; }
.tool-button.is-busy { color: transparent !important; pointer-events: none; }
.tool-button.is-busy::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  margin: -8px;
  border: 2px solid rgb(255 255 255 / 40%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.tool-button.secondary.is-busy::after { border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-top-color: var(--brand); }
.network-result { transition: background .25s ease, color .25s ease, transform .3s cubic-bezier(.22, 1, .36, 1); }
.network-result.result-updated { animation: result-enter .42s cubic-bezier(.22, 1, .36, 1); }
.origin-marker { animation: origin-pulse 2.2s ease-out infinite; }
.hub-marker { animation: hub-enter .48s cubic-bezier(.22, 1, .36, 1) both; }
.density-column-wrap { animation: column-rise .52s cubic-bezier(.22, 1, .36, 1) both; }
.leaflet-overlay-pane path.analysis-overlay-enter {
  animation: overlay-enter .5s cubic-bezier(.22, 1, .36, 1) both;
  transform-box: fill-box;
  transform-origin: center;
}
.leaflet-overlay-pane path.route-draw { animation: route-draw 1.15s cubic-bezier(.22, 1, .36, 1) forwards; }
.leaflet-overlay-pane path.buffer-pulse { animation: buffer-breathe 2.6s ease-in-out infinite; }
.map-motion-indicator {
  position: absolute;
  z-index: 820;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.map-motion-indicator span {
  display: block;
  width: 35%;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, transparent, var(--brand), #73e0d3);
  transform: translateX(-110%);
}
.map-panel.map-is-moving .map-motion-indicator { opacity: 1; }
.map-panel.map-is-moving .map-motion-indicator span { animation: map-progress 1.15s ease-in-out infinite; }
.map-panel::after {
  content: "";
  position: absolute;
  z-index: 810;
  inset: 0;
  border: 0 solid color-mix(in srgb, var(--brand) 20%, transparent);
  pointer-events: none;
  transition: border-width .25s ease;
}
.map-panel.map-is-moving::after { border-width: 2px; }
.map-panel.view-transitioning .leaflet-overlay-pane,
.map-panel.view-transitioning .leaflet-marker-pane { animation: layer-crossfade .48s ease both; }
.leaflet-popup-content-wrapper { animation: popup-enter .25s cubic-bezier(.22, 1, .36, 1) both; }

@keyframes marker-enter {
  from { opacity: 0; transform: translateY(8px) rotate(-45deg) scale(.72); }
  to { opacity: 1; transform: translateY(0) rotate(-45deg) scale(1); }
}
@keyframes preview-pulse {
  0% { transform: scale(.75); opacity: .95; }
  70% { transform: scale(1.16); opacity: .38; }
  100% { transform: scale(1.16); opacity: 0; }
}
@keyframes card-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes section-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes result-enter { 0% { opacity: .4; transform: translateY(5px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes origin-pulse {
  0%, 45% { box-shadow: 0 2px 8px rgb(0 0 0 / 35%), 0 0 0 0 rgb(11 118 109 / 38%); }
  100% { box-shadow: 0 2px 8px rgb(0 0 0 / 35%), 0 0 0 16px rgb(11 118 109 / 0%); }
}
@keyframes hub-enter { from { opacity: 0; transform: scale(.45); } to { opacity: 1; transform: scale(1); } }
@keyframes column-rise { from { opacity: 0; clip-path: inset(100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0); } }
@keyframes overlay-enter { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes route-draw { to { stroke-dashoffset: 0; } }
@keyframes buffer-breathe { 0%, 100% { fill-opacity: .14; stroke-opacity: .72; } 50% { fill-opacity: .28; stroke-opacity: 1; } }
@keyframes map-progress { 0% { transform: translateX(-110%); } 60%, 100% { transform: translateX(310%); } }
@keyframes ask-ai-shine {
  0%, 45% { transform: translateX(0) rotate(18deg); opacity: 0; }
  55% { opacity: .8; }
  100% { transform: translateX(420%) rotate(18deg); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes layer-crossfade { from { opacity: .25; } to { opacity: 1; } }
@keyframes popup-enter { from { opacity: 0; transform: translateY(7px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

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