/* ============================================================
   Smart Route Planner — визуальная система "Ночная трасса"
   ============================================================
   Тема продиктована содержанием: приложение считает то же самое,
   что показывает бортовой компьютер автомобиля в дороге — дистанцию,
   время, стоимость, CO2. Отсюда: тёмный асфальтовый фон, два акцента
   (янтарный — как свет фар/поворотников, для действий; бирюзовый —
   как свечение GPS-навигатора, для данных/чисел), моно-шрифт для всех
   числовых показателей (одометр/бортовой компьютер всегда моноширинный),
   и пунктирные разделители, имитирующие разметку полосы движения.
   Фирменный элемент: список городов маршрута оформлен как лента
   дорожных км-столбов, соединённых пунктирной "полосой".
   ============================================================ */

:root {
    --bg-deep: #0d1118;
    --bg-panel: #151a24;
    --bg-raised: #1d2431;
    --line: #2a3445;
    --line-bright: #3b4960;

    --amber: #ffb547;
    --amber-dim: #d98d1f;
    --teal: #48dbe3;
    --teal-dim: #229ca6;
    --purple: #9d7bff;
    --purple-dim: #7654dc;
    --purple-soft: rgba(157, 123, 255, 0.15);

    --paper: #f2f5fa;
    --muted: #9aa6b8;
    --muted-2: #6d788b;

    --danger: #ff7b72;
    --danger-bg: #33201f;
    --danger-border: #6e2f2b;

    --warn: #f5c76a;
    --warn-bg: #362d1a;
    --warn-border: #6b5423;

    --success: #52d788;
    --success-bg: #17301f;
    --success-border: #2b5a3a;

    --font-display: 'Rajdhani', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    --radius: 18px;
    --radius-sm: 11px;
    --shadow-panel: 0 1px 0 rgba(255,255,255,0.04) inset, 0 24px 60px rgba(0,0,0,0.38);
}

/* --- Светлая тема: та же палитра ролей (asphalt/amber/teal), но не просто
   инвертированная яркость — фон и линии слегка тонированы в лавандовый,
   перекликаясь с фиолетовым логотипом, вместо плоского нейтрального серого.
   Переключается атрибутом data-theme на <html> (см. ui.js) --- */
:root[data-theme="light"] {
    --bg-deep: #f3f1fb;
    --bg-panel: #ffffff;
    --bg-raised: #f7f6fc;
    --line: #dedaf0;
    --line-bright: #c8c1e6;

    --amber: #c97a0a;
    --amber-dim: #a3650a;
    --teal: #087f89;
    --teal-dim: #096b73;
    --purple: #7040df;
    --purple-dim: #5928be;
    --purple-soft: rgba(124, 58, 237, 0.08);

    --paper: #1b1930;
    --muted: #625e78;
    --muted-2: #817c98;

    --danger: #c8433a;
    --danger-bg: #fdeceb;
    --danger-border: #f2c3bf;

    --warn: #9c6a05;
    --warn-bg: #fbf1dc;
    --warn-border: #edd8a0;

    --success: #1f8f52;
    --success-bg: #e8f7ee;
    --success-border: #bce6cc;

    --shadow-panel: 0 1px 0 rgba(255,255,255,0.7) inset, 0 14px 34px rgba(124, 58, 237, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    margin: 0;
    background: var(--bg-deep);
    color: var(--paper);
    line-height: 1.5;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    z-index: -1;
    width: 640px;
    height: 640px;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

body::before {
    top: -220px;
    left: -160px;
    background: radial-gradient(circle, rgba(79, 209, 197, 0.16), transparent 70%);
    animation: orb-drift-a 22s ease-in-out infinite;
}

body::after {
    top: 10%;
    right: -220px;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.13), transparent 70%);
    animation: orb-drift-b 26s ease-in-out infinite;
}

.container::before {
    content: '';
    position: fixed;
    z-index: -1;
    width: 520px;
    height: 520px;
    left: 50%;
    bottom: -260px;
    transform: translateX(-50%);
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.12), transparent 70%);
    animation: orb-drift-a 30s ease-in-out infinite reverse;
}

:root[data-theme="light"] body::before {
    background: radial-gradient(circle, rgba(14, 145, 135, 0.13), transparent 70%);
}

:root[data-theme="light"] body::after {
    background: radial-gradient(circle, rgba(201, 122, 10, 0.12), transparent 70%);
}

:root[data-theme="light"] .container::before {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.10), transparent 70%);
}

@keyframes orb-drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, 80px) scale(1.12); }
}

@keyframes orb-drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-70px, 50px) scale(1.08); }
}

.container {
    max-width: 1320px;
    margin: 40px auto;
    padding: 0 20px 60px;
}

h1 {
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 32px;
    letter-spacing: 0.01em;
    background: linear-gradient(120deg, var(--paper) 35%, var(--purple) 65%, var(--teal) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--paper);
    animation: title-sheen 7s ease-in-out infinite;
}

.logo-mark {
    display: inline-flex;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 14px rgba(124, 58, 237, 0.45));
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-pulse-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: logo-pulse 2.4s ease-in-out infinite;
}

@keyframes logo-pulse {
    50% { opacity: 0; transform: scale(1.67); }
}

.top-bar:hover .logo-mark {
    transform: rotate(-6deg) scale(1.08);
}

@keyframes title-sheen {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.top-bar::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    height: 140px;
    background: radial-gradient(ellipse, var(--purple-soft), transparent 72%);
    filter: blur(6px);
    pointer-events: none;
    z-index: -1;
    animation: logo-glow-pulse 4s ease-in-out infinite;
}

@keyframes logo-glow-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.top-bar::after {
    /* "Бегущая" дорожная разметка вместо статичной пунктирной линии —
       тот же приём, что и у линии маршрута на карте, только в шапке. */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-image: repeating-linear-gradient(90deg, var(--line-bright) 0 14px, transparent 14px 28px);
    background-size: 56px 2px;
    animation: road-flow 1.6s linear infinite;
}

@keyframes road-flow {
    to { background-position: -56px 0; }
}

.top-bar h1 {
    margin-bottom: 0;
}

.top-bar-controls {
    position: absolute;
    right: 0;
    top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: auto;
    padding: 0;
    height: 34px;
    width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s;
}

.theme-toggle:hover {
    border-color: var(--purple-dim);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.theme-toggle:active {
    transform: scale(0.9);
}

.theme-toggle-icon {
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover .theme-toggle-icon {
    transform: rotate(25deg) scale(1.15);
}

.lang-switch {
    position: static;
    display: flex;
    gap: 4px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    padding: 3px;
    border-radius: 8px;
}

.lang-switch button {
    width: auto;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 0.04em;
    background: transparent;
    color: var(--muted);
    border-radius: 6px;
}

.lang-switch button.active {
    background: var(--amber);
    color: var(--bg-deep);
}

@media (max-width: 640px) {
    .top-bar {
        flex-direction: column;
        gap: 10px;
    }
    .top-bar-controls {
        position: static;
    }
}

.layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    align-items: stretch;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.panel::before {
    /* декоративный акцент-полоса сверху панели: тил → фиолетовый (цвет
       логотипа) → янтарь — перекликается с остальной палитрой интерфейса */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal) 0%, var(--purple) 50%, var(--amber) 100%);
    opacity: 0.85;
}

label {
    color: var(--muted);
    font-size: 13px;
}

textarea {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg-raised);
    color: var(--paper);
    padding: 10px;
    margin: 8px 0 15px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea::placeholder {
    color: var(--muted-2);
}

textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.18);
}

button {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--amber);
    color: var(--bg-deep);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

button:hover:not(:disabled) {
    filter: brightness(1.08);
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

#submit-button {
    position: relative;
    margin-top: 18px;
    padding: 13px;
    font-size: 15.5px;
    background: linear-gradient(100deg, var(--amber-dim) 0%, var(--amber) 35%, #ffce6b 50%, var(--amber) 65%, var(--amber-dim) 100%);
    background-size: 240% 100%;
    background-position: 0% 0;
    box-shadow: 0 8px 20px -6px rgba(245, 166, 35, 0.45);
    transition: background-position 0.6s ease, box-shadow 0.2s, transform 0.1s, filter 0.15s;
}

#submit-button:hover:not(:disabled) {
    background-position: 100% 0;
    box-shadow: 0 10px 26px -6px rgba(245, 166, 35, 0.6);
    filter: none;
}

#submit-button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 4px 14px -6px rgba(245, 166, 35, 0.5);
}

/* --- Блок "что умеет сервис": заполняет пустое место под формой на
   десктопе тем же мотивом км-столбов, что и список городов маршрута —
   вместо голого пространства даёт полезный контекст и держит панель
   визуально насыщенной, даже когда результата ещё нет. --- */
.panel-highlights {
    margin-top: auto;
    padding-top: 22px;
}

.panel-highlights-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 14px;
}

.highlight-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.highlight-item::before {
    /* пунктирная "полоса" между км-столбами, тот же приём, что в points-list */
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: -4px;
    border-left: 2px dashed var(--line);
}

.highlight-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.highlight-item:last-child::before {
    display: none;
}

.highlight-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--bg-raised);
    border: 1px solid var(--line-bright);
    box-shadow: 0 0 0 3px var(--bg-panel);
    z-index: 1;
    transition: transform 0.2s, border-color 0.2s;
}

.highlight-item:hover .highlight-icon {
    transform: scale(1.1);
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--bg-panel), 0 0 12px var(--purple-soft);
}

.highlight-text strong {
    display: block;
    font-size: 13px;
    color: var(--paper);
    margin-bottom: 2px;
}

.highlight-text span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.autocomplete-wrap {
    position: relative;
}

.suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% - 15px);
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--line-bright);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 12px 24px rgba(0,0,0,0.45);
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.suggestions li {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--paper);
}

.suggestions li:hover,
.suggestions li.active {
    background: var(--bg-raised);
    color: var(--teal);
}

.cost-settings {
    margin-bottom: 15px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.cost-settings summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--teal);
    font-weight: 600;
    list-style: none;
}

.cost-settings summary::-webkit-details-marker {
    display: none;
}

