/* ===== Thuxe VIN — Design System (hiện đại tối giản) ===== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #131a2b;
  --muted: #5b6478;
  --line: #e6e9f2;
  --brand: #3b5bff;
  --brand-2: #7b3bff;
  --brand-ink: #1e2bb8;
  --accent: #00c2a8;
  --danger: #e5484d;
  --warn: #c8870a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 43, .06), 0 1px 3px rgba(20, 26, 43, .05);
  --shadow: 0 10px 30px -12px rgba(40, 50, 120, .22);
  --shadow-lg: 0 24px 60px -20px rgba(40, 50, 120, .35);
  --grad: linear-gradient(120deg, #3b5bff 0%, #7b3bff 55%, #9b3bff 100%);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
img { max-width: 100%; display: block; }
.container { width: min(1120px, 92%); margin: 0 auto; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-weight: 900; box-shadow: var(--shadow-sm);
}
.brand b { color: var(--brand); }
.nav .spacer { flex: 1; }
.nav a.link { color: var(--muted); font-weight: 600; font-size: 15px; padding: 8px 10px; border-radius: 8px; }
.nav a.link:hover { color: var(--text); background: var(--surface-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 18px; border-radius: 11px; transition: transform .08s ease, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { color: #fff; box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: #e7eaf4; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ===== Hero ===== */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; }
.hero::before {
  content: ''; position: absolute; inset: -40% -10% auto -10%; height: 540px;
  background: radial-gradient(60% 60% at 30% 20%, rgba(59,91,255,.18), transparent 70%),
              radial-gradient(50% 50% at 80% 10%, rgba(123,59,255,.16), transparent 70%);
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px;
  color: var(--brand-ink); background: #eaeeff; padding: 7px 13px; border-radius: 999px; margin-bottom: 18px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(30px, 5vw, 50px); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 16px; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0 auto 8px; }
.hero-center { text-align: center; }

/* ===== Decoder card ===== */
.decoder {
  margin-top: 30px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg); padding: 26px;
}
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 6px; border-radius: 14px; margin-bottom: 20px; }
.tab {
  flex: 1; text-align: center; padding: 11px; border-radius: 10px; font-weight: 700; font-size: 15px;
  color: var(--muted); cursor: pointer; border: 0; background: transparent; font-family: inherit; transition: .2s;
}
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.vin-field { display: flex; gap: 12px; flex-wrap: wrap; }
.vin-field input {
  flex: 1; min-width: 240px; font-size: 18px; letter-spacing: 2px; font-weight: 600;
  padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--surface-2);
  color: var(--text); text-transform: uppercase; font-family: 'SFMono-Regular', ui-monospace, monospace;
}
.vin-field input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(59,91,255,.12); }
.examples { margin-top: 14px; font-size: 14px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip {
  font-family: ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); transition: .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* Dropzone */
.dropzone {
  border: 2px dashed #c7cee2; border-radius: 16px; padding: 34px 20px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #eef1ff; }
.dropzone .dz-icon { font-size: 38px; margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 700; }
.dropzone .dz-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.dz-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.preview { margin-top: 16px; display: none; }
.preview.show { display: block; }
.preview img { border-radius: 12px; max-height: 240px; margin: 0 auto; box-shadow: var(--shadow); }

/* ===== Result ===== */
.result { margin-top: 22px; display: none; }
.result.show { display: block; animation: fade .3s ease; }
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.result-head .vin-out { font-family: ui-monospace, monospace; font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.ok { background: #e4f8f1; color: #00876a; }
.badge.warn { background: #fdf3e0; color: var(--warn); }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rcell { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.rcell .k { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rcell .v { font-size: 19px; font-weight: 800; margin-top: 6px; }
.rcell .ico { font-size: 20px; margin-bottom: 6px; }
.note { margin-top: 14px; font-size: 14px; color: var(--warn); background: #fdf7ec; border: 1px solid #f3e2bd; padding: 11px 14px; border-radius: 11px; }
.note.err { color: var(--danger); background: #fdeced; border-color: #f5c9cb; }

/* ===== Sections ===== */
.section { padding: 56px 0; }
.section-title { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 28px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .fi { width: 46px; height: 46px; border-radius: 12px; background: #eef1ff; color: var(--brand); display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; }
.feature h3 { margin: 0 0 6px; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

/* ===== Blog cards ===== */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.post-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: .2s; display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card .thumb { aspect-ratio: 16/9; background: var(--surface-2); object-fit: cover; width: 100%; }
.post-card .body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card .tag { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.post-card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.post-card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.post-card .meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; margin-top: 6px; }

/* ===== Article ===== */
.article { max-width: 760px; margin: 0 auto; }
.article .cover { border-radius: var(--radius); margin: 18px 0 26px; box-shadow: var(--shadow); width: 100%; aspect-ratio: 16/8; object-fit: cover; }
.article h1 { font-size: 36px; letter-spacing: -.02em; line-height: 1.15; }
.prose { font-size: 17px; color: #25304a; }
.prose h2 { font-size: 24px; margin-top: 34px; letter-spacing: -.01em; }
.prose h3 { font-size: 20px; margin-top: 26px; }
.prose p { margin: 16px 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose img { border-radius: 12px; margin: 20px 0; }
.prose blockquote { border-left: 4px solid var(--brand); background: var(--surface-2); margin: 20px 0; padding: 12px 18px; border-radius: 0 10px 10px 0; color: var(--muted); }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.prose table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prose th { background: var(--surface-2); }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.site-footer .container { padding: 36px 0; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.site-footer .muted { color: var(--muted); font-size: 14px; }
.socials { display: flex; gap: 10px; }
.socials a { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text); }
.socials a:hover { background: var(--grad); color: #fff; }

/* ===== Admin ===== */
.admin-wrap { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: #0e1426; color: #cfd6ea; padding: 22px 16px; }
.admin-side .brand { color: #fff; margin-bottom: 26px; }
.admin-side .brand b { color: #8aa0ff; }
.admin-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent;
  border: 0; color: #aeb7d4; font-family: inherit; font-size: 15px; font-weight: 600; padding: 11px 12px;
  border-radius: 10px; cursor: pointer; margin-bottom: 4px;
}
.admin-nav button:hover { background: #1a2238; color: #fff; }
.admin-nav button.active { background: var(--grad); color: #fff; }
.admin-main { padding: 28px 32px; overflow: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.hamburger { display: none; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 20px; line-height: 1; padding: 8px 12px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.admin-backdrop { display: none; position: fixed; inset: 0; background: rgba(14,20,38,.5); z-index: 40; }
.admin-backdrop.show { display: block; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 30px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 14px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.published { background: #e4f8f1; color: #00876a; }
.pill.draft { background: var(--surface-2); color: var(--muted); }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 15px; background: var(--surface); color: var(--text);
}
.field textarea { min-height: 280px; resize: vertical; font-family: ui-monospace, monospace; font-size: 14px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(59,91,255,.1); }

/* Login */
.login-box { max-width: 380px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-lg); }
.login-box .logo-big { width: 52px; height: 52px; border-radius: 14px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 22px; margin: 0 auto 14px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(14,20,38,.5); display: none; z-index: 100; padding: 4vh 20px; overflow: auto; }
.modal-backdrop.show { display: block; }
.modal { max-width: 760px; margin: 0 auto; background: var(--surface); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #0e1426; color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: .25s; }
.toast.show { opacity: 1; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(59,91,255,.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }
.muted { color: var(--muted); }

/* ===== VIN hint + tô màu nhóm VIN (trang cầm đồ & admin) ===== */
.vin-hint { margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 18px; font-weight: 600; }
.vin-hint.ok { color: #00876a; }
.vin-split { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.vin-split .seg {
  display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); min-width: 56px; background: var(--surface-2);
}
.vin-split .seg-val { font-family: ui-monospace, monospace; font-weight: 800; font-size: 16px; letter-spacing: 1px; }
.vin-split .seg-pos { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .8; margin-top: 2px; }
.vin-split .seg-name { font-size: 11px; color: var(--muted); margin-top: 1px; }
.vin-split .seg-wmi { background: #eaeeff; border-color: #c9d4ff; }
.vin-split .seg-wmi .seg-val { color: var(--brand-ink); }
.vin-split .seg-vds { background: #e9f6f2; border-color: #bfe6da; }
.vin-split .seg-vds .seg-val { color: #00876a; }
.vin-split .seg-check { background: #fdf3e0; border-color: #f0ddb4; }
.vin-split .seg-check .seg-val { color: var(--warn); }
.vin-split .seg-year { background: #f3eaff; border-color: #ddc9ff; }
.vin-split .seg-year .seg-val { color: var(--brand-2); }
.vin-split .seg-plant { background: #f0f2f8; }
.vin-split .seg-serial { background: var(--surface); }

/* ===== Admin: thẩm định cầm đồ ===== */
.vin-resolve {
  margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.src-badge { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.src-DB { background: #e4f8f1; color: #00876a; }
.src-NHTSA { background: #eaeeff; color: var(--brand-ink); }
.src-AI { background: #f3eaff; color: #6b21d8; }
.src-manual { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

.checklist { display: grid; gap: 10px; margin: 8px 0 4px; }
.check-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600;
}
.check-item input[type=checkbox] { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; accent-color: var(--brand); }
.check-item .ci-sub { font-weight: 500; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.check-item.flag-red { border-color: #f5c9cb; background: #fdeced; }
.check-item.flag-yellow { border-color: #f3e2bd; background: #fdf7ec; }

.risk-banner {
  margin: 16px 0; padding: 16px 18px; border-radius: 14px; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; gap: 12px;
}
.risk-PASS { background: #e4f8f1; color: #00876a; border: 1px solid #bfe6da; }
.risk-REVIEW { background: #fdf7ec; color: var(--warn); border: 1px solid #f3e2bd; }
.risk-BLOCK { background: #fdeced; color: var(--danger); border: 1px solid #f5c9cb; }
.risk-banner .rb-flags { font-size: 13px; font-weight: 600; margin-top: 4px; }
.risk-banner ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 10px 0; }
.photo-slot {
  border: 1.5px dashed #c7cee2; border-radius: 12px; padding: 10px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: .15s; position: relative; min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.photo-slot:hover { border-color: var(--brand); background: #eef1ff; }
.photo-slot.filled { border-style: solid; border-color: #bfe6da; background: #fff; padding: 4px; }
.photo-slot img { border-radius: 8px; max-height: 78px; object-fit: cover; width: 100%; }
.photo-slot .ps-label { font-size: 12px; font-weight: 700; }
.photo-slot .ps-icon { font-size: 24px; }
.photo-slot .ps-req { position: absolute; top: 6px; right: 8px; color: var(--danger); font-size: 13px; font-weight: 800; }

.pill.BLOCK { background: #fdeced; color: var(--danger); }
.pill.REVIEW { background: #fdf7ec; color: var(--warn); }
.pill.PASS { background: #e4f8f1; color: #00876a; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .features, .posts-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-wrap { grid-template-columns: 1fr; }
  .nav a.link.hide-sm { display: none; }
  .row { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }

  /* Sidebar → drawer trượt từ trái */
  .admin-side {
    position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
    overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  .admin-side.open { transform: translateX(0); }
  .hamburger { display: inline-flex; align-items: center; }
  .admin-main { padding: 18px 16px; }
  .admin-topbar h1 { font-size: 20px; }

  /* Input phân giải dòng xe full-width, dễ bấm */
  .vin-resolve > div[style] { min-width: 0 !important; width: 100%; flex: 1 1 100%; }
  .vin-resolve #avBody { width: 100% !important; flex: 1 1 100%; }
  .vin-resolve .btn { width: 100%; }
}
@media (max-width: 480px) {
  .result-grid { grid-template-columns: 1fr; }
}
