:root {
  /* Tông vàng CSGT: vàng hổ phách chủ đạo + nâu rêu (kaki) nền sâu */
  --gold: #ffc61a;          /* vàng chủ đạo */
  --gold-2: #e8a800;        /* vàng đậm */
  --gold-3: #a87b00;        /* vàng cũ / viền */
  --amber: #ffb020;
  --khaki: #2b2515;         /* nâu rêu đậm - nền chính */
  --khaki-2: #3a3018;       /* nâu rêu nhạt hơn - nền thẻ */
  --khaki-3: #1a1609;       /* nền sâu nhất */
  --ink: #241c05;           /* chữ nâu đen trên nền vàng */
  --navy: var(--khaki);
  --navy-2: var(--khaki-2);
  --navy-deep: var(--khaki-3);
  --blue: #c99a12;
  --red: #d3202a;
  --green: #2ecc71;
  --orange: #e8863a;
  --text: #fdf6e3;
  --muted: #c3b48a;
  --card: rgba(255, 198, 26, .09);
  --card-b: rgba(255, 198, 26, .26);
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--navy-deep);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* Khung điện thoại trên máy tính */
#device {
  position: relative;
  width: 100%; height: 100%;
  max-width: 430px; margin: 0 auto;
  background: var(--navy);
  overflow: hidden;
  display: flex; flex-direction: column;
}
@media (min-width: 700px) {
  body { background: radial-gradient(circle at 50% 20%, #14294f, #050c18 70%); }
  #device { height: min(900px, 94vh); margin-top: max(3vh, 12px); border-radius: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 10px #0d1626; }
}

/* Nền đô thị ban đêm */
.city-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 10%, rgba(255,198,26,.22), transparent 58%),
    radial-gradient(ellipse at 88% 4%, rgba(232,168,0,.16), transparent 52%),
    linear-gradient(180deg, #3a3018 0%, #2b2515 58%, #151106 100%);
  overflow: hidden;
}
.city-bg svg { position: absolute; bottom: 0; width: 100%; height: 46%; opacity: .55; }

/* Thanh trạng thái giả lập */
.statusbar {
  position: relative; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 18px 2px; font-size: 12px; font-weight: 600; color: #dfe9ff;
}

/* Vùng nội dung */
#screen {
  position: relative; z-index: 2;
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 118px;
  scrollbar-width: none;
}
#screen::-webkit-scrollbar { display: none; }

/* Thanh trên */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 10px; gap: 10px;
}
.appbar h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.appbar .ico {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--card-b);
  background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--gold);
}
.appbar .right { display: flex; gap: 8px; }

/* Thẻ */
.card {
  background: linear-gradient(180deg, rgba(255,198,26,.10), rgba(255,198,26,.045)); border: 1px solid var(--card-b);
  border-radius: var(--radius); padding: 14px; margin: 0 16px 12px;
  backdrop-filter: blur(12px);
}
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 16px 8px; font-size: 14px; font-weight: 700;
}
.section-title .more { font-size: 12px; color: var(--gold); font-weight: 600; cursor: pointer; }

/* Bottom nav */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
  height: 78px; display: flex; align-items: flex-end; justify-content: space-around;
  padding: 0 6px 10px;
  background: linear-gradient(180deg, rgba(26,22,9,0) 0%, rgba(26,22,9,.94) 40%, #151106 100%);
  border-top: 1px solid rgba(255,198,26,.22);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--muted); cursor: pointer; padding-top: 8px; font-weight: 600;
}
.tabbar .tab.active { color: var(--gold); }
.tabbar .tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tabbar .tab.home { position: relative; flex: 0 0 74px; }
.tabbar .tab.home .badge {
  position: absolute; top: -14px; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #4a3d1d, #241d0a);
  border: 3px solid var(--gold); display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(255,198,26,.42);
}
.tabbar .tab.home .badge img { width: 26px; height: auto; }
.tabbar .tab.home span { margin-top: 28px; }

/* Nút */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--gold); background: rgba(255,198,26,.12); color: var(--gold);
  cursor: pointer; width: 100%;
}
.btn.primary { background: linear-gradient(180deg, #ffd94a, #e8a800); color: #241c05; border: none; box-shadow: 0 6px 16px rgba(255,198,26,.25); }
.btn.ghost { background: var(--card); border: 1px solid var(--card-b); color: var(--text); }
.btn.sm { padding: 9px 12px; font-size: 13px; border-radius: 10px; width: auto; }
.btn:active { transform: scale(.985); }

/* Chip */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--card-b); background: var(--card); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--gold); border-color: var(--gold); color: #241c05; }