.cost-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.cost-settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
}

.cost-settings-grid input {
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    color: var(--paper);
    font-family: var(--font-mono);
    padding: 6px 8px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .cost-settings-grid {
        grid-template-columns: 1fr;
    }
}

button:disabled {
    opacity: 0.5;
    cursor: wait;
    filter: none;
}

.result {
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    animation: card-pop-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result .card:nth-child(1) { animation-delay: 0.02s; }
.result .card:nth-child(2) { animation-delay: 0.07s; }
.result .card:nth-child(3) { animation-delay: 0.12s; }
.result .card:nth-child(4) { animation-delay: 0.17s; }
.result .card:nth-child(5) { animation-delay: 0.22s; }
.result .card:nth-child(6) { animation-delay: 0.27s; }

@keyframes card-pop-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.card::before {
    /* лёгкий "стеклянный" блик сверху карточки */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

:root[data-theme="light"] .card::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.6), transparent);
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--teal-dim);
    box-shadow: 0 10px 24px -6px rgba(79, 209, 197, 0.28);
}

.card strong {
    font-family: var(--font-mono);
    font-size: 17px;
    color: var(--paper);
}

.card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

.card.cost-card {
    background: var(--bg-raised);
    border-left: 3px solid var(--amber);
    animation: card-pop-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both, cost-glow 3s ease-in-out infinite 0.5s;
}

.card.cost-card:hover {
    border-color: var(--amber-dim);
    box-shadow: 0 10px 24px -6px rgba(245, 166, 35, 0.35);
}

@keyframes cost-glow {
    0%, 100% { box-shadow: 0 0 0 rgba(245, 166, 35, 0); }
    50% { box-shadow: 0 0 14px rgba(245, 166, 35, 0.15); }
}

.card.cost-card span {
    color: var(--amber);
}

.card.cost-card strong {
    color: var(--amber);
    font-size: 19px;
}

/* --- Панель результата: полноширинная приборная панель под строкой
   форма+карта (см. index.php). Карточки статистики идут ровной лентой,
   а остальные разделы разложены по вкладкам, а не одной длинной колонкой. --- */
#result-section {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.result-notes p:first-child {
    margin-top: 0;
}

.tabs {
    display: flex;
    flex-direction: column;
}

.tab-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 2px dashed var(--line);
    scrollbar-width: thin;
}

.tab-nav-btn {
    width: auto;
    flex: 0 0 auto;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    padding: 11px 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab-nav-btn:hover {
    color: var(--paper);
    background: var(--bg-raised);
}

.tab-nav-btn.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
    background: var(--bg-raised);
    transform: translateY(-1px);
}

.tab-panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-panel);
    min-height: 160px;
    animation: tab-fade-in 0.25s ease both;
}

@keyframes tab-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-panel > *:first-child {
    margin-top: 0;
}

@media (max-width: 640px) {
    .tab-nav-btn {
        padding: 9px 12px;
        font-size: 12px;
    }
    .tab-panel {
        padding: 16px;
    }
}

.confidence-bar {
    margin-top: 6px;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    background: var(--teal);
}

.routing-source-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
}

.confidence-label-text {
    font-size: 12px;
    color: var(--teal);
    margin-top: 4px;
}

.cost-note-text {
    font-size: 12px;
    color: var(--muted-2);
    margin-top: 2px;
}

/* --- Список городов маршрута: лента км-столбов вдоль пунктирной "полосы" --- */
.points-list {
    margin-top: 20px;
    padding: 0;
    list-style: none;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.points-list li {
    background: transparent;
    padding: 10px 12px;
    border-bottom: 2px dashed var(--line-bright);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background 0.15s, padding-left 0.15s;
}

.points-list li:hover {
    background: var(--bg-panel);
    padding-left: 16px;
}

.points-list li:last-child {
    border-bottom: none;
}

.points-list .point-index {
    background: var(--amber);
    color: var(--bg-deep);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 11px;
    box-shadow: 0 0 0 3px var(--bg-raised), 0 0 0 4px var(--line);
    transition: box-shadow 0.15s;
}

.points-list li:hover .point-index {
    box-shadow: 0 0 0 3px var(--bg-panel), 0 0 0 4px var(--line), 0 0 12px rgba(245, 166, 35, 0.5);
}

.points-list .point-label {
    flex: 1;
}

.points-list .point-weather {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.points-list .point-weather.weather-warning {
    color: var(--warn);
    font-weight: 600;
}

/* --- AI-ассистент поездки --- */
.assistant-card {
    margin-top: 18px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.assistant-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--paper);
}

.assistant-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--paper);
}

.assistant-source {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font-mono);
}

/* --- точки интереса (Overpass) --- */
.poi-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--teal-dim);
    background: transparent;
    color: var(--teal);
    cursor: pointer;
    font-family: var(--font-display);
}

.poi-btn:hover:not(:disabled) {
    background: rgba(79, 209, 197, 0.08);
}

.poi-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.poi-empty-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted-2);
    text-align: center;
}

.poi-marker-icon {
    font-size: 16px;
    line-height: 26px;
    display: block;
    text-align: center;
}

/* --- AI-планировщик по дням (K-Means) --- */
.day-plan-section {
    margin-top: 14px;
}

.day-plan-btn {
    display: block;
    width: 100%;
    border: 1px solid var(--teal-dim);
    background: transparent;
    color: var(--teal);
    cursor: pointer;
    font-family: var(--font-display);
}

.day-plan-btn:hover:not(:disabled) {
    background: rgba(79, 209, 197, 0.08);
}

.day-plan-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.day-plan-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}

.day-plan-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.day-plan-controls input[type="number"] {
    width: 56px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 13px;
}

.day-plan-intro {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--muted-2);
    max-width: 640px;
}

.day-plan-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.day-plan-item {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.day-plan-item-header {
    font-weight: 700;
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 13px;
}

.day-plan-item-route {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
}

.day-plan-error {
    color: var(--muted-2);
    font-size: 12px;
    text-align: center;
    list-style: none;
}

/* --- decision boundary визуализация --- */
.boundary-section {
    margin-top: 24px;
}

.boundary-section .btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    color: var(--paper);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 999px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.boundary-section .btn:hover {
    border-color: var(--teal-dim);
    box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.12);
    transform: translateY(-1px);
}

.boundary-panel {
    margin-top: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    animation: panel-rise-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boundary-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal) 0%, var(--success) 33%, var(--amber) 66%, var(--danger) 100%);
    opacity: 0.85;
}

@keyframes panel-rise-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.boundary-panel h3 {
    margin: 0 0 6px;
    color: var(--paper);
}

.boundary-intro {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--muted);
    max-width: 720px;
}

.boundary-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--muted);
}

.boundary-controls select {
    margin-left: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-raised);
    color: var(--paper);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.boundary-controls select:hover {
    border-color: var(--teal-dim);
}

.boundary-chart-wrap {
    position: relative;
    height: 380px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background:
        radial-gradient(ellipse 480px 260px at 20% 15%, rgba(79, 209, 197, 0.08), transparent 70%),
        radial-gradient(ellipse 480px 260px at 85% 85%, rgba(245, 166, 35, 0.07), transparent 70%),
        var(--bg-raised);
    border: 1px solid var(--line);
    transition: opacity 0.2s;
}

.boundary-chart-wrap.loading {
    opacity: 0.45;
}

.boundary-chart-wrap.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--teal);
    animation: boundary-spin 0.8s linear infinite;
}

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

.boundary-error {
    text-align: center;
    color: var(--muted-2);
    font-size: 13px;
    padding-top: 40px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--teal);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
    width: auto;
}

.emissions-compare {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--muted-2);
}

.ml-inline-controls {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.learn-correction {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
}

.learn-btn {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    color: var(--paper);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    width: auto;
}

.learn-btn:hover:not(:disabled) {
    border-color: var(--teal-dim);
}

.learn-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.learn-toast {
    margin-top: 6px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.explain-panel {
    margin-top: 10px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.explain-intro {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--muted);
}

.explain-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

.explain-row-label {
    width: 90px;
    flex-shrink: 0;
    color: var(--muted);
}

.explain-bar-track {
    flex: 1;
    height: 10px;
    background: var(--bg-panel);
    border-radius: 5px;
    overflow: hidden;
    display: block;
}

.explain-bar-fill {
    display: block;
    height: 100%;
}

.explain-bar-fill.positive {
    background: var(--success);
}

.explain-bar-fill.negative {
    background: var(--danger);
}

.explain-row-value {
    width: 50px;
    flex-shrink: 0;
    text-align: right;
    color: var(--muted);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.ab-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
}

.ab-stats-panel {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 2px dashed var(--line);
}

.ab-stats-panel h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--paper);
}

.ab-stats-content {
    font-size: 13px;
    color: var(--paper);
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.links {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--teal-dim);
    color: var(--teal);
    text-decoration: none;
    font-size: 14px;
    font-family: var(--font-display);
    font-weight: 600;
    transition: background 0.15s;
}

.btn:hover {
    background: rgba(79, 209, 197, 0.08);
}

.btn.secondary {
    background: var(--bg-raised);
    border-color: var(--line);
    color: var(--paper);
}

.btn.secondary:hover {
    border-color: var(--line-bright);
    background: var(--bg-raised);
}

.map-panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
    min-height: 460px;
    padding: 6px;
    position: relative;
}

.map-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--amber) 0%, var(--purple) 50%, var(--teal) 100%);
    opacity: 0.85;
    z-index: 10;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 448px;
    border-radius: 8px;
    overflow: hidden;
}

@media (min-width: 861px) {
    /* На десктопе форма компактная, а карта — главный визуальный элемент
       верхней строки: она выше и шире, чем в мобильной версии. */
    .map-panel {
        min-height: 560px;
    }
    #map {
        min-height: 548px;
    }
}

/* --- Векторная карта MapLibre + компактный переключатель 2D / 3D --- */
.map-mode-control {
    position: absolute;
    z-index: 12;
    top: 18px;
    right: 18px;
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 12px;
    background: rgba(20, 23, 28, 0.82);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
}

