:root {
    --nav-primary: #1a6fd4;
    --nav-primary-dark: #1458a8;
    --nav-bg: #eef2f6;
    --nav-surface: #ffffff;
    --nav-text: #1e293b;
    --nav-muted: #64748b;
    --nav-border: #e2e8f0;
    --nav-radius: 1rem;
    --nav-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    --nav-sidebar-width: 300px;
    --nav-directions-width: 340px;
    --nav-gallery-height: 88px;
    /* Sân bản đồ — mặt đất campus nhạt (IsoY 0.42), không át nội dung */
    --map-stage-bg: #e9ece7;
    --map-iso-tile-w: 112px;
    --map-iso-tile-h: 47.04px; /* 56 * 2 * 0.42 */
    --map-iso-tiles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='47.04' viewBox='0 0 112 47.04'%3E%3Crect width='112' height='47.04' fill='%23e9ece7'/%3E%3Cpath d='M56 1.2 L109.5 23.52 L56 45.84 L2.5 23.52 Z' fill='%23f5f6f2' fill-opacity='0.32' stroke='%2394a3b8' stroke-opacity='0.1' stroke-width='0.75'/%3E%3Cpath d='M56 9 L88 23.52 L56 38 L24 23.52 Z' fill='%23ffffff' fill-opacity='0.08'/%3E%3C/svg%3E");
    --map-stage-vignette: radial-gradient(ellipse 80% 70% at 50% 42%, transparent 45%, rgba(100, 116, 139, 0.07) 100%);
    --map-stage-surface: #ffffff;
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html, body {
    font-family: var(--font-sans);
    color: var(--nav-text);
    background: var(--nav-bg);
    margin: 0;
    overflow: hidden;
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.nav-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.nav-main {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    position: relative;
}

.nav-shell.map-only .nav-main {
    flex: 1;
}

.nav-shell.map-only .nav-map-area {
    min-height: 0;
}

.nav-shell.gallery-hidden .nav-map-area,
.nav-shell.map-only .nav-map-area {
    flex: 1;
}

/* Sidebar */
.nav-sidebar {
    width: var(--nav-sidebar-width);
    flex-shrink: 0;
    background: var(--nav-surface);
    border-right: 1px solid var(--nav-border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    gap: 1.25rem;
    overflow-y: auto;
    box-shadow: var(--nav-shadow);
    z-index: 2;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.nav-brand-tagline {
    font-size: 0.65rem;
    color: var(--nav-muted);
    margin: 0.15rem 0 0;
    line-height: 1.3;
}

.nav-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a6fd4, #3b9aeb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.nav-brand-title {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: var(--nav-primary);
    margin: 0;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--nav-muted);
    margin-bottom: 0.5rem;
}

.nav-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--nav-muted);
    margin-bottom: 0.25rem;
}

.nav-field .form-select {
    border-radius: 0.65rem;
    border-color: var(--nav-border);
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
}

.location-floor-hint {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--nav-primary);
    background: #eff6ff;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}

/* Kiosk buttons — đồng bộ với admin UI */
.nav-shell-rail .btn,
.nav-shell .btn {
    border-radius: 0.55rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.btn-find-route {
    background: var(--nav-primary);
    border: none;
    border-radius: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.btn-find-route:hover {
    background: var(--nav-primary-dark);
}

.floor-pills {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
    max-height: 96px;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.floor-pill {
    border: 1px solid var(--nav-border);
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 0.4rem 0.15rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--nav-muted);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.floor-pill.active {
    background: var(--nav-primary);
    border-color: var(--nav-primary);
    color: #fff;
}

.nav-hotline {
    margin-top: auto;
    padding: 1rem;
    background: #f0f7ff;
    border-radius: var(--nav-radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.nav-hotline i {
    font-size: 1.25rem;
    color: var(--nav-primary);
}

.nav-hotline strong {
    display: block;
    font-size: 1.1rem;
    color: var(--nav-primary);
}

/* Map area */
.nav-map-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 360px;
    position: relative;
}

.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--nav-surface);
    border-bottom: 1px solid var(--nav-border);
}

.map-toolbar-floor {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--nav-primary);
}

.map-legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    align-items: center;
}

.map-legend-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--nav-muted);
    font-weight: 500;
}

.map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.map-legend-dot.legend-dept { background: #4ade80; }
.map-legend-dot.legend-elevator { background: #a78bfa; }
.map-legend-dot.legend-stairs { background: #fb923c; }
.map-legend-dot.legend-restroom { background: #2dd4bf; }
.map-legend-dot.legend-service { background: #1e40af; }
.map-legend-dot.legend-you { background: #22c55e; }
.map-legend-dot.legend-visited { background: #4ade80; }
.map-legend-dot.legend-node { background: #bfdbfe; border: 1px solid #1a6fd4; }

/* Nền sân bản đồ (dùng chung visitor + admin map-draw) */
.map-stage-ground {
    background-color: var(--map-stage-bg, #e9ece7);
    background-image: var(--map-stage-vignette), var(--map-iso-tiles);
    background-size: auto, var(--map-iso-tile-w, 112px) var(--map-iso-tile-h, 47.04px);
    background-position: center, center;
    background-repeat: no-repeat, repeat;
}

.map-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--map-stage-bg);
    background-image: var(--map-stage-vignette), var(--map-iso-tiles);
    background-size: auto, var(--map-iso-tile-w) var(--map-iso-tile-h);
    background-position: center, center;
    background-repeat: no-repeat, repeat;
}

.map-canvas {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none;
    overscroll-behavior: contain;
    -webkit-user-select: none;
    user-select: none;
}

.map-viewport-layer,
.map-svg-host,
.map-svg-host svg {
    touch-action: none;
}

.map-canvas.map-canvas--dragging {
    cursor: grabbing;
}

.map-canvas:active {
    cursor: grabbing;
}

.map-viewport-layer {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.map-svg-host {
    display: inline-block;
    padding: 1rem;
    min-width: 0;
    line-height: 0;
}

.map-svg-host svg {
    display: block;
    width: auto;
    max-width: none;
    height: auto;
}

.map-loading,
.map-load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 280px;
    color: var(--nav-muted);
    padding: 2rem;
}

.map-canvas-fill.is-loading {
    position: relative;
    min-height: min(52vh, 420px);
    background:
        linear-gradient(110deg, #f1f5f9 0%, #e2e8f0 40%, #f8fafc 55%, #e2e8f0 70%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: map-skeleton-shimmer 1.35s ease-in-out infinite;
}

.map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    min-height: 0;
    background: rgba(248, 250, 252, 0.72);
    backdrop-filter: blur(2px);
}

.map-loading-overlay span,
.map-loading-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: #475569;
}

.map-loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #e2e8f0;
    border-top-color: var(--nav-primary);
    border-radius: 50%;
    animation: map-loading-spin 0.75s linear infinite;
}

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

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

.map-load-error i {
    font-size: 2rem;
    color: #f59e0b;
}

.map-zoom-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    z-index: 5;
}

.map-zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 0.65rem;
    background: var(--nav-surface);
    box-shadow: var(--nav-shadow);
    color: var(--nav-text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-zoom-btn:hover {
    background: #f1f5f9;
}

.map-zoom-btn-locate {
    color: #16a34a;
}

.map-zoom-btn-locate:hover {
    background: #dcfce7;
}

.layout-toggle-bar {
    position: absolute;
    top: 4.75rem;
    right: 1rem;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-shell.directions-hidden .layout-toggle-bar,
.nav-shell.map-only .layout-toggle-bar {
    right: 1rem;
}

.nav-shell:not(.directions-hidden):not(.map-only) .layout-toggle-bar {
    right: calc(var(--nav-directions-width) + 1rem);
}

.layout-toggle-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 0.65rem;
    background: var(--nav-surface);
    box-shadow: var(--nav-shadow);
    color: var(--nav-muted);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--nav-text);
}

.layout-toggle-btn.is-on {
    background: var(--nav-primary);
    color: #fff;
}

.layout-toggle-btn-map.is-on {
    background: #16a34a;
}

.layout-edge-tab {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 25;
    width: 28px;
    height: 56px;
    border: none;
    background: var(--nav-surface);
    box-shadow: var(--nav-shadow);
    color: var(--nav-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-edge-tab-left {
    left: 0;
    border-radius: 0 0.65rem 0.65rem 0;
}

.layout-edge-tab-right {
    right: 0;
    border-radius: 0.65rem 0 0 0.65rem;
}

.map-legend-float {
    position: absolute;
    right: var(--map-overlay-right);
    bottom: var(--map-overlay-bottom);
    left: auto;
    top: auto;
    background: var(--nav-surface);
    border: 1px solid var(--nav-border);
    border-radius: var(--nav-radius);
    padding: 0.55rem 0.7rem 0.65rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    font-size: 0.72rem;
    z-index: 13;
    width: min(220px, calc(100vw - 5.5rem));
    max-width: 220px;
    max-height: min(36vh, 280px);
    overflow: hidden;
    pointer-events: auto;
}

.map-legend-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.map-legend-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--nav-text);
}

.map-legend-title .bi {
    font-size: 0.9rem;
    color: var(--nav-primary);
}

.map-legend-hide-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--nav-border);
    border-radius: 0.4rem;
    background: #f8fafc;
    color: var(--nav-muted);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.map-legend-hide-btn:hover {
    background: #eef2f6;
    color: var(--nav-text);
    border-color: #cbd5e1;
}

.map-legend-hide-btn .bi {
    font-size: 0.75rem;
}

.map-legend-restore {
    position: absolute;
    right: var(--map-overlay-right);
    bottom: var(--map-overlay-bottom);
    z-index: 13;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--nav-border);
    border-radius: 2rem;
    background: var(--nav-surface);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    color: var(--nav-text);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.map-legend-restore:hover {
    background: #f8fafc;
    color: var(--nav-primary);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
}

.map-legend-restore .bi-info-circle {
    color: var(--nav-primary);
    font-size: 0.95rem;
}

.map-legend-restore .bi-chevron-up {
    font-size: 0.7rem;
    color: var(--nav-muted);
}

/* Chú thích: icon trigger + popup */
.map-legend-trigger {
    position: absolute;
    z-index: 13;
    right: auto;
    left: max(0.85rem, env(safe-area-inset-left, 0px));
    bottom: var(--map-overlay-bottom, 1rem);
    top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    background: var(--nav-surface);
    color: var(--nav-primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

.map-legend-trigger.is-active {
    border-color: var(--nav-primary);
    background: #eff6ff;
}

.map-legend-trigger .bi {
    font-size: 1.05rem;
}

.map-legend-backdrop {
    position: fixed;
    inset: 0;
    z-index: 12040;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.42);
    cursor: default;
}

.map-legend-popup {
    position: fixed;
    z-index: 12050;
    left: 50%;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(300px, calc(100vw - 2rem));
    max-height: min(60dvh, 420px);
    overflow: hidden;
    background: var(--nav-surface);
    border: 1px solid var(--nav-border);
    border-radius: 0.55rem;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
    pointer-events: auto;
}

.map-legend-popup .map-legend-head {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--nav-border);
}

.map-legend-popup .map-legend-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--nav-text);
}

.map-legend-popup .map-legend-hide-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    flex-shrink: 0;
}

.map-legend-popup .map-legend-body {
    max-height: min(48dvh, 340px);
    overflow-y: auto;
    padding: 0.5rem 0.85rem 0.75rem;
    margin-top: 0;
}

.map-legend-popup .legend-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    padding: 0.45rem 0;
    min-height: 36px;
}

.map-legend-popup .legend-row + .legend-row {
    border-top: 1px solid #f1f5f9;
}

.map-legend-popup .legend-icon-badge {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.35rem;
    border: 1px solid var(--legend-border, #cbd5e1);
    background: var(--legend-bg, #f8fafc);
    color: var(--legend-icon, #334155);
    font-size: 0.85rem;
    line-height: 1;
}

.map-legend-popup .legend-label {
    flex: 1;
    min-width: 0;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--nav-text);
}

.nav-rail-mobile-fab {
    display: none;
}

.nav-mobile-dock {
    display: none;
}

.nav-chrome-floors--mobile {
    display: none;
}

.nav-chrome-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    background: var(--nav-surface);
    color: var(--nav-text);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    touch-action: manipulation;
}

.nav-chrome-icon-btn.active {
    border-color: var(--nav-primary);
    background: var(--nav-primary);
    color: #fff;
}

.nav-browse-sheet-backdrop {
    display: none;
}

.nav-browse-sheet {
    display: none;
}

.map-legend-body {
    margin-top: 0;
    max-height: min(30vh, 240px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.map-legend-float .legend-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.3rem;
    line-height: 1.35;
}

.map-legend-float .legend-row:last-child {
    margin-bottom: 0;
}

.map-legend-float .legend-icon-badge {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--legend-bg, #f1f5f9);
    border: 1px solid var(--legend-border, rgba(148, 163, 184, 0.25));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.map-legend-float .legend-icon-badge .bi {
    font-size: 0.9rem;
    line-height: 1;
    color: var(--legend-icon, var(--nav-primary));
}

.map-legend-float .legend-label {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    font-size: 0.72rem;
    font-weight: 500;
    color: #475569;
    letter-spacing: 0.01em;
}

/* Directions panel */
.nav-directions {
    width: var(--nav-directions-width);
    flex-shrink: 0;
    background: var(--nav-surface);
    border-left: 1px solid var(--nav-border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--nav-shadow);
    z-index: 2;
}

.directions-header {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--nav-border);
}

.directions-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.route-stats {
    display: flex;
    gap: 1.5rem;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--nav-primary);
}

.directions-steps {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    max-height: calc(100vh - 280px);
}

.route-step {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    position: relative;
}

.route-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: var(--nav-border);
}

.route-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--nav-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    font-size: 0.9rem;
}

.route-step-btn {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0;
    margin: 0;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}

.route-step-btn:hover {
    background: #f8fafc;
}

.route-step.active .route-step-icon {
    background: #22c55e;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.route-step.completed .route-step-icon {
    background: #22c55e;
    color: #fff;
}

.route-step.completed .route-step-title {
    color: #15803d;
}

.route-step.destination .route-step-icon {
    background: #dc2626;
    color: #fff;
}

.route-step-floor {
    font-size: 0.65rem;
    margin-top: 0.2rem;
}

.nav-dot-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: dot-ring-pulse 1.6s ease-in-out infinite;
}

.nav-route-waypoint,
.nav-route-waypoint-label {
    cursor: pointer;
    pointer-events: all;
}

.route-step-markers {
    pointer-events: all;
}

.nav-route-step-marker {
    cursor: pointer;
    pointer-events: all;
}

@keyframes dot-ring-pulse {
    0%, 100% {
        stroke-width: 1.5;
        opacity: 0.35;
    }
    50% {
        stroke-width: 2.5;
        opacity: 0.65;
    }
}

.route-step-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.route-step-detail {
    font-size: 0.75rem;
    color: var(--nav-muted);
    margin: 0.15rem 0 0;
}

.directions-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--nav-border);
}

