:root {
    --ink: #172033;
    --muted: #7b879d;
    --line: #e8edf3;
    --soft: #f5f8fa;
    --green: #08a879;
    --green-dark: #07855f;
    --green-soft: #e8fbf4;
    --blue: #5476f4;
    --orange: #f6a313;
    --shadow: 0 18px 50px rgba(23, 32, 51, .14);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f2f5f6; overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.boot-loader { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); background: #f8fbfa; }
.brand-mark { display: inline-grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 14px; color: #fff; font-size: 21px; font-weight: 800; background: linear-gradient(145deg, #09b782, #087d61); box-shadow: 0 10px 24px rgba(8, 168, 121, .25); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { font-size: 21px; letter-spacing: .02em; }

.auth-view { min-height: 100%; display: grid; grid-template-columns: minmax(500px, 1.15fr) minmax(390px, .85fr); background: #fff; }
.auth-visual { position: relative; display: flex; align-items: center; overflow: hidden; padding: 8vw; color: #fff; background: radial-gradient(circle at 18% 15%, rgba(54, 219, 161, .45), transparent 23%), linear-gradient(145deg, #075d4a 0%, #08835f 48%, #0a6b57 100%); }
.auth-visual::after { content: ""; position: absolute; right: -15%; bottom: -30%; width: 650px; height: 650px; border-radius: 50%; border: 1px solid rgba(255,255,255,.09); }
.auth-copy { position: relative; z-index: 3; max-width: 650px; transform: translateY(-62px); }
.auth-copy .brand-lockup { margin-bottom: 70px; }
.auth-copy .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; backdrop-filter: blur(12px); }
.auth-copy h1 { margin: 0 0 24px; font-size: clamp(40px, 4.2vw, 68px); line-height: 1.16; letter-spacing: -.04em; }
.auth-copy > p { max-width: 570px; margin: 0; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.8; }
.feature-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }
.feature-row span { padding: 10px 15px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(255,255,255,.85); font-size: 13px; background: rgba(255,255,255,.07); }
.auth-orbit { position: absolute; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; }
.orbit-one { width: 520px; height: 520px; right: -230px; top: -150px; }
.orbit-two { width: 280px; height: 280px; left: -140px; bottom: -80px; }
.demo-map-card { position: absolute; z-index: 2; right: 9%; bottom: 8%; width: 300px; height: 185px; border: 1px solid rgba(255,255,255,.18); border-radius: 24px; background: rgba(255,255,255,.12); box-shadow: 0 28px 55px rgba(0,0,0,.18); backdrop-filter: blur(16px); transform: rotate(-3deg); }
.demo-road { position: absolute; height: 3px; border-radius: 999px; background: rgba(255,255,255,.22); transform-origin: left center; }
.road-a { left: 24px; top: 70px; width: 245px; transform: rotate(14deg); }
.road-b { left: 88px; top: 19px; width: 150px; transform: rotate(67deg); }
.demo-pin { position: absolute; width: 17px; height: 17px; border: 4px solid rgba(255,255,255,.9); border-radius: 50%; background: #ffb41f; box-shadow: 0 0 0 6px rgba(255,180,31,.2); }
.demo-pin::after { content: ""; position: absolute; top: 13px; left: 2px; border: 4px solid transparent; border-top-color: rgba(255,255,255,.9); }
.p1 { left: 66px; top: 50px; }.p2 { right: 48px; top: 64px; }.p3 { left: 124px; bottom: 33px; }
.demo-customer { position: absolute; left: 84px; top: 33px; display: flex; flex-direction: column; gap: 3px; padding: 11px 16px; color: var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 10px 25px rgba(0,0,0,.15); }
.demo-customer small { color: var(--muted); }
.auth-panel { display: grid; place-items: center; padding: 48px; background: #fff; }
.auth-box { width: min(420px, 100%); }
.mobile-brand { display: none; }
.auth-tabs { display: flex; gap: 22px; margin-bottom: 42px; border-bottom: 1px solid var(--line); }
.auth-tab { position: relative; padding: 0 2px 15px; color: #98a2b2; font-size: 16px; font-weight: 700; border: 0; background: transparent; cursor: pointer; }
.auth-tab.active { color: var(--green-dark); }
.auth-tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--green); }
.auth-title h2 { margin: 0 0 10px; font-size: 32px; }
.auth-title p { margin: 0 0 34px; color: var(--muted); }
.field-label { display: block; margin: 18px 0 9px; color: #354052; font-size: 14px; font-weight: 650; }
.field-label i { color: #e45858; font-style: normal; }
.input-shell { display: flex; align-items: center; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: .2s ease; }
.input-shell:focus-within { border-color: rgba(8,168,121,.7); box-shadow: 0 0 0 4px rgba(8,168,121,.08); }
.input-icon { display: grid; width: 48px; place-items: center; color: #8b96a8; font-size: 12px; }
.input-shell input { width: 100%; height: 50px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.input-shell input::placeholder, .form-input::placeholder { color: #a6afbe; }
.text-button { margin: 0 14px; padding: 5px; color: var(--green-dark); font-size: 13px; border: 0; background: transparent; cursor: pointer; }
.primary-button, .secondary-button, .danger-button, .danger-filled-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 11px; font-weight: 700; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.primary-button { color: #fff; border: 1px solid var(--green); background: linear-gradient(135deg, #0bb681, #07976c); box-shadow: 0 10px 20px rgba(8,168,121,.18); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 24px rgba(8,168,121,.25); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-button { color: #4c596c; border: 1px solid #dfe5eb; background: #fff; box-shadow: none; }
.secondary-button:hover { background: #f6f8fa; }
.danger-button { color: #da5353; border: 1px solid #f0cece; background: #fff7f7; }
.danger-filled-button { color: #fff; border: 1px solid #de5555; background: #de5555; }
.auth-submit { width: 100%; height: 52px; margin-top: 28px; }
.form-tip { margin: 20px 0 0; color: #96a0af; font-size: 13px; text-align: center; }

.app-view { position: fixed; inset: 0; display: flex; padding: 8px; background: #dfe5e7; }
.sidebar { position: relative; z-index: 500; width: 370px; flex: 0 0 370px; display: flex; flex-direction: column; overflow: hidden; border-radius: 16px 0 0 16px; background: rgba(255,255,255,.98); box-shadow: 8px 0 35px rgba(30,45,55,.08); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 18px; }
.app-brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
.app-brand strong { font-size: 20px; }
.sidebar-header p { margin: 10px 0 0 51px; color: var(--muted); font-size: 13px; }
.user-menu-wrap { position: relative; }
.avatar-button { width: 40px; height: 40px; color: var(--green-dark); font-weight: 800; border: 1px solid #c9eee2; border-radius: 50%; background: var(--green-soft); cursor: pointer; }
.user-menu { position: absolute; z-index: 20; top: 48px; right: 0; width: 180px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.user-menu b { display: block; padding: 7px 8px 12px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu button { width: 100%; padding: 10px; color: #d64f4f; text-align: left; border: 0; border-radius: 8px; background: #fff5f5; cursor: pointer; }
.sidebar-actions { padding: 0 22px 20px; }
.add-button { width: 100%; height: 50px; font-size: 15px; }
.add-button span { margin-right: 7px; font-size: 21px; line-height: 1; }
.search-shell { display: flex; align-items: center; height: 48px; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfc; }
.search-shell > span { width: 46px; color: #536075; font-size: 25px; text-align: center; transform: rotate(-15deg); }
.search-shell input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.clear-search { width: 36px; height: 36px; color: #8490a2; border: 0; background: transparent; cursor: pointer; }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 22px; padding: 18px 2px 12px; color: #667389; font-size: 13px; font-weight: 700; border-top: 1px solid var(--line); }
.count-badge { min-width: 28px; padding: 3px 7px; border-radius: 999px; color: #768399; text-align: center; background: #f0f3f6; }
.customer-list { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 0 10px 14px; }
.customer-card { display: grid; grid-template-columns: 43px minmax(0,1fr) 26px; align-items: center; gap: 10px; padding: 13px 12px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: .16s ease; }
.customer-card:hover, .customer-card.active { border-color: #d9eee7; background: #f3fbf8; }
.customer-avatar { display: grid; width: 42px; height: 42px; place-items: center; color: #c97800; font-weight: 750; border-radius: 50%; background: #fff0cc; }
.customer-card-main { min-width: 0; }
.customer-card-main b { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-main small { display: block; margin-top: 5px; overflow: hidden; color: #8a96a8; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.location-state { display: grid; width: 24px; height: 24px; place-items: center; color: var(--green); font-size: 11px; border-radius: 50%; background: var(--green-soft); }
.location-state.missing { color: #c58b20; background: #fff4d7; }
.empty-list { padding: 58px 30px; color: #8a95a5; text-align: center; }
.empty-illustration { display: grid; width: 70px; height: 70px; margin: 0 auto 16px; place-items: center; color: var(--green); font-size: 30px; border-radius: 24px; background: var(--green-soft); }
.empty-list b { display: block; margin-bottom: 8px; color: #4a5667; }
.empty-list p { margin: 0; font-size: 13px; line-height: 1.7; }
.sidebar-footnote { padding: 13px 18px; color: #788597; font-size: 12px; text-align: center; border-top: 1px solid var(--line); background: #fafcfc; }

.map-stage { position: relative; min-width: 0; flex: 1; overflow: hidden; border-radius: 0 16px 16px 0; }
#map { width: 100%; height: 100%; background: #e8eded; }
.amap-maps { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.customer-popup { padding: 19px; }
.amap-customer-popup { position: relative; width: 300px; border: 1px solid rgba(229,235,239,.95); border-radius: 17px; background: #fff; box-shadow: 0 14px 40px rgba(32,44,60,.22); }
.map-popup-close { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; width: 27px; height: 27px; place-items: center; padding: 0; color: #8994a5; font-size: 18px; line-height: 1; border: 0; border-radius: 8px; background: #f3f5f7; cursor: pointer; }
.amap-customer-popup .customer-popup-head { padding-right: 26px; }
.customer-popup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.customer-popup-head b { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.customer-popup-tag { flex: 0 0 auto; padding: 5px 9px; color: var(--green-dark); font-size: 11px; border-radius: 999px; background: var(--green-soft); }
.customer-popup-row { display: flex; gap: 10px; margin-top: 13px; color: #586579; font-size: 13px; line-height: 1.55; }
.customer-popup-row span { flex: 0 0 20px; color: var(--green-dark); text-align: center; }
.customer-popup-row a { color: #586579; text-decoration: none; }
.popup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.popup-actions button, .popup-actions a { display: flex; align-items: center; justify-content: center; min-height: 38px; color: #536176; font-size: 12px; font-weight: 700; text-decoration: none; border: 1px solid var(--line); border-radius: 9px; background: #f8fafb; cursor: pointer; }
.popup-actions .call-action { color: #fff; border-color: var(--green); background: var(--green); }
.customer-marker { display: flex; align-items: center; cursor: pointer; user-select: none; }
.customer-marker-dot { display: grid; width: 30px; height: 30px; place-items: center; border: 4px solid #fff; border-radius: 50%; background: #f5a414; box-shadow: 0 2px 5px rgba(72,55,15,.25), 0 0 0 5px rgba(245,164,20,.2); }
.customer-marker-label { max-width: 120px; margin-left: 5px; padding: 4px 8px; overflow: hidden; color: #b26d00; font-size: 11px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #e9b256; border-radius: 5px; background: rgba(255,255,255,.94); box-shadow: 0 2px 6px rgba(40,50,60,.09); }
.map-filter-card { position: absolute; z-index: 400; top: 20px; left: 50%; display: flex; gap: 4px; padding: 6px; border: 1px solid rgba(230,235,239,.9); border-radius: 16px; background: rgba(255,255,255,.92); box-shadow: 0 10px 26px rgba(29,44,57,.12); backdrop-filter: blur(12px); transform: translateX(-50%); }
.map-filter { min-height: 39px; padding: 0 16px; color: #687589; font-size: 13px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; }
.map-filter b { margin-left: 4px; color: #9aa4b2; font-size: 11px; }
.map-filter.active { color: #fff; background: #172033; }
.map-filter.active b { color: #ced4dd; }
.stats-row { position: absolute; z-index: 400; top: 20px; right: 20px; display: flex; gap: 10px; }
.stat-card { display: flex; align-items: center; gap: 11px; min-width: 126px; padding: 12px 15px; border: 1px solid rgba(230,235,239,.9); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 10px 26px rgba(29,44,57,.11); backdrop-filter: blur(12px); }
.stat-icon { display: grid; width: 38px; height: 38px; place-items: center; font-size: 12px; font-weight: 800; border-radius: 12px; }
.stat-card.green .stat-icon { color: var(--green-dark); background: var(--green-soft); }
.stat-card.blue .stat-icon { color: var(--blue); background: #eef1ff; }
.stat-card small { display: block; color: #8894a5; font-size: 10px; }
.stat-card b { display: block; margin-top: 2px; font-size: 19px; }
.map-control { position: absolute; z-index: 400; display: grid; width: 44px; height: 44px; place-items: center; color: #526074; font-size: 22px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.95); box-shadow: 0 8px 22px rgba(29,44,57,.14); cursor: pointer; }
.fit-button { right: 20px; bottom: 20px; }
.center-add-button { right: 20px; bottom: 74px; color: var(--green-dark); }
.mobile-menu-button { display: none; top: 18px; left: 18px; }

.modal { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17,29,40,.48); backdrop-filter: blur(4px); }
.modal-card { position: relative; z-index: 1; width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.customer-modal-card { padding: 25px 28px 28px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 23px; }
.modal-header p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.icon-button { width: 36px; height: 36px; color: #7a8798; font-size: 22px; border: 0; border-radius: 9px; background: #f3f5f7; cursor: pointer; }
.form-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.form-input { width: 100%; min-height: 46px; padding: 0 13px; color: var(--ink); border: 1px solid #dde4ea; border-radius: 10px; outline: 0; background: #fff; transition: .2s ease; }
.form-input:focus { border-color: rgba(8,168,121,.7); box-shadow: 0 0 0 4px rgba(8,168,121,.08); }
.form-textarea { min-height: 76px; padding-top: 12px; resize: vertical; }
.address-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.address-row .secondary-button { min-height: 46px; }
.geocode-results { max-height: 155px; margin-top: 8px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 10px 24px rgba(28,40,54,.1); }
.geocode-result { display: block; width: 100%; padding: 11px 13px; color: #4e5c70; font-size: 12px; line-height: 1.5; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; }
.geocode-result:last-child { border-bottom: 0; }
.geocode-result:hover { color: var(--green-dark); background: #f2fbf8; }
.picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 18px 0 9px; font-size: 14px; font-weight: 650; }
.picker-heading small { color: #8a95a5; font-size: 11px; font-weight: 400; }
.picker-map { height: 235px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #eef2f2; }
.picker-marker { width: 26px; height: 26px; border: 4px solid #fff; border-radius: 50% 50% 50% 4px; background: var(--green); box-shadow: 0 3px 8px rgba(10,90,67,.3); transform: rotate(-45deg); }
.modal-footer { display: flex; align-items: center; gap: 10px; margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal-footer-spacer { flex: 1; }
.confirm-card { width: min(390px, 100%); padding: 30px; text-align: center; }
.confirm-icon { display: grid; width: 55px; height: 55px; margin: 0 auto 17px; place-items: center; color: #d64f4f; font-size: 25px; font-weight: 800; border-radius: 50%; background: #fff0f0; }
.confirm-card h3 { margin: 0; font-size: 20px; }
.confirm-card p { margin: 12px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 3000; left: 50%; bottom: 30px; max-width: calc(100vw - 32px); padding: 13px 18px; color: #fff; font-size: 13px; border-radius: 10px; background: #253044; box-shadow: 0 10px 30px rgba(20,30,40,.24); transform: translateX(-50%); }
.toast.success { background: #087f5d; }.toast.error { background: #c84f4f; }
.sidebar-backdrop { display: none; }

@media (max-width: 1120px) {
    .stats-row .stat-card { min-width: auto; }
    .stat-card { padding: 10px; }
    .stat-card div { display: none; }
    .map-filter-card { left: auto; right: 78px; transform: none; }
    .map-filter { padding: 0 11px; }
}

@media (max-width: 820px) {
    .auth-view { display: block; overflow-y: auto; background: linear-gradient(160deg, #effbf7, #fff 40%); }
    .auth-visual { display: none; }
    .auth-panel { min-height: 100%; padding: 28px 22px; background: transparent; }
    .mobile-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 42px; font-size: 20px; }
    .app-view { padding: 0; }
    .sidebar { position: absolute; inset: 0 auto 0 0; width: min(88vw, 370px); border-radius: 0; transform: translateX(-105%); transition: transform .24s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: absolute; z-index: 450; inset: 0; display: block; background: rgba(19,29,38,.35); }
    .map-stage { border-radius: 0; }
    .mobile-menu-button { display: grid; }
    .map-filter-card { top: 18px; right: 15px; }
    .map-filter { padding: 0 10px; }
    .map-filter b { display: none; }
    .stats-row { top: 73px; right: 15px; }
    .stat-card { display: none; }
    .center-add-button, .fit-button { right: 15px; }
    .fit-button { bottom: 18px; }
    .center-add-button { bottom: 72px; }
    .modal { align-items: end; padding: 0; }
    .customer-modal-card { width: 100%; max-height: 94vh; padding: 22px 18px 20px; border-radius: 20px 20px 0 0; }
}

@media (max-width: 520px) {
    .two-columns { grid-template-columns: 1fr; gap: 0; }
    .address-row { grid-template-columns: 1fr; }
    .picker-map { height: 205px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .primary-button, .modal-footer .secondary-button { flex: 1; }
    .danger-button { order: 4; width: 100%; }
    .map-filter-card { left: 68px; right: 12px; justify-content: stretch; }
    .map-filter { flex: 1; padding: 0 4px; }
}