:root[data-theme="light"] .map-mode-control {
    border-color: rgba(58, 42, 105, 0.13);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 28px rgba(60, 42, 100, 0.14);
}

.map-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 56px;
    min-height: 34px;
    justify-content: center;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #aab2c1;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
}

:root[data-theme="light"] .map-mode-btn {
    color: var(--muted);
}

.map-mode-btn:hover {
    color: var(--paper);
    transform: translateY(-1px);
}

.map-mode-btn.active {
    color: #10211f;
    background: linear-gradient(135deg, #7ff0df, #4fd1c5);
    box-shadow: 0 4px 14px rgba(79, 209, 197, 0.3);
}

.map-mode-btn:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

.map-mode-icon {
    display: inline-block;
    font-size: 17px;
    line-height: 1;
    transform: rotate(-8deg);
}

.map-mode-icon-3d {
    transform: rotate(45deg) skew(-4deg, -4deg);
}

.maplibregl-canvas {
    border-radius: 8px;
    outline: none;
}

.maplibregl-ctrl-group {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(20, 23, 28, 0.82);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
}

.maplibregl-ctrl-group button {
    background-color: transparent;
}

.maplibregl-ctrl-group button + button {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.maplibregl-ctrl-group button:hover {
    background-color: rgba(79, 209, 197, 0.13);
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: invert(1) brightness(1.7);
}

:root[data-theme="light"] .maplibregl-ctrl-group {
    border-color: rgba(58, 42, 105, 0.12);
    background: rgba(255, 255, 255, 0.88);
}

:root[data-theme="light"] .maplibregl-ctrl-group button + button {
    border-top-color: rgba(58, 42, 105, 0.1);
}

:root[data-theme="light"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: none;
}

.maplibregl-ctrl-attrib {
    border-radius: 7px 0 0 0;
    background: rgba(20, 23, 28, 0.78) !important;
    color: #9aa4b5;
    backdrop-filter: blur(8px);
}

:root[data-theme="light"] .maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--muted);
}

.maplibregl-ctrl-attrib a {
    color: inherit;
}

.maplibregl-popup-content {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-panel);
    color: var(--paper);
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--bg-panel); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--bg-panel); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--bg-panel); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--bg-panel); }

.map-webgl-error {
    display: grid;
    min-height: 448px;
    place-items: center;
    padding: 32px;
    color: var(--danger);
    text-align: center;
}

.route-popup {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
}

.route-popup-index {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--amber);
    color: var(--bg-deep);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 11px;
}

.route-popup-label {
    font-size: 13px;
    font-weight: 600;
}

/* --- Маркеры маршрута на карте: те же номерные жетоны, что и в списке слева.
   Старт и финиш выделены отдельным цветом/иконкой и пульсирующим кольцом,
   чтобы маршрут читался мгновенно — не нужно приглядываться к номерам. --- */
.route-marker-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffc55c, var(--amber));
    color: var(--bg-deep);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 0 0 3px var(--bg-deep), 0 2px 8px rgba(0,0,0,0.5);
    animation: marker-drop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes marker-drop-in {
    from { opacity: 0; transform: translateY(-14px) scale(0.5); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.route-marker-badge.route-marker-start,
.route-marker-badge.route-marker-end {
    width: 30px;
    height: 30px;
    font-size: 14px;
    position: relative;
}

.route-marker-badge.route-marker-start {
    background: linear-gradient(145deg, #7ef0c2, var(--success));
}

.route-marker-badge.route-marker-end {
    background: linear-gradient(145deg, #ff9b8f, var(--danger));
}

.route-marker-badge.route-marker-start::after,
.route-marker-badge.route-marker-end::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0;
    animation: marker-pulse-ring 2.2s ease-out infinite;
}

.route-marker-badge.route-marker-start::after {
    color: var(--success);
    animation-delay: 0.3s;
}

.route-marker-badge.route-marker-end::after {
    color: var(--danger);
}

@keyframes marker-pulse-ring {
    0% { opacity: 0.6; transform: scale(0.75); }
    75% { opacity: 0; transform: scale(1.35); }
    100% { opacity: 0; transform: scale(1.35); }
}

.poi-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.poi-marker .poi-marker-icon {
    background: var(--bg-panel);
    border: 1px solid var(--line-bright);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    line-height: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    transition: transform 0.15s;
}

.poi-marker:hover .poi-marker-icon {
    transform: scale(1.15);
}

/* --- "Бегущая" пунктирная линия маршрута — трек читается как активный,
   с мягким цветным свечением, повторяющим текущий сегмент градиента --- */
.route-line-animated {
    animation: route-dash-flow 0.9s linear infinite;
    filter: drop-shadow(0 0 4px rgba(245, 166, 35, 0.55));
}

@keyframes route-dash-flow {
    to {
        stroke-dashoffset: -18;
    }
}

.map-placeholder {
    height: 100%;
    min-height: 448px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-2);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

@media (min-width: 861px) {
    .map-placeholder {
        min-height: 548px;
    }
}

.warning-banner {
    margin-top: 15px;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.error-banner {
    margin-top: 15px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.hidden {
    display: none !important;
}

.share-btn {
    margin-top: 12px;
    background: var(--amber);
    color: var(--bg-deep);
}

.share-toast {
    margin-top: 10px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.install-btn {
    width: auto;
    display: block;
    margin: 24px auto 0;
    padding: 10px 22px;
    background: transparent;
    border: 1px solid var(--teal-dim);
    color: var(--teal);
    border-radius: 20px;
    font-size: 13px;
}

.install-btn:hover {
    background: rgba(79, 209, 197, 0.08);
}

/* ============================================================
   Map-first workspace — brand system v2
   ============================================================ */

body {
    min-height: 100vh;
    background:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
        radial-gradient(circle at 72% 3%, rgba(96, 72, 190, 0.16), transparent 34%),
        var(--bg-deep);
    background-size: 44px 44px, 44px 44px, auto, auto;
}

:root[data-theme="light"] body {
    background:
        linear-gradient(rgba(74, 55, 126, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 55, 126, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 72% 3%, rgba(112, 64, 223, 0.11), transparent 34%),
        var(--bg-deep);
    background-size: 44px 44px, 44px 44px, auto, auto;
}

.container {
    width: min(100%, 1540px);
    max-width: none;
    margin: 0 auto;
    padding: 22px 28px 72px;
}

.top-bar {
    min-height: 70px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 6px 4px 17px;
}

.top-bar::before {
    top: -50px;
    left: -48px;
    width: 360px;
    height: 150px;
    transform: none;
    background: radial-gradient(ellipse, rgba(157, 123, 255, 0.18), transparent 72%);
}

.top-bar::after {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--purple-dim) 18%, var(--teal) 54%, var(--amber) 82%, transparent);
    background-size: 100% 1px;
    animation: none;
    opacity: 0.72;
}

.brand-lockup,
.brand-copy {
    display: flex;
}

.brand-lockup {
    align-items: center;
    gap: 12px;
}

.brand-copy {
    min-width: 0;
    flex-direction: column;
    line-height: 1;
}

.brand-copy h1 {
    justify-content: flex-start;
    margin: 2px 0 0;
    text-align: left;
    font-size: clamp(25px, 2.2vw, 34px);
    line-height: 1;
    animation-duration: 10s;
}

.brand-eyebrow,
.section-kicker {
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    line-height: 1.3;
    text-transform: uppercase;
}

.top-bar-controls {
    position: static;
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-status {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-panel) 82%, transparent);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    white-space: nowrap;
    backdrop-filter: blur(16px);
}

.system-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(72, 219, 227, 0.11), 0 0 12px rgba(72, 219, 227, 0.65);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.lang-switch {
    min-height: 40px;
    align-items: center;
    border-radius: 12px;
}

.lang-switch button {
    min-height: 32px;
    padding-inline: 11px;
}

.layout {
    grid-template-columns: clamp(320px, 26vw, 386px) minmax(0, 1fr);
    gap: 18px;
}

.panel {
    min-height: 620px;
    padding: 28px;
    border-color: color-mix(in srgb, var(--line) 88%, var(--purple) 12%);
    background:
        linear-gradient(155deg, rgba(157, 123, 255, 0.055), transparent 28%),
        var(--bg-panel);
}

.panel::before {
    height: 2px;
    background: linear-gradient(90deg, var(--purple) 0%, var(--teal) 62%, var(--amber) 100%);
}

.panel-heading {
    margin-bottom: 22px;
}

.panel-heading h2,
.result-header h2 {
    margin: 5px 0 0;
    color: var(--paper);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.panel-heading h2 {
    font-size: 27px;
    line-height: 1.08;
}

.panel-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--paper);
    font-size: 12px;
    font-weight: 600;
}

.required-mark {
    color: var(--amber);
}

textarea {
    height: 108px;
    margin-bottom: 6px;
    padding: 13px 14px;
    border-color: var(--line-bright);
    background:
        linear-gradient(135deg, rgba(157, 123, 255, 0.04), transparent 42%),
        var(--bg-raised);
    font-size: 13px;
    line-height: 1.55;
    resize: vertical;
}

.route-input-meta {
    min-height: 18px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--muted-2);
    font-size: 10px;
}

#route-point-count {
    flex: 0 0 auto;
    color: var(--teal);
    font-family: var(--font-mono);
}

.cost-settings {
    margin-bottom: 0;
    padding: 11px 12px;
    border-radius: 12px;
}

.cost-settings summary {
    min-height: 24px;
    display: flex;
    align-items: center;
    color: var(--muted);
}

.cost-settings[open] summary {
    color: var(--teal);
}

#submit-button {
    min-height: 48px;
    margin-top: 14px;
    border: 1px solid rgba(255, 224, 163, 0.3);
    border-radius: 12px;
    color: #17120a;
    letter-spacing: 0.045em;
}

.panel.is-calculating #submit-button::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 9px;
    border-radius: 50%;
    background: currentColor;
    animation: request-pulse 1s ease-in-out infinite;
}

@keyframes request-pulse {
    50% { opacity: 0.35; transform: scale(0.72); }
}

.panel-highlights {
    margin-top: auto;
    padding-top: 26px;
}

.panel-highlights-title {
    margin-bottom: 16px;
}