.btn-start-nav {
    width: 100%;
    background: var(--nav-primary);
    border: none;
    border-radius: 0.55rem;
    font-weight: 700;
    padding: 0.85rem;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.btn-start-nav:hover {
    background: var(--nav-primary-dark);
}

/* Floor gallery */
.nav-gallery {
    height: var(--nav-gallery-height);
    background: var(--nav-surface);
    border-top: 1px solid var(--nav-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    overflow-x: auto;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 0.65rem;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #e2e8f0;
    padding: 0;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.gallery-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
}

.gallery-thumb:hover {
    transform: translateY(-2px);
}

.gallery-thumb.active {
    border-color: var(--nav-primary);
    box-shadow: 0 0 0 2px rgba(26, 111, 212, 0.2);
}

.gallery-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    padding: 0.2rem;
}

.gallery-thumb-overview {
    width: 140px;
}

/* Route line — mockup: viền sáng + đường xanh + mũi tên trắng.
   Overlay đã inject khi đang dẫn đường → luôn hiện (không phụ thuộc .route-visible trên ancestor). */
.route-visible .route-overlay,
.nav-dynamic-overlay .route-overlay,
.route-overlay.route-remaining,
.route-overlay.route-completed {
    opacity: 1;
}

.route-overlay {
    opacity: 0;
    transition: opacity 0.35s ease;
}

.route-completed path {
    stroke: #22c55e !important;
}

.route-completed .route-arrows path {
    fill: #ffffff !important;
}

.route-remaining path {
    stroke: #1a6fd4 !important;
}

.route-arrows path {
    filter: drop-shadow(0 0 1px rgba(26, 111, 212, 0.6));
}

.elevator-shaft-line {
    animation: elevator-flow 1.4s linear infinite;
}

/* Chuyển tầng trong tòa — thanh dưới bản đồ, đồng bộ callout lộ trình */
.map-svg-host .route-floor-transition {
    pointer-events: none;
}

.map-svg-host .route-floor-transition text {
    user-select: none;
}

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

.nav-branch-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.25rem max(2rem, env(safe-area-inset-bottom, 0px));
    text-align: center;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(26, 111, 212, 0.12), transparent 55%),
        linear-gradient(165deg, #e8f1fb 0%, #f4f7fa 45%, #eef2f6 100%);
}

.nav-branch-gate-card {
    width: min(100%, 26rem);
    padding: 2rem 1.5rem 1.75rem;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.nav-branch-gate-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    border-radius: 1rem;
    font-size: 2rem;
}

.nav-branch-gate-icon--warning {
    color: #b45309;
    background: #fff7ed;
}

.nav-branch-gate-icon--muted {
    color: #64748b;
    background: #f1f5f9;
}

.nav-branch-gate-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.nav-branch-gate-message {
    margin: 0;
    color: #475569;
    font-size: 0.975rem;
    line-height: 1.5;
}

.nav-branch-gate-code {
    margin: 0.85rem 0 0;
    font-size: 0.875rem;
    color: #64748b;
}

.nav-branch-gate-code code {
    padding: 0.15rem 0.45rem;
    border-radius: 0.35rem;
    background: #f1f5f9;
    color: #be185d;
    font-size: 0.85em;
}

.nav-branch-gate-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-top: 1.35rem;
}

.nav-branch-gate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.1rem;
    border-radius: 0.75rem;
    font-size: 0.925rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-branch-gate-btn-primary {
    color: #fff;
    background: var(--nav-primary, #1a6fd4);
    box-shadow: 0 4px 14px rgba(26, 111, 212, 0.28);
}

.nav-branch-gate-btn-primary:hover,
.nav-branch-gate-btn-primary:focus-visible {
    color: #fff;
    background: var(--nav-primary-dark, #1458a8);
}

.nav-branch-gate-btn-secondary {
    color: #334155;
    background: #f1f5f9;
}

.nav-branch-gate-btn-secondary:hover,
.nav-branch-gate-btn-secondary:focus-visible {
    color: #0f172a;
    background: #e2e8f0;
}

/* Trang chọn chi nhánh (/) */
.nav-branch-portal {
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.25rem max(2rem, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(165deg, #e8f1fb 0%, #f4f7fa 45%, #ffffff 100%);
    overflow-y: auto;
}

.nav-branch-portal-header {
    text-align: center;
    max-width: 36rem;
    margin: 0 auto 2rem;
}

.nav-branch-portal-logo {
    max-height: 4.5rem;
    width: auto;
    margin-bottom: 0.75rem;
}

.nav-branch-portal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    background: #fff;
    color: var(--nav-primary, #1a6fd4);
    font-size: 2rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 16px rgba(26, 111, 212, 0.15);
}

.nav-branch-portal-title {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.35rem;
}

.nav-branch-portal-slogan {
    color: #475569;
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.nav-branch-portal-hint {
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
}

.nav-branch-portal-empty {
    text-align: center;
    color: #64748b;
    padding: 3rem 1rem;
}

.nav-branch-portal-empty .bi {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.nav-branch-portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    gap: 1rem;
    max-width: 56rem;
    margin: 0 auto;
}

.nav-branch-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.nav-branch-card:hover,
.nav-branch-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--branch-accent, var(--nav-primary, #1a6fd4));
    box-shadow: 0 8px 24px rgba(26, 111, 212, 0.18);
    outline: none;
}

.nav-branch-card-disabled {
    cursor: not-allowed;
    opacity: 0.72;
    background: #f8fafc;
}

.nav-branch-card-disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    border-color: rgba(148, 163, 184, 0.35);
}

.nav-branch-card-icon {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
}

.nav-branch-card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.nav-branch-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-branch-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
    line-height: 1.3;
}

.nav-branch-card-tagline,
.nav-branch-card-meta,
.nav-branch-card-status {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.35;
}

.nav-branch-card-status {
    color: #b45309;
}

.nav-branch-card-action {
    flex-shrink: 0;
    font-size: 1.75rem;
    color: var(--branch-accent, var(--nav-primary, #1a6fd4));
    opacity: 0.85;
}

/* Map-first: panel trái trên bản đồ, nút tầng/zoom phải */
.nav-shell-rail {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.nav-main-map {
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    --map-overlay-right: 0.85rem;
    --map-overlay-top: max(0.85rem, env(safe-area-inset-top, 0px));
    --map-overlay-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

/* Bản đồ phủ toàn vùng kiosk — SVG lớn fit theo khung màn hình */
.nav-shell-rail .nav-main-map > .nav-map-area {
    position: absolute;
    inset: 0;
    z-index: 1;
    flex: none;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Bước 2 zone browse: bảng tầng/điểm thay SVG */
.zone-child-browse {
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 90% 55% at 50% -10%, rgba(26, 111, 212, 0.14), transparent 55%),
        var(--nav-bg);
}

.zone-child-browse-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: min(720px, 100%);
    margin: 0 auto;
    padding: max(0.85rem, env(safe-area-inset-top, 0px)) 1rem max(1.1rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.zone-child-browse-head {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.7rem;
}

.zone-child-browse-topbar {
    display: flex;
    align-items: center;
}

.zone-child-browse-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.35rem 0.55rem 0.35rem 0.4rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--nav-primary);
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.zone-child-browse-back:hover,
.zone-child-browse-back:focus-visible {
    background: rgba(26, 111, 212, 0.1);
    outline: none;
}

.zone-child-browse-back .bi {
    font-size: 0.95rem;
}

.zone-child-browse-eyebrow {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--nav-primary);
}

.zone-child-browse-eyebrow .bi {
    font-size: 0.8rem;
}

.zone-child-browse-title {
    margin: 0.1rem 0 0;
    font-size: clamp(1.05rem, 2vw, 1.28rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--nav-text);
}

.zone-child-browse-hint {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--nav-muted);
}

.zone-child-browse-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.65rem;
    background: var(--nav-surface);
    border: 1.5px solid rgba(26, 111, 212, 0.28);
    box-shadow: 0 1px 2px rgba(26, 111, 212, 0.06);
}

.zone-child-browse-search:focus-within {
    border-color: var(--nav-primary);
    box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.16);
}

.zone-child-browse-search .bi {
    color: var(--nav-primary);
    font-size: 0.9rem;
}

.zone-child-browse-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.88rem;
    color: var(--nav-text);
}

.zone-child-browse-search input::placeholder {
    color: #94a3b8;
}

.zone-child-browse-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 0.75rem;
    background: var(--nav-surface);
    border: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
}

.zone-child-browse-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 10rem;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--nav-muted);
}

.zone-child-browse-empty .bi {
    font-size: 1.4rem;
    color: var(--nav-primary);
    opacity: 0.55;
}

.zone-child-browse-empty p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    max-width: 22rem;
}

.zone-child-tree {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.zone-child-tree-floor {
    border-bottom: 1px solid var(--nav-border);
}

.zone-child-tree-floor:last-child {
    border-bottom: 0;
}

.zone-child-tree-floor-row {
    display: flex;
    align-items: stretch;
    min-height: 2.4rem;
}

.zone-child-tree-toggle {
    flex: 0 0 2.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--nav-primary);
    cursor: pointer;
}

.zone-child-tree-toggle:hover,
.zone-child-tree-toggle:focus-visible {
    background: rgba(26, 111, 212, 0.08);
    outline: none;
}

.zone-child-tree-toggle .bi {
    font-size: 0.85rem;
}

.zone-child-tree-floor-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    margin: 0;
    padding: 0.55rem 0.7rem 0.55rem 0.15rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--nav-text);
}

.zone-child-tree-floor-main:hover,
.zone-child-tree-floor-main:focus-visible {
    background: rgba(26, 111, 212, 0.07);
    outline: none;
}

.zone-child-tree-floor-main > .bi-layers {
    flex-shrink: 0;
    color: var(--nav-primary);
    font-size: 0.95rem;
}

.zone-child-tree-floor-name {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.3;
}

.zone-child-tree-count {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 650;
    color: var(--nav-muted);
    background: rgba(26, 111, 212, 0.08);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
}

.zone-child-tree-open {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--nav-primary);
    opacity: 0.65;
}

.zone-child-tree-points {
    list-style: none;
    margin: 0;
    padding: 0 0 0.35rem 2.1rem;
    background: rgba(248, 250, 252, 0.85);
    border-top: 1px solid rgba(26, 111, 212, 0.08);
}

.zone-child-tree-point {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.7rem 0.45rem 0.35rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--nav-text);
}

.zone-child-tree-point:hover,
.zone-child-tree-point:focus-visible {
    background: rgba(26, 111, 212, 0.08);
    outline: none;
}

.zone-child-tree-point > .bi-geo-alt {
    flex-shrink: 0;
    color: var(--nav-primary);
    font-size: 0.82rem;
}

.zone-child-tree-point-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 550;
    line-height: 1.35;
}

.zone-child-tree-point > .bi-chevron-right {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--nav-primary);
    opacity: 0.55;
}

@media (max-width: 640px) {
    .zone-child-browse-panel {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .zone-child-tree-points {
        padding-left: 1.75rem;
    }

    .zone-child-tree-floor-name {
        font-size: 0.84rem;
    }

    .zone-child-tree-point-name {
        font-size: 0.78rem;
    }
}

.floor-location-table-wrap {
    overflow: auto;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 0.75rem;
    background: #fff;
}

.floor-location-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.floor-location-table th,
.floor-location-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    vertical-align: middle;
}

.floor-location-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.floor-location-table tbody tr:last-child td {
    border-bottom: none;
}

.floor-location-table tbody tr:hover {
    background: #f8fafc;
}

.floor-location-name {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-weight: 650;
    color: var(--nav-text);
    line-height: 1.35;
}

.floor-location-name .bi {
    color: var(--nav-primary);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.floor-location-kind {
    display: inline-block;
    margin-top: 0.2rem;
    margin-left: 1.35rem;
    font-size: 0.72rem;
    color: #64748b;
}

.floor-location-table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right !important;
}

.floor-location-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.3rem;
    padding: 0.35rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.floor-location-pick--from {
    background: #ecfdf5;
    border-color: #86efac;
    color: #15803d;
}

.floor-location-pick--to {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.floor-location-pick:hover,
.floor-location-pick:focus-visible {
    filter: brightness(0.97);
    outline: none;
}

@media (max-width: 640px) {
    .floor-location-table th,
    .floor-location-table td {
        padding: 0.6rem 0.55rem;
    }

    .floor-location-pick {
        padding: 0.4rem 0.45rem;
    }
}

.nav-rail {
    width: min(300px, 38vw);
    flex-shrink: 0;
    background: var(--nav-surface);
    display: flex;
    flex-direction: column;
    min-height: 0;
    z-index: 10;
}

.nav-rail-on-map {
    position: absolute;
    left: 0.85rem;
    top: 0.85rem;
    bottom: auto;
    height: auto;
    max-height: min(50vh, 520px);
    width: min(300px, calc(100vw - 6.5rem));
    /* Không dùng backdrop-filter — phá containing block của position:fixed trong dropdown */
    background: color-mix(in srgb, var(--nav-surface) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--nav-border) 85%, transparent);
    border-radius: 1rem;
    box-shadow: 0 10px 36px rgba(15, 23, 42, 0.12);
    pointer-events: auto;
    overflow: hidden;
    z-index: 40;
}

.nav-rail-on-map.nav-rail--search {
    max-height: min(62vh, 580px);
    overflow: visible;
    --nav-rail-pad-x: 0.85rem;
    --nav-rail-pad-block: 0.7rem;
    --nav-rail-stack-gap: 0.75rem;
}

.nav-rail--search .nav-rail-head,
.nav-rail--search .nav-rail-search,
.nav-rail--search .nav-rail-field-group,
.nav-rail--search .nav-rail-input-qr,
.nav-rail--search .nav-rail-route-fields {
    overflow: visible;
}

.nav-rail--search .nav-rail-head {
    padding: var(--nav-rail-pad-block) var(--nav-rail-pad-x);
}

.nav-rail--search .nav-rail-search {
    padding: var(--nav-rail-pad-block) var(--nav-rail-pad-x) calc(var(--nav-rail-pad-block) + 0.1rem);
}

.nav-rail--search .nav-rail-route-fields {
    gap: 0.55rem;
}

.nav-rail--search .nav-rail-btn-find {
    margin-top: var(--nav-rail-stack-gap);
}