/* Input tìm kiếm */
.search {
  display: flex; align-items: center; gap: 10px; margin: 0 16px 10px; padding: 12px 14px;
  border-radius: 14px; background: rgba(255,255,255,.10); border: 1px solid var(--card-b);
}
.search input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-size: 14.5px;
}
.search input::placeholder { color: #b6a878; }
.search .mic { font-size: 17px; opacity: .85; cursor: pointer; }

/* Màn đăng nhập */
.login-wrap { display: flex; flex-direction: column; align-items: center; padding: 26px 20px 0; position: relative; z-index: 2; }
.drum { position: absolute; top: 6px; width: 300px; height: 300px; opacity: .22; z-index: -1; }
.login-logo { width: 92px; margin-bottom: 8px; filter: drop-shadow(0 8px 22px rgba(255,198,26,.45)); }
.login-org { text-align: center; font-size: 13px; line-height: 1.5; color: #e8dcb8; letter-spacing: .3px; }
.login-org b { display: block; font-size: 14px; color: #fff; }
.star-sep { color: var(--gold); margin: 10px 0 6px; font-size: 12px; letter-spacing: 6px; }
.app-name { font-size: 28px; font-weight: 900; color: var(--gold); text-align: center; line-height: 1.15; margin: 4px 0 18px; letter-spacing: .5px; }
.app-name small { display: block; font-size: 13px; font-weight: 600; color: #e8dcb8; letter-spacing: 2px; margin-top: 6px; }
.login-sub { color: var(--muted); font-size: 13px; text-align: center; margin-top: 12px; }
.login-sub b { color: var(--gold); cursor: pointer; }
.mini-row { display: flex; gap: 10px; margin-top: 12px; }
.mini-row .btn { font-size: 12.5px; padding: 11px 10px; }

/* PIN pad */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0 20px; }
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold); display: inline-block;
}
.pin-dots span.on { background: var(--gold); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 34px; }
.key {
  height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; font-weight: 600;
  background: rgba(255,255,255,.09); border: 1px solid var(--card-b); cursor: pointer; color: #fff;
}
.key:active { background: rgba(255,198,26,.26); }

/* Danh sách biển báo */
.sign-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0 16px 10px;
  background: var(--card); border: 1px solid var(--card-b); border-radius: 14px; cursor: pointer;
}
.sign-item .thumb { flex: 0 0 52px; display: grid; place-items: center; }
.sign-item .body { flex: 1; min-width: 0; }
.sign-item .code { font-size: 12.5px; font-weight: 800; color: var(--gold); }
.sign-item .name { font-size: 14px; font-weight: 700; margin: 2px 0 3px; line-height: 1.35; }
.sign-item .desc {
  font-size: 12px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sign-item .tag {
  font-size: 10px; padding: 2px 7px; border-radius: 6px; background: rgba(24,103,180,.28);
  color: #9ecbff; margin-left: 6px; font-weight: 700;
}
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13.5px; }