.highlight-item {
    gap: 11px;
    padding-bottom: 13px;
    margin-bottom: 13px;
}

.highlight-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 13px;
}

.highlight-item::before {
    left: 14px;
    top: 32px;
    border-left-color: var(--line-bright);
}

.highlight-text strong {
    font-size: 12.5px;
}

.highlight-text span {
    font-size: 11px;
}

.map-panel {
    min-height: 620px;
    height: clamp(620px, calc(100dvh - 128px), 780px);
    padding: 0;
    border-color: color-mix(in srgb, var(--line) 76%, var(--purple) 24%);
    border-radius: 20px;
    background:
        radial-gradient(circle at 70% 15%, rgba(72, 219, 227, 0.11), transparent 34%),
        radial-gradient(circle at 18% 82%, rgba(157, 123, 255, 0.15), transparent 38%),
        #10151e;
    isolation: isolate;
}

.map-panel::before {
    height: 2px;
    background: linear-gradient(90deg, var(--purple), var(--teal) 58%, var(--amber));
    z-index: 20;
}

.map-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(7, 10, 18, 0.2), transparent 20%, transparent 74%, rgba(7, 10, 18, 0.28)),
        radial-gradient(circle at 50% 46%, transparent 54%, rgba(5, 8, 14, 0.28) 100%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}

:root[data-theme="light"] .map-panel {
    background:
        radial-gradient(circle at 70% 15%, rgba(8, 127, 137, 0.1), transparent 34%),
        radial-gradient(circle at 18% 82%, rgba(112, 64, 223, 0.12), transparent 38%),
        #eaeaf2;
}

:root[data-theme="light"] .map-panel::after {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.12), transparent 20%, transparent 78%, rgba(70, 55, 110, 0.1)),
        radial-gradient(circle at 50% 46%, transparent 62%, rgba(61, 48, 95, 0.11) 100%);
}

#map {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: inherit;
}

.map-identity {
    position: absolute;
    z-index: 16;
    top: 18px;
    left: 18px;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px 7px 8px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 14px;
    background: rgba(13, 17, 24, 0.78);
    color: #dce6f6;
    box-shadow: 0 12px 34px rgba(0,0,0,0.28);
    backdrop-filter: blur(16px) saturate(1.18);
    pointer-events: none;
}

:root[data-theme="light"] .map-identity {
    border-color: rgba(62, 48, 103, 0.14);
    background: rgba(255,255,255,0.87);
    color: var(--paper);
    box-shadow: 0 12px 34px rgba(51, 39, 88, 0.14);
}

.map-identity-icon {
    width: 31px;
    height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(157,123,255,0.28), rgba(72,219,227,0.2));
    color: #88ecf1;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

:root[data-theme="light"] .map-identity-icon {
    color: var(--purple);
}

.map-identity-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.18;
}

.map-identity-copy strong {
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 0.035em;
}

.map-identity-copy small {
    margin-top: 3px;
    color: #8f9caf;
    font-family: var(--font-mono);
    font-size: 8.5px;
}

:root[data-theme="light"] .map-identity-copy small {
    color: var(--muted);
}

.map-mode-control {
    z-index: 16;
    top: 18px;
    right: 18px;
    min-height: 46px;
    align-items: center;
    padding: 4px;
    border-radius: 14px;
}

.map-mode-btn {
    min-width: 64px;
    min-height: 36px;
    border-radius: 10px;
}

.map-mode-btn.active {
    color: #11141a;
    background: linear-gradient(135deg, #b49aff, #65e5eb);
    box-shadow: 0 6px 18px rgba(91, 215, 224, 0.3);
}

.map-mode-icon {
    position: relative;
    width: 17px;
    height: 14px;
    border: 1.6px solid currentColor;
    border-radius: 3px;
    font-size: 0;
    transform: rotate(-7deg) skewX(-6deg);
}

.map-mode-icon::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid currentColor;
    border-radius: 1px;
    opacity: 0.56;
}

.map-mode-icon-3d {
    width: 15px;
    height: 15px;
    border-radius: 2px;
    transform: rotate(30deg) skew(-7deg, -7deg);
    box-shadow: 4px -4px 0 -1px currentColor;
}

.map-mode-icon-3d::after {
    inset: 4px;
    border: 0;
    border-radius: 50%;
    background: currentColor;
}

.map-placeholder {
    position: absolute;
    inset: 0;
    z-index: 5;
    min-height: 0;
    height: auto;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 86px 22px 22px;
    background:
        radial-gradient(circle at 74% 28%, rgba(72, 219, 227, 0.1), transparent 34%),
        linear-gradient(135deg, rgba(13,17,24,0.08), rgba(13,17,24,0.4));
    pointer-events: none;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

:root[data-theme="light"] .map-placeholder {
    background:
        radial-gradient(circle at 74% 28%, rgba(8,127,137,0.09), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(245,243,251,0.36));
}

.map-placeholder-card {
    width: min(430px, calc(100% - 4px));
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 17px;
    background: rgba(13, 17, 24, 0.78);
    color: #f1f4fa;
    text-align: left;
    box-shadow: 0 20px 54px rgba(0,0,0,0.3);
    backdrop-filter: blur(18px) saturate(1.18);
}

:root[data-theme="light"] .map-placeholder-card {
    border-color: rgba(61,48,103,0.14);
    background: rgba(255,255,255,0.88);
    color: var(--paper);
    box-shadow: 0 20px 54px rgba(55,43,92,0.15);
}

.map-placeholder-card > strong {
    display: block;
    margin-top: 5px;
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.012em;
}

.map-placeholder-card p {
    margin: 7px 0 12px;
    color: #9ca8ba;
    font-size: 11.5px;
    line-height: 1.5;
}

:root[data-theme="light"] .map-placeholder-card p {
    color: var(--muted);
}

.map-placeholder-visual {
    width: 100%;
    margin-bottom: 9px;
    overflow: hidden;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(157,123,255,0.1), rgba(72,219,227,0.045));
}

.map-placeholder-visual svg {
    width: 100%;
    height: 82px;
    display: block;
}

.preview-network {
    fill: none;
    stroke: rgba(173, 189, 214, 0.16);
    stroke-width: 1;
}

.preview-route-glow,
.preview-route {
    fill: none;
    stroke: url(#previewRouteGradient);
    stroke-linecap: round;
}

.preview-route-glow {
    stroke-width: 10;
    opacity: 0.55;
}

.preview-route {
    stroke-width: 3.3;
    stroke-dasharray: 4 7;
    animation: preview-route-flow 2.4s linear infinite;
}

@keyframes preview-route-flow {
    to { stroke-dashoffset: -44; }
}

.preview-pin {
    stroke: #0d1118;
    stroke-width: 3;
}

.preview-pin-start { fill: var(--purple); }
.preview-pin-end { fill: var(--amber); }

.map-feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.map-feature-pills span {
    padding: 5px 8px;
    border: 1px solid rgba(72,219,227,0.16);
    border-radius: 999px;
    background: rgba(72,219,227,0.07);
    color: #84e8ed;
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.02em;
}

:root[data-theme="light"] .map-feature-pills span {
    border-color: rgba(8,127,137,0.17);
    background: rgba(8,127,137,0.065);
    color: var(--teal);
}

.map-panel.map-route-active .map-placeholder {
    opacity: 0;
    visibility: hidden;
}

.map-scene-status {
    position: absolute;
    z-index: 17;
    top: 76px;
    left: 50%;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    transform: translateX(-50%);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 999px;
    background: rgba(13,17,24,0.8);
    color: #dce6f6;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.025em;
    box-shadow: 0 10px 28px rgba(0,0,0,0.24);
    backdrop-filter: blur(14px);
}

:root[data-theme="light"] .map-scene-status {
    border-color: rgba(61,48,103,0.14);
    background: rgba(255,255,255,0.9);
    color: var(--paper);
}

.map-scene-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 0 rgba(72,219,227,0.42);
    animation: scene-pulse 1.5s ease-out infinite;
}

.map-style-chip {
    position: absolute;
    z-index: 16;
    top: 76px;
    right: 18px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid rgba(157,123,255,0.2);
    border-radius: 999px;
    background: rgba(13,17,24,0.76);
    color: #aeb8cb;
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    box-shadow: 0 10px 28px rgba(0,0,0,0.2);
    backdrop-filter: blur(14px);
    pointer-events: none;
}

.map-style-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--teal));
    box-shadow: 0 0 10px rgba(72,219,227,0.55);
}

:root[data-theme="light"] .map-style-chip {
    border-color: rgba(112,64,223,0.16);
    background: rgba(255,255,255,0.86);
    color: var(--muted);
}

.map-panel.map-static .map-style-chip {
    display: none;
}

@keyframes scene-pulse {
    70%, 100% { box-shadow: 0 0 0 7px rgba(72,219,227,0); }
}

.map-trip-summary {
    position: absolute;
    z-index: 16;
    left: 18px;
    bottom: 18px;
    width: min(520px, calc(100% - 36px));
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 15px;
    background: rgba(13,17,24,0.82);
    color: #eef3fb;
    box-shadow: 0 16px 42px rgba(0,0,0,0.3);
    backdrop-filter: blur(18px) saturate(1.2);
    animation: summary-enter 0.5s cubic-bezier(.22,1,.36,1) both;
}

:root[data-theme="light"] .map-trip-summary {
    border-color: rgba(61,48,103,0.15);
    background: rgba(255,255,255,0.91);
    color: var(--paper);
    box-shadow: 0 16px 42px rgba(51,39,88,0.16);
}