.nav-rail-connector-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.nav-rail-connector-opt {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--nav-border, #dbeafe);
    border-radius: 0.65rem;
    background: #fff;
    color: var(--nav-muted, #64748b);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-rail-connector-opt .bi {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
}

.nav-rail-connector-opt span {
    display: inline;
    white-space: nowrap;
}

.nav-rail-connector-opt.active {
    border-color: var(--nav-primary, #1a6fd4);
    background: #eff6ff;
    color: var(--nav-primary, #1a6fd4);
    box-shadow: 0 0 0 1px rgba(26, 111, 212, 0.12);
}

.nav-rail-connector-opt:hover:not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--nav-text, #334155);
}

.nav-rail-route-error {
    margin-top: 0.45rem;
    color: #b45309;
    font-weight: 600;
}

.nav-rail-route-error-box {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.55rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.55rem;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

.nav-rail-route-error-box .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #d97706;
    font-size: 1rem;
}

/* Panel dẫn đường: cao hơn để xem nhiều bước */
.nav-rail-on-map.nav-rail--directions {
    display: flex;
    flex-direction: column;
    height: min(72vh, 640px);
    max-height: min(72vh, 640px);
}

.nav-rail--directions .nav-rail-head,
.nav-rail--directions .nav-rail-route-meta {
    flex-shrink: 0;
}

.nav-rail--directions .nav-rail-steps {
    flex: 1 1 auto;
    min-height: 10rem;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.nav-chrome-map-tools {
    z-index: 12;
}

.nav-rail-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--nav-border);
}

.nav-rail-change-branch {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    color: var(--nav-primary, #1a6fd4);
    background: rgba(26, 111, 212, 0.08);
    text-decoration: none;
    margin-left: auto;
}

.nav-rail-head:has(.nav-rail-collapse-btn) .nav-rail-change-branch {
    margin-left: 0;
}

.nav-rail-collapse-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border: none;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: var(--nav-muted);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.nav-rail-change-branch + .nav-rail-collapse-btn {
    margin-left: 0.35rem;
}

.nav-rail-collapse-btn:hover {
    background: #e2e8f0;
    color: var(--nav-primary);
}

.nav-rail-head-hint {
    display: none;
    margin-left: auto;
    margin-right: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(26, 111, 212, 0.1);
    color: var(--nav-primary);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.nav-rail-head--expandable {
    cursor: pointer;
}

.nav-rail-cta-route {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-height: 2.4rem;
    margin: 0;
    padding: 0.45rem 0.85rem;
    border: none;
    border-radius: 0.75rem;
    background: var(--nav-primary, #1a6fd4);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: none;
}

.nav-rail-cta-route:active {
    background: var(--nav-primary-dark, #1458a8);
}

.nav-rail-cta-route__chev {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Desktop: luôn hiện form tìm đường + step list — không dùng chrome thu gọn kiểu mobile */
@media (min-width: 992px) {
    .nav-rail-on-map .nav-rail-collapse-btn {
        display: none !important;
    }

    .nav-rail-on-map .nav-rail-sheet-handle {
        display: none !important;
    }

    .nav-rail-on-map .nav-rail-cta-route,
    .nav-rail-on-map .nav-rail-step-nav,
    .nav-rail-on-map .nav-rail-connector-bar,
    .nav-rail-on-map .nav-rail-head-hint {
        display: none !important;
    }

    .nav-rail-on-map.nav-rail--search .nav-rail-brand,
    .nav-rail-on-map.nav-rail--directions .nav-rail-brand {
        display: flex !important;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-search,
    .nav-rail-on-map.nav-rail--collapsed .nav-rail-steps,
    .nav-rail-on-map.nav-rail--collapsed .nav-rail-foot,
    .nav-rail-on-map.nav-rail--collapsed .nav-route-handoff,
    .nav-rail-on-map.nav-rail--collapsed .nav-rail-qr-quick,
    .nav-rail-on-map.nav-rail--collapsed .nav-rail-route-meta {
        display: flex !important;
    }

    .nav-rail-on-map .nav-rail-step-foot {
        display: flex;
        align-items: stretch;
        gap: 0.5rem;
        flex-shrink: 0;
        margin: 0 0.55rem 0.65rem;
        padding: 0;
    }

    .nav-rail-step-foot__btn {
        flex: 1 1 0;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        min-height: 2.55rem;
        padding: 0.45rem 0.7rem;
        border-radius: 0.7rem;
        font-size: 0.82rem;
        font-weight: 650;
        line-height: 1.15;
        white-space: nowrap;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .nav-rail-step-foot__btn .bi {
        font-size: 0.95rem;
        line-height: 1;
    }

    .nav-rail-step-foot__btn--prev {
        border: 1.5px solid color-mix(in srgb, var(--nav-primary, #1a6fd4) 45%, #cbd5e1);
        background: #fff;
        color: var(--nav-primary, #1a6fd4);
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .nav-rail-step-foot__btn--prev:hover:not(:disabled),
    .nav-rail-step-foot__btn--prev:focus-visible:not(:disabled) {
        background: color-mix(in srgb, var(--nav-primary, #1a6fd4) 8%, #fff);
        border-color: var(--nav-primary, #1a6fd4);
        outline: none;
    }

    .nav-rail-step-foot__btn--next {
        border: 1.5px solid var(--nav-primary, #1a6fd4);
        background: var(--nav-primary, #1a6fd4);
        color: #fff;
        box-shadow: 0 2px 8px color-mix(in srgb, var(--nav-primary, #1a6fd4) 28%, transparent);
    }

    .nav-rail-step-foot__btn--next:hover:not(:disabled),
    .nav-rail-step-foot__btn--next:focus-visible:not(:disabled) {
        background: var(--nav-primary-dark, #1458a8);
        border-color: var(--nav-primary-dark, #1458a8);
        outline: none;
    }

    .nav-rail-step-foot__btn:disabled {
        opacity: 0.42;
        cursor: not-allowed;
        box-shadow: none;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-step-foot {
        display: none !important;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-search {
        display: block !important;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-steps {
        display: flex !important;
        flex-direction: column;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-route-meta {
        display: block !important;
    }

    .nav-rail-on-map.nav-rail--collapsed {
        height: auto;
        max-height: none;
        overflow: auto;
    }

    .nav-rail-on-map.nav-rail--collapsed .nav-rail-head {
        border-bottom: 1px solid #e2e8f0;
        padding: 0.75rem 1rem;
    }

    .nav-rail-on-map.nav-rail--search-collapsed-only,
    .nav-rail-on-map.nav-rail--step-nav-only {
        /* Desktop bỏ modifier mobile */
    }

    /* Không ẩn hẳn trên desktop — giữ thanh thu gọn để mở lại */
    .nav-rail-on-map.nav-rail--fab-hidden {
        display: flex !important;
        flex-direction: column;
        width: min(300px, calc(100vw - 6.5rem));
        max-width: min(300px, calc(100vw - 6.5rem));
        height: auto;
        max-height: none;
    }

    .nav-rail-on-map .nav-rail-brand span {
        max-width: 12rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.nav-rail-change-branch:hover {
    background: rgba(26, 111, 212, 0.16);
    color: var(--nav-primary-dark, #1458a8);
}

.nav-rail-back {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 0.5rem;
    background: #f1f5f9;
    flex-shrink: 0;
    touch-action: manipulation;
}

.nav-rail-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--nav-primary);
    min-width: 0;
}

.nav-rail-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-rail-search {
    padding: 0.75rem 0.85rem;
    flex-shrink: 0;
}

.nav-rail-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--nav-muted);
    margin-bottom: 0.25rem;
}

.nav-rail-route-fields {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.nav-rail-route-ends {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem 0.55rem;
    align-items: stretch;
}

.nav-rail-route-spine {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    align-self: stretch;
    padding: 0.15rem 0;
    min-height: 100%;
    position: relative;
}

.nav-rail-route-spine::before {
    content: "";
    position: absolute;
    top: 1.15rem;
    bottom: 1.15rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #22c55e 0%, #cbd5e1 45%, #dc2626 100%);
    border-radius: 1px;
    pointer-events: none;
    z-index: 0;
}

.nav-rail-end-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px #fff;
    line-height: 1;
}

.nav-rail-end-icon .bi {
    font-size: 1.05rem;
    line-height: 1;
}

.nav-rail-end-icon--from .bi {
    color: #16a34a;
}

.nav-rail-end-icon--to .bi {
    color: #dc2626;
}

.nav-rail-route-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
}

.nav-rail-route-inputs .nav-rail-field-group > .nav-rail-searchable,
.nav-rail-route-inputs .nav-rail-field-group > .searchable-select {
    width: 100%;
}

.nav-rail-field-group {
    min-width: 0;
}

.nav-rail-input-qr {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-rail-input-qr .kiosk-hierarchy-select,
.nav-rail-input-qr .kiosk-hierarchy-select .form-select,
.nav-rail-input-qr .nav-rail-searchable,
.nav-rail-input-qr .searchable-select {
    flex: 1;
    min-width: 0;
}

.nav-rail-input-qr .searchable-select-trigger {
    min-height: calc(1.5em + 0.5rem + 2px);
    height: calc(1.5em + 0.5rem + 2px);
    box-sizing: border-box;
}

.kiosk-hierarchy-select {
    width: 100%;
    min-width: 0;
}

.kiosk-hierarchy-select .form-select {
    width: 100%;
    max-width: 100%;
}

.kiosk-hierarchy-select optgroup {
    font-weight: 700;
    color: var(--nav-muted);
}

.kiosk-hierarchy-select option {
    font-weight: 500;
    color: var(--nav-text);
    padding: 0.15rem 0;
}

/* Searchable dropdown */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-backdrop {
    position: fixed;
    inset: 0;
    z-index: 11990;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: default;
}

.searchable-select-sheet-head {
    display: none;
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--nav-border);
    border-radius: 0.375rem;
    background: #fff;
    color: var(--nav-text);
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

.searchable-select-trigger:hover {
    border-color: #cbd5e1;
}

.searchable-select.is-open .searchable-select-trigger {
    border-color: var(--nav-primary);
    box-shadow: 0 0 0 2px rgba(26, 111, 212, 0.15);
}

.searchable-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-value.is-placeholder {
    color: var(--nav-muted);
}

.searchable-select-chevron {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--nav-muted);
    transition: transform 0.15s ease;
}

.searchable-select.is-open .searchable-select-chevron {
    transform: rotate(180deg);
}

.searchable-select.is-open {
    z-index: 12001;
}

.searchable-select-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 12000;
    background: #fff;
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    min-width: 16rem;
}

.searchable-select-panel--wide {
    min-width: 25rem;
}

.searchable-select-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid var(--nav-border);
    background: #f8fafc;
}

.searchable-select-search-wrap .bi-search {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--nav-muted);
}

.searchable-select-search {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.8rem;
    padding: 0.15rem 0;
    outline: none;
}

.searchable-select-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: min(240px, 40dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.searchable-select-group {
    padding: 0.4rem 0.75rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--nav-muted);
    user-select: none;
}

.searchable-select-group + .searchable-select-group {
    padding-top: 0.55rem;
}

.searchable-select-option {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--nav-text);
    cursor: pointer;
}

.searchable-select-option:hover {
    background: #f1f5f9;
}

.searchable-select-option.selected {
    background: #eff6ff;
    color: var(--nav-primary);
    font-weight: 600;
}

.searchable-select-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.78rem;
    color: var(--nav-muted);
    text-align: center;
}

.searchable-select-group-rich {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    font-size: 0.78rem;
    padding-left: calc(0.65rem + var(--select-depth, 0) * 1.1rem);
    padding-right: 0.65rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.searchable-select-item-rich {
    list-style: none;
}

.searchable-select-option-rich {
    padding-left: calc(0.65rem + var(--select-depth, 0) * 1.1rem);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.searchable-select-panel .searchable-select-row {
    align-items: flex-start;
    gap: 0.35rem 0.45rem;
}

.searchable-select-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
}

.searchable-select-row-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    color: var(--nav-primary);
    opacity: 0.85;
    margin-top: 0.1rem;
}

.searchable-select-panel .searchable-select-row-label {
    flex: 1 1 0;
    min-width: 6rem;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.searchable-select-row-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-code {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--nav-muted);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    padding: 0.05rem 0.35rem;
    line-height: 1.35;
}

.searchable-select-panel .searchable-select-tag {
    margin-left: auto;
    align-self: flex-start;
    margin-top: 0.05rem;
    white-space: nowrap;
}

.searchable-select-tag {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    line-height: 1.2;
}

.searchable-select-tag--zone {
    background: #dbeafe;
    color: #1d4ed8;
}

.searchable-select-tag--floor {
    background: #fef3c7;
    color: #b45309;
}

.nav-rail-qr-btn {
    flex-shrink: 0;
    box-sizing: border-box;
    /* Cao bằng dropdown; rộng hơn để nổi bật cạnh ô Từ */
    --nav-qr-btn-h: calc(1.5em + 0.5rem + 2px);
    width: auto;
    min-width: 2.85rem;
    height: var(--nav-qr-btn-h);
    min-height: var(--nav-qr-btn-h);
    max-height: var(--nav-qr-btn-h);
    padding: 0 0.7rem;
    border: 1.5px solid #16a34a;
    border-radius: 0.45rem;
    background: #ecfdf5;
    color: #15803d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.18);
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nav-rail-qr-btn:hover,
.nav-rail-qr-btn:focus-visible {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.28);
    outline: none;
}

.nav-rail-qr-btn .bi {
    font-size: 1.28rem;
    line-height: 1;
}

.nav-rail-qr-feedback {
    color: #15803d;
    margin: 0.15rem 0 0;
}

.nav-qr-overlay {
    position: fixed;
    inset: 0;
    /* Trên mọi sheet dropdown / dock mobile (13050+) */
    z-index: 20000;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

.nav-qr-panel {
    width: min(400px, 100%);
    background: var(--nav-surface);
    border-radius: var(--nav-radius);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
    padding: 1rem 1rem 1.1rem;
}

.nav-qr-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.nav-qr-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--nav-text);
}

.nav-qr-overlay--js {
    z-index: 20000;
}

.nav-qr-reader {
    width: 100%;
    min-height: 280px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #0f172a;
    position: relative;
}

.nav-qr-reader--native {
    min-height: min(52vh, 360px);
}

.nav-qr-reader video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: inherit;
    object-fit: cover;
    border-radius: 0.5rem;
    background: #0f172a;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative;
    z-index: 1;
}

.nav-qr-frame {
    pointer-events: none;
    position: absolute;
    inset: 18% 16%;
    z-index: 2;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 0.65rem;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.35);
}

.nav-qr-facing {
    color: #15803d;
    font-weight: 600;
    margin: 0;
}

.nav-qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.nav-qr-actions .btn,
.nav-qr-actions .nav-qr-action-btn {
    flex: 1 1 auto;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 600;
}

.nav-qr-actions .nav-qr-action-btn .bi {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.nav-rail-swap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--nav-primary);
    color: #fff;
    box-shadow: 0 1px 5px rgba(26, 111, 212, 0.28);
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.nav-rail-swap:hover {
    background: #1558a8;
    box-shadow: 0 2px 8px rgba(26, 111, 212, 0.36);
    transform: scale(1.06);
}

.nav-rail-swap .bi {
    font-size: 0.78rem;
    line-height: 1;
}

.nav-rail-access .form-check-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.35;
}

.nav-rail-access .form-check-label .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 1rem;
    color: var(--nav-primary);
}

.nav-rail-btn-find,
.nav-rail-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.nav-rail-btn-find .bi,
.nav-rail-btn-icon .bi {
    font-size: 1rem;
    line-height: 1;
}

.nav-rail-route-meta {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--nav-border);
}

.nav-rail-meta-title {
    font-size: 0.72rem;
    color: var(--nav-muted);
    margin: 0 0 0.2rem;
}

.nav-rail-meta-value {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.nav-rail-dest {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-rail-steps {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.65rem;
    min-height: 0;
}

.nav-rail-step {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.45rem;
    border-radius: 0.5rem;
    margin-bottom: 0.15rem;
    position: relative;
    transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.nav-rail-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 1.15rem;
    top: 2rem;
    bottom: -0.15rem;
    width: 2px;
    background: var(--nav-border);
}

.nav-rail-step.done::before {
    background: #86efac;
}

.nav-rail-step:hover {
    background: #f8fafc;
}

.nav-rail-step.active {
    background: #dcfce7;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.22);
}

.nav-rail-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--nav-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    font-size: 0.85rem;
}

/* Bước chuyển tầng: icon SVG + chip chuyên nghiệp hơn vòng tròn xanh nhạt */
.nav-rail-step--xfer {
    padding: 0.65rem 0.5rem;
}

.nav-rail-step--xfer .nav-rail-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.7rem;
    font-size: 0;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.nav-rail-step--xfer .nav-xfer-glyph {
    display: flex;
    width: 22px;
    height: 22px;
}

.nav-rail-step--xfer .nav-xfer-glyph svg {
    width: 100%;
    height: 100%;
    display: block;
}

.nav-rail-step-icon--stairs-up,
.nav-rail-step-icon--stairs-down,
.nav-rail-step-icon--stairs {
    background: linear-gradient(160deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
}

.nav-rail-step-icon--elevator-up,
.nav-rail-step-icon--elevator-down,
.nav-rail-step-icon--elevator {
    background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
}

.nav-rail-step--xfer.pending .nav-rail-step-icon--stairs-up,
.nav-rail-step--xfer.pending .nav-rail-step-icon--stairs-down,
.nav-rail-step--xfer.pending .nav-rail-step-icon--stairs {
    background: #fff7ed;
    color: #ea580c;
    opacity: 0.72;
}

.nav-rail-step--xfer.pending .nav-rail-step-icon--elevator-up,
.nav-rail-step--xfer.pending .nav-rail-step-icon--elevator-down,
.nav-rail-step--xfer.pending .nav-rail-step-icon--elevator {
    background: #eff6ff;
    color: #2563eb;
    opacity: 0.72;
}

.nav-rail-step--xfer.done .nav-rail-step-icon--stairs-up,
.nav-rail-step--xfer.done .nav-rail-step-icon--stairs-down,
.nav-rail-step--xfer.done .nav-rail-step-icon--stairs {
    background: linear-gradient(160deg, #ffedd5, #fed7aa);
    color: #9a3412;
}

.nav-rail-step--xfer.done .nav-rail-step-icon--elevator-up,
.nav-rail-step--xfer.done .nav-rail-step-icon--elevator-down,
.nav-rail-step--xfer.done .nav-rail-step-icon--elevator {
    background: linear-gradient(160deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.nav-rail-step--xfer.active {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    outline: 1px solid rgba(15, 23, 42, 0.06);
}

.nav-rail-step--stairs-up.active,
.nav-rail-step--stairs-down.active,
.nav-rail-step--stairs.active {
    background: linear-gradient(135deg, #fffbeb 0%, #ffedd5 100%);
    box-shadow: 0 6px 18px rgba(194, 65, 12, 0.14);
    outline: 1px solid rgba(234, 88, 12, 0.18);
}

.nav-rail-step--elevator-up.active,
.nav-rail-step--elevator-down.active,
.nav-rail-step--elevator.active {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.14);
    outline: 1px solid rgba(37, 99, 235, 0.2);
}

.nav-rail-step--xfer.active .nav-rail-step-icon--stairs-up,
.nav-rail-step--xfer.active .nav-rail-step-icon--stairs-down,
.nav-rail-step--xfer.active .nav-rail-step-icon--stairs {
    background: linear-gradient(160deg, #fb923c, #ea580c);
    color: #fff;
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.35);
}

.nav-rail-step--xfer.active .nav-rail-step-icon--elevator-up,
.nav-rail-step--xfer.active .nav-rail-step-icon--elevator-down,
.nav-rail-step--xfer.active .nav-rail-step-icon--elevator {
    background: linear-gradient(160deg, #3b82f6, #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.nav-rail-step--xfer.active .nav-rail-step-title {
    color: #0f172a;
    font-weight: 700;
}

.nav-rail-step--xfer .nav-rail-step-detail {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

.nav-rail-step.active:not(.nav-rail-step--xfer) .nav-rail-step-icon {
    background: #bbf7d0;
    color: #15803d;
    box-shadow: inset 0 0 0 2px #16a34a;
}

.nav-rail-step.active:not(.nav-rail-step--xfer) .nav-rail-step-title {
    color: #14532d;
    font-weight: 700;
}

.nav-rail-step.done:not(.nav-rail-step--xfer) .nav-rail-step-icon {
    background: #dcfce7;
    color: #16a34a;
}

.nav-rail-step.pending:not(.nav-rail-step--xfer) .nav-rail-step-icon {
    background: #f1f5f9;
    color: var(--nav-muted);
}

.nav-rail-step.pending .nav-rail-step-title {
    color: var(--nav-muted);
}

.nav-rail-step--xfer:not(:last-child)::before {
    left: 1.35rem;
    top: 2.45rem;
}

.nav-rail-step-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nav-rail-step-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.nav-rail-step-detail {
    font-size: 0.72rem;
    color: var(--nav-muted);
}

.nav-rail-foot {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--nav-border);
    flex-shrink: 0;
}

/* Chuyển lộ trình sang điện thoại — luôn hiện khi xem hướng đi */
.nav-route-handoff {
    display: block;
    flex-shrink: 0;
    margin: 0.35rem 0.55rem 0.35rem;
    padding: 0.55rem 0.65rem 0.6rem;
    border-radius: 0.65rem;
    border: 1px solid color-mix(in srgb, var(--nav-primary, #1a6fd4) 28%, #e2e8f0);
    background:
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--nav-primary, #1a6fd4) 8%, #fff) 0%,
            color-mix(in srgb, var(--nav-primary, #1a6fd4) 14%, #f8fafc) 48%,
            #f8fafc 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 4px 14px color-mix(in srgb, var(--nav-primary, #1a6fd4) 14%, transparent);
}

/* Desktop: Quay lại | Tiếp tục dưới QR — ẩn trên mobile (đã có step-nav) */
.nav-rail-step-foot {
    display: none;
}

.nav-route-handoff-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.nav-route-handoff-qr-frame {
    width: 5.75rem;
    height: 5.75rem;
    padding: 0.28rem;
    border-radius: 0.5rem;
    border: 1px solid #fff;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
}

.nav-route-handoff-qr-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 0.35rem;
    object-fit: contain;
}

.nav-route-handoff-qr-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 0.35rem;
    border: 1px dashed #cbd5e1;
    background:
        repeating-linear-gradient(
            0deg,
            #f1f5f9 0,
            #f1f5f9 3px,
            #ffffff 3px,
            #ffffff 6px
        ),
        repeating-linear-gradient(
            90deg,
            #f1f5f9 0,
            #f1f5f9 3px,
            #ffffff 3px,
            #ffffff 6px
        );
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.65rem;
}

.nav-route-handoff-caption {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--nav-primary-dark, #1458a8);
    line-height: 1.2;
    white-space: nowrap;
}

.nav-route-handoff-caption-icon {
    font-size: 0.82rem;
    color: var(--nav-primary, #1a6fd4);
}

.nav-rail--directions.nav-rail--collapsed .nav-route-handoff {
    display: none;
}

.nav-rail--directions.nav-rail--collapsed .nav-rail-step-foot {
    display: none !important;
}

/* Mobile / tablet: không hiện QR chuyển máy (đã có trên cùng thiết bị) */
@media (max-width: 991.98px) {
    .nav-route-handoff {
        display: none !important;
    }

    .nav-rail-step-foot {
        display: none !important;
    }
}

/* Desktop: không tạo box — nút back vẫn absolute trên map */
.nav-map-mobile-header {
    display: contents;
}

.nav-map-home-back {
    position: absolute;
    z-index: 14;
    top: var(--map-overlay-top, 0.85rem);
    left: max(0.85rem, env(safe-area-inset-left, 0px));
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem 0.45rem 0.6rem;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(4px);
    pointer-events: auto;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nav-map-home-back:hover,
.nav-map-home-back:focus-visible {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
    outline: none;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.18);
}

.nav-map-home-back .bi {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-rail-qr-quick {
    display: none;
}

.nav-chrome-map-tools {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

.nav-chrome-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-chrome-dot-from {
    background: #22c55e;
}

.nav-chrome-dot-to {
    background: #dc2626;
}

/* Map-first kiosk layout (legacy) */
.nav-shell-map-first {
    height: 100vh;
    height: 100dvh;
}

.nav-main-fill {
    flex: 1;
    position: relative;
    min-height: 0;
    min-width: 0;
}

.nav-map-area-fill {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.map-canvas-wrap-fill {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.map-canvas-fill {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* Kiosk: nền bản đồ — mặt đất campus + lưới isometric */
.nav-shell-rail .map-canvas-wrap-fill {
    background-color: var(--map-stage-bg);
    background-image: var(--map-stage-vignette), var(--map-iso-tiles);
    background-size: auto, var(--map-iso-tile-w) var(--map-iso-tile-h);
    background-position: center, center;
    background-repeat: no-repeat, repeat;
}

.nav-shell-rail .map-canvas-fill {
    background: transparent;
}

.nav-shell-rail .map-svg-host {
    display: inline-block;
    flex-shrink: 0;
    line-height: 0;
    padding: 0;
    min-width: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.nav-shell-rail .map-svg-host svg {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
}

/* Chi nhánh demo (/demo): nền trắng để SVG/ảnh bản đồ nổi bật */
.nav-app:has(.nav-shell-map-bg-light) {
    background: #ffffff;
}

.nav-shell-map-bg-light {
    --map-stage-bg: #eef0eb;
    --map-stage-surface: #ffffff;
    --map-stage-vignette: radial-gradient(ellipse 82% 72% at 50% 42%, transparent 48%, rgba(100, 116, 139, 0.05) 100%);
    --map-iso-tiles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='47.04' viewBox='0 0 112 47.04'%3E%3Crect width='112' height='47.04' fill='%23eef0eb'/%3E%3Cpath d='M56 1.2 L109.5 23.52 L56 45.84 L2.5 23.52 Z' fill='%23f7f8f5' fill-opacity='0.28' stroke='%2394a3b8' stroke-opacity='0.08' stroke-width='0.7'/%3E%3Cpath d='M56 9 L88 23.52 L56 38 L24 23.52 Z' fill='%23ffffff' fill-opacity='0.06'/%3E%3C/svg%3E");
}

.nav-shell-map-bg-light .map-canvas-wrap-fill {
    background-color: var(--map-stage-bg);
    background-image: var(--map-stage-vignette), var(--map-iso-tiles);
    background-size: auto, var(--map-iso-tile-w) var(--map-iso-tile-h);
    background-position: center, center;
    background-repeat: no-repeat, repeat;
}

.map-svg-host {
    display: inline-block;
    flex-shrink: 0;
    line-height: 0;
}

.nav-chrome {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 12;
}

.nav-chrome-route,
.nav-chrome-floors,
.nav-chrome-side,
.nav-chrome-zoom,
.nav-mobile-dock,
.nav-browse-sheet-backdrop,
.nav-browse-sheet {
    pointer-events: auto;
}

.nav-chrome-card {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: min(300px, calc(100vw - 4.5rem));
    background: var(--nav-surface);
    border-radius: 1rem;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--nav-border);
    padding: 0.65rem 0.75rem 0.75rem;
}

.nav-chrome-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.nav-chrome-menu {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0.65rem;
    background: #f1f5f9;
    color: var(--nav-text);
    flex-shrink: 0;
}

.nav-chrome-brand {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--nav-primary);
}

.nav-chrome-brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-chrome-stats {
    display: flex;
    gap: 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--nav-primary);
    width: 100%;
}

.nav-chrome-fields {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-chrome-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-chrome-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-chrome-dot-from {
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #22c55e;
}

.nav-chrome-dot-to {
    background: #dc2626;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #dc2626;
}

.nav-chrome-swap {
    align-self: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--nav-muted);
}

.nav-chrome-summary {
    cursor: pointer;
    font-size: 0.82rem;
}

.nav-chrome-summary-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
}

.nav-chrome-step-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--nav-border);
}

.nav-chrome-step-text {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.nav-chrome-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.nav-chrome-hint {
    font-size: 0.68rem;
    color: var(--nav-muted);
    margin-top: 0.35rem;
}

.nav-chrome-floors {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: var(--map-overlay-bottom, 1rem);
    top: auto;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    pointer-events: auto;
    max-width: min(720px, calc(100% - 8.5rem));
    padding: 0.45rem 0.65rem;
    background: rgba(241, 245, 249, 0.94);
    border: 1px solid var(--nav-border);
    border-radius: 999px;
    box-shadow: var(--nav-shadow);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.nav-chrome-floor-btn {
    flex-shrink: 0;
    min-width: 44px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--nav-surface);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-chrome-floor-btn:hover:not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--nav-primary);
}

.nav-chrome-floor-btn.active {
    background: var(--nav-primary);
    color: #fff;
    border-color: var(--nav-primary-dark);
    box-shadow: 0 2px 8px rgba(26, 111, 212, 0.28);
}

.nav-chrome-floor-btn.active i {
    color: #fff;
}

.nav-chrome-zone-btn {
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-chrome-level-sep {
    flex-shrink: 0;
    width: 1px;
    height: 22px;
    background: #cbd5e1;
    margin: 0 0.1rem;
}

.nav-chrome-floor-btn.parent {
    background: #e0f2fe;
    color: var(--nav-primary);
    border-color: #93c5fd;
    box-shadow: none;
}

.nav-chrome-floor-btn.parent:hover {
    background: #bae6fd;
    border-color: #60a5fa;
    color: var(--nav-primary-dark);
}

.nav-chrome-side {
    position: absolute;
    right: var(--map-overlay-right, 0.85rem);
    top: var(--map-overlay-top, 0.85rem);
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: auto;
    z-index: 12;
}

.nav-chrome-zoom {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-end;
}

.nav-chrome-tool {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 0.65rem;
    background: var(--nav-surface);
    box-shadow: var(--nav-shadow);
    color: var(--nav-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.nav-chrome-tool-locate {
    color: #16a34a;
}

.nav-chrome-tool-rating {
    color: #eab308;
}

.nav-chrome-tool-rating:hover {
    color: #ca8a04;
}

.nav-chrome-tool-hotline {
    color: var(--nav-primary);
    text-decoration: none;
}

.nav-chrome-tool-hotline:hover {
    color: var(--nav-primary-dark);
}

.nav-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 20;
}

.nav-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 92vw);
    z-index: 25;
    background: var(--nav-surface);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--nav-border);
}

.nav-drawer .nav-sidebar {
    width: 100%;
    border: none;
    box-shadow: none;
    flex: 1;
    min-height: 0;
}

/* Expand gắn pin: mô tả + khảo sát */
.nav-map-pin-expand {
    position: absolute;
    z-index: 40;
    left: 0;
    top: 0;
    width: min(300px, calc(100% - 1.5rem));
    transform: translate(-50%, calc(-100% - 10px)) scale(0.92);
    transform-origin: bottom center;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, opacity;
}

.nav-map-pin-expand.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, calc(-100% - 10px)) scale(1);
}

.nav-map-pin-expand__panel {
    background: var(--nav-surface, #fff);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.16),
        0 1px 0 rgba(255, 255, 255, 0.7) inset;
    padding: 0.7rem 0.75rem 0.75rem;
    overflow: hidden;
}

.nav-map-pin-expand__head {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.nav-map-pin-expand__title {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--nav-text, #0f172a);
}

.nav-map-pin-expand__close {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0;
    margin: -0.1rem -0.15rem 0 0;
}

.nav-map-pin-expand__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.nav-map-pin-expand__desc {
    margin-top: 0.3rem;
    max-height: 5.5rem;
    overflow: auto;
    font-size: 0.7rem;
    font-style: italic;
    line-height: 1.4;
    color: #64748b;
}

.nav-map-pin-expand__desc p,
.nav-map-pin-expand__desc li,
.nav-map-pin-expand__desc span,
.nav-map-pin-expand__desc div {
    font-style: italic;
    font-size: inherit;
}

.nav-map-pin-expand__desc p {
    margin: 0 0 0.25rem;
}

.nav-map-pin-expand__desc p:last-child {
    margin-bottom: 0;
}

.nav-map-pin-expand__foot {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0.45rem;
    margin-top: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid #e2e8f0;
}

.nav-map-pin-expand__action {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.28rem 0.15rem 0.22rem;
    cursor: pointer;
    line-height: 1.1;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.nav-map-pin-expand__icon {
    display: flex;
    width: 1.1rem;
    height: 1.1rem;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.nav-map-pin-expand__icon > .bi {
    display: block;
    font-size: 0.88rem;
    line-height: 1;
    width: 1em;
    height: 1em;
    margin: 0;
    text-align: center;
}

/* bi-flag-fill lệch trái do cán cờ — chỉnh quang học cho căn giữa */
.nav-map-pin-expand__action--to .nav-map-pin-expand__icon > .bi {
    transform: translateX(0.12em);
}

.nav-map-pin-expand__label {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.5rem;
    font-weight: 650;
    letter-spacing: 0;
    white-space: nowrap;
    line-height: 1.15;
}

.nav-map-pin-expand__action:hover,
.nav-map-pin-expand__action:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.nav-map-pin-expand__action--from {
    border-color: #86efac;
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
}

.nav-map-pin-expand__action--from:hover,
.nav-map-pin-expand__action--from:focus-visible {
    background: #dcfce7;
}

.nav-map-pin-expand__action--to {
    border-color: #fca5a5;
    background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
}

.nav-map-pin-expand__action--to:hover,
.nav-map-pin-expand__action--to:focus-visible {
    background: #fee2e2;
}

.nav-map-pin-expand__action--sat {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
}

.nav-map-pin-expand__action--sat:hover,
.nav-map-pin-expand__action--sat:focus-visible {
    background: #dbeafe;
}

.nav-map-pin-expand__caret {
    width: 12px;
    height: 12px;
    margin: -6px auto 0;
    background: var(--nav-surface, #fff);
    border-right: 1px solid rgba(226, 232, 240, 0.95);
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(15, 23, 42, 0.06);
}

.map-svg-host .map-wp-pin.is-expanded,
.map-svg-host .map-endpoint.is-expanded {
    filter: drop-shadow(0 3px 8px rgba(37, 99, 235, 0.4));
}

/* Không dùng CSS transform trên .map-wp-marker--pin — sẽ ghi đè transform SVG và làm mất icon ghim. */

/* Legacy modal styles (giữ nếu còn gọi cũ) */
.nav-map-note-overlay {
    position: fixed;
    inset: 0;
    z-index: 10090;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.nav-map-note-panel {
    width: min(520px, 100%);
    max-height: min(80vh, 640px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--nav-surface);
    border-radius: var(--nav-radius);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
}

.nav-map-note-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--nav-border);
}

.nav-map-note-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--nav-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-map-note-title .bi {
    color: var(--nav-primary);
}

.nav-map-note-body {
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--nav-text);
}

.nav-map-note-html p:last-child,
.nav-map-note-html ul:last-child,
.nav-map-note-html ol:last-child {
    margin-bottom: 0;
}

.nav-map-note-empty {
    margin: 0;
    color: var(--nav-muted, #64748b);
}

.nav-map-note-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--nav-border);
}

.nav-map-note-pick-hint {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #15803d;
}

.nav-map-note-sat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    font-weight: 600;
}

.nav-waypoint-info {
    cursor: pointer;
}

.map-svg-host .kiosk-wp-pick {
    pointer-events: all;
    cursor: pointer;
}

.map-svg-host .kiosk-wp-pick .kiosk-wp-hit-area {
    pointer-events: all;
}

.nav-waypoint-info-hit {
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.22));
}

.map-svg-host .map-wp-pin {
    pointer-events: none;
}

.map-svg-host .kiosk-wp-hit {
    cursor: pointer;
}

.map-svg-host .map-wp-pin .nav-waypoint-info {
    pointer-events: all;
    cursor: pointer;
}

.map-svg-host .map-wp-label-row {
    pointer-events: none;
}

.map-svg-host .map-wp-label {
    font-size: 8px;
    font-weight: 600;
    dominant-baseline: central;
    paint-order: stroke fill;
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 2px;
    stroke-linejoin: round;
    pointer-events: none;
}

.map-svg-host .nav-waypoint-info-glyph {
    font-size: 7px;
    font-weight: 700;
    dominant-baseline: central;
    pointer-events: none;
}

.map-svg-host .map-wp-marker {
    pointer-events: none;
}

.map-svg-host .map-wp-marker--pin {
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.28));
}

.map-svg-host .map-wp-pin:has(.map-wp-marker--pin) .map-wp-label {
    font-size: 8.5px;
    font-weight: 700;
}

.map-svg-host .kiosk-wp-hit {
    cursor: pointer;
}

.map-svg-host .kiosk-wp-hit .map-wp-marker {
    pointer-events: none;
}

.nav-toast-wrap {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    max-width: 90vw;
}

/* Đánh giá hài lòng */
.nav-satisfaction-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.nav-satisfaction-panel {
    width: min(680px, 96vw);
    max-height: min(94vh, 860px);
    overflow: auto;
    background: var(--nav-surface);
    border-radius: 1.1rem;
    box-shadow: 0 20px 56px rgba(15, 23, 42, 0.28);
    padding: 1.5rem 1.75rem 1.6rem;
}

.nav-satisfaction-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-satisfaction-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--nav-text);
}

.nav-satisfaction-title .bi {
    color: #f59e0b;
}

.nav-satisfaction-lead {
    font-size: 0.98rem;
    color: var(--nav-muted);
    margin: 0 0 1rem;
}

.nav-satisfaction-form-top {
    margin-bottom: 0.5rem;
}

.nav-satisfaction-criteria-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--nav-text);
    margin: 0 0 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-satisfaction-level-num {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.2rem;
    opacity: 0.85;
}

.nav-satisfaction-levels {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.nav-satisfaction-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 5.5rem;
    padding: 0.55rem 0.35rem;
    border: 1.5px solid var(--nav-border);
    border-radius: 0.75rem;
    background: #f8fafc;
    color: var(--nav-text);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.nav-satisfaction-level .bi {
    font-size: 1.85rem;
    line-height: 1;
}

.nav-satisfaction-level.tone-5 .bi { color: #16a34a; }
.nav-satisfaction-level.tone-4 .bi { color: #65a30d; }
.nav-satisfaction-level.tone-3 .bi { color: #ca8a04; }
.nav-satisfaction-level.tone-2 .bi { color: #ea580c; }
.nav-satisfaction-level.tone-1 .bi { color: #dc2626; }

.nav-satisfaction-level:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.nav-satisfaction-level.is-selected {
    border-color: var(--nav-primary);
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(26, 111, 212, 0.18);
    transform: translateY(-1px);
}

.nav-satisfaction-error {
    color: #dc2626;
}

.nav-satisfaction-form .form-label {
    color: var(--nav-text);
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-satisfaction-form .form-control,
.nav-satisfaction-form .form-select {
    font-size: 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.65rem;
}

.nav-satisfaction-required {
    color: #dc2626;
    font-weight: 700;
}

.nav-satisfaction-contact-row > [class*="col-"] {
    min-width: 0;
}

.nav-satisfaction-file .btn-link {
    font-size: 0.75rem;
}

.nav-satisfaction-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--nav-border);
}

.nav-satisfaction-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-size: 1rem;
    padding: 0.6rem 1.15rem;
    border-radius: 0.65rem;
}

.nav-satisfaction-thanks {
    text-align: center;
    padding: 1.5rem 0.5rem 1rem;
    color: var(--nav-text);
}

.nav-satisfaction-thanks .bi {
    font-size: 2.5rem;
    color: #16a34a;
    margin-bottom: 0.5rem;
}

/* Mobile: form gọn, mức 1–5 đều 1 hàng, nút căn giữa */
@media (max-width: 767.98px) {
    .nav-satisfaction-overlay {
        align-items: flex-end;
        padding: max(0.5rem, env(safe-area-inset-top, 0px))
            max(0.55rem, env(safe-area-inset-right, 0px))
            max(0.55rem, env(safe-area-inset-bottom, 0px))
            max(0.55rem, env(safe-area-inset-left, 0px));
    }

    .nav-satisfaction-panel {
        width: 100%;
        max-height: min(92dvh, 860px);
        border-radius: 1rem 1rem 0.85rem 0.85rem;
        padding: 0.9rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .nav-satisfaction-head {
        margin-bottom: 0.35rem;
    }

    .nav-satisfaction-title {
        font-size: 1.1rem;
        gap: 0.35rem;
    }

    .nav-satisfaction-form-top {
        margin-bottom: 0.25rem;
    }

    .nav-satisfaction-form-top .mb-3 {
        margin-bottom: 0.65rem !important;
    }

    .nav-satisfaction-criteria-label {
        font-size: 0.72rem;
        margin: 0 0 0.4rem;
        letter-spacing: 0.03em;
    }

    .nav-satisfaction-levels {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.3rem;
        margin-bottom: 0.7rem;
    }

    .nav-satisfaction-level {
        min-height: 0;
        min-width: 0;
        max-width: none;
        padding: 0.4rem 0.12rem 0.45rem;
        gap: 0.15rem;
        border-radius: 0.55rem;
        border-width: 1px;
        font-size: 0.58rem;
        font-weight: 600;
        line-height: 1.15;
    }

    /* Mobile: chỉ số + icon — tránh chữ dài làm thẻ quá cao/lệch */
    .nav-satisfaction-level > span:not(.nav-satisfaction-level-num) {
        display: none;
    }

    .nav-satisfaction-level-num {
        font-size: 0.78rem;
        margin-bottom: 0;
        opacity: 1;
    }

    .nav-satisfaction-level .bi {
        font-size: 1.35rem;
    }

    .nav-satisfaction-form .form-label {
        font-size: 0.82rem;
        margin-bottom: 0.25rem;
    }

    .nav-satisfaction-form .form-control,
    .nav-satisfaction-form .form-select,
    .nav-satisfaction-form .form-control-lg,
    .nav-satisfaction-form .form-select.form-control-lg {
        font-size: 0.92rem;
        padding: 0.5rem 0.65rem;
        border-radius: 0.5rem;
        min-height: 42px;
    }

    .nav-satisfaction-form textarea.form-control {
        min-height: 4.5rem;
        height: 4.5rem;
        padding: 0.5rem 0.65rem;
    }

    .nav-satisfaction-contact-row {
        margin-bottom: 0.55rem !important;
    }

    .nav-satisfaction-contact-row > [class*="col-"] {
        margin-bottom: 0.45rem;
    }

    .nav-satisfaction-contact-row > [class*="col-"]:last-child {
        margin-bottom: 0;
    }

    .nav-satisfaction-form .mb-2 {
        margin-bottom: 0.55rem !important;
    }

    .nav-satisfaction-actions {
        justify-content: center;
        align-items: center;
        gap: 0.55rem;
        margin-top: 0.75rem;
        padding-top: 0.7rem;
    }

    .nav-satisfaction-actions .btn {
        flex: 1 1 auto;
        max-width: 11rem;
        min-height: 42px;
        font-size: 0.9rem;
        padding: 0.5rem 0.85rem;
        border-radius: 0.55rem;
    }

    .nav-satisfaction-thanks {
        padding: 1.1rem 0.25rem 0.75rem;
    }

    .nav-satisfaction-thanks .bi {
        font-size: 2rem;
    }
}

@media (max-width: 380px) {
    .nav-satisfaction-panel {
        padding: 0.75rem 0.7rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .nav-satisfaction-levels {
        gap: 0.25rem;
    }

    .nav-satisfaction-actions .btn {
        max-width: none;
        flex: 1 1 0;
        font-size: 0.85rem;
        padding: 0.45rem 0.6rem;
    }
}

/* Kiosk — màn hình chính (idle reset) */
.kiosk-home-hub {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(165deg, #e8f1fb 0%, #f4f7fa 45%, #ffffff 100%);
    overflow-y: auto;
}

.kiosk-home-hub--page {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    background-color: #f4f7fa;
    overflow: hidden;
}

.kiosk-home-hub--page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('/images/bg-axis-199.png');
    background-repeat: no-repeat;
    background-position: right bottom;
    background-size: 100% 100%;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.kiosk-home-hub--page > * {
    position: relative;
    z-index: 1;
}

.nav-app:has(.kiosk-home-hub--page) {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    background-color: #f4f7fa;
}

.kiosk-home-hub-panel {
    width: min(40rem, 100%);
    margin: 0 auto;
}

.kiosk-home-hub-head {
    text-align: center;
    margin-bottom: 1.75rem;
}

.kiosk-home-hub-logo {
    max-height: 4.5rem;
    width: auto;
    margin-bottom: 0.75rem;
}

.kiosk-home-hub-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 1rem;
    background: #fff;
    color: var(--nav-primary, #1a6fd4);
    font-size: 2rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 16px rgba(26, 111, 212, 0.15);
}

.kiosk-home-hub-title {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.35rem;
}

.kiosk-home-hub-tagline {
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
}

.kiosk-home-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 720px) {
    .kiosk-home-hub-grid {
        grid-template-columns: 1fr;
    }
}

.kiosk-home-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-height: 6.5rem;
    padding: 1.1rem 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.kiosk-home-tile:hover,
.kiosk-home-tile:focus-visible {
    transform: translateY(-2px);
    border-color: var(--nav-primary, #1a6fd4);
    box-shadow: 0 10px 28px rgba(26, 111, 212, 0.16);
    outline: none;
}

.kiosk-home-tile-icon {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    font-size: 1.65rem;
}

.kiosk-home-tile--service .kiosk-home-tile-icon {
    background: #ecfdf5;
    color: #059669;
}

.kiosk-home-tile--route .kiosk-home-tile-icon {
    background: #eff6ff;
    color: #2563eb;
}

.kiosk-home-tile--satisfaction .kiosk-home-tile-icon {
    background: #fffbeb;
    color: #d97706;
}

.kiosk-home-tile--invoice .kiosk-home-tile-icon {
    background: #f5f3ff;
    color: #7c3aed;
}

a.kiosk-home-tile {
    text-decoration: none;
    color: inherit;
}

.kiosk-home-tile-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kiosk-home-tile-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
    line-height: 1.3;
}

.kiosk-home-tile-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.35;
}

.kiosk-home-tile-arrow {
    flex-shrink: 0;
    font-size: 1.65rem;
    color: var(--nav-primary, #1a6fd4);
    opacity: 0.85;
}

.kiosk-home-service-panel {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.kiosk-home-service-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: none;
    border-radius: 0.45rem;
    background: transparent;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.kiosk-home-service-card {
    text-align: center;
    padding: 1.5rem 1.25rem;
    border-radius: 1rem;
    border: 1px solid #dbeafe;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.kiosk-home-service-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.85rem;
    background: #ecfdf5;
    color: #059669;
    font-size: 1.5rem;
    margin-bottom: 0.65rem;
}

.kiosk-home-service-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: #0f172a;
}

.kiosk-home-service-card-lead {
    margin: 0 0 1rem;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.45;
}

.kiosk-home-service-hotline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
}

/* Kiosk — cảnh báo idle */
.kiosk-idle-overlay {
    position: fixed;
    inset: 0;
    z-index: 10090;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.kiosk-idle-panel {
    width: min(24rem, 100%);
    padding: 1.35rem 1.25rem 1.2rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    text-align: center;
}

.kiosk-idle-icon {
    font-size: 2rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}

.kiosk-idle-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.45rem;
    color: #0f172a;
}

.kiosk-idle-lead {
    margin: 0 0 0.65rem;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.45;
}

.kiosk-idle-countdown {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    color: #64748b;
}

.kiosk-idle-continue {
    width: 100%;
    font-weight: 700;
    padding: 0.55rem 1rem;
}

/* Kiosk — tra cứu giá dịch vụ */
.kiosk-service-page {
    --kiosk-service-max: 52rem;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1rem max(0.75rem, env(safe-area-inset-bottom, 0px));
    background-color: #f4f7fa;
    overflow: hidden;
}

.kiosk-service-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('/images/bg-axis-199.png');
    background-repeat: no-repeat;
    background-position: right bottom;
    background-size: 100% 100%;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.kiosk-service-page > * {
    position: relative;
    z-index: 1;
}

.nav-app:has(.kiosk-service-page) {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    overflow: hidden;
    background-color: #f4f7fa;
}

.kiosk-service-page-head,
.kiosk-service-filters {
    flex-shrink: 0;
}

.kiosk-service-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-width: var(--kiosk-service-max, 52rem);
    width: 100%;
    margin: 0 auto;
}

.kiosk-service-page-head {
    width: 100%;
    max-width: var(--kiosk-service-max, 52rem);
    margin: 0 auto 1rem;
    padding: 0.85rem 1rem 1rem;
    border-radius: 1rem;
    border: 1px solid #bfdbfe;
    background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 52%, #f8fafc 100%);
    box-shadow: 0 8px 24px rgba(26, 111, 212, 0.12);
}

.kiosk-service-page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.9rem 0.5rem 0.65rem;
    border: 1px solid #60a5fa;
    border-radius: 999px;
    background: #fff;
    color: #1d4ed8;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.16);
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.kiosk-service-page-back:hover,
.kiosk-service-page-back:focus-visible {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
    outline: none;
}

.kiosk-service-page-back .bi {
    font-size: 1.1rem;
}

.kiosk-service-page-hero {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.kiosk-service-page-hero-icon {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: #fff;
    color: #059669;
    font-size: 1.55rem;
    box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.15);
}

.kiosk-service-page-title {
    margin: 0 0 0.15rem;
    font-size: clamp(1.2rem, 2.8vw, 1.55rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

.kiosk-service-page-sub {
    margin: 0;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
}

.kiosk-service-filters {
    display: grid;
    grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
    gap: 0.75rem;
    width: 100%;
    max-width: var(--kiosk-service-max, 52rem);
    margin: 0 auto 0.75rem;
}

.kiosk-service-filter-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

.kiosk-service-search-row {
    display: flex;
    gap: 0.4rem;
}

.kiosk-service-list {
    display: grid;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    max-width: var(--kiosk-service-max, 52rem);
    width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.65rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.kiosk-service-list:has(+ .kiosk-service-pagination) {
    border-bottom: none;
    border-radius: 0.65rem 0.65rem 0 0;
    box-shadow: none;
}

.kiosk-service-row {
    margin: 0;
}

.kiosk-service-row + .kiosk-service-row .kiosk-service-row-hit {
    border-top: 1px solid #e2e8f0;
}

.kiosk-service-row-hit {
    width: 100%;
    display: grid;
    grid-template-columns:
        4.25rem
        minmax(0, 1.35fr)
        minmax(0, 9.5rem)
        minmax(4.6rem, 5.75rem)
        minmax(4.6rem, 5.75rem)
        minmax(4.6rem, 5.75rem)
        minmax(6.75rem, 8.25rem)
        1.15rem;
    align-items: center;
    gap: 0.2rem 0.45rem;
    padding: 0.42rem 0.6rem;
    border: none;
    border-radius: 0;
    background: #fff;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.kiosk-service-row-hit:hover,
.kiosk-service-row-hit:focus-visible {
    background: #f0f7ff;
    outline: none;
}

.kiosk-service-row:nth-child(even) .kiosk-service-row-hit {
    background: #f8fafc;
}

.kiosk-service-row:nth-child(even) .kiosk-service-row-hit:hover,
.kiosk-service-row:nth-child(even) .kiosk-service-row-hit:focus-visible {
    background: #e8f2ff;
}

.kiosk-service-row-code {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kiosk-service-row-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kiosk-service-row-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    overflow: hidden;
}

.kiosk-service-row-group {
    font-size: 0.68rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kiosk-service-row-type {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    color: #2563eb;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    background: #eff6ff;
    white-space: nowrap;
}

.kiosk-service-row-prices {
    display: contents;
}

.kiosk-service-row-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.08rem;
    min-width: 0;
    color: #059669;
    text-align: right;
}

.kiosk-service-row-price-value {
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.kiosk-service-row-price--muted {
    color: #2563eb;
}

.kiosk-service-row-price--muted .kiosk-service-row-price-value,
.kiosk-service-row-price--clc .kiosk-service-row-price-value,
.kiosk-service-row-price--foreign .kiosk-service-row-price-value {
    font-weight: 700;
    font-size: 0.74rem;
}

.kiosk-service-row-price--clc {
    color: #c2410c;
}

.kiosk-service-row-price--foreign {
    color: #7c3aed;
}

.kiosk-service-row-price-label {
    display: block;
    width: 100%;
    font-size: 0.58rem;
    font-weight: 700;
    color: #64748b;
    text-align: right;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kiosk-service-row-chevron {
    color: #94a3b8;
    font-size: 0.95rem;
    display: inline-flex;
    justify-content: center;
}

.kiosk-service-empty,
.kiosk-service-status {
    flex: 1 1 auto;
    max-width: var(--kiosk-service-max, 52rem);
    margin: 1.5rem auto;
    text-align: center;
}

.kiosk-service-pagination {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 0.75rem;
    width: 100%;
    max-width: var(--kiosk-service-max, 52rem);
    margin: 0 auto;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 0.65rem 0.65rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.kiosk-service-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    flex: 0 0 auto;
    min-width: 5.75rem;
    min-height: 2.35rem;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid color-mix(in srgb, var(--nav-primary, #1a6fd4) 35%, #cbd5e1);
    border-radius: 0.65rem;
    background: #fff;
    color: var(--nav-primary, #1a6fd4);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.kiosk-service-pagination-btn .bi {
    font-size: 0.9rem;
    line-height: 1;
}

.kiosk-service-pagination-btn:hover:not(:disabled),
.kiosk-service-pagination-btn:focus-visible:not(:disabled) {
    background: color-mix(in srgb, var(--nav-primary, #1a6fd4) 8%, #fff);
    border-color: var(--nav-primary, #1a6fd4);
    outline: none;
}

.kiosk-service-pagination-btn--primary {
    border-color: var(--nav-primary, #1a6fd4);
    background: var(--nav-primary, #1a6fd4);
    color: #fff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--nav-primary, #1a6fd4) 28%, transparent);
}

.kiosk-service-pagination-btn--primary:hover:not(:disabled),
.kiosk-service-pagination-btn--primary:focus-visible:not(:disabled) {
    background: var(--nav-primary-dark, #1458a8);
    border-color: var(--nav-primary-dark, #1458a8);
    color: #fff;
}

.kiosk-service-pagination-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

.kiosk-service-pagination-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    line-height: 1.2;
}

.kiosk-service-pagination-page {
    font-size: 0.82rem;
    font-weight: 750;
    color: #0f172a;
    white-space: nowrap;
}

.kiosk-service-pagination-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

@media (max-width: 520px) {
    .kiosk-service-pagination {
        gap: 0.45rem;
        padding: 0.5rem 0.55rem;
    }

    .kiosk-service-pagination-btn {
        min-width: 0;
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }

    .kiosk-service-pagination-btn span {
        display: none;
    }

    .kiosk-service-pagination-page {
        font-size: 0.76rem;
    }

    .kiosk-service-pagination-count {
        font-size: 0.66rem;
    }
}

.kiosk-service-empty .bi {
    font-size: 2rem;
    color: #94a3b8;
    display: block;
    margin-bottom: 0.5rem;
}

.kiosk-service-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10090;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1rem max(0.75rem, env(safe-area-inset-bottom, 0px));
}

.kiosk-service-modal-panel {
    width: min(46rem, 100%);
    max-height: min(92vh, 860px);
    overflow: auto;
    padding: 1.15rem 1.2rem 1.2rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 20px 56px rgba(15, 23, 42, 0.28);
}

.kiosk-service-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.kiosk-service-modal-head-main {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    min-width: 0;
}

.kiosk-service-modal-head-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: #ecfdf5;
    color: #059669;
    font-size: 1.25rem;
}

.kiosk-service-modal-kicker {
    margin: 0 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.kiosk-service-modal-title {
    margin: 0;
    font-size: clamp(1.05rem, 2.5vw, 1.35rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
}

.kiosk-service-modal-price-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.kiosk-service-modal-price-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #bbf7d0;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    min-width: 0;
}

.kiosk-service-modal-price-card--bhyt {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
}

.kiosk-service-modal-price-card--bhyt .kiosk-service-modal-price-label {
    color: #1d4ed8;
}

.kiosk-service-modal-price-card--bhyt .kiosk-service-modal-price-value {
    color: #2563eb;
}

.kiosk-service-modal-price-card--clc {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
}

.kiosk-service-modal-price-card--clc .kiosk-service-modal-price-label {
    color: #c2410c;
}

.kiosk-service-modal-price-card--clc .kiosk-service-modal-price-value {
    color: #ea580c;
}

.kiosk-service-modal-price-card--foreign {
    border-color: #ddd6fe;
    background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
}

.kiosk-service-modal-price-card--foreign .kiosk-service-modal-price-label {
    color: #6d28d9;
}

.kiosk-service-modal-price-card--foreign .kiosk-service-modal-price-value {
    color: #7c3aed;
}

.kiosk-service-modal-price-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #166534;
}

.kiosk-service-modal-price-value {
    font-size: clamp(0.95rem, 2.4vw, 1.15rem);
    font-weight: 800;
    color: #059669;
    line-height: 1.2;
    word-break: break-word;
}

.kiosk-service-modal-dl {
    margin: 0 0 1rem;
}

.kiosk-service-modal-row {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 0.5rem 0.85rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.92rem;
}

.kiosk-service-modal-row dt {
    margin: 0;
    display: inline-flex;
    align-items: flex-start;
    gap: 0.35rem;
    color: #475569;
    font-weight: 700;
}

.kiosk-service-modal-row dt .bi {
    color: #2563eb;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.kiosk-service-modal-row dd {
    margin: 0;
    color: #0f172a;
    line-height: 1.45;
    word-break: break-word;
}

.kiosk-service-modal-row--notes dd {
    white-space: pre-wrap;
}

.kiosk-service-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 700;
    min-height: 2.75rem;
}

@media (min-width: 768px) {
    .kiosk-service-page {
        --kiosk-service-max: min(96vw, 72rem);
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .kiosk-service-filters {
        grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
    }
}

@media (min-width: 992px) {
    .kiosk-service-page {
        --kiosk-service-max: min(97vw, 84rem);
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .kiosk-service-row-hit {
        grid-template-columns:
            7.25rem
            minmax(14rem, 2fr)
            minmax(11rem, 14rem)
            repeat(3, minmax(5.5rem, 6.75rem))
            minmax(7.75rem, 9.25rem)
            1.25rem;
        gap: 0.25rem 0.65rem;
        padding: 0.5rem 0.85rem;
    }

    .kiosk-service-row-code {
        font-size: 0.72rem;
    }

    .kiosk-service-row-name {
        font-size: 0.84rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .kiosk-service-row-group {
        max-width: none;
    }

    .kiosk-service-row-price-value {
        font-size: 0.82rem;
    }

    .kiosk-service-row-price-label {
        font-size: 0.62rem;
    }
}

@media (min-width: 1280px) {
    .kiosk-service-page {
        --kiosk-service-max: min(98vw, 96rem);
    }

    .kiosk-service-row-hit {
        grid-template-columns:
            8.5rem
            minmax(16rem, 2.2fr)
            minmax(12rem, 15rem)
            repeat(3, minmax(6rem, 7.25rem))
            minmax(8.5rem, 10rem)
            1.35rem;
        gap: 0.3rem 0.75rem;
        padding: 0.55rem 1rem;
    }
}

@media (max-width: 1100px) and (min-width: 901px) {
    .kiosk-service-row-hit {
        grid-template-columns:
            5.5rem
            minmax(0, 1.4fr)
            minmax(0, 9rem)
            repeat(3, minmax(4.5rem, 5.5rem))
            minmax(6.25rem, 7.5rem)
            1rem;
        gap: 0.2rem 0.45rem;
    }

    .kiosk-service-row-price-label {
        font-size: 0.54rem;
    }

    .kiosk-service-row-price-value {
        font-size: 0.7rem;
    }
}

@media (max-width: 900px) {
    .kiosk-service-row-hit {
        grid-template-columns: 3.75rem minmax(0, 1fr) minmax(7.5rem, 9.5rem) 1rem;
        grid-template-areas:
            "code name price chevron"
            "code meta price chevron";
    }

    .kiosk-service-row-code { grid-area: code; }
    .kiosk-service-row-name { grid-area: name; }
    .kiosk-service-row-meta { grid-area: meta; }
    .kiosk-service-row-prices {
        display: grid;
        grid-area: price;
        grid-template-columns: 1fr 1fr;
        gap: 0.2rem 0.35rem;
        align-content: center;
        min-width: 0;
    }

    .kiosk-service-row-price {
        align-items: flex-end;
    }

    .kiosk-service-row-price-label {
        font-size: 0.52rem;
    }

    .kiosk-service-row-price-value {
        font-size: 0.68rem;
    }

    .kiosk-service-row-chevron { grid-area: chevron; }
}

@media (max-width: 720px) {
    .kiosk-service-filters {
        grid-template-columns: 1fr;
    }

    .kiosk-service-page-head {
        padding: 0.75rem 0.85rem 0.9rem;
    }

    .kiosk-service-page-hero-icon {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.3rem;
    }

    .kiosk-service-modal-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .kiosk-service-modal-price-grid {
        grid-template-columns: 1fr;
    }

    .kiosk-service-modal-price-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.map-svg-host .map-endpoint-layer {
    pointer-events: none;
}

.map-svg-host .map-endpoint {
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.22));
}

.map-svg-host .map-endpoint__bubble {
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.14));
}

.map-svg-host .map-endpoint--start .map-endpoint__sub {
    fill: #16a34a;
}

.map-svg-host .map-endpoint--end .map-endpoint__sub {
    fill: #dc2626;
}

.map-instruction-callout {
    /* Không animate — overlay được cập nhật theo bước, fade gây nháy liên tục. */
}

.map-svg-host .map-instruction-callout__bubble {
    fill: #ffffff;
    stroke: #16a34a;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.14));
}

.map-svg-host .map-instruction-callout--elevator .map-instruction-callout__bubble {
    stroke: #2563eb;
}

.map-svg-host .map-instruction-callout--stairs .map-instruction-callout__bubble {
    stroke: #ea580c;
}

.map-svg-host .map-instruction-callout__label {
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 600;
    fill: #0f172a;
    letter-spacing: 0.01em;
    dominant-baseline: central;
    text-anchor: middle;
}

.map-svg-host .map-instruction-callout__detail {
    font-family: var(--font-sans);
    font-size: 7.5px;
    font-weight: 600;
    fill: #475569;
    letter-spacing: 0.01em;
    dominant-baseline: central;
    text-anchor: middle;
}

.map-svg-host .map-instruction-callout__tip {
    fill: #16a34a;
}

.map-svg-host .map-instruction-callout--elevator .map-instruction-callout__tip {
    fill: #2563eb;
}

.map-svg-host .map-instruction-callout--stairs .map-instruction-callout__tip {
    fill: #ea580c;
}

/* Callout / badge thang bộ · thang máy trên lộ trình */
.map-svg-host .route-xfer-callout__bubble {
    fill: #ffffff;
    stroke-width: 1.7;
    filter: drop-shadow(0 3px 10px rgba(15, 23, 42, 0.16));
}

.map-svg-host .route-xfer-callout--stairs .route-xfer-callout__bubble {
    stroke: #ea580c;
}

.map-svg-host .route-xfer-callout--elevator .route-xfer-callout__bubble {
    stroke: #2563eb;
}

.map-svg-host .route-xfer-callout__title {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 700;
    fill: #0f172a;
    letter-spacing: 0.01em;
}

.map-svg-host .route-xfer-callout__detail {
    font-family: var(--font-sans);
    font-size: 7.5px;
    font-weight: 600;
    fill: #64748b;
    letter-spacing: 0.01em;
}

.map-svg-host .route-xfer-callout--stairs .route-xfer-callout__tip {
    fill: #ea580c;
}

.map-svg-host .route-xfer-callout--elevator .route-xfer-callout__tip {
    fill: #2563eb;
}

.map-svg-host .route-xfer-callout--stairs .route-xfer-callout__title {
    fill: #9a3412;
}

.map-svg-host .route-xfer-callout--elevator .route-xfer-callout__title {
    fill: #1e3a8a;
}

.map-svg-host .map-xfer-badge.is-active {
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.22));
}

.map-svg-host .route-vertical-connector.is-active-transfer .map-wp-marker {
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.2));
}

.map-svg-host .nav-route-step-marker--active .nav-step-dot-fill {
    fill: #16a34a;
    stroke: #ffffff;
    stroke-width: 2.5;
}

.map-svg-host .nav-route-step-marker--active .nav-step-dot-ring {
    fill: none;
    stroke: #4ade80;
    stroke-width: 2;
}

.map-svg-host .nav-route-step-marker--active .nav-step-dot-label {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    fill: #ffffff;
}

.map-svg-host .nav-route-step-marker--reached .nav-step-dot-fill {
    fill: #4ade80;
    stroke: #15803d;
    stroke-width: 1.5;
}

.map-svg-host .nav-route-step-marker--reached .nav-step-dot-label {
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    fill: #14532d;
}

.map-svg-host .nav-route-step-marker--pending .nav-step-dot-fill {
    fill: #dbeafe;
    stroke: var(--nav-primary);
    stroke-width: 1.5;
}

.map-svg-host .nav-route-step-marker--pending .nav-step-dot-label {
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    fill: #1e40af;
}

.map-svg-host .nav-waypoint-active .nav-step-dot-fill {
    fill: #16a34a;
    stroke: #ffffff;
    stroke-width: 2.5;
}

.map-svg-host .nav-waypoint-active .nav-step-dot-ring {
    fill: none;
    stroke: #4ade80;
    stroke-width: 2;
}

.map-svg-host .nav-waypoint-active .nav-step-dot-label {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    fill: #ffffff;
}

.map-svg-host .route-vertical-connector .map-wp-marker {
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.16));
}

.map-svg-host .route-connector-label text {
    paint-order: stroke fill;
    stroke: #ffffff;
    stroke-width: 2px;
    stroke-linejoin: round;
}

/* Mobile */
.mobile-toggle-directions {
    display: none;
}

.nav-rail-sheet-handle {
    display: none;
    width: 2.25rem;
    height: 0.28rem;
    border: none;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 0.45rem auto 0;
    flex-shrink: 0;
    padding: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

button.nav-rail-sheet-handle {
    /* vùng chạm lớn hơn thanh xám */
    min-height: 1.1rem;
    min-width: 3rem;
    background-clip: content-box;
    padding: 0.4rem 0 0;
    background-image: linear-gradient(#cbd5e1, #cbd5e1);
    background-repeat: no-repeat;
    background-position: center 0.4rem;
    background-size: 2.25rem 0.28rem;
    background-color: transparent;
}

@media (max-width: 991.98px) {
    /* ── Mobile kiosk: map-first, bottom tab bar + sheets ── */
    .nav-main-map {
        --map-floor-bar-h: 3.35rem;
        --map-search-chip-h: 0px;
        --map-overlay-right: max(0.5rem, env(safe-area-inset-right, 0px));
        --map-overlay-top: max(0.5rem, env(safe-area-inset-top, 0px));
        --map-mobile-dock-h: 3.55rem;
        --map-mobile-dock-gap: 0;
        --map-overlay-bottom: calc(var(--map-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
        --map-rail-search-max: min(52dvh, 420px);
        --map-rail-route-max: min(50dvh, 400px);
        /* Chiều cao thanh bước (+ chọn thang nếu có) */
        --map-rail-collapsed-h: 3.75rem;
        --map-rail-search-collapsed-h: 3.85rem;
    }

    /* Tắt CSS drop-shadow trên pin/route — giảm giật pan/zoom Safari */
    .map-svg-host .map-wp-marker,
    .map-svg-host .map-wp-marker--pin,
    .map-svg-host .map-wp-pin.is-expanded,
    .map-svg-host .map-endpoint,
    .map-svg-host .map-endpoint.is-expanded,
    .map-svg-host .map-endpoint__bubble,
    .map-svg-host .map-instruction-callout__bubble,
    .map-svg-host .route-vertical-connector .map-wp-marker,
    .map-svg-host .route-vertical-connector.is-active-transfer .map-wp-marker,
    .map-svg-host .route-arrows path {
        filter: none !important;
    }

    .map-canvas.map-canvas--dragging .map-svg-host,
    .map-canvas.map-canvas--dragging .map-viewport-layer {
        filter: none !important;
    }

    .nav-rail--fab-hidden {
        display: none !important;
    }

    /* Bottom nav kiểu app: full-width sát đáy, liền khối với sheet */
    .nav-mobile-dock {
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        gap: 0.15rem;
        position: absolute;
        z-index: 12080;
        pointer-events: auto;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        max-width: none;
        min-height: calc(var(--map-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
        padding: 0.2rem 0.45rem calc(0.2rem + env(safe-area-inset-bottom, 0px));
        border: none;
        border-top: 1px solid rgba(226, 232, 240, 0.95);
        border-radius: 0;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        touch-action: manipulation;
    }

    .nav-mobile-dock-btn,
    .nav-mobile-dock a.nav-mobile-dock-btn {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.12rem;
        flex: 1 1 0;
        min-width: 0;
        min-height: 2.85rem;
        margin: 0;
        padding: 0.25rem 0.2rem;
        border: none;
        border-radius: 0.75rem;
        background: transparent;
        color: #64748b;
        text-decoration: none;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .nav-mobile-dock-btn--labeled {
        flex-direction: column;
        gap: 0.12rem;
        width: auto;
        min-width: 0;
        height: auto;
        padding: 0.2rem 0.25rem;
        border-radius: 0.75rem;
    }

    .nav-mobile-dock-btn-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.65rem;
        height: 1.65rem;
        border-radius: 0.4rem;
        border: none;
        line-height: 1;
        background: transparent;
    }

    .nav-mobile-dock-btn--labeled .bi {
        font-size: 1.15rem;
        line-height: 1;
    }

    .nav-mobile-dock-btn-label {
        max-width: 100%;
        font-size: 0.62rem;
        font-weight: 600;
        line-height: 1.15;
        letter-spacing: -0.01em;
        color: inherit;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }

    .nav-mobile-dock-btn .bi {
        font-size: 1.2rem;
        line-height: 1;
    }

    .nav-mobile-dock-btn.is-active {
        border-color: transparent;
        background: rgba(26, 111, 212, 0.1);
        color: var(--nav-primary, #1a6fd4);
    }

    .nav-mobile-dock-btn--labeled.is-active .nav-mobile-dock-btn-icon {
        border-color: transparent;
        background: transparent;
        color: var(--nav-primary, #1a6fd4);
    }

    .nav-mobile-dock-btn--labeled.is-active .nav-mobile-dock-btn-label {
        color: var(--nav-primary, #1a6fd4);
    }

    .nav-mobile-dock-btn:not(.nav-mobile-dock-btn--labeled).is-active {
        border-color: transparent;
        background: rgba(26, 111, 212, 0.1);
        color: var(--nav-primary, #1a6fd4);
    }

    .nav-mobile-dock-btn--browse.is-active .bi,
    .nav-mobile-dock-btn--labeled.is-active .bi.bi-x-lg {
        font-size: 1.05rem;
    }

    .nav-rail-head-hint--desktop {
        display: none !important;
    }

    .nav-rail-sheet-handle {
        display: block;
        order: -1;
    }

    .nav-rail-collapse-btn {
        display: inline-flex;
    }

    .nav-rail-head-hint {
        display: inline-flex;
        align-items: center;
        margin-left: auto;
        margin-right: 0.35rem;
        padding: 0.32rem 0.75rem;
        border-radius: 999px;
        background: var(--nav-primary);
        color: #fff;
        font-size: 0.75rem;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(26, 111, 212, 0.28);
    }

    /* CTA map-first: một nút «Tìm đường» — màu primary thuần */
    .nav-rail-cta-route {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        flex: 1 1 auto;
        width: 100%;
        min-height: 2.65rem;
        margin: 0;
        padding: 0.55rem 1rem;
        border: none;
        border-radius: 0.95rem;
        background: var(--nav-primary, #1a6fd4);
        color: #fff;
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        line-height: 1.1;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-shadow: none;
    }

    .nav-rail-cta-route:active {
        background: var(--nav-primary-dark, #1458a8);
        transform: none;
        filter: none;
    }

    .nav-rail-cta-route .bi:first-child {
        font-size: 1.1rem;
        line-height: 1;
    }

    .nav-rail-cta-route__chev {
        margin-left: 0.15rem;
        font-size: 0.95rem;
        opacity: 0.9;
        line-height: 1;
    }

    .nav-rail--search.nav-rail--collapsed .nav-rail-brand {
        display: none;
    }

    .nav-rail--search.nav-rail--collapsed .nav-rail-brand span {
        max-width: 6.5rem;
    }

    .nav-rail-head--expandable {
        cursor: pointer;
    }

    .nav-rail-head--expandable:active {
        background: transparent;
    }

    .nav-rail--search.nav-rail--search-collapsed-only .nav-rail-head {
        padding: 0.55rem 0.7rem 0.45rem;
        border-bottom: none;
        gap: 0;
        background: transparent;
    }

    /* Tìm đường: bottom sheet nằm trên tab bar */
    .nav-main-map:not(:has(.nav-rail--directions)) {
        --map-overlay-top: max(0.5rem, env(safe-area-inset-top, 0px));
    }

    .nav-main-map:not(:has(.nav-rail--directions)):not(:has(.nav-rail--collapsed)) {
        --map-overlay-bottom: calc(
            var(--map-mobile-dock-h)
            + env(safe-area-inset-bottom, 0px)
            + min(var(--map-rail-search-max), 100%)
        );
    }

    .nav-main-map:not(:has(.nav-rail--directions)):has(.nav-rail--collapsed) {
        --map-overlay-bottom: calc(
            var(--map-rail-search-collapsed-h, 3.85rem)
            + var(--map-mobile-dock-h)
            + env(safe-area-inset-bottom, 0px)
        );
    }

    /* Sheet tìm đường: cao theo nội dung, sát tab bar — không chừa khoảng trắng */
    .nav-main-map:not(:has(.nav-rail--directions)) .nav-rail-on-map {
        left: 0;
        right: 0;
        top: auto;
        bottom: calc(var(--map-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: auto;
        max-height: var(--map-rail-search-max);
        overflow: hidden;
        border-radius: 1.15rem 1.15rem 0 0;
        border: 1px solid rgba(226, 232, 240, 0.95);
        border-bottom: none;
        box-shadow: 0 -10px 32px rgba(15, 23, 42, 0.12);
        background: #fff;
    }

    .nav-main-map:not(:has(.nav-rail--directions)):not(:has(.nav-rail--collapsed)) .nav-mobile-dock {
        /* Giữ tab bar khi mở tìm đường */
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    .nav-rail-on-map.nav-rail--search {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .nav-rail-on-map.nav-rail--search:not(.nav-rail--collapsed) {
        max-height: min(var(--map-rail-search-max), 70dvh);
    }

    .nav-rail--search.nav-rail--collapsed .nav-rail-search,
    .nav-rail--search.nav-rail--collapsed .nav-rail-sheet-handle,
    .nav-rail--search.nav-rail--collapsed .nav-rail-qr-quick {
        display: none !important;
    }

    .nav-rail--search.nav-rail--collapsed .nav-rail-head {
        border-bottom: none;
        padding: 0.55rem 0.7rem 0.45rem;
        gap: 0;
    }

    .nav-rail-on-map.nav-rail--search.nav-rail--collapsed {
        max-height: var(--map-rail-search-collapsed-h, 3.85rem);
        height: auto;
        overflow: hidden;
    }

    .nav-rail--search:not(.nav-rail--collapsed) .nav-rail-sheet-handle {
        margin: 0.4rem auto 0.15rem;
    }

    .nav-rail--search .nav-rail-search {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        padding-bottom: 0.75rem;
    }

    .nav-rail-on-map .nav-rail-qr-btn {
        min-width: 3.35rem;
        padding: 0 0.85rem;
        border-width: 2px;
        border-radius: 0.55rem;
        touch-action: manipulation;
    }

    .nav-rail-on-map .nav-rail-qr-btn .bi {
        font-size: 1.4rem;
    }

    /* Header mobile — màu primary; nội dung căn đáy (dưới safe-area) */
    .nav-map-mobile-header {
        --map-mobile-header-content-h: 2.75rem;
        display: flex;
        align-items: flex-end;
        position: absolute;
        z-index: 70;
        top: 0;
        left: 0;
        right: 0;
        height: calc(var(--map-mobile-header-content-h) + env(safe-area-inset-top, 0px));
        min-height: calc(var(--map-mobile-header-content-h) + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 0.75rem 0;
        box-sizing: border-box;
        background: var(--nav-primary, #1a6fd4);
        border-bottom: none;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        pointer-events: auto;
    }

    .nav-map-mobile-header .nav-map-home-back {
        position: static;
        top: auto;
        left: auto;
        max-width: none;
        width: 100%;
        height: var(--map-mobile-header-content-h);
        justify-content: flex-start;
        align-items: center;
        gap: 0.45rem;
        padding: 0 0.15rem;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        font-size: 0.92rem;
        font-weight: 700;
        color: #fff;
    }

    .nav-map-mobile-header .nav-map-home-back:hover,
    .nav-map-mobile-header .nav-map-home-back:focus-visible {
        background: transparent;
        box-shadow: none;
        color: #fff;
        opacity: 0.92;
    }

    .nav-map-mobile-header .nav-map-home-back .bi {
        font-size: 1.15rem;
        color: #fff;
    }

    /* Icon info / zoom: sát mép dưới header */
    .nav-main-map:has(.nav-map-mobile-header) {
        --map-mobile-header-h: calc(2.75rem + env(safe-area-inset-top, 0px));
        --map-overlay-top: var(--map-mobile-header-h);
    }

    .nav-main-map:has(.nav-map-mobile-header) .nav-chrome-side,
    .nav-main-map:has(.nav-map-mobile-header) .map-legend-trigger {
        top: calc(var(--map-mobile-header-h) + 0.4rem);
    }

    .nav-mobile-dock-btn-label {
        max-width: 100%;
        font-size: 0.58rem;
    }

    /* Card pin trên mobile: gọn hơn desktop, không chiếm nửa màn */
    .nav-map-pin-expand {
        width: min(16.5rem, calc(100vw - 1.5rem));
    }

    .nav-map-pin-expand__panel {
        border-radius: 12px;
        padding: 0.55rem 0.6rem 0.55rem;
        box-shadow:
            0 8px 22px rgba(15, 23, 42, 0.14),
            0 1px 0 rgba(255, 255, 255, 0.7) inset;
    }

    .nav-map-pin-expand__title {
        font-size: 0.82rem;
    }

    .nav-map-pin-expand__desc {
        font-size: 0.68rem;
        max-height: 4.25rem;
    }

    .nav-map-pin-expand__action {
        padding: 0.32rem 0.12rem 0.26rem;
        border-radius: 9px;
        min-height: 2.65rem;
    }

    .nav-map-pin-expand__label {
        font-size: 0.62rem;
    }

    .nav-map-pin-expand__icon {
        width: 1.15rem;
        height: 1.15rem;
    }

    .nav-map-pin-expand__icon > .bi {
        font-size: 0.92rem;
    }

    /* Dẫn đường: sheet trên tab bar; tab bar luôn sát đáy */
    .nav-main-map:has(.nav-rail--directions) {
        --map-overlay-bottom: calc(
            var(--map-rail-route-max)
            + var(--map-mobile-dock-h)
            + env(safe-area-inset-bottom, 0px)
        );
    }

    .nav-main-map:has(.nav-rail--directions):has(.nav-rail--collapsed) {
        --map-overlay-bottom: calc(
            var(--map-rail-collapsed-h)
            + var(--map-mobile-dock-h)
            + env(safe-area-inset-bottom, 0px)
        );
    }

    .nav-main-map:has(.nav-rail--directions) .nav-rail-on-map {
        left: 0;
        right: 0;
        top: auto;
        bottom: calc(var(--map-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: var(--map-rail-route-max);
        max-height: none;
        border-radius: 1rem 1rem 0 0;
        box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.14);
        z-index: 40;
    }

    .nav-main-map:has(.nav-rail--directions) .nav-mobile-dock {
        bottom: 0;
        z-index: 60;
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    }

    .nav-main-map:has(.nav-rail--directions):has(.nav-rail--collapsed) .nav-rail-on-map {
        bottom: calc(var(--map-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
        height: auto;
        max-height: var(--map-rail-collapsed-h);
    }

    .nav-main-map:has(.nav-rail--directions):has(.nav-rail--collapsed) .nav-mobile-dock {
        bottom: 0;
    }

    .nav-rail--directions.nav-rail--collapsed.nav-rail--step-nav-only .nav-rail-head,
    .nav-rail--directions.nav-rail--collapsed.nav-rail--step-nav-only .nav-rail-sheet-handle,
    .nav-rail--directions.nav-rail--collapsed.nav-rail--step-nav-only .nav-rail-route-meta,
    .nav-rail--directions.nav-rail--collapsed.nav-rail--step-nav-only .nav-rail-steps,
    .nav-rail--directions.nav-rail--collapsed.nav-rail--step-nav-only .nav-route-handoff {
        display: none !important;
    }

    .nav-rail-step-nav {
        display: none;
        align-items: stretch;
        gap: 0.4rem;
        width: 100%;
    }

    .nav-rail--directions.nav-rail--collapsed .nav-rail-step-nav {
        display: flex;
    }

    .nav-rail--directions.nav-rail--collapsed .nav-rail-connector-bar {
        display: block;
        margin: 0 0 0.4rem;
    }

    .nav-rail-connector-switch--compact {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
        width: 100%;
    }

    .nav-rail-connector-switch--compact .nav-rail-connector-opt {
        min-height: 2.35rem;
        padding: 0.35rem 0.5rem;
        border-radius: 0.75rem;
        background: #f1f5f9;
        color: #334155;
        border: none;
        box-shadow: none;
    }

    .nav-rail-connector-switch--compact .nav-rail-connector-opt.active {
        background: var(--nav-primary, #1a6fd4);
        color: #fff;
        border-color: transparent;
    }

    .nav-rail-field-group--connector-compact {
        margin: 0;
    }

    .nav-rail-field-group--connector-compact .nav-rail-label {
        display: none;
    }

    .nav-rail-step-nav__btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        min-height: 2.65rem;
        padding: 0.4rem 0.6rem;
        border: none;
        border-radius: 0.85rem;
        background: var(--nav-primary, #1a6fd4);
        color: #fff;
        font-size: 0.8rem;
        font-weight: 650;
        line-height: 1.15;
        white-space: nowrap;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-shadow: none;
    }

    .nav-rail-step-nav__btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .nav-rail-step-nav__btn:not(:disabled):active {
        background: var(--nav-primary-dark, #1458a8);
    }

    .nav-rail-step-nav__btn--prev,
    .nav-rail-step-nav__btn--next {
        flex: 1 1 0;
        min-width: 0;
    }

    .nav-rail-step-nav__btn--show {
        flex: 0 0 auto;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .nav-rail-step-nav__btn--show:hover,
    .nav-rail-step-nav__btn--show:focus-visible {
        outline: none;
    }

    .nav-rail-step-nav__btn .bi {
        font-size: 0.95rem;
        line-height: 1;
    }

    .nav-rail-on-map.nav-rail--directions.nav-rail--collapsed {
        height: auto;
        max-height: none;
        padding: 0.45rem 0.6rem 0.4rem;
        border-radius: 1.15rem 1.15rem 0 0;
        border: 1px solid rgba(226, 232, 240, 0.95);
        border-bottom: none;
        box-shadow: 0 -10px 32px rgba(15, 23, 42, 0.12);
        overflow: hidden;
        background: #fff;
    }

    .nav-main-map:has(.nav-rail--directions) .nav-mobile-dock,
    .nav-main-map:has(.nav-rail--directions) .nav-rail-on-map {
        transition: bottom 0.22s ease, max-height 0.22s ease, height 0.22s ease;
    }

    .nav-main-map:has(.nav-rail--directions) .map-legend-float,
    .nav-main-map:has(.nav-rail--directions) .map-legend-restore {
        display: none !important;
    }

    /* Picker vị trí: full-width bottom sheet — CSS bắt buộc (không phụ thuộc JS class) */
    .nav-rail-on-map .searchable-select.is-open .searchable-select-backdrop {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.5) !important;
        z-index: 13090 !important;
        pointer-events: auto !important;
    }

    /*
     * Khi mở dropdown: rail thành overlay full-screen + panel dính đáy.
     * Máy thật hay cắt panel nếu còn absolute theo trigger / overflow sheet.
     */
    .nav-main-map:has(.searchable-select.is-open),
    .nav-shell-rail:has(.searchable-select.is-open),
    .nav-shell:has(.searchable-select.is-open) {
        overflow: visible !important;
    }

    .nav-rail-on-map:has(.searchable-select.is-open) {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
        z-index: 13050 !important;
        pointer-events: none !important;
        transform: none !important;
        filter: none !important;
        contain: none !important;
    }

    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-sheet-handle,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-head,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-route-spine,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-connector-section,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-btn-find,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-qr-quick,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-qr-btn,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-field-group:not(:has(.searchable-select.is-open)),
    .nav-rail-on-map:has(.searchable-select.is-open) .searchable-select.is-open .searchable-select-trigger {
        position: fixed !important;
        width: 1px !important;
        height: 1px !important;
        margin: -1px !important;
        padding: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        border: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }

    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-search,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-route-fields,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-route-ends,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-route-inputs,
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-field-group:has(.searchable-select.is-open),
    .nav-rail-on-map:has(.searchable-select.is-open) .nav-rail-input-qr,
    .nav-rail-on-map:has(.searchable-select.is-open) .searchable-select.is-open {
        pointer-events: auto !important;
        visibility: visible !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
        clip: auto !important;
        opacity: 1 !important;
        position: static !important;
        width: auto !important;
        margin: 0 !important;
    }

    .nav-main-map:has(.searchable-select.is-open) .nav-mobile-dock {
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Bottom sheet: luôn fixed đáy — không cần class --mobile-sheet từ JS */
    .nav-rail-on-map .searchable-select.is-open .searchable-select-panel,
    .nav-rail-on-map .searchable-select-panel--mobile-sheet {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: min(88dvh, 640px) !important;
        max-height: min(88dvh, 640px) !important;
        margin: 0 !important;
        border-radius: 1.1rem 1.1rem 0 0 !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        border-bottom: none !important;
        z-index: 13100 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px)) !important;
        box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22) !important;
        background: #fff !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    .nav-rail-on-map .searchable-select-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        flex: 0 0 auto;
        padding: 0.55rem 0.75rem 0.45rem;
        border-bottom: 1px solid var(--nav-border);
        background: #fff;
    }

    .nav-rail-on-map .searchable-select.is-open .searchable-select-search-wrap {
        flex: 0 0 auto;
    }

    .nav-rail-on-map .searchable-select.is-open .searchable-select-list,
    .nav-rail-on-map .searchable-select-panel--mobile-sheet .searchable-select-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 0.35rem 0 max(1rem, env(safe-area-inset-bottom, 0px)) !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scroll-padding-top: 0.5rem;
        scroll-padding-bottom: 1.25rem;
        pointer-events: auto !important;
    }

    .nav-rail-on-map .searchable-select-panel--mobile-sheet .searchable-select-sheet-head {
        display: flex;
    }

    .searchable-select-sheet-title {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--nav-text);
    }

    .searchable-select-sheet-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 0.5rem;
        background: #f1f5f9;
        color: var(--nav-muted);
        touch-action: manipulation;
    }

    .nav-main-map:has(.searchable-select.is-open) .nav-chrome-map-tools,
    .nav-main-map:has(.searchable-select.is-open) .map-legend-float,
    .nav-main-map:has(.searchable-select.is-open) .map-legend-restore,
    .nav-main-map:has(.searchable-select.is-open) .nav-map-home-back {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    .map-legend-trigger {
        top: calc(var(--map-overlay-top) + 0.35rem);
        bottom: auto;
        left: max(0.5rem, env(safe-area-inset-left, 0px));
        width: 32px;
        height: 32px;
        border-radius: 0.4rem;
    }

    .map-legend-trigger .bi {
        font-size: 0.95rem;
    }

    .map-legend-popup {
        border-radius: 0.55rem;
    }

    /* Zoom + góp ý: cột góc phải, nút nhỏ có viền */
    .nav-chrome-side {
        position: absolute;
        top: calc(var(--map-overlay-top) + 0.35rem);
        bottom: auto;
        right: max(0.5rem, env(safe-area-inset-right, 0px));
        left: auto;
        max-height: none;
        overflow: visible;
    }

    .nav-chrome-zoom {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .nav-chrome-tool-extra,
    .nav-chrome-tool-hotline {
        display: none;
    }

    .nav-chrome-tool {
        width: 32px;
        height: 32px;
        border: 1px solid var(--nav-border);
        border-radius: 0.4rem;
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
        font-size: 0.85rem;
    }

    .nav-chrome-tool-rating {
        color: #eab308;
    }

    .nav-main-map:not(:has(.nav-rail--directions)):not(:has(.nav-rail--collapsed)) .nav-chrome-side,
    .nav-main-map:not(:has(.nav-rail--directions)):not(:has(.nav-rail--collapsed)) .map-legend-trigger {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    /* Thanh dock mobile — đã gộp ở .nav-mobile-dock */
    .nav-chrome-floors--desktop {
        display: none !important;
    }

    .nav-browse-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 12090;
        border: none;
        padding: 0;
        margin: 0;
        background: rgba(15, 23, 42, 0.45);
        cursor: default;
        pointer-events: auto;
        touch-action: manipulation;
    }

    .nav-browse-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--map-mobile-dock-h, 3.65rem) + env(safe-area-inset-bottom, 0px));
        z-index: 12100;
        max-height: min(70dvh, 480px);
        background: #fff;
        border-radius: 0.85rem 0.85rem 0 0;
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
        overflow: hidden;
        pointer-events: auto;
        touch-action: manipulation;
    }

    .nav-browse-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
        border-bottom: 1px solid var(--nav-border);
        flex-shrink: 0;
    }

    .nav-browse-sheet-title {
        font-size: 1rem;
        font-weight: 700;
        color: var(--nav-text);
        letter-spacing: -0.01em;
    }

    .nav-browse-sheet-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 0.4rem;
        background: #f1f5f9;
        color: var(--nav-muted);
    }

    .nav-browse-sheet-body {
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0.35rem 0.5rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .nav-browse-sheet-section {
        margin: 0.55rem 0.35rem 0.25rem;
        font-size: 0.68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--nav-muted);
    }

    .nav-browse-sheet-item {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        width: 100%;
        min-height: 48px;
        padding: 0.6rem 0.75rem;
        border: none;
        border-radius: 0.4rem;
        background: transparent;
        color: var(--nav-text);
        font-size: 0.9rem;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
        pointer-events: auto;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-browse-sheet-item span {
        flex: 1;
        min-width: 0;
        line-height: 1.35;
    }

    .nav-browse-sheet-item .bi {
        flex-shrink: 0;
        font-size: 1rem;
        color: var(--nav-primary);
    }

    .nav-browse-sheet-item.active {
        background: #eff6ff;
        color: var(--nav-primary);
        font-weight: 600;
    }

    .nav-main-map:has(.nav-browse-sheet) .nav-chrome-side,
    .nav-main-map:has(.nav-browse-sheet) .map-legend-trigger {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    /* Giữ tab bar khi mở sheet chọn khu/tầng */

    .nav-toast-wrap {
        bottom: calc(var(--map-overlay-bottom) + 0.5rem);
        left: max(0.75rem, env(safe-area-inset-left, 0px));
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        transform: none;
        max-width: none;
    }

    .searchable-select-trigger {
        min-height: 44px;
        padding: 0.35rem 0.65rem;
        font-size: 16px;
        border-radius: 0.4rem;
    }

    .searchable-select-search {
        font-size: 16px;
    }

    .searchable-select-option {
        min-height: 44px;
        padding: 0.55rem 0.75rem;
    }

    .nav-rail-btn-find {
        min-height: 44px;
        font-size: 0.95rem;
        border-radius: 0.4rem;
    }

    .nav-rail-on-map {
        border-radius: 0.5rem 0.5rem 0.35rem 0.35rem;
    }

    .nav-rail--directions .nav-rail-head {
        padding: 0.45rem 0.65rem 0.35rem;
    }

    .nav-rail--directions .nav-rail-route-meta {
        padding: 0.45rem 0.65rem;
    }

    .nav-rail--directions .nav-rail-meta-title {
        display: none;
    }

    .nav-rail--directions .nav-rail-meta-value {
        font-size: 0.88rem;
        margin-bottom: 0.25rem;
    }

    .nav-rail--directions .nav-rail-dest {
        font-size: 0.76rem;
    }

    .nav-rail--directions .nav-rail-steps {
        padding: 0.35rem 0.5rem 0.55rem;
        flex: 1 1 auto;
        min-height: 7rem;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .nav-rail--directions .nav-rail-step {
        padding: 0.55rem 0.4rem;
        gap: 0.45rem;
        min-height: 44px;
    }

    .nav-rail--directions .nav-rail-step-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .nav-rail--directions .nav-rail-step--xfer .nav-rail-step-icon {
        width: 34px;
        height: 34px;
    }

    .nav-rail--directions .nav-rail-step--xfer .nav-xfer-glyph {
        width: 20px;
        height: 20px;
    }

    .nav-rail--directions .nav-rail-step-title {
        font-size: 0.8rem;
    }

    .nav-rail--directions .nav-rail-step-detail {
        font-size: 0.7rem;
    }

    .nav-rail--directions .nav-rail-foot {
        padding: 0.45rem 0.55rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
        display: block;
    }

    .nav-rail--directions .nav-rail-foot .btn {
        margin: 0 !important;
        font-size: 0.82rem;
        min-height: 44px;
        padding: 0.55rem 0.75rem;
    }

    .nav-rail-on-map.nav-rail--search {
        --nav-rail-pad-x: 0.6rem;
        --nav-rail-pad-block: 0.45rem;
        --nav-rail-stack-gap: 0.5rem;
    }

    .nav-rail--search .nav-rail-search {
        padding: var(--nav-rail-pad-block) var(--nav-rail-pad-x) calc(var(--nav-rail-pad-block) + 0.1rem);
    }

    .nav-rail--search .nav-rail-head {
        padding: calc(var(--nav-rail-pad-block) + 0.05rem) var(--nav-rail-pad-x) var(--nav-rail-pad-block);
        border-bottom: 1px solid var(--nav-border);
    }

    .nav-rail--search .nav-rail-route-fields {
        gap: 0.45rem;
    }

    .nav-rail-route-ends {
        gap: 0.4rem 0.45rem;
    }

    .nav-rail-route-inputs {
        gap: 0.45rem;
    }

    .nav-rail--search .nav-rail-label {
        font-size: 0.68rem;
        margin-bottom: 0.15rem;
    }

    .nav-main-map:not(:has(.nav-rail--directions)) .nav-rail-on-map .nav-rail-sheet-handle {
        margin: 0.25rem auto 0.05rem;
    }

    .nav-rail--search .nav-rail-brand span {
        font-size: 0.68rem;
    }

    .nav-rail-connector-opt {
        min-height: 2.65rem;
        font-size: 0.72rem;
    }
}

@media (min-width: 992px) {
    .nav-rail-sheet-handle {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .map-legend-bar {
        display: none;
    }

    .nav-main-map {
        --map-rail-search-max: min(58dvh, 460px);
        --map-rail-route-max: min(48dvh, 380px);
        --map-rail-collapsed-h: 3.55rem;
        --map-mobile-dock-h: 3.65rem;
    }

    .nav-chrome-zone-btn {
        max-width: 5.5rem;
    }

    .nav-rail-connector-opt {
        min-height: 2.65rem;
        font-size: 0.75rem;
        padding: 0.4rem 0.4rem;
        gap: 0.3rem;
    }

    .nav-rail-connector-opt .bi {
        font-size: 1rem;
    }

    .nav-rail-connector-opt span {
        display: inline;
    }

    .nav-rail-on-map .searchable-select-option-rich {
        min-height: 48px;
    }
}

@media (max-width: 991.98px) and (max-height: 480px) and (orientation: landscape) {
    .nav-main-map {
        --map-rail-search-max: calc(100dvh - max(1rem, env(safe-area-inset-top, 0px)) - max(1rem, env(safe-area-inset-bottom, 0px)));
        --map-rail-route-max: min(52dvh, 260px);
    }

    .nav-main-map:not(:has(.nav-rail--directions)) {
        --map-overlay-top: max(0.5rem, env(safe-area-inset-top, 0px));
    }

    .nav-main-map:not(:has(.nav-rail--directions)):not(:has(.nav-rail--collapsed)) {
        --map-overlay-top: 0;
    }

    .nav-main-map:not(:has(.nav-rail--directions)) .nav-rail-on-map {
        left: auto;
        right: max(0.5rem, env(safe-area-inset-right, 0px));
        top: max(0.5rem, env(safe-area-inset-top, 0px));
        bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
        width: min(340px, 46vw);
        max-height: none;
    }

    .nav-main-map:not(:has(.nav-rail--directions)):has(.nav-rail--collapsed) {
        --map-overlay-top: max(0.5rem, env(safe-area-inset-top, 0px));
    }

    .nav-chrome-side {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.35rem;
        max-width: calc(100% - min(360px, 48vw) - 1rem);
    }

    .nav-chrome-zoom {
        flex-direction: row;
        align-items: center;
    }

    .map-legend-float {
        max-height: min(36dvh, 140px);
    }
}