/* Chi tiết biển */
.detail-head { text-align: center; padding: 10px 16px 4px; }
.detail-head .big { display: grid; place-items: center; margin-bottom: 8px; }
.detail-head h2 { font-size: 18px; margin: 4px 0 2px; line-height: 1.35; }
.detail-head .code { color: var(--gold); font-weight: 800; font-size: 13px; }
.detail-body { font-size: 14px; line-height: 1.62; color: #dbe6f7; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed rgba(255,255,255,.10); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }

/* Trang chủ */
.greet { padding: 6px 16px 2px; }
.greet .hi { font-size: 13px; color: var(--muted); }
.greet .who { font-size: 19px; font-weight: 800; margin-top: 2px; }
.home-logo { width: 46px; }

.lookup-card { background: linear-gradient(135deg, #4d3f16, #2b2410); border: 1px solid rgba(255,198,26,.45); }
.lookup-card .t { font-size: 15px; font-weight: 800; color: var(--gold); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.veh-chips { display: flex; gap: 8px; margin-bottom: 10px; }

.brief-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.brief-grid .cell { background: rgba(255,255,255,.06); border: 1px solid var(--card-b); border-radius: 12px; padding: 10px 8px; text-align: center; }
.brief-grid .v { font-size: 17px; font-weight: 800; color: #fff; }
.brief-grid .l { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.ai-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 6px; scrollbar-width: none; }
.ai-row::-webkit-scrollbar { display: none; }
.ai-item { flex: 0 0 92px; text-align: center; cursor: pointer; }
.ai-item .bot {
  height: 76px; border-radius: 16px; background: linear-gradient(160deg, rgba(255,198,26,.22), rgba(74,61,29,.85));
  border: 1px solid var(--card-b); display: grid; place-items: center; margin-bottom: 6px; color: var(--gold);
}
.ai-item .lbl { font-size: 11px; color: #cfdcf0; line-height: 1.3; font-weight: 600; }

/* Điều hành / đội */
.team-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.team-row::-webkit-scrollbar { display: none; }
.team-card {
  flex: 0 0 100px; padding: 11px 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--card-b); cursor: pointer;
}
.team-card.active { background: linear-gradient(160deg, #6b561d, #3d3213); border-color: var(--gold); }
.team-card .n { font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.team-card .r { font-size: 11px; color: var(--muted); margin-top: 3px; }
.team-card.active .r { color: #f0e2b8; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 6px; text-align: center; border: 1px solid var(--card-b); }
.stat .v { font-size: 19px; font-weight: 900; }
.stat .l { font-size: 9.5px; color: var(--muted); margin-top: 2px; line-height: 1.25; }
.stat.hi .v { color: #ff5b5b; }
.stat.ok .v { color: var(--green); }
.stat.mid .v { color: #ffbe3d; }
.stat.bad .v { color: #ff7a45; }

#map { height: 230px; border-radius: 14px; overflow: hidden; background: #0d1a2c; }
.leaflet-container { background: #0d1a2c; font-family: inherit; }
.map-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; }

/* Nghiệp vụ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 16px 12px; }
.nv {
  background: var(--card); border: 1px solid var(--card-b); border-radius: 14px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-height: 96px;
}
.nv .ico { font-size: 22px; }
.nv .t { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.nv .s { font-size: 11px; color: var(--muted); }

/* Cá nhân */
.profile-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(160deg,#e8a800,#8a6400); display: grid; place-items: center; font-size: 22px; font-weight: 800; border: 2px solid var(--gold); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 14px; cursor: pointer; }
.list-row:last-child { border-bottom: none; }
.list-row .r { margin-left: auto; color: var(--muted); font-size: 12px; }

.hidden { display: none !important; }
.toast {
  position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 13px;
  z-index: 50; opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ===== Form dùng chung: đăng nhập, quản trị, công cụ nghiệp vụ ===== */
.fld{display:block;font-size:12px;color:#c1b183;margin-bottom:10px}
.fld input,.fld select{display:block;width:100%;margin-top:5px;padding:11px 12px;border-radius:10px;
  background:rgba(255,255,255,.06);border:1px solid rgba(159,179,209,.25);color:#fdf6e3;font-size:14px;font-family:inherit}
.fld input:focus,.fld select:focus{outline:none;border-color:#ffc61a;background:rgba(255,198,26,.10)}
.fld select option{background:#3a3018;color:#fdf6e3}
.out{margin-top:14px}
.out .kv{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid rgba(159,179,209,.12);font-size:12.5px}
.out .kv .k{color:#c1b183;flex:0 0 48%}
.out .kv span:last-child{text-align:right;flex:1}
.out .src{font-size:11px;color:#8d8161;margin:-2px 0 8px;line-height:1.45}
.out .hint{background:rgba(255,198,26,.12);border:1px solid rgba(255,198,26,.35);border-radius:10px;
  padding:10px 12px;font-size:12px;color:#ffe9a8;margin-top:10px;line-height:1.5}
.out .warn{color:#ffb86b;font-size:12.5px}
.hl{color:#ffc61a;font-weight:800}
.tag-red{font-size:10px;background:rgba(255,91,91,.18);color:#ff8f8f;padding:1px 6px;border-radius:6px}
.tag-gold{font-size:10px;background:rgba(255,198,26,.20);color:#ffc61a;padding:1px 6px;border-radius:6px}
label.fld[style*="row"]{display:flex!important;align-items:center;gap:8px;font-size:13px;color:#fdf6e3}

/* v2: ô nhập giọng nói + nút ghi âm */
.mic-btn{width:96px;height:96px;border-radius:50%;margin:6px auto 14px;display:grid;place-items:center;
  background:radial-gradient(circle at 50% 35%,#ffd94a,#e0a800);box-shadow:0 10px 30px rgba(245,197,24,.35);cursor:pointer;font-size:38px}
.mic-btn.rec{animation:pulse 1.1s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(245,197,24,.55)}70%{box-shadow:0 0 0 22px rgba(245,197,24,0)}100%{box-shadow:0 0 0 0 rgba(245,197,24,0)}}

/* v3: tông vàng CSGT — tăng tương phản ô nhập và chữ phụ */
#login input::placeholder { color: #c2b183 !important; }
#login input:focus { border-color: var(--gold) !important; background: rgba(255,198,26,.10) !important; }
.login-sub, .login-org { color: #eadfbe; }
.brief-grid .cell { background: rgba(255,198,26,.07); }
.nv, .sign-item, .list-row { border-color: rgba(255,198,26,.18); }
.nv:active, .card:active { background: rgba(255,198,26,.14); }
.statusbar { color: var(--gold); }

/* v4: chữ trên nền vàng luôn màu nâu đen để đủ tương phản */
.btn.primary, .btn.primary * { color: #241c05 !important; }
.chip.active, .chip.active * { color: #241c05 !important; }
.tabbar .tab { color: #b9a878; }
.tabbar .tab.active { color: var(--gold); }
.tabbar .tab svg { opacity: .92; }
.src, .brief-grid .l, .small-note { color: #b9a878; }

/* v5: tương phản chữ phụ + tabbar, số liệu bớt chói */
.tabbar .tab { color: #d3c39a; }
.tabbar .tab.active { color: #ffc61a; font-weight: 800; }
.brief-grid .v { color: #fff8e6; }
.brief-grid .cell:nth-child(3) .v { color: #ff8a5b; }
.src { color: #a99a72; }

/* v6: tăng độ sáng chữ phụ và số liệu trạng thái trên nền nâu vàng */
.nv .s, .src, .out .src, .sign-item .desc, .brief-grid .l { color: #c9ba8e !important; }
.av-green, .stat.ok .v { color: #6ef2a3 !important; }
.text-green { color: #6ef2a3 !important; }