@keyframes summary-enter {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.map-summary-metric {
    min-width: 0;
    padding: 11px 13px 9px;
    border-right: 1px solid rgba(255,255,255,0.09);
}

:root[data-theme="light"] .map-summary-metric {
    border-right-color: rgba(61,48,103,0.1);
}

.map-summary-metric:nth-child(3) {
    border-right: 0;
}

.map-summary-metric span {
    display: block;
    color: #8f9caf;
    font-size: 8.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.map-summary-metric strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: inherit;
    font-family: var(--font-mono);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-trip-summary > small {
    grid-column: 1 / -1;
    padding: 6px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #8f9caf;
    font-size: 8.5px;
}

:root[data-theme="light"] .map-trip-summary > small {
    border-top-color: rgba(61,48,103,0.09);
    color: var(--muted);
}

.map-panel.map-framing::after {
    background:
        linear-gradient(180deg, rgba(7,10,18,0.28), transparent 28%, transparent 70%, rgba(7,10,18,0.32)),
        radial-gradient(circle at 50% 46%, transparent 45%, rgba(5,8,14,0.38) 100%);
}

.map-panel.map-ready .map-identity-icon {
    color: var(--teal);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 0 18px rgba(72,219,227,0.2);
}

.maplibregl-ctrl-top-left {
    top: 70px;
    left: 12px;
}

.maplibregl-ctrl-group {
    border-radius: 12px;
    background: rgba(13,17,24,0.82);
}

.maplibregl-ctrl-attrib {
    background: rgba(13,17,24,0.76) !important;
}

.maplibregl-ctrl-scale {
    margin-right: 10px !important;
    border-color: rgba(255,255,255,0.42) !important;
    background: rgba(13,17,24,0.68) !important;
    color: #dce6f6 !important;
    font-family: var(--font-mono) !important;
    font-size: 9px !important;
    backdrop-filter: blur(10px);
}

:root[data-theme="light"] .maplibregl-ctrl-scale {
    border-color: rgba(49,42,78,0.45) !important;
    background: rgba(255,255,255,0.82) !important;
    color: var(--paper) !important;
}

.route-marker-badge {
    border: 1px solid rgba(255,255,255,0.4);
    background: linear-gradient(145deg, #bdabff, var(--purple));
    box-shadow: 0 0 0 4px rgba(13,17,24,0.88), 0 5px 16px rgba(0,0,0,0.48), 0 0 20px rgba(157,123,255,0.28);
}

.route-marker-badge.route-marker-start {
    background: linear-gradient(145deg, #8df1f4, var(--teal));
}

.route-marker-badge.route-marker-end {
    background: linear-gradient(145deg, #ffd286, var(--amber));
}

.route-marker-badge.route-marker-start::after { color: var(--teal); }
.route-marker-badge.route-marker-end::after { color: var(--amber); }

.static-route-map {
    position: absolute;
    inset: 0;
    z-index: 3;
    overflow: hidden;
    border-radius: inherit;
    background: #0d1320;
}

.static-route-map svg {
    width: 100%;
    height: 100%;
    display: block;
}

.static-route-glow,
.static-route-path,
.static-route-highlight {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.static-route-glow {
    stroke: rgba(72,219,227,0.42);
    stroke-width: 24;
    filter: url(#static-route-glow);
}

.static-route-path {
    stroke: url(#static-route-line);
    stroke-width: 8;
}

.static-route-highlight {
    stroke: rgba(255,255,255,0.72);
    stroke-width: 1.4;
    stroke-dasharray: 4 10;
    animation: static-route-flow 1.25s linear infinite;
}

@keyframes static-route-flow {
    to { stroke-dashoffset: -56; }
}

.static-route-marker circle:first-child {
    fill: #9d7bff;
    stroke: #0d1118;
    stroke-width: 6;
}

.static-route-marker.static-marker-start circle:first-child { fill: #48dbe3; }
.static-route-marker.static-marker-end circle:first-child { fill: #ffb547; }

.static-route-marker text {
    fill: #11141a;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 800;
}

.static-route-marker-ring {
    fill: none;
    stroke: rgba(157,123,255,0.5);
    stroke-width: 2;
}

.static-marker-start .static-route-marker-ring { stroke: rgba(72,219,227,0.62); }
.static-marker-end .static-route-marker-ring { stroke: rgba(255,181,71,0.62); }

.static-route-label {
    fill: #f1f5fb;
    paint-order: stroke;
    stroke: rgba(8,12,20,0.9);
    stroke-width: 6px;
    stroke-linejoin: round;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
}

.static-route-note {
    position: absolute;
    right: 18px;
    bottom: 18px;
    max-width: 420px;
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 11px;
    background: rgba(13,17,24,0.82);
    color: #aab5c6;
    font-size: 10px;
    backdrop-filter: blur(14px);
}

.result-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 0 2px;
}

.result-header h2 {
    font-size: 25px;
}

.route-ready-status {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid rgba(72,219,227,0.2);
    border-radius: 999px;
    background: rgba(72,219,227,0.07);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.04em;
}

.route-ready-status > span:first-child {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 10px rgba(72,219,227,0.65);
}

.result-entering .result-header {
    animation: result-header-enter 0.42s ease-out both;
}

@keyframes result-header-enter {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

#result-section {
    margin-top: 28px;
    gap: 16px;
}

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

.card {
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left-width: 1px;
    border-top: 2px solid var(--teal);
    border-radius: 14px;
    background:
        linear-gradient(150deg, rgba(72,219,227,0.055), transparent 48%),
        var(--bg-raised);
}

.card.cost-card {
    border-left-width: 1px;
    border-top-color: var(--amber);
    background:
        linear-gradient(150deg, rgba(255,181,71,0.08), transparent 50%),
        var(--bg-raised);
}

.result-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-panel) 82%, transparent);
}

.result-notes p {
    margin: 0;
}

.tabs {
    margin-top: 2px;
}

.tab-nav {
    border-bottom-style: solid;
    border-bottom-width: 1px;
}

.tab-panel {
    border-radius: 0 0 16px 16px;
}

.points-list {
    position: relative;
    margin-top: 0;
    padding: 7px 0;
    overflow: visible;
    border: 0;
    background: transparent;
}

.points-list::before {
    content: '';
    position: absolute;
    top: 26px;
    bottom: 26px;
    left: 25px;
    width: 2px;
    background: linear-gradient(var(--teal), var(--purple) 55%, var(--amber));
    opacity: 0.58;
}

.points-list li {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 54px;
    padding: 9px 12px 9px 7px;
    border: 0;
    border-radius: 11px;
}

.points-list li + li {
    margin-top: 3px;
}

.points-list li:hover {
    padding-left: 7px;
}

.points-list .point-index {
    width: 30px;
    height: 30px;
    z-index: 1;
    background: var(--purple);
    box-shadow: 0 0 0 4px var(--bg-panel), 0 0 0 5px var(--line);
}

.points-list li:first-child .point-index { background: var(--teal); }
.points-list li:last-child .point-index { background: var(--amber); }

.point-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.points-list .point-label {
    overflow: hidden;
    color: var(--paper);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.point-role {
    margin-top: 2px;
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.points-list .point-weather {
    align-self: center;
}

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

    .panel {
        padding: 24px;
    }

    .result {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .panel {
        min-height: 0;
    }

    .map-panel {
        min-height: 560px;
        height: 64vh;
        max-height: 680px;
    }

    .result {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 14px 14px 52px;
    }

    .top-bar {
        align-items: flex-start;
        gap: 13px;
        padding-bottom: 14px;
    }

    .brand-copy h1 {
        font-size: 25px;
    }

    .system-status {
        display: none;
    }

    .map-panel {
        min-height: 520px;
        height: 68vh;
    }

    .map-placeholder {
        padding: 82px 13px 13px;
    }

    .map-placeholder-card {
        padding: 14px;
    }

    .map-placeholder-visual {
        display: none;
    }

    .map-placeholder-card > strong {
        font-size: 21px;
    }

    .map-identity {
        top: 12px;
        left: 12px;
    }

    .map-identity-copy small {
        display: none;
    }

    .map-mode-control {
        top: 12px;
        right: 12px;
    }

    .map-mode-btn {
        min-width: 50px;
        padding-inline: 7px;
    }

    .map-mode-icon {
        display: none;
    }

    .map-scene-status {
        top: 70px;
        max-width: calc(100% - 24px);
    }

    .map-style-chip {
        display: none;
    }

    .map-trip-summary {
        left: 12px;
        bottom: 12px;
        width: calc(100% - 24px);
    }

    .map-summary-metric {
        padding-inline: 9px;
    }

    .map-summary-metric strong {
        font-size: 11px;
    }

    .result-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .result-notes {
        grid-template-columns: 1fr;
    }

    .points-list li {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .points-list .point-weather {
        grid-column: 2;
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================================
   Product workspace v3: structured editor, alternatives, navigation
   ============================================================ */

.panel-sheet-handle,
.map-focus-toggle {
    display: none;
}

.route-stop-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 8px;
}

.route-stop-row {
    position: relative;
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 9px 8px 9px 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-raised) 92%, var(--purple) 8%);
    transition: border-color 0.18s, transform 0.18s, background 0.18s;
}

.route-stop-row:focus-within,
.route-stop-row.drag-target {
    border-color: var(--teal-dim);
    background: color-mix(in srgb, var(--bg-raised) 89%, var(--teal) 11%);
}

.route-stop-row.dragging {
    opacity: 0.5;
}

.stop-rail {
    align-self: stretch;
    display: flex;
    align-items: center;
    flex-direction: column;
    min-height: 48px;
}

.stop-number {
    z-index: 1;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 2px solid var(--bg-deep);
    border-radius: 50%;
    background: linear-gradient(145deg, var(--purple), var(--teal));
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--line-bright);
}

.route-stop-row:first-child .stop-number {
    background: linear-gradient(145deg, #48dbe3, #6078f0);
}

.route-stop-row:last-child .stop-number {
    background: linear-gradient(145deg, #ffb547, #f07a60);
    color: var(--bg-deep);
}

.stop-rail-line {
    position: absolute;
    top: 35px;
    bottom: -13px;
    width: 1px;
    background: repeating-linear-gradient(to bottom, var(--teal-dim) 0 4px, transparent 4px 8px);
}

.stop-field-body {
    min-width: 0;
}

.stop-field-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 2px 3px;
}

.stop-role {
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stop-coordinate {
    min-width: 0;
    overflow: hidden;
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stop-label-input {
    width: 100%;
    min-height: 30px;
    margin: 0;
    padding: 4px 2px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--paper);
    font-size: 12px;
}

.stop-label-input:focus {
    border: 0;
    box-shadow: none;
}

.stop-row-actions {
    display: grid;
    grid-template-columns: repeat(2, 25px);
    gap: 3px;
}

.stop-icon-button,
.editor-tool {
    width: auto;
    min-height: 0;
    margin: 0;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    color: var(--muted);
    box-shadow: none;
}

.stop-icon-button {
    display: grid;
    width: 25px;
    height: 25px;
    padding: 0;
    place-items: center;
    border-radius: 7px;
    font-size: 13px;
}

.stop-icon-button:hover:not(:disabled),
.editor-tool:hover:not(:disabled) {
    border-color: var(--teal-dim);
    background: color-mix(in srgb, var(--bg-panel) 86%, var(--teal) 14%);
    color: var(--paper);
    transform: none;
    box-shadow: none;
}

.stop-icon-button:disabled {
    opacity: 0.28;
}

.route-editor-toolbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 9px;
}

.editor-tool {
    min-height: 33px;
    padding: 6px 5px;
    border-radius: 9px;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.editor-tool-accent {
    border-color: color-mix(in srgb, var(--amber) 50%, var(--line));
    color: var(--amber);
}

.editor-tool.active {
    border-color: var(--teal);
    background: rgba(72, 219, 227, 0.14);
    color: var(--teal);
}

.optimize-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(157, 123, 255, 0.045);
    cursor: pointer;
}

.optimize-toggle input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--purple);
}

.optimize-toggle span {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.optimize-toggle strong {
    color: var(--paper);
    font-size: 11px;
}

.optimize-toggle small {
    color: var(--muted-2);
    font-size: 9px;
}

.route-options-section {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(72, 219, 227, 0.035), rgba(157, 123, 255, 0.045)), var(--bg-panel);
}

.section-heading-inline,
.navigation-head,
.saved-routes-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-heading-inline h3,
.navigation-head h3,
.saved-routes-heading h3 {
    margin: 3px 0 0;
    color: var(--paper);
    font-family: var(--font-display);
}

.section-heading-inline h3 {
    font-size: 19px;
}

.section-heading-inline > small {
    max-width: 360px;
    color: var(--muted-2);
    font-size: 10px;
    text-align: right;
}

.route-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 13px;
}

.route-option-card {
    width: 100%;
    min-width: 0;
    min-height: 112px;
    margin: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--bg-raised);
    color: var(--paper);
    box-shadow: none;
    text-align: left;
}

.route-option-card:hover,
.route-option-card.active {
    border-color: var(--teal-dim);
    background: color-mix(in srgb, var(--bg-raised) 91%, var(--teal) 9%);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.route-option-card.active {
    outline: 2px solid color-mix(in srgb, var(--teal) 58%, transparent);
    outline-offset: -3px;
}

.route-option-top,
.route-option-metrics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.route-option-top strong {
    font-family: var(--font-display);
    font-size: 15px;
}

.route-option-badge {
    padding: 3px 7px;
    border: 1px solid rgba(72, 219, 227, 0.24);
    border-radius: 999px;
    background: rgba(72, 219, 227, 0.08);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 8px;
    text-transform: uppercase;
}

.route-option-metrics {
    margin-top: 14px;
}

.route-option-metrics span {
    display: flex;
    flex-direction: column;
    color: var(--muted-2);
    font-size: 9px;
}

.route-option-metrics b {
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 12px;
}

.route-option-card > small {
    display: block;
    margin-top: 9px;
    color: var(--muted-2);
    font-size: 9px;
}

.navigation-head {
    margin-bottom: 15px;
}

.navigation-head h3,
.saved-routes-heading h3 {
    font-size: 17px;
}

.navigation-head p {
    margin: 3px 0 0;
    color: var(--muted-2);
    font-size: 10px;
}

.compact-btn {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding-inline: 16px;
}

.navigation-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    max-height: 520px;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.navigation-step {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 62px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-raised);
    color: var(--paper);
    box-shadow: none;
    text-align: left;
}

.navigation-step:hover,
.navigation-step.active {
    border-color: var(--amber);
    background: color-mix(in srgb, var(--bg-raised) 90%, var(--amber) 10%);
    transform: none;
    box-shadow: none;
}

.navigation-step-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: rgba(72, 219, 227, 0.1);
    color: var(--teal);
    font-size: 20px;
}

.navigation-step-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.navigation-step-copy strong {
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navigation-step-copy small,
.navigation-empty {
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-size: 9px;
}

.route-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
}

.route-actions-grid .btn {
    width: 100%;
    margin: 0;
}

#favorite-route-button.is-favorite {
    border-color: var(--amber);
    color: var(--amber);
}

.saved-routes {
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.saved-routes-list {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.saved-route-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px 32px;
    gap: 5px;
    align-items: center;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-raised);
}

.saved-route-open,
.saved-route-star,
.saved-route-remove {
    width: auto;
    min-height: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--paper);
}

.saved-route-open {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 5px 7px;
    text-align: left;
}

.saved-route-open:hover,
.saved-route-star:hover,
.saved-route-remove:hover {
    transform: none;
    box-shadow: none;
}

.saved-route-open strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-route-open small,
.saved-routes-empty {
    margin-top: 3px;
    color: var(--muted-2);
    font-size: 9px;
}

.saved-route-star,
.saved-route-remove {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border-radius: 8px;
    color: var(--muted);
}

.saved-route-star.active {
    color: var(--amber);
}

.saved-route-remove:hover {
    color: var(--danger);
}

.ml-lab-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 9px;
}

