:root {
    --navy-950: #0b1729;
    --navy-900: #10233f;
    --navy-800: #173557;
    --ink: #142033;
    --muted: #68758a;
    --line: #e5eaf1;
    --surface: #ffffff;
    --canvas: #f3f6fa;
    --primary: #315efb;
    --primary-dark: #2349d6;
    --cyan: #26c7d9;
    --amber: #f4b73b;
    --green: #16a36a;
    --red: #d94b56;
    --shadow: 0 18px 45px rgba(31, 48, 76, .10);
    --radius: 18px;
    --sidebar: 250px;
}

* { box-sizing: border-box; }
html { min-height: 100%; font-size: 16px; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(49, 94, 251, .20);
    outline-offset: 2px;
}
.hidden, [hidden] { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(440px, .95fr); background: white; }
.is-authenticated .auth-screen { display: none; }
.is-guest .app-shell { display: none; }
.auth-visual { position: relative; overflow: hidden; display: grid; place-items: center; padding: 56px; background: linear-gradient(145deg, #09172c 0%, #102d50 58%, #0d4963 100%); color: white; }
.auth-visual::before { content: ""; position: absolute; inset: 0; opacity: .11; background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom right, black, transparent 75%); }
.auth-visual::after { content: ""; position: absolute; width: 500px; height: 500px; border-radius: 50%; background: rgba(38,199,217,.12); filter: blur(2px); right: -170px; bottom: -210px; }
.auth-orbit { position: absolute; border: 1px solid rgba(69,210,224,.32); border-radius: 50%; }
.orbit-one { width: 570px; height: 570px; left: -250px; top: -240px; }
.orbit-two { width: 280px; height: 280px; right: -55px; top: 9%; }
.route-line { position: absolute; width: 330px; height: 200px; right: 12%; bottom: 12%; border: 2px dashed rgba(255,255,255,.13); border-radius: 50%; transform: rotate(-16deg); }
.auth-pin { position: absolute; width: 44px; height: 44px; display: grid; place-items: center; color: #fff; border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); box-shadow: 0 12px 24px rgba(0,0,0,.22); }
.auth-pin span { transform: rotate(45deg); font-size: 17px; }
.pin-one { background: #315efb; left: 18%; bottom: 18%; }
.pin-two { background: #f59e0b; right: 18%; top: 22%; }
.pin-three { background: #16a36a; right: 30%; bottom: 28%; width: 34px; height: 34px; }
.visual-copy { position: relative; z-index: 2; width: min(460px, 82%); }
.visual-copy p { margin: 30px 0 0; color: rgba(255,255,255,.72); font-size: clamp(1.35rem, 3vw, 2.25rem); line-height: 1.35; letter-spacing: -.025em; }
.visual-copy strong { color: white; font-weight: 760; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border-radius: 11px 11px 11px 3px; color: white; background: linear-gradient(135deg, var(--primary), var(--cyan)); font-weight: 900; box-shadow: 0 8px 22px rgba(49,94,251,.28); }
.brand-mark-large { width: 56px; height: 56px; border-radius: 16px 16px 16px 4px; font-size: 1.4rem; }
.auth-panel { display: grid; place-items: center; padding: 52px; }
.auth-card { width: min(440px, 100%); }
.mobile-brand { display: none; align-items: center; gap: 11px; font-weight: 800; margin-bottom: 56px; }
.eyebrow { color: var(--primary); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.auth-card h1 { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.08; letter-spacing: -.045em; margin: 11px 0 13px; }
.auth-intro { color: var(--muted); line-height: 1.65; margin: 0 0 30px; }
.stack-form { display: grid; gap: 18px; }
.stack-form.compact { gap: 15px; }
label { display: grid; gap: 7px; color: #344157; font-size: .83rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #dbe2ec; border-radius: 11px; background: #fff; color: var(--ink); min-height: 44px; padding: 10px 12px; transition: border .18s, box-shadow .18s; }
textarea { min-height: 92px; line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b9c4d4; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(49,94,251,.09); outline: 0; }
.stack-form > label > input { min-height: 50px; }
.btn { min-height: 42px; border: 0; border-radius: 11px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 780; color: var(--ink); transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 8px 20px rgba(49,94,251,.20); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 11px 24px rgba(49,94,251,.25); }
.btn-secondary { background: white; border: 1px solid var(--line); }
.btn-secondary:hover { background: #f8faff; }
.btn-danger-text { background: #fff1f2; color: #c23543; }
.btn-block { width: 100%; min-height: 52px; margin-top: 4px; }
.btn-small { min-height: 36px; padding: 7px 11px; font-size: .79rem; }
.auth-foot { display: flex; align-items: center; gap: 9px; margin-top: 28px; color: #8490a1; font-size: .76rem; }
.lock-icon { font-size: .65rem; color: var(--green); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 1000; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 25px 16px 17px; color: white; background: var(--navy-950); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 25px; }
.brand-name { font-weight: 850; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-name span { color: var(--cyan); }
.main-nav { display: grid; gap: 5px; }
.nav-item { position: relative; width: 100%; border: 0; border-radius: 11px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; color: #98a9bf; background: transparent; text-align: left; font-size: .86rem; font-weight: 700; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(49,94,251,.30), rgba(49,94,251,.08)); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; width: 3px; height: 24px; background: var(--cyan); border-radius: 0 4px 4px 0; }
.nav-icon { font-size: 1.15rem; line-height: 1; color: currentColor; text-align: center; }
.nav-count { min-width: 23px; padding: 2px 6px; border-radius: 99px; color: #b7c6d8; background: rgba(255,255,255,.07); font-size: .67rem; text-align: center; }
.nav-count-accent { color: #d9fcff; background: rgba(38,199,217,.18); }
.sidebar-spacer { flex: 1; }
.region-legend-wrap { padding: 12px 12px 17px; min-height: 100px; }
.sidebar-label { color: #61758f; font-size: .63rem; font-weight: 850; letter-spacing: .12em; margin-bottom: 10px; }
.sidebar-regions { display: grid; gap: 9px; max-height: 164px; overflow: auto; }
.sidebar-region { display: flex; align-items: center; gap: 9px; color: #9aabc0; font-size: .72rem; }
.region-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.profile-card { width: 100%; border: 1px solid rgba(255,255,255,.07); border-radius: 13px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 9px; color: white; background: rgba(255,255,255,.035); text-align: left; }
.profile-card:hover { background: rgba(255,255,255,.07); }
.avatar { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #315efb, #1caabb); font-weight: 850; }
.profile-copy { display: grid; gap: 2px; min-width: 0; }
.profile-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.profile-copy small { color: #71849d; font-size: .65rem; }
.more-dots { color: #60738c; font-size: .7rem; }

.main-content { grid-column: 2; min-width: 0; padding: 0 30px 34px; }
.topbar { min-height: 91px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar-kicker { color: var(--muted); font-size: .71rem; font-weight: 650; margin-bottom: 3px; }
.topbar h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.mobile-menu { display: none !important; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: #58667b; background: white; font-size: 1.2rem; }
.icon-btn:hover { background: #f7f9fc; color: var(--primary); }
.icon-btn.small { width: 34px; height: 34px; font-size: 1rem; }
.view { display: none; }
.view.active { display: block; animation: viewIn .22s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 15px; }
.stat-card { position: relative; overflow: hidden; min-height: 100px; display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: 15px; padding: 18px; background: white; box-shadow: 0 3px 12px rgba(31,48,76,.035); }
.stat-card::after { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; right: -34px; bottom: -38px; background: var(--tint, rgba(49,94,251,.08)); }
.stat-label { color: var(--muted); font-size: .7rem; font-weight: 750; }
.stat-value { display: block; margin-top: 5px; font-size: 1.7rem; line-height: 1; font-weight: 850; letter-spacing: -.04em; }
.stat-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; color: var(--tone, var(--primary)); background: var(--tint, rgba(49,94,251,.08)); font-size: 1.05rem; font-weight: 800; }

.map-workspace { height: calc(100vh - 218px); min-height: 560px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 15px; }
.map-panel, .route-panel, .content-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 18px rgba(31,48,76,.04); }
.map-panel { position: relative; width: 100%; height: 100%; min-width: 0; overflow: hidden; }
.map-toolbar { position: absolute; z-index: 500; top: 14px; left: 14px; right: 14px; display: grid; grid-template-columns: minmax(170px, 1fr) 145px 145px 130px 112px 42px; gap: 8px; pointer-events: none; }
.map-toolbar > * { pointer-events: auto; box-shadow: 0 7px 22px rgba(20,35,58,.12); }
.search-box { min-height: 42px; display: flex; align-items: center; gap: 8px; border: 1px solid #dce3ec; border-radius: 11px; padding: 0 11px; background: white; color: #78869a; }
.search-box input { min-height: 40px; padding: 0; border: 0; box-shadow: none; background: transparent; }
.search-box input:focus { box-shadow: none; }
.search-box.wide { width: min(390px, 100%); }
.map-toolbar select { box-shadow: 0 7px 22px rgba(20,35,58,.12); }
.map-toolbar select:disabled { color: #98a3b2; background: #f5f7fa; cursor: not-allowed; }
.map-route-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 11px; color: white; background: var(--navy-900); font-size: .7rem; font-weight: 850; white-space: nowrap; }
.map-route-button:hover { background: #183253; }
.main-map { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; background: #dce5ea; }
.leaflet-overlay-pane path { transition: fill-opacity .22s ease, stroke-width .22s ease; cursor: pointer; }
.leaflet-overlay-pane path.leaflet-interactive,
.leaflet-overlay-pane path.leaflet-interactive:focus,
.leaflet-overlay-pane path.leaflet-interactive:focus-visible { outline: none !important; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 7px 22px rgba(20,35,58,.15) !important; }
.leaflet-control-zoom a { color: var(--navy-900) !important; border: 0 !important; }
.leaflet-popup-content-wrapper { border-radius: 14px !important; box-shadow: 0 15px 35px rgba(15,30,52,.20) !important; }
.leaflet-popup-content { margin: 14px !important; }
.map-key { position: absolute; z-index: 500; left: 14px; bottom: 14px; display: flex; gap: 14px; padding: 8px 11px; border-radius: 9px; background: rgba(255,255,255,.94); box-shadow: 0 6px 18px rgba(20,35,58,.12); color: var(--muted); font-size: .68rem; }
.map-key span { display: flex; align-items: center; gap: 5px; }
.key-star { color: var(--amber); font-style: normal; font-size: .9rem; }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.selected-region-card { position: absolute; z-index: 510; top: 67px; left: 14px; min-width: 285px; display: grid; grid-template-columns: 9px 1fr auto 25px; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border: 1px solid rgba(255,255,255,.86); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 10px 26px rgba(20,35,58,.16); backdrop-filter: blur(8px); }
.selected-region-color { width: 8px; height: 33px; border-radius: 99px; }
.selected-region-card > span:nth-child(2) { display: grid; gap: 2px; }
.selected-region-card small { color: #8290a4; font-size: .55rem; font-weight: 850; letter-spacing: .11em; }
.selected-region-card strong { font-size: .76rem; }
.selected-region-card em { color: #8793a4; font-size: .62rem; font-style: normal; }
.selected-region-card > b { color: var(--muted); font-size: .67rem; white-space: nowrap; }
.selected-region-card button { width: 25px; height: 25px; border: 0; border-radius: 7px; color: #6d798a; background: #eef2f6; font-size: 1rem; line-height: 1; }
.region-label-icon { background: transparent; border: 0; }
.region-label-icon > span { width: max-content; max-width: 170px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--label-color) 24%, white); border-radius: 8px; color: color-mix(in srgb, var(--label-color) 75%, #15243a); background: rgba(255,255,255,.88); box-shadow: 0 4px 11px rgba(20,35,58,.10); font-size: .62rem; font-weight: 850; white-space: nowrap; transform: translateX(calc((170px - 100%) / 2)); }
.region-label-icon > span.is-selected { padding: 7px 10px; border-color: var(--label-color); background: rgba(255,255,255,.97); box-shadow: 0 7px 18px rgba(20,35,58,.16); font-size: .7rem; }
.region-label-icon i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--label-color); }
.region-label-icon b { min-width: 17px; padding: 1px 5px; border-radius: 99px; color: white; background: var(--label-color); font-size: .55rem; text-align: center; }
.district-label-icon { border: 0; background: transparent; pointer-events: none; }
.district-label-icon > span { width: max-content; max-width: 136px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--district-color) 28%, white); border-radius: 7px; color: color-mix(in srgb, var(--district-color) 70%, #13243b); background: rgba(255,255,255,.88); box-shadow: 0 3px 10px rgba(20,35,58,.10); font-size: .59rem; font-weight: 820; line-height: 1; white-space: nowrap; transform: translateX(calc((136px - 100%) / 2)); }
.district-label-icon > span.is-selected { padding: 6px 9px; border: 2px solid var(--district-color); color: color-mix(in srgb, var(--district-color) 82%, #102039); background: rgba(255,255,255,.98); box-shadow: 0 7px 17px rgba(20,35,58,.18); font-size: .67rem; }
.district-label-icon b { min-width: 16px; padding: 2px 4px; border-radius: 99px; color: white; background: var(--district-color); font-size: .52rem; text-align: center; }
.district-map-tooltip { border: 0 !important; border-radius: 7px !important; padding: 6px 9px !important; color: white !important; background: var(--navy-900) !important; box-shadow: 0 7px 18px rgba(12,26,45,.22) !important; font-size: .68rem !important; font-weight: 800 !important; }
.district-map-tooltip::before { border-top-color: var(--navy-900) !important; }
.customer-marker { background: transparent; border: 0; }
.customer-pin { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid white; border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); color: #fff; box-shadow: 0 5px 13px rgba(15,30,52,.30); font-weight: 900; }
.customer-pin > span { transform: rotate(45deg); text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.customer-pin .priority-num { position: absolute; right: -8px; top: -7px; width: 17px; height: 17px; display: grid; place-items: center; transform: rotate(45deg); border: 2px solid white; border-radius: 50%; background: var(--navy-900); font-size: .56rem; }
.route-stop-marker, .route-origin-marker { border: 0; background: transparent; }
.route-stop-marker > span { width: 29px; height: 29px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; color: white; background: var(--stop-color); box-shadow: 0 5px 13px rgba(15,30,52,.30); font-size: .7rem; font-weight: 900; }
.route-origin-marker > span { width: 36px; height: 36px; display: grid; place-items: center; border: 3px solid white; border-radius: 12px; color: white; background: var(--navy-900); box-shadow: 0 6px 15px rgba(15,30,52,.32); font-size: 1.05rem; font-weight: 900; }
.map-popup { min-width: 190px; }
.map-popup strong { display: block; font-size: .9rem; margin-bottom: 3px; }
.map-popup small { color: var(--muted); }
.popup-source { display: inline-flex; margin-top: 7px; color: var(--primary); font-size: .67rem; font-weight: 800; text-decoration: none; }
.popup-source:hover { text-decoration: underline; }
.popup-actions { display: flex; gap: 6px; margin-top: 11px; }
.popup-actions button { border: 0; border-radius: 7px; padding: 6px 8px; background: #edf2ff; color: var(--primary); font-size: .68rem; font-weight: 800; }

.route-panel { overflow: hidden; display: flex; flex-direction: column; }
.panel-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 4px 0 0; font-size: .99rem; letter-spacing: -.02em; }
.result-count { color: var(--muted); font-size: .69rem; white-space: nowrap; }
.customer-card-list { flex: 1; min-height: 0; overflow: auto; padding: 8px; }
.customer-card { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; border-radius: 12px; padding: 11px 10px; transition: background .15s; }
.customer-card:hover { background: #f5f8fc; }
.customer-card + .customer-card { border-top: 1px solid #f0f3f7; }
.priority-star { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--region-color); background: color-mix(in srgb, var(--region-color) 10%, white); font-size: 1.05rem; }
.customer-card-copy { min-width: 0; }
.customer-card-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .79rem; }
.customer-card-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; color: var(--muted); font-size: .66rem; }
.card-actions { display: flex; align-items: center; gap: 3px; opacity: 0; transition: opacity .15s; }
.customer-card:hover .card-actions { opacity: 1; }
.mini-action { width: 27px; height: 27px; border: 0; border-radius: 7px; color: var(--primary); background: #eaf0ff; font-weight: 900; }
.mini-action.done { color: var(--green); background: #e8f8f0; }
.route-plan-summary { display: grid; gap: 5px; margin: 5px 4px 8px; padding: 13px; border-radius: 12px; color: white; background: var(--navy-900); }
.route-plan-summary strong { font-size: .78rem; }
.route-plan-summary small { color: #b9c8da; font-size: .64rem; }
.route-plan-summary .btn { justify-self: start; margin-top: 5px; border-color: rgba(255,255,255,.2); color: white; background: rgba(255,255,255,.10); }
.route-stop-item { position: relative; display: grid; grid-template-columns: 31px 1fr; align-items: center; gap: 10px; padding: 10px 7px; }
.route-stop-item + .route-stop-item { border-top: 1px solid #edf0f4; }
.route-stop-item > span { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid white; border-radius: 9px; color: white; background: var(--stop-color, var(--primary)); box-shadow: 0 3px 9px rgba(20,35,58,.18); font-size: .67rem; font-weight: 900; }
.route-stop-item.is-origin > span { color: var(--navy-900); background: #e8eef6; box-shadow: none; }
.route-stop-item button { min-width: 0; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; }
.route-stop-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.route-stop-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; color: var(--muted); font-size: .62rem; }

.content-card { overflow: hidden; }
.section-toolbar { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section-toolbar .btn { margin-left: auto; }
.section-toolbar select { width: 180px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
th { color: #8590a1; background: #fbfcfe; font-size: .65rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: .77rem; }
tbody tr:hover { background: #fafcff; }
.table-primary { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.table-primary strong { display: block; font-size: .78rem; }
.table-primary small { display: block; margin-top: 3px; color: var(--muted); font-size: .66rem; }
.table-district { display: block; margin-top: 3px; color: #8490a1; font-size: .62rem; }
.table-star { font-size: 1rem; color: var(--amber); letter-spacing: -2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 4px 8px; background: #edf2ff; color: var(--primary); font-size: .65rem; font-weight: 800; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-completed { background: #e9f8f1; color: #118357; }
.badge-potential, .badge-planned { background: #fff5df; color: #b67600; }
.badge-passive, .badge-cancelled { background: #f0f2f5; color: #737f90; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.table-action { border: 0; border-radius: 7px; padding: 6px 8px; color: var(--primary); background: #edf2ff; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.table-action.neutral { color: #58667a; background: #f0f3f7; }
.table-action.danger { color: #c93948; background: #fff0f1; }
.empty-state { display: grid; place-items: center; min-height: 230px; padding: 30px; color: var(--muted); text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 16px; background: #edf2ff; color: var(--primary); font-size: 1.4rem; }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 5px; }

.visit-columns { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 15px; }
.timeline-list { max-height: calc(100vh - 190px); overflow: auto; }
.timeline-item { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #edf0f4; }
.timeline-date { width: 44px; height: 48px; display: grid; place-items: center; align-content: center; border-radius: 11px; background: #eef2ff; color: var(--primary); }
.timeline-date strong { font-size: 1rem; line-height: 1; }
.timeline-date small { margin-top: 3px; font-size: .55rem; font-weight: 850; text-transform: uppercase; }
.timeline-copy strong { display: block; font-size: .81rem; }
.timeline-copy p { margin: 5px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.45; }
.timeline-meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 99px; color: var(--type-color); background: color-mix(in srgb, var(--type-color) 10%, white); font-size: .61rem; font-weight: 800; }
.timeline-actions { display: grid; align-content: start; gap: 5px; }

.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.admin-wide { grid-column: 1 / -1; }
.panel-heading-actions { display: flex; align-items: center; gap: 7px; }
.settings-list { padding: 6px 14px 14px; }
.setting-row { display: grid; grid-template-columns: 13px 1fr auto; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid #edf0f4; }
.setting-row:last-child { border-bottom: 0; }
.setting-color { width: 11px; height: 11px; border-radius: 4px; }
.setting-copy strong { display: block; font-size: .76rem; }
.setting-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .63rem; }

.profile-layout { max-width: 860px; margin: 15px auto; display: grid; grid-template-columns: 270px 1fr; gap: 15px; }
.profile-identity { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.avatar-xl { width: 78px; height: 78px; border-radius: 23px; font-size: 1.6rem; }
.profile-identity h3 { margin: 18px 0 4px; }
.profile-identity p { color: var(--muted); font-size: .8rem; margin: 0 0 14px; }
.password-card { padding-bottom: 20px; }
.password-card form { padding: 20px; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 5px; }

.modal-backdrop { position: fixed; z-index: 3000; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(5,15,28,.63); backdrop-filter: blur(4px); }
.modal { width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 20px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.3); animation: modalIn .18s ease both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-header { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 19px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.modal-header h2 { margin: 4px 0 0; font-size: 1.15rem; }
.modal-body { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card span { min-height: 54px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; font-size: .75rem; font-weight: 800; text-align: center; }
.choice-card input:checked + span { border-color: var(--primary); color: var(--primary); background: #eef2ff; box-shadow: 0 0 0 3px rgba(49,94,251,.08); }
.mini-map { height: 240px; border: 1px solid var(--line); border-radius: 13px; background: #e1e8ed; overflow: hidden; }
.map-help { margin: 7px 0 0; color: var(--muted); font-size: .68rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.checkbox-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 3px 0; }
.check-option { display: flex; align-items: center; grid-template-columns: auto 1fr; gap: 8px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: .72rem; }
.check-option input { width: 16px; min-height: 16px; }
.inline-check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.inline-check input { width: 18px; min-height: 18px; }
.route-planner-form { display: grid; gap: 14px; }
.route-origin-card { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; padding: 14px; border: 1px solid #dbe4ef; border-radius: 13px; background: #f6f9fc; }
.route-origin-symbol { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--navy-900); font-size: 1.1rem; }
.route-origin-card > span:last-child { display: grid; gap: 3px; }
.route-origin-card small { color: #76859a; font-size: .58rem; font-weight: 850; letter-spacing: .08em; }
.route-origin-card strong { font-size: .79rem; }
.route-origin-card em { color: var(--muted); font-size: .66rem; font-style: normal; }
.route-planner-help { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.route-quick-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.route-quick-actions button { border: 0; border-radius: 7px; padding: 6px 8px; color: var(--primary); background: #edf2ff; font: inherit; font-weight: 800; cursor: pointer; }
.route-region-groups { display: grid; gap: 10px; }
.route-region-group { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.route-region-heading { display: block; padding: 10px 12px; background: #f8fafc; cursor: pointer; }
.route-region-heading > input { position: absolute; opacity: 0; pointer-events: none; }
.route-region-heading > span { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; }
.route-region-heading i { width: 9px; height: 9px; border-radius: 3px; background: var(--route-region-color); }
.route-region-heading strong { font-size: .74rem; }
.route-region-heading small { color: var(--muted); font-size: .61rem; }
.route-region-heading:has(input:checked), .route-region-heading:has(input:indeterminate) { color: color-mix(in srgb, var(--route-region-color) 75%, #15243a); background: color-mix(in srgb, var(--route-region-color) 8%, white); }
.route-district-customer-list { display: grid; gap: 8px; padding: 10px; }
.route-district-block { overflow: hidden; border: 1px solid #e4e9f0; border-radius: 10px; background: #fbfcfe; }
.route-district-option { cursor: pointer; }
.route-district-option input { position: absolute; opacity: 0; pointer-events: none; }
.route-district-option span { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 8px; border: 1px solid #e0e6ee; border-radius: 8px; color: #57667a; background: white; font-size: .65rem; }
.route-district-heading span { border: 0; border-radius: 0; background: #f7f9fc; font-weight: 850; }
.route-district-option b { min-width: 17px; padding: 2px 4px; border-radius: 99px; color: #718096; background: #edf1f5; font-size: .53rem; text-align: center; }
.route-district-option input:checked + span, .route-district-option:has(input:indeterminate) span { color: color-mix(in srgb, var(--route-region-color) 78%, #15243a); background: color-mix(in srgb, var(--route-region-color) 8%, white); }
.route-district-option input:checked + span b { color: white; background: var(--route-region-color); }
.route-customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px; }
.route-customer-option { cursor: pointer; }
.route-customer-option input { position: absolute; opacity: 0; pointer-events: none; }
.route-customer-option > span { min-height: 48px; display: grid; align-content: center; gap: 3px; padding: 8px 9px; border: 1px solid #e1e7ef; border-radius: 8px; background: white; }
.route-customer-option strong { overflow: hidden; color: #435066; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.route-customer-option small { color: var(--muted); font-size: .57rem; }
.route-customer-option input:checked + span { border-color: var(--route-region-color); background: color-mix(in srgb, var(--route-region-color) 8%, white); box-shadow: 0 0 0 2px color-mix(in srgb, var(--route-region-color) 10%, transparent); }
.route-customer-option input:checked + span strong { color: color-mix(in srgb, var(--route-region-color) 78%, #15243a); }
.route-empty-state { padding: 24px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; font-size: .72rem; }
.route-return-check { padding: 11px 13px; border-radius: 10px; background: #f6f8fb; font-size: .7rem; }
.route-planner-form .modal-footer { align-items: center; }
.route-selection-count { margin-right: auto; color: var(--muted); font-size: .68rem; font-weight: 750; }
.danger-zone { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); text-align: left; }

.toast-region { position: fixed; z-index: 5000; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { min-width: 290px; max-width: 390px; display: grid; grid-template-columns: 25px 1fr; align-items: center; gap: 9px; padding: 13px 15px; border-radius: 12px; color: white; background: var(--navy-900); box-shadow: var(--shadow); animation: toastIn .25s ease both; font-size: .78rem; }
.toast.success .toast-icon { color: #53dfa5; }
.toast.error .toast-icon { color: #ff8a95; }
@keyframes toastIn { from { opacity: 0; transform: translateY(9px); } }
.sidebar-overlay { display: none; }

@media (max-width: 1180px) {
    :root { --sidebar: 220px; }
    .main-content { padding-left: 22px; padding-right: 22px; }
    .map-workspace { grid-template-columns: minmax(0, 1fr) 290px; }
    .map-toolbar { grid-template-columns: 1fr 138px 138px 110px 42px; }
    .map-toolbar #mapStatusFilter { display: none; }
}

@media (max-width: 900px) {
    .auth-screen { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-panel { padding: 30px; }
    .mobile-brand { display: flex; }
    .app-shell { display: block; }
    .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 45px rgba(0,0,0,.2); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { position: fixed; z-index: 900; inset: 0; background: rgba(5,15,28,.5); }
    .sidebar-overlay.open { display: block; }
    .main-content { padding: 0 15px 28px; }
    .mobile-menu { display: inline-grid !important; }
    .topbar { min-height: 78px; }
    .topbar > div:nth-child(2) { flex: 1; }
    .topbar-kicker { display: none; }
    .topbar-actions .btn-secondary { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .map-workspace { display: block; height: auto; min-height: 0; }
    .map-panel { height: 570px; }
    .route-panel { margin-top: 15px; max-height: 480px; }
    .visit-columns, .admin-grid { grid-template-columns: 1fr; }
    .admin-wide { grid-column: auto; }
}

@media (max-width: 620px) {
    .topbar h2 { font-size: 1.15rem; }
    .topbar-actions .btn { min-width: 42px; padding: 10px; font-size: 0; }
    .topbar-actions .btn span { font-size: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .stat-card { min-height: 85px; padding: 13px; }
    .stat-value { font-size: 1.4rem; }
    .map-panel { height: 550px; }
    .map-toolbar { grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr) 42px; }
    .map-toolbar .search-box { grid-column: 1 / -1; }
    .map-toolbar #mapStatusFilter { display: none; }
    .map-toolbar .map-route-button { grid-column: 1 / 3; }
    .selected-region-card { top: 166px; min-width: 0; max-width: calc(100% - 28px); }
    .map-key { max-width: calc(100% - 28px); flex-wrap: wrap; }
    .section-toolbar { flex-wrap: wrap; }
    .section-toolbar .search-box { width: 100%; }
    .section-toolbar select { flex: 1; width: auto; }
    .section-toolbar .btn { margin-left: 0; }
    .profile-layout { grid-template-columns: 1fr; }
    .profile-identity { min-height: 220px; }
    .modal-backdrop { padding: 0; place-items: end stretch; }
    .modal { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
    .modal-body { padding: 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .choice-row { grid-template-columns: 1fr; }
    .route-planner-help { align-items: flex-start; flex-direction: column; }
    .route-customer-grid { grid-template-columns: 1fr; }
    .checkbox-list { grid-template-columns: 1fr; }
    .route-district-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toast-region { right: 12px; bottom: 12px; left: 12px; }
    .toast { min-width: 0; max-width: none; }
}

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

@media (hover: none) {
    .card-actions { opacity: 1; }
    .btn:hover { transform: none; }
}
