:root {
  /* Giao diện SÁNG (mặc định) */
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --border: #dce3df;
  --text: #0f1714;
  --muted: #5b6962;
  --accent: #059669;
  --accent-ink: #ffffff;
  --accent-soft: rgba(5, 150, 105, .10);
  --accent-line: rgba(5, 150, 105, .35);
  --orange: #ea580c;
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, .08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .07);
  --danger-line: rgba(220, 38, 38, .35);
  --topbar-bg: rgba(255, 255, 255, .9);
  --tabbar-bg: rgba(255, 255, 255, .96);
  --shadow-lg: 0 24px 60px rgba(15, 23, 20, .12);
  --card-a: #ffffff;
  --card-b: #fbfcfb;
  --hl-a: #059669;
  --hl-b: #10b981;
  --art-bg: #e4ede8; --art-st: #d0dcd5; --art-st2: #d9e3de; --art-ring: #cbd8d1;
  --art-road: #bfcbc4; --art-road2: #d0dad5; --art-card: #ffffff; --art-card-line: #dce3df;
  --art-text: #0f1714; --art-muted: #5b6962;
  color-scheme: light;
  --radius: 16px;
}
/* Giao diện TỐI: theo thiết bị (khi người dùng không tự chọn) hoặc khi chọn "Tối" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0b0d0c;
  --surface: #131715;
  --surface-2: #1a1f1c;
  --border: #262c29;
  --text: #ecf1ee;
  --muted: #95a29b;
  --accent: #34d399;
  --accent-ink: #052e1f;
  --accent-soft: rgba(52, 211, 153, .12);
  --accent-line: rgba(52, 211, 153, .3);
  --orange: #f97316;
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .07);
  --danger: #fca5a5;
  --danger-soft: rgba(248, 113, 113, .08);
  --danger-line: rgba(248, 113, 113, .4);
  --topbar-bg: rgba(11, 13, 12, .88);
  --tabbar-bg: rgba(19, 23, 21, .96);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .45);
  --card-a: rgba(26, 31, 28, .92);
  --card-b: rgba(19, 23, 21, .96);
  --hl-a: #34d399;
  --hl-b: #6ee7b7;
  --art-bg: #101613; --art-st: #1d2823; --art-st2: #18211d; --art-ring: #24302a;
  --art-road: #2a3530; --art-road2: #1d2622; --art-card: #131715; --art-card-line: #2f3b35;
  --art-text: #ecf1ee; --art-muted: #95a29b;
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d0c;
  --surface: #131715;
  --surface-2: #1a1f1c;
  --border: #262c29;
  --text: #ecf1ee;
  --muted: #95a29b;
  --accent: #34d399;
  --accent-ink: #052e1f;
  --accent-soft: rgba(52, 211, 153, .12);
  --accent-line: rgba(52, 211, 153, .3);
  --orange: #f97316;
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .07);
  --danger: #fca5a5;
  --danger-soft: rgba(248, 113, 113, .08);
  --danger-line: rgba(248, 113, 113, .4);
  --topbar-bg: rgba(11, 13, 12, .88);
  --tabbar-bg: rgba(19, 23, 21, .96);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .45);
  --card-a: rgba(26, 31, 28, .92);
  --card-b: rgba(19, 23, 21, .96);
  --hl-a: #34d399;
  --hl-b: #6ee7b7;
  --art-bg: #101613; --art-st: #1d2823; --art-st2: #18211d; --art-ring: #24302a;
  --art-road: #2a3530; --art-road2: #1d2622; --art-card: #131715; --art-card-line: #2f3b35;
  --art-text: #ecf1ee; --art-muted: #95a29b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: clip; background: var(--bg); color: var(--text);
  font: 16px/1.6 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ico { width: 1.25em; height: 1.25em; flex: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right)); }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 1000; background: var(--topbar-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.logo-mark { flex: none; display: block; }
.logo:hover { text-decoration: none; }
.logo .ico { color: var(--orange); width: 1.5em; height: 1.5em; }
.logo b { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 8px 10px; border-radius: 10px; font-size: .92rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.back-btn, .tabbar, .sheet-handle { display: none; }
.vcard .stats small { display: block; font-size: .68rem; color: var(--muted); }

/* ---------- Layout blocks ---------- */
main { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tool { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 20px; align-items: start; margin: 20px 0; }
@media (max-width: 860px) { .tool { grid-template-columns: minmax(0, 1fr); } }
.tool .result { position: sticky; top: 80px; }

/* ---------- Hero ---------- */
.hero { padding: 24px 0 8px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 2px 10px; border-radius: 99px; margin-bottom: 12px; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

.feature { display: block; color: var(--text); transition: border-color .15s, transform .15s; }
.feature:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.feature .ico { color: var(--accent); width: 28px; height: 28px; margin-bottom: 10px; }
.feature h3 { margin-bottom: 4px; }
.feature p { color: var(--muted); margin: 0; font-size: .92rem; }

/* ---------- Form ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.field input[type=number], .field select {
  width: 100%; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; font: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.range-val { float: right; color: var(--accent); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 4px 12px; font-size: .8rem; cursor: pointer; font: inherit; font-size: .8rem; }
.chip:hover, .chip.on { color: var(--accent); border-color: var(--accent); }
.seg { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg label { flex: 1; text-align: center; padding: 8px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* ---------- Result ---------- */
.result .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.big { font-size: clamp(1.9rem, 5vw, 2.5rem); font-weight: 800; color: var(--accent); line-height: 1.15; margin: 4px 0 16px; font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: .95rem; }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.note { font-size: .8rem; color: var(--muted); margin-top: 14px; }
.bars { margin-top: 16px; display: grid; gap: 10px; }
.bar { font-size: .85rem; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .25s; }
.bar-fill.alt { background: var(--orange); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: var(--surface); }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }

/* ---------- Content ---------- */
.prose { max-width: 760px; }
.prose li { margin-bottom: .4em; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; max-width: 760px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }
.notice { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .88rem; color: var(--muted); margin: 16px 0; }

.vcard { display: block; color: var(--text); }
.vcard:hover { border-color: var(--accent); text-decoration: none; }
.vcard .brand { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.vcard h3 { margin: 2px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats div { font-size: .75rem; color: var(--muted); }
.stats b { display: block; color: var(--text); font-size: 1rem; }

/* ---------- Map ---------- */
#map { height: min(70vh, 620px); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.map-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 12px; }
#map-status { color: var(--muted); font-size: .9rem; }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 48px 0 0; margin-top: 56px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px 40px; padding-bottom: 40px; align-items: start; }
.footer-brand p { max-width: 320px; margin-top: 14px; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.footer-col { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.footer-col h4 { margin: 4px 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text); }
.footer-col a { color: var(--muted); font-size: .92rem; line-height: 1.35; text-decoration: none; width: fit-content; transition: color .15s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 24px; padding: 20px 0 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
@media (max-width: 1024px) and (min-width: 861px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- Bộ lọc danh sách xe ---------- */
.filter-bar { margin: 16px 0 18px; display: grid; gap: 10px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 14px; }
.search .ico { color: var(--muted); }
.search input { flex: 1; background: none; border: 0; color: var(--text); font: inherit; padding: 12px 0; outline: none; min-width: 0; }
.search:focus-within { border-color: var(--accent); }
.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chip { white-space: nowrap; flex: none; }
.vcard[hidden] { display: none; }

/* ---------- Thanh kết quả nổi (mobile) ---------- */
.result-dock { display: none; }

/* =========================================================
   GIAO DIỆN ỨNG DỤNG TRÊN ĐIỆN THOẠI
   ========================================================= */
@media (max-width: 860px) {
  html { -webkit-tap-highlight-color: transparent; }
  body { overscroll-behavior-y: none; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  a, button, .chip, .card { touch-action: manipulation; }

  /* Header gọn kiểu app */
  /* không dùng backdrop-filter: nó biến header thành khung chứa của menu position:fixed */
  .topbar { padding-top: env(safe-area-inset-top); background: var(--topbar-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar-in { min-height: 52px; gap: 6px; }
  .logo { font-size: 1.05rem; }
  .back-btn { display: grid; place-items: center; width: 38px; height: 38px; margin-left: -8px; border-radius: 12px; color: var(--text); }
  .back-btn:active { background: var(--surface-2); }
  .back-btn .ico { width: 24px; height: 24px; }

  /* Menu "Thêm" dạng bottom sheet */
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300; flex-direction: column; gap: 2px; margin: 0;
         background: var(--surface); border-top: 1px solid var(--border); border-radius: 22px 22px 0 0;
         padding: 10px 12px calc(84px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
  .nav.open { transform: none; }
  .nav a { padding: 14px 16px; font-size: 1rem; color: var(--text); border-radius: 14px; }
  .nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
  .sheet-handle { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 8px; }
  .backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.55); }
  .backdrop[hidden] { display: none; }

  /* Thanh tab dưới cùng */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400;
            background: var(--tabbar-bg); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; background: none; border: 0;
            color: var(--muted); font: inherit; font-size: .68rem; font-weight: 600; cursor: pointer; border-radius: 12px; }
  .tabbar .ico { width: 24px; height: 24px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar [aria-current], .tabbar [aria-expanded="true"] { color: var(--accent); }
  .tabbar a:active, .tabbar button:active { transform: scale(.94); }

  /* Nội dung */
  main { padding-top: 14px; padding-bottom: 24px; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.15rem; margin-top: 1.4em; }
  .lead { font-size: .97rem; }
  .crumbs { display: none; }
  .hero { padding-top: 6px; }
  .card { padding: 16px; border-radius: 18px; }
  a.card:active { transform: scale(.985); }
  .tool { margin: 14px 0; gap: 12px; }
  .tool .result { position: static; }
  .big { font-size: 2rem; margin-bottom: 10px; }
  .grid { gap: 10px; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .feature { display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-items: start; }
  .feature .ico { grid-row: span 2; width: 40px; height: 40px; padding: 9px; margin: 0; border-radius: 12px; background: var(--accent-soft); }
  .feature .badge { grid-column: 1 / -1; justify-self: start; }
  .feature:hover { transform: none; }
  .chips { gap: 8px; }
  .chip { padding: 7px 14px; }
  .field input[type=number], .field select { padding: 13px 14px; border-radius: 14px; }
  .btn { padding: 13px 18px; border-radius: 14px; justify-content: center; }
  .result .btn.ghost { width: 100%; margin-top: 4px; }
  .filter-bar { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 900; background: var(--bg); margin: 8px -16px 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
  #map { height: calc(100dvh - 300px); min-height: 360px; border-radius: 18px; }
  .map-bar .btn { flex: 1; }
  .faq details { padding: 14px 0; }
  .footer { padding: 28px 0 0; margin-top: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 16px; padding-bottom: 24px; }
  .footer-brand, .footer-col.wide { grid-column: 1 / -1; }
  .footer-col.wide { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 16px; }
  .footer-col.wide h4 { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; padding-bottom: 8px; }
  table { font-size: .88rem; }

  /* Kết quả nổi khi kéo xuống nhập liệu */
  .result-dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; z-index: 1350;
                 left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom));
                 background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 12px 16px;
                 box-shadow: var(--shadow-lg); transform: translateY(160%); transition: transform .25s ease; cursor: pointer; }
  .result-dock.show { transform: none; }
  .result-dock span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
  .result-dock b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
}

/* Khi mở dạng ứng dụng (đã cài lên màn hình chính) */
@media (display-mode: standalone) and (max-width: 860px) {
  .footer { display: none; }
}

/* =========================================================
   ĐĂNG NHẬP / ĐĂNG KÝ / TÀI KHOẢN
   ========================================================= */
.auth-wrap { position: relative; min-height: calc(100dvh - 220px); display: grid; place-items: center; padding: 24px 0 40px; isolation: isolate; }
.auth-wrap::before { content: ""; position: absolute; inset: -40px -16px auto; height: 420px; z-index: -1; pointer-events: none;
  background: radial-gradient(420px 260px at 50% 30%, rgba(52,211,153,.16), transparent 70%),
              radial-gradient(260px 200px at 72% 10%, rgba(249,115,22,.10), transparent 70%); }
.auth-card { width: 100%; max-width: 420px; background: linear-gradient(180deg, var(--card-a), var(--card-b));
  border: 1px solid var(--border); border-radius: 24px; padding: 32px 28px 26px; box-shadow: var(--shadow-lg); }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 18px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: 0 0 0 6px rgba(249,115,22,.06), 0 8px 24px rgba(249,115,22,.18); }
.auth-logo .ico { width: 30px; height: 30px; color: var(--orange); }
.auth-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: .93rem; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }
.input-icon { position: relative; display: block; }
.input-icon > .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.input-icon input { width: 100%; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 44px 13px 42px; font: inherit; transition: border-color .15s, box-shadow .15s; }
.input-icon input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-icon input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--bg) inset; -webkit-text-fill-color: var(--text); }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none;
  color: var(--muted); border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle .ico { width: 18px; height: 18px; }
.pw-meter { height: 4px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .2s, background .2s; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 18px; font-size: .88rem; }
.auth-row label { display: flex; gap: 8px; align-items: center; color: var(--muted); cursor: pointer; }
.auth-row input[type=checkbox], .check input { accent-color: var(--accent); width: 16px; height: 16px; }
.btn.block { width: 100%; justify-content: center; padding: 14px 18px; font-size: 1rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.auth-alt { text-align: center; color: var(--muted); font-size: .92rem; margin: 20px 0 0; }
.auth-alt a { font-weight: 600; }
.auth-terms { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 14px; }
.auth-perks { display: grid; gap: 10px; margin: 0 0 22px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 16px; font-size: .88rem; color: var(--muted); }
.auth-perks div { display: flex; gap: 10px; align-items: center; }
.auth-perks .ico { color: var(--accent); width: 18px; height: 18px; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 11px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 16px; border: 1px solid; }
.alert.err { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert.ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* Nút tài khoản trên header */
.acct-btn { margin-left: 12px; display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: .92rem;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px; white-space: nowrap; }
.acct-btn:hover { text-decoration: none; border-color: var(--accent); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: linear-gradient(135deg, var(--accent), #10b981); color: var(--accent-ink); flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.6rem; }
.acct-btn.has-user { padding: 3px 12px 3px 3px; }

/* Trang tài khoản */
.profile-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 20px; }
.profile-head h1 { margin: 0; font-size: 1.5rem; }
.saved-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.saved-item .ico { color: var(--accent); width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--accent-soft); }
.saved-item .meta { flex: 1; min-width: 0; }
.saved-item .meta a { color: var(--text); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item .meta small { color: var(--muted); }
.saved-item .res { font-weight: 700; color: var(--accent); white-space: nowrap; }
.icon-btn { background: none; border: 0; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--danger); background: var(--danger-soft); }
.danger-zone { border-color: var(--danger-line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger-line); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.result-actions .btn { flex: 1; justify-content: center; }

@media (max-width: 860px) {
  .acct-btn { margin-left: auto; padding: 5px 10px; font-size: .85rem; }
  .acct-btn.has-user { padding: 3px; border: 0; }
  .acct-btn.has-user span { display: none; }
  .auth-wrap { min-height: auto; padding-top: 8px; }
  .auth-card { padding: 26px 20px 22px; border-radius: 22px; }
}

/* =========================================================
   TRANG CHỦ – HERO & HÌNH MINH HỌA
   ========================================================= */
.hero2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 32px; align-items: center; padding: 20px 0 8px; }
.hero2 h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; margin-bottom: 16px; }
.hero2 h1 .hl { background: linear-gradient(90deg, var(--hl-a), var(--hl-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero2 .lead { font-size: 1.08rem; margin-bottom: 24px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-cta .btn { padding: 13px 20px; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-stats div { font-size: .82rem; color: var(--muted); }
.hero-stats b { display: block; font-size: 1.45rem; color: var(--text); font-weight: 800; letter-spacing: -.02em; }
.hero-art { width: 100%; height: auto; display: block; }
.hero-art text { font-family: "Be Vietnam Pro", system-ui, sans-serif; }

.promo { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: center; overflow: hidden; position: relative; }
.promo::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.promo h2 { margin-top: 0; font-size: 1.5rem; }
.promo p { color: var(--muted); }
.map-art { width: 100%; height: auto; display: block; border-radius: 18px; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; display: block; }

.install-card { display: flex; gap: 18px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), rgba(249,115,22,.06)); }
.install-card img { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.install-card h3 { margin: 0 0 4px; }
.install-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.install-card .btn { margin-left: auto; flex: none; }

@media (max-width: 860px) {
  .hero2 { grid-template-columns: minmax(0, 1fr); gap: 6px; padding-top: 0; }
  .hero2 .art { order: -1; margin: -6px -10px 0; }
  .hero2 h1 { font-size: 2rem; }
  .hero-cta .btn { flex: 1; white-space: nowrap; padding: 13px 10px; font-size: .95rem; }
  .hero2 h1 { font-size: 1.9rem; }
  .hero-stats { gap: 0; justify-content: space-between; }
  .promo { grid-template-columns: minmax(0, 1fr); }
  .promo .map-art { order: -1; }
  .install-card { flex-wrap: wrap; }
  .install-card .btn { margin-left: 0; width: 100%; }
}

/* =========================================================
   TRANG BỘ NHẬN DIỆN
   ========================================================= */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.brand-tile { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: var(--surface); }
.brand-tile .stage { height: 170px; display: grid; place-items: center; padding: 24px; }
.brand-tile .stage img { max-width: 100%; max-height: 100%; }
.brand-tile .stage.light { background: #f6f7f6; }
.brand-tile .stage.dark { background: #0b0d0c; }
.brand-tile .stage.green { background: #059669; }
.brand-tile .cap { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .88rem; }
.brand-tile .cap a { font-weight: 600; white-space: nowrap; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.swatch { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.swatch .chip-color { height: 90px; }
.swatch > div:last-child { padding: 10px 14px; font-size: .85rem; background: var(--surface); }
.swatch b { display: block; }
.type-sample { font-size: clamp(2.4rem, 7vw, 4.5rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.dodont { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.dodont .card h3 { display: flex; gap: 8px; align-items: center; }

.tools-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 860px) { .tools-grid { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================
   NÚT ĐỔI GIAO DIỆN SÁNG / TỐI
   ========================================================= */
.theme-btn { margin-left: 8px; width: 38px; height: 38px; border-radius: 99px; border: 1px solid var(--border); background: transparent;
  color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-btn .ico { width: 18px; height: 18px; }
.theme-btn [data-ic] { display: none; }
.theme-btn[data-mode="auto"] [data-ic="auto"], .theme-btn[data-mode="light"] [data-ic="light"], .theme-btn[data-mode="dark"] [data-ic="dark"] { display: grid; }
@media (max-width: 860px) { .theme-btn { margin-left: 6px; width: 34px; height: 34px; } .acct-btn + .theme-btn, .theme-btn { order: 3; } }

/* Ô nhập chung (text, email, tel…) */
.field > input.input, .field > input[type=text], .field > input[type=email], .field > input[type=tel], .field > input[type=search] {
  width: 100%; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; font: inherit; }
.field > input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* Hình minh họa đổi màu theo giao diện */
.hero-art .a-bg, .map-art .a-bg { fill: var(--art-bg); }
.hero-art .a-st, .map-art .a-st { stroke: var(--art-st); }
.hero-art .a-st2 { stroke: var(--art-st2); }
.hero-art .a-ring { stroke: var(--art-ring); }
.hero-art .a-road { stroke: var(--art-road); }
.hero-art .a-road2 { stroke: var(--art-road2); }
.hero-art .a-card { fill: var(--art-card); stroke: var(--art-card-line); }
.hero-art .a-text { fill: var(--art-text); }
.hero-art .a-muted { fill: var(--art-muted); }
.hero-art .a-mutedline { stroke: var(--art-muted); }

/* =========================================================
   BẢN ĐỒ TRẠM SẠC
   ========================================================= */
.map-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.map-head .lead { margin: 0; }
.map-shell { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 14px; align-items: stretch; }
.map-side { display: flex; flex-direction: column; min-height: 0; height: min(76vh, 720px); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.map-side .chips.scroll-x { margin: 10px 0 0; padding: 2px 0; }
.map-side .field select { padding: 9px 12px; font-size: .9rem; }
.map-tools { display: flex; gap: 8px; }
.map-tools .btn { flex: 1; justify-content: center; padding: 10px 12px; }
.map-count { font-size: .82rem; color: var(--muted); margin: 10px 2px 6px; }
.station-list { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.st-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--border);
  padding: 11px 4px; color: var(--text); font: inherit; cursor: pointer; border-radius: 0; }
.st-item:hover { background: var(--surface-2); }
.st-dot { width: 10px; height: 10px; border-radius: 50%; background: #10b981; margin-top: 6px; flex: none; }
.st-dot.dc { background: #f97316; }
.st-main { flex: 1; min-width: 0; }
.st-main b { display: block; font-size: .92rem; line-height: 1.35; }
.st-main small { display: block; color: var(--muted); font-size: .78rem; }
.st-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { font-style: normal; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.dc { background: rgba(249,115,22,.14); color: var(--orange); }
.st-dist { font-size: .78rem; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.map-canvas { position: relative; min-width: 0; }
#map { height: min(76vh, 720px); border-radius: 18px; border: 1px solid var(--border); background: var(--surface-2); }
.map-pick-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 1000; background: var(--accent); color: var(--accent-ink);
  padding: 9px 10px 9px 16px; border-radius: 99px; font-weight: 700; font-size: .9rem; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-lg); white-space: nowrap; }
.map-pick-hint[hidden] { display: none; }
.map-pick-hint .chip { background: rgba(0,0,0,.15); color: inherit; border: 0; }
.st-marker { background: none; border: 0; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59,130,246,.25); }
.st-pop { font: 13px/1.5 "Be Vietnam Pro", system-ui, sans-serif; color: #0f1714; min-width: 200px; }
.st-pop strong { font-size: 14px; display: block; margin-bottom: 2px; }
.st-pop-prov { margin-bottom: 6px; }
.st-pop-prov a, .st-pop a { color: #059669; }
.st-pop-actions { display: flex; gap: 6px; margin-top: 10px; }
.st-pop-actions .btn { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; color: #fff; background: #059669; }
.st-pop-actions .btn.ghost { background: #eef2f0; color: #0f1714; border: 1px solid #dce3df; }
.st-pop-src { margin-top: 6px; color: #5b6962; font-size: 11px; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container { font-family: inherit; }
/* Bản đồ Leaflet tối khi giao diện tối */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); } }
:root[data-theme="dark"] .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }

dialog.sheet { border: 1px solid var(--border); border-radius: 22px; padding: 0; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 24px)); max-height: 90dvh; box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(0,0,0,.55); }
.sheet-body { padding: 22px; overflow-y: auto; }

@media (max-width: 860px) {
  .map-shell { grid-template-columns: minmax(0, 1fr); }
  .map-canvas { order: -1; }
  #map { height: 58dvh; min-height: 340px; }
  .map-side { height: auto; max-height: none; }
  .station-list { max-height: 70dvh; }
  .map-head .btn { width: 100%; justify-content: center; }
  dialog.sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* =========================================================
   THỐNG KÊ
   ========================================================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px 18px; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi b { display: inline-block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); margin-top: 2px; }
.kpi small { margin-left: 6px; color: var(--accent); font-weight: 700; }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label a { color: var(--text); }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hbar b { font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: right; }
.station-table td { white-space: normal; vertical-align: top; }
.station-table td.act { white-space: nowrap; }

@media (min-width: 861px) and (max-width: 1140px) { .nav a { padding: 8px 7px; font-size: .86rem; } .acct-btn span:not(.avatar) { display: none; } .acct-btn { padding: 6px 9px; } }
.gm-attr { font-size: 10px; background: rgba(255,255,255,.75); color: #333; padding: 0 5px; margin: 0 0 2px 74px; }
.gm-attr a { color: #333; }

/* Bài viết: bảng và danh sách nguồn tham khảo */
.prose .table-wrap { margin: 12px 0 18px; }
.prose table td, .prose table th { white-space: normal; }
.prose ul.sources { font-size: .88rem; color: var(--muted); padding-left: 18px; }
.prose ul.sources a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.prose ul.sources a:hover { color: var(--accent); }