.ml-lab-heading p {
    margin: 0;
    color: var(--muted-2);
    font-size: 10px;
}

.draft-stop-marker {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4);
}

.map-pick-hint {
    position: absolute;
    z-index: 18;
    left: 50%;
    bottom: 24px;
    display: inline-flex;
    width: max-content;
    max-width: calc(100% - 32px);
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 13px;
    transform: translateX(-50%);
    border: 1px solid rgba(72, 219, 227, 0.38);
    border-radius: 999px;
    background: rgba(13, 17, 24, 0.88);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
    pointer-events: none;
}

.map-picking .route-marker-badge {
    opacity: 0.35;
}

/* ============================================================
   ML Lab 2.0 — explainability, model comparison and quality
   ============================================================ */

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.prediction-explainer {
    position: relative;
    display: grid;
    gap: 16px;
    overflow: hidden;
}

.prediction-explainer::before {
    content: '';
    position: absolute;
    z-index: 0;
    top: -130px;
    right: -120px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(157, 123, 255, 0.18), transparent 70%);
    pointer-events: none;
}

.prediction-explainer > * {
    position: relative;
    z-index: 1;
}

.prediction-explainer-head,
.boundary-view-header,
.what-if-heading,
.section-heading-inline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.prediction-explainer-head h3,
.section-heading-inline h3,
.what-if-heading h4 {
    margin: 2px 0 0;
    font-family: var(--font-display);
    line-height: 1.15;
}

.model-meta-chips {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.model-meta-chip,
.ml-readonly-badge,
.model-agreement-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-raised) 86%, transparent);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}

.model-meta-chip-accent,
.model-agreement-badge {
    border-color: color-mix(in srgb, var(--teal) 38%, var(--line));
    color: var(--teal);
}

.model-agreement-badge.is-disagreement {
    border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
    color: var(--amber);
}

.ml-readonly-badge {
    border-color: color-mix(in srgb, var(--success) 34%, var(--line));
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ml-insight-loading,
.model-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--line-bright);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.ml-insight-loading.is-error {
    border-color: var(--danger-border);
    color: var(--danger);
}

#ml-insight-content {
    display: grid;
    gap: 16px;
}

.prediction-hero {
    display: flex;
    min-height: 108px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--purple) 38%, var(--line));
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(157, 123, 255, 0.15), transparent 54%),
        color-mix(in srgb, var(--bg-raised) 92%, transparent);
}

.prediction-hero > div:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.prediction-hero span,
.prediction-hero small {
    color: var(--muted);
    font-size: 10px;
}

.prediction-hero > div:first-child strong {
    margin: 3px 0;
    color: var(--paper);
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1;
}

.prediction-score {
    display: grid;
    min-width: 82px;
    min-height: 82px;
    place-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(72, 219, 227, 0.34);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(72, 219, 227, 0.15), transparent 68%);
    text-align: center;
}

.prediction-score strong {
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 21px;
}

.probability-stack {
    display: grid;
    gap: 8px;
}

.probability-row {
    display: grid;
    grid-template-columns: minmax(112px, 0.85fr) minmax(100px, 2fr) 50px;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

.probability-row strong {
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 10px;
    text-align: right;
}

.probability-row.compact {
    grid-template-columns: minmax(85px, 0.9fr) minmax(70px, 1.5fr) 43px;
    gap: 7px;
    font-size: 9px;
}

.probability-track {
    display: block;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--line) 78%, transparent);
}

.probability-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.model-input-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.model-input-strip > span {
    display: flex;
    min-width: 0;
    padding: 10px 12px;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-raised);
}

.model-input-strip small {
    overflow: hidden;
    color: var(--muted-2);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-input-strip strong {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.model-explanation-grid,
.quality-grid,
.model-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.model-explanation-grid > section,
.quality-grid > section,
.model-card-grid > section,
.model-card-limitations {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: color-mix(in srgb, var(--bg-raised) 82%, transparent);
}

.model-explanation-grid h4,
.transport-ranking h4,
.quality-grid h4,
.model-card-content h4,
.release-policy-card h4 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 15px;
}

.feature-influence-list,
.counterfactual-list,
.transport-ranking-list {
    display: grid;
    gap: 8px;
}

.feature-influence-card,
.counterfactual-card {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 10px;
}

.feature-influence-card + .feature-influence-card,
.counterfactual-card + .counterfactual-card {
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.influence-icon,
.counterfactual-card > span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid rgba(157, 123, 255, 0.3);
    border-radius: 9px;
    background: var(--purple-soft);
    color: var(--purple);
    font-family: var(--font-mono);
}

.feature-influence-card strong,
.counterfactual-card strong {
    display: block;
    font-size: 11px;
}

.feature-influence-card p {
    margin: 2px 0;
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.4;
}

.feature-influence-card small,
.counterfactual-card small {
    display: block;
    margin-top: 2px;
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-size: 8px;
}

.transport-ranking {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(72, 219, 227, 0.06), transparent 48%);
}

.compact-heading {
    margin-bottom: 10px;
}

.compact-heading small {
    color: var(--muted-2);
    font-size: 9px;
}

.transport-rank-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-raised);
}

.transport-rank-card:first-child {
    border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
    box-shadow: 0 0 0 1px rgba(72, 219, 227, 0.06) inset;
}

.transport-rank-card.is-muted {
    opacity: 0.58;
}

.rank-number {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 9px;
    background: var(--bg-panel);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 10px;
}

.transport-rank-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.transport-rank-copy strong {
    font-size: 11px;
}

.transport-rank-copy small,
.transport-rank-copy em,
.transport-rank-score small {
    color: var(--muted-2);
    font-size: 8px;
    font-style: normal;
}

.transport-rank-copy em {
    color: var(--amber);
}

.transport-rank-score {
    display: flex;
    min-width: 42px;
    flex-direction: column;
    text-align: right;
}

.transport-rank-score strong {
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 13px;
}

.model-feedback-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--bg-raised);
}

.model-feedback-panel > div:first-child {
    display: flex;
    flex-direction: column;
}

.model-feedback-panel strong {
    font-size: 11px;
}

.model-feedback-panel small {
    color: var(--muted-2);
    font-size: 8.5px;
}

.model-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.model-feedback-actions .learn-btn,
.ab-feedback .learn-btn {
    min-width: 42px;
    min-height: 34px;
    border-radius: 9px;
}

.ab-feedback {
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.ml-lab-heading {
    justify-content: space-between;
    align-items: flex-end;
}

.ml-lab-heading h2 {
    margin: 2px 0 3px;
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
}

.ml-lab-heading p {
    max-width: 680px;
    font-size: 12px;
}

.boundary-panel {
    padding: 0;
    overflow: clip;
}

.ml-lab-tabs {
    display: flex;
    overflow-x: auto;
    padding: 15px 18px 0;
    gap: 5px;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.ml-lab-tab {
    min-height: 40px;
    padding: 8px 12px 11px;
    flex: 0 0 auto;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
}

.ml-lab-tab:hover,
.ml-lab-tab.active {
    color: var(--paper);
}

.ml-lab-tab.active {
    border-bottom-color: var(--purple);
}

.ml-lab-tab:focus-visible,
.boundary-check:focus-within,
.what-if-controls input:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.ml-lab-view {
    min-height: 360px;
    padding: 22px 24px 24px;
}

.boundary-view-header {
    margin-bottom: 14px;
}

.boundary-controls {
    justify-content: flex-end;
    margin: 0;
    gap: 10px 14px;
    flex-wrap: wrap;
}

.boundary-controls label,
.what-if-heading label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.boundary-controls select,
.what-if-heading select {
    min-height: 34px;
    margin-left: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg-raised);
    color: var(--paper);
    font: inherit;
}

.boundary-check {
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg-raised);
    cursor: pointer;
}

.boundary-check input {
    accent-color: var(--purple);
}

.boundary-class-filters {
    display: flex;
    margin: -2px 0 13px;
    padding: 0;
    align-items: center;
    gap: 7px;
    border: 0;
    flex-wrap: wrap;
}

.boundary-class-filters legend {
    margin-right: 3px;
    color: var(--muted-2);
    font-size: 9px;
}

.class-filter {
    display: inline-flex;
    min-height: 30px;
    padding: 4px 9px;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-raised);
    color: var(--muted);
    cursor: pointer;
    font-size: 9px;
}

.class-filter:focus-within {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.class-filter input {
    accent-color: var(--purple);
}

.class-filter.walk:has(input:checked) { border-color: color-mix(in srgb, #52d788 55%, var(--line)); color: #52d788; }
.class-filter.car:has(input:checked) { border-color: color-mix(in srgb, #ffb547 55%, var(--line)); color: #ffb547; }
.class-filter.bus:has(input:checked) { border-color: color-mix(in srgb, #48dbe3 55%, var(--line)); color: #48dbe3; }

.boundary-chart-wrap {
    height: 430px;
}

.what-if-panel {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--purple) 32%, var(--line));
    border-radius: 15px;
    background:
        radial-gradient(circle at 100% 0, rgba(157, 123, 255, 0.12), transparent 34%),
        var(--bg-raised);
}

.what-if-heading {
    align-items: center;
}

.what-if-heading label {
    color: var(--muted);
    font-size: 10px;
}

.what-if-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 13px;
}

.what-if-controls label {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
    color: var(--muted);
    font-size: 10px;
}

.what-if-controls output {
    color: var(--teal);
    font-family: var(--font-mono);
}

.what-if-controls input {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--purple);
}

.what-if-result {
    display: grid;
    grid-template-columns: minmax(150px, 0.75fr) minmax(220px, 1.3fr) minmax(140px, 0.8fr);
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.what-if-prediction {
    display: flex;
    align-items: center;
    gap: 10px;
}

.what-if-prediction > span {
    font-size: 30px;
}

.what-if-prediction div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.what-if-prediction small {
    color: var(--muted-2);
    font-size: 8px;
}

.what-if-prediction strong {
    font-family: var(--font-display);
    font-size: 15px;
}

.what-if-ranking {
    display: grid;
    gap: 3px;
}

.what-if-ranking > strong {
    margin-bottom: 2px;
    font-size: 9px;
}

.what-if-ranking span {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 9px;
}

.what-if-ranking em {
    color: var(--teal);
    font-family: var(--font-mono);
    font-style: normal;
}

.what-if-counterfactual {
    display: flex;
    grid-column: 1 / -1;
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid color-mix(in srgb, var(--purple) 38%, var(--line));
    border-radius: 10px;
    background: var(--purple-soft);
}

.what-if-counterfactual small {
    color: var(--muted);
    font-size: 8px;
}

.what-if-counterfactual strong {
    font-size: 10px;
    text-align: right;
}

.accessible-model-table {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-raised);
}

.accessible-model-table summary {
    padding: 10px 12px;
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
}

.table-scroll {
    max-width: 100%;
    overflow: auto;
}

.table-scroll table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 10px;
}

.table-scroll caption {
    padding: 8px 10px;
    color: var(--muted-2);
    text-align: left;
}

.table-scroll th,
.table-scroll td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.table-scroll th {
    color: var(--muted);
    font-weight: 600;
}

.table-scroll td {
    font-family: var(--font-mono);
}

.table-scroll tr.is-disagreement td {
    background: rgba(157, 123, 255, 0.07);
}

.model-comparison-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.model-comparison-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--purple);
    border-radius: 15px;
    background: var(--bg-raised);
}

.model-comparison-card.softmax {
    border-top-color: var(--teal);
}

.comparison-card-head,
.comparison-prediction {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.comparison-card-head > div,
.comparison-prediction > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.comparison-card-head > span {
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-size: 8px;
}

.comparison-prediction {
    justify-content: flex-start;
    margin: 17px 0;
}

.comparison-prediction > span {
    font-size: 36px;
}

.comparison-prediction strong {
    font-family: var(--font-display);
    font-size: 20px;
}

.comparison-prediction small {
    color: var(--muted);
    font-size: 9px;
}

.quality-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 9px;
    margin: 16px 0;
}

.quality-metric-card {
    display: flex;
    min-height: 92px;
    padding: 12px;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-raised);
}

.quality-metric-card small,
.quality-metric-card span {
    color: var(--muted-2);
    font-size: 8px;
}

.quality-metric-card strong {
    margin: 4px 0;
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 20px;
}

.matrix-table td {
    text-align: center;
}

.matrix-hit {
    background: color-mix(in srgb, var(--success-bg) 78%, transparent);
    color: var(--success);
}

.matrix-miss:not(:empty) {
    color: var(--danger);
}

.calibration-chart-wrap {
    height: 280px;
}

#per-class-metrics {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.network-visual {
    display: grid;
    min-height: 360px;
    margin-top: 16px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(157, 123, 255, 0.10), transparent 52%),
        var(--bg-raised);
}

.network-visual svg {
    width: min(100%, 720px);
    max-height: 380px;
}

.network-visual text {
    fill: var(--paper);
    font-family: var(--font-mono);
    font-size: 9px;
    text-anchor: middle;
}

.network-node {
    fill: var(--bg-panel);
    stroke: var(--line-bright);
    stroke-width: 2;
}

.network-node.input { stroke: var(--teal); }
.network-node.hidden.positive { stroke: var(--purple); }
.network-node.hidden.negative { stroke: var(--danger); }
.network-node.output.winner { fill: var(--purple-soft); stroke: var(--amber); stroke-width: 4; }

.network-values {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.network-values span {
    display: flex;
    min-width: 0;
    padding: 8px 5px;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg-raised);
    text-align: center;
}

.network-values b,
.network-values em,
.network-values small {
    font-family: var(--font-mono);
    font-size: 8px;
    font-style: normal;
}

.network-values em { color: var(--teal); }
.network-values small { color: var(--muted-2); }

.training-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
    margin-top: 16px;
}

.training-grid > section {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--bg-raised);
}

.training-grid h4 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 15px;
}

.training-chart-wrap {
    height: 330px;
}

.training-snapshot-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.training-boundary-canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-panel);
}

.training-scrubber {
    display: grid;
    grid-template-columns: auto minmax(100px, 1fr) auto;
    margin-top: 12px;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 9px;
}

.training-scrubber input {
    width: 100%;
    accent-color: var(--purple);
}

.training-scrubber output,
.training-snapshot-metrics {
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 9px;
}

.training-snapshot-metrics {
    margin-top: 8px;
    text-align: right;
}

.dataset-summary {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
    margin: 16px 0 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--bg-raised);
}

.dataset-summary-hero {
    display: flex;
    grid-row: span 2;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--line);
}

.dataset-summary-hero strong {
    color: var(--purple);
    font-family: var(--font-mono);
    font-size: 34px;
}

.dataset-summary-hero span,
.dataset-summary p {
    color: var(--muted-2);
    font-size: 9px;
}

.dataset-summary p {
    margin: 0;
}

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

.dataset-summary-grid span {
    display: flex;
    padding: 8px;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.dataset-summary-grid small {
    color: var(--muted-2);
    font-size: 7px;
}

.dataset-summary-grid strong {
    font-family: var(--font-mono);
    font-size: 11px;
}

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

.nearest-examples article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-raised);
}

.nearest-examples article > span {
    font-size: 18px;
}

.nearest-examples article > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.nearest-examples strong,
.nearest-examples small,
.nearest-examples em {
    font-size: 8px;
}

.nearest-examples small { color: var(--muted-2); }
.nearest-examples em { grid-column: 1 / -1; color: var(--teal); font-family: var(--font-mono); font-style: normal; }

.model-card-content {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.model-card-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--purple) 35%, var(--line));
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(157, 123, 255, 0.12), transparent 58%);
}

.model-card-hero h4 {
    margin: 4px 0;
    font-size: 21px;
}

.model-card-hero p,
.model-card-content li {
    color: var(--muted);
    font-size: 10px;
}

.model-card-privacy {
    max-width: 300px;
    padding: 10px;
    align-self: flex-start;
    border: 1px solid var(--success-border);
    border-radius: 11px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 8px;
}

.model-card-content ul {
    margin: 0;
    padding-left: 18px;
}

.release-policy-card {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--success-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--success-bg) 72%, transparent);
}

.release-policy-card ol {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding-left: 22px;
}

.release-policy-card li {
    color: var(--muted);
    font-size: 9px;
}

.ab-stats-content {
    gap: 7px;
}

.ab-stats-row {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto minmax(130px, auto);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-raised);
}

.ab-stats-row > div {
    display: flex;
    flex-direction: column;
}

.ab-stats-row small,
.ab-stats-row em {
    color: var(--muted-2);
    font-size: 8px;
    font-style: normal;
}

.ab-stats-row > span {
    color: var(--teal);
    font-family: var(--font-mono);
}

@media (max-width: 900px) {
    .quality-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nearest-examples {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .what-if-result {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .training-grid {
        grid-template-columns: 1fr;
    }

    .what-if-ranking {
        grid-column: 1 / -1;
    }

    .route-options {
        grid-template-columns: 1fr;
    }

    .navigation-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    body {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    body.route-sheet-open {
        overflow: hidden;
    }

    .layout {
        display: flex;
        min-height: calc(100svh - 104px);
        flex-direction: column;
    }

    .map-panel {
        order: 1;
        height: calc(100svh - 112px);
        min-height: 570px;
        max-height: none;
    }

    .panel {
        --route-sheet-tab-height: 78px;
        position: fixed;
        z-index: 50;
        inset: 0;
        order: 2;
        width: 100%;
        height: 100svh;
        height: 100dvh;
        max-height: none;
        min-height: 0;
        padding: 0 18px max(24px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: 0;
        box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.48);
        touch-action: pan-y;
        transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.2s ease;
    }

    .panel.sheet-peek {
        right: 14px;
        left: 14px;
        width: auto;
        overflow: hidden;
        border-color: color-mix(in srgb, var(--purple) 35%, var(--line));
        border-radius: 24px 24px 0 0;
        box-shadow:
            0 -18px 48px color-mix(in srgb, var(--purple) 20%, transparent),
            0 -5px 18px rgba(0, 0, 0, 0.18),
            inset 0 1px rgba(255, 255, 255, 0.14);
        transform: translateY(calc(100dvh - var(--route-sheet-tab-height) - env(safe-area-inset-bottom)));
    }

    .panel.sheet-peek::before {
        height: 3px;
        opacity: 1;
    }

    .panel.sheet-peek .panel-sheet-content {
        display: none;
    }

    .panel.sheet-half,
    .panel.sheet-full {
        transform: translateY(0);
    }

    .panel-sheet-handle {
        position: sticky;
        z-index: 3;
        top: 0;
        display: grid;
        width: calc(100% + 36px);
        min-height: var(--route-sheet-tab-height);
        margin: 0 -18px 12px;
        padding: 14px 16px 10px;
        align-items: center;
        grid-template-columns: 42px minmax(0, 1fr) 38px;
        gap: 12px;
        border: 0;
        border-bottom: 1px solid var(--line);
        border-radius: 22px 22px 0 0;
        background:
            linear-gradient(135deg, color-mix(in srgb, var(--purple) 7%, transparent), color-mix(in srgb, var(--teal) 5%, transparent)),
            color-mix(in srgb, var(--bg-panel) 96%, transparent);
        color: var(--paper);
        box-shadow: none;
        font-family: var(--font-display);
        text-align: left;
        backdrop-filter: blur(16px);
    }

    .panel.sheet-peek .panel-sheet-handle {
        margin-bottom: 0;
        border-bottom: 0;
        border-radius: 24px 24px 0 0;
    }

    .panel.sheet-full .panel-sheet-handle {
        padding-top: max(14px, calc(env(safe-area-inset-top) + 8px));
        border-radius: 0;
    }

    .panel-sheet-handle:hover,
    .panel-sheet-handle:active {
        transform: none;
        box-shadow: none;
    }

    .sheet-grabber {
        position: absolute;
        top: 6px;
        left: 50%;
        width: 34px;
        height: 3px;
        border-radius: 999px;
        background: color-mix(in srgb, var(--purple) 48%, var(--line-bright));
        transform: translateX(-50%);
    }

    .sheet-route-mark {
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 14px;
        background: linear-gradient(145deg, var(--purple), var(--teal));
        color: #fff;
        box-shadow: 0 8px 20px color-mix(in srgb, var(--purple) 28%, transparent);
    }

    .sheet-route-mark svg {
        width: 27px;
        height: 27px;
    }

    .sheet-copy {
        display: block;
        min-width: 0;
    }

    .sheet-copy strong,
    .sheet-copy small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sheet-copy strong {
        color: var(--paper);
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.01em;
        line-height: 1.15;
    }

    .sheet-copy small {
        margin-top: 4px;
        color: var(--teal-dim);
        font-family: var(--font-mono);
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.08em;
        line-height: 1.2;
        text-transform: uppercase;
    }

    .sheet-state-icon {
        display: grid;
        width: 38px;
        height: 38px;
        place-items: center;
        border: 1px solid color-mix(in srgb, var(--purple) 28%, var(--line));
        border-radius: 999px;
        background: color-mix(in srgb, var(--bg-raised) 80%, transparent);
        color: var(--paper);
        box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
        transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
    }

    .sheet-state-icon svg {
        width: 18px;
        height: 18px;
    }

    .panel.sheet-full .sheet-state-icon {
        border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
        background: color-mix(in srgb, var(--teal) 10%, var(--bg-raised));
        transform: rotate(180deg);
    }

    .map-focus-toggle {
        position: absolute;
        z-index: 13;
        top: 70px;
        left: 12px;
        display: block;
        width: auto;
        min-height: 34px;
        margin: 0;
        padding: 7px 11px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 10px;
        background: rgba(20, 23, 28, 0.82);
        color: #fff;
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
        font-family: var(--font-mono);
        font-size: 10px;
        backdrop-filter: blur(10px);
    }

    .map-trip-summary {
        bottom: 102px;
    }

    .map-pick-hint {
        bottom: 110px;
    }

    .panel-highlights {
        display: none;
    }

    .route-editor-toolbar {
        grid-template-columns: repeat(2, 1fr);
    }

    .route-options-section {
        padding: 14px;
    }

    .section-heading-inline {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .section-heading-inline > small {
        text-align: left;
    }

    .route-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ml-lab-heading,
    .prediction-explainer-head,
    .boundary-view-header,
    .model-feedback-panel,
    .model-card-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .ml-readonly-badge {
        align-self: flex-start;
    }

    .boundary-section {
        margin-top: 16px;
    }

    .boundary-panel {
        border-radius: 16px;
    }

    .ml-lab-tabs {
        padding: 12px 12px 0;
    }

    .ml-lab-tab {
        min-height: 44px;
        padding-inline: 11px;
    }

    .ml-lab-view {
        padding: 16px 13px 18px;
    }

    .boundary-controls {
        justify-content: flex-start;
    }

    .boundary-chart-wrap {
        height: 350px;
        padding: 7px;
    }

    .prediction-hero,
    .model-explanation-grid,
    .quality-grid,
    .model-card-grid,
    .model-comparison-cards,
    .what-if-controls,
    .what-if-result,
    .dataset-summary {
        grid-template-columns: 1fr;
    }

    .prediction-hero {
        align-items: flex-start;
    }

    .prediction-score {
        position: absolute;
        top: 13px;
        right: 13px;
        min-width: 70px;
        min-height: 70px;
    }

    .prediction-hero > div:first-child {
        padding-right: 82px;
    }

    .model-input-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .model-feedback-actions {
        justify-content: flex-start;
    }

    .what-if-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .what-if-ranking {
        grid-column: auto;
    }

    .what-if-counterfactual {
        align-items: flex-start;
        flex-direction: column;
    }

    .what-if-counterfactual strong {
        text-align: left;
    }

    .quality-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .network-visual {
        min-height: 280px;
    }

    .network-values {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dataset-summary-hero {
        grid-row: auto;
        padding-bottom: 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .dataset-summary-grid,
    .release-policy-card ol {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nearest-examples {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .model-card-privacy {
        max-width: none;
    }

    .ab-stats-row {
        grid-template-columns: 1fr auto;
    }

    .ab-stats-row em {
        grid-column: 1 / -1;
    }
}

@media print {
    .top-bar-controls,
    .panel,
    .map-mode-control,
    .map-focus-toggle,
    .tab-nav,
    .route-actions-grid,
    .share-btn,
    .boundary-section,
    .install-btn {
        display: none !important;
    }

    body,
    .container,
    #result-section,
    .tabs,
    .tab-panel {
        background: #fff !important;
        color: #111 !important;
        box-shadow: none !important;
    }

    .layout {
        display: block;
    }

    .map-panel {
        height: 360px;
        min-height: 360px;
    }

    #panel-navigation {
        display: block !important;
    }

    .navigation-steps {
        max-height: none;
        overflow: visible;
    }
}
