/* =========================================================
   NEKKO PET HOME — Giao diện
   Font thương hiệu (bản quyền) đặt vào assets/fonts/ theo đúng tên file bên dưới.
   Khi chưa có file, app tự dùng font dự phòng có hỗ trợ tiếng Việt.
   ========================================================= */
@font-face { font-family: 'Benjamin Title'; src: url('../assets/fonts/BenjaminTitle.woff2') format('woff2'), url('../assets/fonts/BenjaminTitle.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Zimra Serif'; src: url('../assets/fonts/ZimraSerif.woff2') format('woff2'), url('../assets/fonts/ZimraSerif.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Marschel'; src: url('../assets/fonts/Marschel.woff2') format('woff2'), url('../assets/fonts/Marschel.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Elaris'; src: url('../assets/fonts/Elaris.woff2') format('woff2'), url('../assets/fonts/Elaris.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Leyton'; src: url('../assets/fonts/Leyton.woff2') format('woff2'), url('../assets/fonts/Leyton.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Brixton'; src: url('../assets/fonts/Brixton.woff2') format('woff2'), url('../assets/fonts/Brixton.otf') format('opentype'); font-display: swap; }

:root {
  /* Vai trò font:
     Benjamin Title → tiêu đề lớn (hero, tên trại)
     Zimra Serif    → tiêu đề trang
     Marschel       → tiêu đề thẻ / mục
     Elaris         → câu phụ, trích dẫn (in nghiêng)
     Brixton        → nhãn nhỏ viết hoa (hạng mục)
     Leyton         → chữ nội dung, số liệu */
  --f-display: 'Benjamin Title', 'Cormorant Garamond', Georgia, serif;
  --f-heading: 'Zimra Serif', 'Cormorant Garamond', Georgia, serif;
  --f-section: 'Marschel', 'Cormorant Garamond', Georgia, serif;
  --f-accent: 'Elaris', 'Cormorant Garamond', Georgia, serif;
  --f-label: 'Brixton', 'Be Vietnam Pro', system-ui, sans-serif;
  --f-body: 'Leyton', 'Be Vietnam Pro', system-ui, sans-serif;

  /* Bảng màu: than chì lạnh (obsidian) + ngọc trai + vàng champagne dùng tiết chế cho điểm nhấn.
     Khối: mỗi bề mặt có 3 lớp — viền sáng phía trên, bóng mềm phía dưới, bóng đổ xa. */
  --bg: #08090c;
  --bg-2: #0e1015;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.065);
  --surface-solid: #14171e;
  --raise-1: #191c24;
  --raise-2: #11131a;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #f1f2f4;
  --text-2: #b3b8c2;
  --muted: #7c8290;
  --pearl: #f4f5f7;
  --pearl-2: #cfd3da;
  --gold: #cfae74;
  --gold-2: #ecd5a6;
  --gold-soft: rgba(207, 174, 116, 0.13);
  --rosette: #6e5236;
  --jade: #7fc4ad;
  --ok: #86c2a0;
  --ok-soft: rgba(134, 194, 160, 0.13);
  --warn: #e2b264;
  --warn-soft: rgba(226, 178, 100, 0.14);
  --bad: #e07d72;
  --bad-soft: rgba(224, 125, 114, 0.14);
  --silver: #b8bdc6;
  --radius: 24px;
  --radius-sm: 15px;
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --lo: inset 0 -1px 0 rgba(0, 0, 0, 0.45);
  --drop: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -14px rgba(0, 0, 0, 0.85);
  --shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.85), 0 2px 8px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --sidebar: 256px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(120, 140, 170, 0.10), transparent 62%),
    radial-gradient(900px 520px at -12% 108%, rgba(207, 174, 116, 0.07), transparent 60%),
    radial-gradient(700px 400px at 40% 40%, rgba(255, 255, 255, 0.015), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-2); text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--pearl-2); color: #0d0f13; }
:focus-visible { outline: 2px solid rgba(236, 213, 166, 0.55); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Kiểu chữ ---------- */
.display { font-family: var(--f-display); font-weight: 400; letter-spacing: 0.01em; line-height: 1.05; }
.h1 { font-family: var(--f-heading); font-weight: 500; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.1; margin: 0; letter-spacing: 0.005em; }
.h2 { font-family: var(--f-section); font-weight: 500; font-size: 22px; line-height: 1.2; margin: 0; }
.h3 { font-family: var(--f-section); font-weight: 500; font-size: 18px; margin: 0; }
.eyebrow { font-family: var(--f-label); font-size: 10.5px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.accent { font-family: var(--f-accent); font-style: italic; color: var(--gold-2); }
.muted { color: var(--muted); }
.soft { color: var(--text-2); }
.num { font-family: var(--f-body); font-weight: 200; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gold { color: var(--gold-2); }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { position: relative; overflow: hidden; }
.login-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.9) contrast(1.05); }
.login-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 40%, var(--bg) 100%), linear-gradient(0deg, rgba(10,11,13,0.85), transparent 45%); }
.login-art .caption { position: absolute; left: 48px; bottom: 48px; z-index: 2; max-width: 460px; }
.login-art .caption .display { font-size: 56px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { margin-bottom: 40px; }
.login-card form { display: grid; gap: 16px; }
.login-error { color: var(--bad); font-size: 13px; min-height: 20px; }

/* ---------- Bố cục ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 18px; display: flex; flex-direction: column; gap: 28px;
  border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(20, 22, 29, 0.85), rgba(10, 11, 15, 0.85)); backdrop-filter: blur(24px);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.02), 12px 0 40px -30px rgba(0,0,0,.9);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2); flex: none;
  background: radial-gradient(circle at 32% 22%, rgba(255,255,255,.16), transparent 55%), linear-gradient(160deg, #23262f, #101218);
  box-shadow: var(--hi), var(--lo), 0 6px 18px -8px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.06); }
.brand .mark svg { width: 28px; height: 28px; }
.brand .name { font-family: var(--f-display); font-size: 21px; letter-spacing: 0.14em; line-height: 1; }
.brand .sub { font-family: var(--f-label); font-size: 9px; letter-spacing: 0.42em; color: var(--muted); margin-top: 5px; text-transform: uppercase; }
.nav { display: grid; gap: 4px; position: relative; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--text-2);
  font-size: 13.5px; font-weight: 400; transition: color .25s var(--ease), transform .25s var(--ease); position: relative; z-index: 1;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .8; transition: opacity .25s, transform .35s var(--spring); }
.nav a:hover { color: var(--text); }
.nav a:hover svg { transform: translateX(1px) scale(1.06); opacity: 1; }
.nav a.active { color: var(--text); }
.nav a.active svg { opacity: 1; color: var(--gold-2); }
/* Viên trượt dưới mục đang chọn (vị trí do app.js đặt) */
.glider { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 14px; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.035));
  box-shadow: var(--hi), var(--lo), 0 8px 20px -12px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.06);
  transition: transform .45s var(--spring), width .45s var(--spring), height .45s var(--spring), opacity .2s; }
.glider.on { opacity: 1; }
.nav .glider::before { content: ''; position: absolute; left: -18px; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 0 12px rgba(236,213,166,.5); }
.nav .badge { margin-left: auto; }
.nav-label { padding: 0 14px 6px; }
.sidebar .foot { margin-top: auto; display: grid; gap: 10px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: linear-gradient(180deg, var(--raise-1), var(--raise-2)); box-shadow: var(--hi), var(--lo), var(--drop); border: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, var(--pearl), var(--pearl-2)); color: #14161b; font-weight: 600; font-size: 12.5px; flex: none; box-shadow: inset 0 -2px 3px rgba(0,0,0,.18), 0 3px 8px -2px rgba(0,0,0,.6); }
.userchip .who { line-height: 1.25; min-width: 0; }
.userchip .who b { font-weight: 500; font-size: 13px; display: block; }
.userchip .who span { font-size: 11px; color: var(--muted); }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 11px 16px 11px 40px; border-radius: 999px; background: rgba(0,0,0,.28); border: 1px solid var(--line); outline: none; box-shadow: inset 0 2px 6px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.04); transition: border-color .2s, background .2s; }
.topbar .search input:focus { border-color: var(--line-2); background: rgba(0,0,0,.36); }
.topbar .search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.savestate { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border-radius: 999px; background: rgba(255,255,255,.03); border: 1px solid var(--line); white-space: nowrap; }
.savestate i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 3px rgba(134,194,160,.15); }
.savestate.gold i { background: var(--gold-2); box-shadow: 0 0 0 3px rgba(236,213,166,.15); animation: breathe 1.4s ease-in-out infinite; }
.savestate.warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.savestate.bad i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
@keyframes breathe { 50% { opacity: .35; transform: scale(.8); } }
.sync-orb { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft), 0 0 18px rgba(134,194,160,.5); }
.sync-orb.gold { background: var(--gold-2); box-shadow: 0 0 0 5px var(--gold-soft); animation: breathe 1.4s infinite; }
.sync-orb.warn { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.sync-orb.bad { background: var(--bad); box-shadow: 0 0 0 5px var(--bad-soft); }
.sync-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.mobile-brand { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .lead { margin-top: 8px; max-width: 620px; }

/* ---------- Bề mặt kính ---------- */
.card {
  background: linear-gradient(165deg, rgba(30, 33, 42, 0.92) 0%, rgba(17, 19, 25, 0.94) 55%, rgba(13, 15, 20, 0.96) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden;
  box-shadow: var(--hi), var(--lo), var(--drop);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
/* lớp ánh sáng mềm góc trên — tạo cảm giác bề mặt cong nhẹ */
.card::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255,255,255,.055), transparent 55%); }
a.card:hover, .card.lift:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--hi), var(--lo), 0 2px 4px rgba(0,0,0,.4), 0 22px 40px -18px rgba(0,0,0,.95); }
.card.pad-0 { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* hero */
.hero { min-height: 280px; padding: 32px; display: flex; flex-direction: column; justify-content: flex-end; }
.hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center 30%; opacity: .55; filter: saturate(.85); }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,11,13,.95) 0%, rgba(10,11,13,.6) 55%, rgba(10,11,13,.1) 100%); }
.hero > *:not(.bg) { position: relative; z-index: 1; }
.hero .display { font-size: clamp(34px, 4vw, 54px); margin: 10px 0 12px; }
.hero p { max-width: 520px; margin: 0; color: var(--text-2); }

/* KPI */
.kpi { padding: 20px 20px 18px; }
.kpi .val { font-size: 38px; line-height: 1; margin: 14px 0 6px; }
.kpi .val small { font-size: 15px; color: var(--muted); margin-left: 4px; font-weight: 300; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi .ico { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.14), transparent 60%), linear-gradient(160deg, #262a34, #12141a);
  box-shadow: var(--hi), var(--lo), 0 6px 14px -6px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.05); }
.kpi .ico svg { width: 18px; height: 18px; }

/* ---------- Nút & nhãn ----------
   Nút thường: khối than chì nổi (sáng mép trên, tối mép dưới), bấm vào lún xuống.
   Nút chính: ngọc trai bóng — sáng, sang, không dùng màu cam/be. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, #242832, #171a21); cursor: pointer; font-size: 13px; font-weight: 400; white-space: nowrap; color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), inset 0 -1px 0 rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.5), 0 6px 14px -8px rgba(0,0,0,.9);
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .25s, color .2s, filter .2s;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.btn:hover { background: linear-gradient(180deg, #2a2f3a, #1a1d25); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.5), 0 12px 22px -10px rgba(0,0,0,.95); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: inset 0 2px 5px rgba(0,0,0,.55), 0 0 0 rgba(0,0,0,0); transition-duration: .06s; }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(180deg, #ffffff 0%, #eceef2 45%, #c9cdd5 100%); color: #121419; border-color: rgba(255,255,255,.5); font-weight: 500;
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(0,0,0,.14), 0 1px 2px rgba(0,0,0,.5), 0 8px 22px -8px rgba(220,226,236,.35);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffffff 0%, #f3f4f7 45%, #d3d7de 100%); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.5), 0 14px 30px -10px rgba(220,226,236,.45); }
.btn.primary:active { box-shadow: inset 0 2px 6px rgba(0,0,0,.25); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,.05); color: var(--text); box-shadow: none; transform: none; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 13px; font-size: 12px; }
.btn.icon { padding: 0; width: 40px; height: 40px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.pill.gold { color: var(--gold-2); background: var(--gold-soft); border-color: transparent; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #1b0f0c; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.025); font-size: 12.5px; color: var(--text-2); cursor: pointer;
  transition: transform .2s var(--ease), background .25s, color .2s, box-shadow .25s; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.chip:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.chip:active { transform: scale(.97); }
.chip.active { background: linear-gradient(180deg, #ffffff, #d4d8df); color: #121419; border-color: rgba(255,255,255,.5); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(0,0,0,.12), 0 6px 16px -8px rgba(220,226,236,.35); }
.chip .n { opacity: .55; margin-left: 4px; }

/* Tab: khay lõm, viên chọn nổi trượt theo */
.tabs { display: inline-flex; padding: 5px; border-radius: 999px; background: rgba(0,0,0,.3); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; position: relative;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.04); }
.tabs button { padding: 8px 17px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); font-size: 13px; position: relative; z-index: 1; transition: color .3s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: #121419; font-weight: 500; }
.tabs .glider { border-radius: 999px; background: linear-gradient(180deg, #ffffff, #d4d8df); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(0,0,0,.14), 0 4px 12px -4px rgba(0,0,0,.7); }
.tabs:not(.ready) button.active { background: linear-gradient(180deg, #ffffff, #d4d8df); }

/* ---------- Thẻ mèo ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cat-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, #171a21, #101217); cursor: pointer; display: flex; flex-direction: column;
  box-shadow: var(--hi), var(--drop); transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .3s; }
.cat-card:hover { transform: translateY(-5px); border-color: var(--line-2); box-shadow: var(--hi), 0 4px 8px rgba(0,0,0,.4), 0 28px 50px -22px rgba(0,0,0,1); }
.cat-card:active { transform: translateY(-1px) scale(.99); }
.cat-card .ph { aspect-ratio: 4/3.4; position: relative; overflow: hidden; background: var(--bg-2); }
.cat-card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.cat-card:hover .ph img { transform: scale(1.04); }
.cat-card .ph::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,11,13,.92) 0%, rgba(10,11,13,.35) 38%, transparent 60%), linear-gradient(180deg, rgba(10,11,13,.45), transparent 30%); }
.cat-card .ph .tl .pill { background: rgba(10,11,13,.62); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12); }
.cat-card .ph .tl { position: absolute; top: 12px; left: 12px; z-index: 1; }
.cat-card .ph .tr { position: absolute; top: 12px; right: 12px; z-index: 1; }
.cat-card .ph .bl { position: absolute; left: 14px; bottom: 12px; z-index: 1; right: 14px; }
.cat-card .ph .bl .h3 { font-size: 21px; }
.cat-card .meta { padding: 12px 14px 14px; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.sex { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,11,13,.55); border: 1px solid var(--line-2); font-size: 13px; backdrop-filter: blur(6px); }
.thumb { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.placeholder-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--rosette); background:
  radial-gradient(circle at 20% 30%, rgba(122,86,52,.35) 0 8%, transparent 9%), radial-gradient(circle at 70% 60%, rgba(122,86,52,.3) 0 10%, transparent 11%),
  radial-gradient(circle at 45% 80%, rgba(122,86,52,.25) 0 7%, transparent 8%), var(--bg-2); }
.placeholder-ph svg { width: 34%; height: 34%; max-width: 64px; color: var(--gold); opacity: .55; }
.placeholder-ph.thumb { width: 42px; height: 42px; border-radius: 12px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-family: var(--f-label); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .15s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--surface); }
table.t td.r, table.t th.r { text-align: right; }
.cell-cat { display: flex; align-items: center; gap: 10px; }
.cell-cat b { font-weight: 500; display: block; }
.cell-cat span { font-size: 11.5px; color: var(--muted); }

/* ---------- Danh sách cảnh báo ---------- */
.alerts { display: grid; gap: 8px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); cursor: pointer; color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04); transition: background .2s, transform .25s var(--ease); }
.alert:hover { background: rgba(255,255,255,.055); transform: translateX(3px); }
.alert .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.alert .dot svg { width: 16px; height: 16px; }
.alert .dot.bad { background: var(--bad-soft); color: var(--bad); }
.alert .dot.warn { background: var(--warn-soft); color: var(--warn); }
.alert .dot.gold { background: var(--gold-soft); color: var(--gold-2); }
.alert .dot.ok { background: var(--ok-soft); color: var(--ok); }
.alert .txt { flex: 1; min-width: 0; }
.alert .txt b { font-weight: 500; display: block; font-size: 13px; }
.alert .txt span { font-size: 12px; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty .accent { font-size: 20px; display: block; margin-bottom: 4px; }

/* ---------- Chi tiết ---------- */
.profile { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile .photo { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/4.6; border: 1px solid var(--line); background: var(--bg-2); position: relative; }
.profile .photo img { width: 100%; height: 100%; object-fit: cover; }
.gallery { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); opacity: .7; }
.gallery img.on { opacity: 1; border-color: var(--gold); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.facts > div { background: var(--surface-solid); padding: 14px 16px; }
.facts .eyebrow { font-size: 9.5px; }
.facts .v { margin-top: 5px; font-size: 14px; font-weight: 400; }
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; padding: 10px 0; position: relative; align-items: start; }
.tl-item::before { content: ''; position: absolute; left: 10px; top: 28px; bottom: -10px; width: 1px; background: var(--line-2); }
.tl-item:last-child::before { display: none; }
.tl-item .pt { width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; background: var(--bg); margin-top: 1px; }
.tl-item .pt.done { background: var(--gold); border-color: var(--gold); color: #1b140d; }
.tl-item .pt svg { width: 12px; height: 12px; }
.tl-item b { font-weight: 500; }

.stage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 6px; }
.stage div { height: 4px; border-radius: 4px; background: var(--line-2); }
.stage div.on { background: var(--gold); }
.stage-l { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 10.5px; color: var(--muted); }

/* biểu đồ */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 12px; align-items: center; font-size: 13px; padding: 6px 0; }
.bar-row .track { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-row .track div { height: 100%; background: linear-gradient(90deg, var(--rosette), var(--gold)); border-radius: 6px; }

/* ---------- Form & modal ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-family: var(--f-label); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: 13px; background: rgba(0,0,0,0.28); border: 1px solid var(--line); outline: none; font-size: 14px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.04); transition: border-color .2s, background .2s, box-shadow .2s;
}
.input:focus { border-color: rgba(236,213,166,.55); background: rgba(0,0,0,0.36); box-shadow: inset 0 2px 5px rgba(0,0,0,.45), 0 0 0 4px rgba(236,213,166,.08); }
.input[disabled] { opacity: .55; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a857d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
select.input option { background: #16181d; }
textarea.input { min-height: 84px; resize: vertical; }
input[type=date].input::-webkit-calendar-picker-indicator { filter: invert(.7); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.toggle { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.3); border: 1px solid var(--line); box-shadow: inset 0 2px 5px rgba(0,0,0,.5); }
.toggle button { border: 0; background: transparent; padding: 7px 18px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-size: 13px; transition: all .3s var(--ease); }
.toggle button.on { background: linear-gradient(180deg, #ffffff, #d4d8df); color: #121419; font-weight: 500; box-shadow: inset 0 1px 0 #fff, 0 3px 10px -3px rgba(0,0,0,.7); }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.suggest button { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; }
.suggest button:hover { border-style: solid; color: var(--text); }
.photos-in { display: flex; gap: 8px; flex-wrap: wrap; }
.photos-in .ph { width: 76px; height: 76px; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--line); }
.photos-in .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos-in .ph button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.photos-in .add { width: 76px; height: 76px; border-radius: 12px; border: 1px dashed var(--line-2); display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 11px; text-align: center; }
.photos-in .add:hover { color: var(--text); border-color: var(--gold); }

.modal-back { position: fixed; inset: 0; background: rgba(4,5,7,.66); backdrop-filter: blur(10px) saturate(.9); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .25s var(--ease); }
.modal { width: 100%; max-width: 640px; background: linear-gradient(170deg, #1b1e26, #111318 60%); border: 1px solid var(--line-2); border-radius: 28px; box-shadow: var(--hi), var(--shadow); animation: pop .42s var(--spring); transform-origin: 50% 30%; }
.modal.wide { max-width: 860px; }
.modal-h { padding: 24px 26px 0; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.modal-b { padding: 22px 26px; }
.modal-f { padding: 0 26px 24px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 80; padding: 12px 20px; border-radius: 999px; background: linear-gradient(180deg, #252932, #1a1d24); border: 1px solid var(--line-2); box-shadow: var(--hi), var(--shadow); font-size: 13px; animation: toastIn .4s var(--spring); display: flex; gap: 10px; align-items: center; }
.toast i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 10px rgba(236,213,166,.7); }

/* ---------- Chuyển cảnh giữa các trang ----------
   Mỗi khối trên trang trượt lên + hiện dần, lần lượt từng khối (so le 40ms). */
.page-enter > * { animation: viewIn .55s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: .04s; } .page-enter > *:nth-child(3) { animation-delay: .08s; }
.page-enter > *:nth-child(4) { animation-delay: .12s; } .page-enter > *:nth-child(5) { animation-delay: .16s; }
.page-enter > *:nth-child(n+6) { animation-delay: .2s; }
.page-enter.soft > *:nth-child(-n+2) { animation: none; }
.page-enter .grid > * { animation: viewIn .6s var(--ease) both; }
.page-enter .grid > *:nth-child(2) { animation-delay: .06s; } .page-enter .grid > *:nth-child(3) { animation-delay: .1s; } .page-enter .grid > *:nth-child(4) { animation-delay: .14s; }
.page-enter .cat-grid > * { animation: viewIn .6s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 30ms + 60ms); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
/* Biểu đồ: cột mọc lên, đường vẽ dần, vòng tròn quay ra */
.grow { transform-box: fill-box; transform-origin: 50% 100%; animation: growY .8s var(--ease) both; }
.grow-x { transform-box: fill-box; transform-origin: 0 50%; animation: growX .8s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
.draw { stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); animation: draw 1.2s var(--ease) .15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fade-in { animation: fade .6s var(--ease) .5s both; }
.meter-arc { animation: meterTo 1.3s var(--ease) .2s forwards; }
@keyframes meterTo { to { stroke-dashoffset: var(--to); } }
.seg { transform-box: view-box; transform-origin: 100px 100px; animation: segIn .7s var(--spring) both; transition: opacity .2s, transform .25s var(--ease); }
@keyframes segIn { from { opacity: 0; transform: rotate(-20deg) scale(.85); } }

.typing { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold-2); animation: breathe 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

/* ---------- Hướng dẫn ---------- */
.kbd { display: inline-block; padding: 1px 9px; margin: 0 1px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; color: #121419;
  background: linear-gradient(180deg, #ffffff, #d4d8df); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0,0,0,.18), 0 2px 4px -1px rgba(0,0,0,.6); vertical-align: 1px; }
.guide-map { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.gm { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 14px 6px; border-radius: 18px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }
.gm-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.14), transparent 60%), linear-gradient(160deg, #262a34, #12141a); box-shadow: var(--hi), var(--lo), 0 6px 14px -6px rgba(0,0,0,.9); }
.gm-ico svg { width: 20px; height: 20px; }
.gm b { font-weight: 500; font-size: 13px; }
.gm span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.page-enter .gm { animation: viewIn .6s var(--ease) both; animation-delay: calc(var(--i) * 50ms + 80ms); }
.guide-list { display: grid; gap: 10px; }
.guide-item { padding: 0; }
.guide-item summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.guide-item summary::-webkit-details-marker { display: none; }
.gi-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--gold-2); background: rgba(255,255,255,.05); box-shadow: var(--hi); }
.gi-ico svg { width: 19px; height: 19px; }
.gi-t { flex: 1; min-width: 0; display: grid; }
.gi-t b { font-family: var(--f-section); font-weight: 500; font-size: 17px; }
.gi-t span { font-size: 12px; color: var(--muted); }
.gi-chev svg { width: 18px; height: 18px; color: var(--muted); transform: rotate(-90deg); transition: transform .35s var(--spring); }
.guide-item[open] .gi-chev svg { transform: rotate(90deg); }
.guide-item[open] { border-color: var(--line-2); }
.guide-item > :not(summary) { margin-left: 72px; margin-right: 20px; }
.guide-item > :last-child { margin-bottom: 18px; }
.guide-item[open] > :not(summary) { animation: viewIn .45s var(--ease) both; }
.steps { margin-top: 0; padding-left: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding-left: 36px; line-height: 1.6; color: var(--text-2); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--text); background: rgba(255,255,255,.07); box-shadow: var(--hi); }
.guide-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 14px; background: var(--gold-soft); color: var(--text-2); font-size: 13px; margin-top: 12px; }
.guide-tip svg { width: 16px; height: 16px; color: var(--gold-2); flex: none; margin-top: 3px; }
@media (max-width: 1180px) { .guide-map { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .guide-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-item > :not(summary) { margin-left: 18px; margin-right: 16px; }
}

/* ---------- Biểu đồ (charts.js) ---------- */
.viz { position: relative; }
.viz svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz .tick { fill: #8d93a0; font-size: 10.5px; font-family: var(--f-body); }
.viz .val { fill: var(--text); font-size: 11.5px; font-weight: 500; font-family: var(--f-body); }
.viz .hit .cross { opacity: 0; transition: opacity .15s; }
.viz .hit.on-hover .cross { opacity: 1; }
.viz .hit path { transition: filter .2s; }
.viz .hit.on-hover path { filter: brightness(1.18); }
.viz .seg.on-hover { transform: scale(1.04); }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.viz-legend i, .donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.viz-table { margin-top: 8px; font-size: 12px; }
.viz-table summary { cursor: pointer; color: var(--muted); font-size: 11.5px; list-style: none; display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.viz-table summary::-webkit-details-marker { display: none; }
.viz-table summary:hover { color: var(--text); }
.viz-table[open] summary { margin-bottom: 8px; }
.viz-table table.t td, .viz-table table.t th { padding: 7px 10px; }
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut svg { width: auto; flex: none; }
.donut-v { fill: var(--text); font-size: 26px; font-weight: 300; font-family: var(--f-body); letter-spacing: -.02em; }
.donut-legend { display: grid; gap: 9px; flex: 1; min-width: 170px; }
.donut-legend div { display: grid; grid-template-columns: auto 1fr auto 40px; align-items: center; gap: 4px; font-size: 12.5px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.donut-legend div:last-child { border-bottom: 0; padding-bottom: 0; }
.donut-legend b { font-weight: 500; }
.donut-legend em { font-style: normal; color: var(--muted); text-align: right; font-size: 11.5px; }
.hbars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr 92px; gap: 12px; align-items: center; padding: 7px 6px; border-radius: 10px; transition: background .2s; }
.hbar:hover, .hbar.on-hover { background: rgba(255,255,255,.035); }
.hbar .lb { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .lb a { color: var(--text); }
.hbar .lb small { display: block; color: var(--muted); font-size: 11px; }
.hbar .tr { height: 10px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.hbar .tr div { height: 100%; border-radius: 0 4px 4px 0; }
.hbar .v { text-align: right; font-size: 13px; font-weight: 400; }
.hbar .v small { color: var(--muted); margin-left: 6px; font-size: 11px; }
.meter { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 6px 4px 10px; border-radius: 18px; background: rgba(255,255,255,.02); border: 1px solid var(--line); }
.meter svg { width: 100%; max-width: 190px; }
.fn-bar.dark { color: #f6efe0; }
.funnel { display: grid; gap: 8px; }
.fn { display: grid; grid-template-columns: 1fr 150px; gap: 12px; align-items: center; }
.fn-bar { height: 34px; border-radius: 4px 10px 10px 4px; display: flex; align-items: center; padding: 0 12px; color: #14110b; font-size: 13px; min-width: 38px; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.fn-bar b { font-weight: 600; }
.fn-l { font-size: 12.5px; }
.fn-l small { display: block; color: var(--muted); font-size: 11px; }
.spark { width: 100%; height: 30px; display: block; margin-top: 10px; opacity: .9; }
.viz-tip { position: fixed; z-index: 90; pointer-events: none; padding: 9px 12px; border-radius: 12px; font-size: 12px; line-height: 1.5; display: grid; gap: 2px; max-width: 260px;
  background: linear-gradient(180deg, rgba(36,40,50,.97), rgba(22,25,31,.97)); border: 1px solid var(--line-2); box-shadow: var(--hi), 0 14px 30px -10px rgba(0,0,0,.9);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.viz-tip.on { opacity: 1; transform: none; }
.viz-tip b { font-weight: 600; }
.viz-tip span { color: var(--text-2); }
.viz-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.report-kpi .val { font-size: 32px; }
.report-kpi .delta { font-size: 11.5px; margin-left: 6px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
@media (max-width: 900px) {
  .hbar { grid-template-columns: 92px 1fr 78px; gap: 8px; }
  .fn { grid-template-columns: 1fr 110px; }
  .donut { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .draw { stroke-dashoffset: 0; }
}

/* ---------- Trợ lý ---------- */
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 170px); min-height: 480px; }
.chat-log { overflow-y: auto; padding: 8px 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 760px; }
.msg.me { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--line); padding: 11px 16px; border-radius: 18px 18px 4px 18px; }
.msg.bot { align-self: flex-start; display: grid; grid-template-columns: 36px 1fr; gap: 12px; width: 100%; }
.msg.bot .mark { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--gold-2); }
.msg.bot .mark svg { width: 22px; height: 22px; }
.msg.bot .body { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 16px 18px; min-width: 0; }
.msg.bot .body p { margin: 0 0 10px; }
.msg.bot .body p:last-child { margin-bottom: 0; }
.msg.bot .body ul { margin: 6px 0 10px; padding-left: 18px; }
.msg.bot .body li { margin: 3px 0; }
.msg.bot .big { font-size: 34px; line-height: 1; margin: 4px 0 8px; }
.chat-input { display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); flex-direction: column; }
.chat-input form { display: flex; gap: 10px; }
.chat-input input { flex: 1; padding: 14px 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); outline: none; }
.chat-input input:focus { border-color: var(--gold); }

/* ---------- Di động ---------- */
.tabbar { display: none; }
.mobile-only { display: none !important; }
@media (max-width: 900px) { .mobile-only { display: inline-flex !important; } }
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .profile { grid-template-columns: 1fr; }
  .profile .photo { aspect-ratio: 16/10; max-height: 420px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 14px 16px 110px; }
  .topbar { margin-bottom: 18px; }
  .topbar .search { display: none; }
  .mobile-brand { display: flex; }
  .mobile-brand .mark { width: 36px; height: 36px; }
  .mobile-brand .name { font-size: 17px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { height: 42vh; }
  .login-art::after { background: linear-gradient(0deg, var(--bg) 2%, transparent 70%); }
  .login-art .caption { left: 22px; bottom: 10px; }
  .login-art .caption .display { font-size: 38px; }
  .login-panel { padding: 8px 22px 40px; align-items: flex-start; }
  .login-card .brand { display: none; }
  .hero { min-height: 240px; padding: 24px; }
  .kpi .val { font-size: 30px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-card .ph .bl .h3 { font-size: 17px; }
  .cat-card .meta { padding: 10px; font-size: 11px; }
  .bar-row { grid-template-columns: 96px 1fr 84px; font-size: 12px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 26px 26px 0 0; max-height: 94vh; overflow-y: auto; }
  .chat { height: calc(100vh - 210px); }
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; justify-content: space-around; padding: 8px;
    border-radius: 28px; background: linear-gradient(180deg, rgba(34, 37, 46, 0.86), rgba(16, 18, 23, 0.9)); backdrop-filter: blur(24px) saturate(1.2); border: 1px solid var(--line-2);
    box-shadow: var(--hi), var(--lo), 0 20px 50px -12px rgba(0,0,0,.95);
  }
  .tabbar a { display: grid; place-items: center; gap: 3px; color: var(--muted); font-size: 10px; padding: 7px 2px 6px; border-radius: 20px; position: relative; z-index: 1; flex: 1; white-space: nowrap; min-width: 0; transition: color .3s; }
  .tabbar a svg { width: 21px; height: 21px; transition: transform .45s var(--spring); }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active svg { transform: translateY(-2px) scale(1.08); color: var(--gold-2); }
  .tabbar a:active svg { transform: scale(.88); }
  .tabbar .glider { border-radius: 20px; }
  .tabbar a .badge { position: absolute; top: 0; right: 18%; transform: scale(.85); }
  table.t.responsive thead { display: none; }
  table.t.responsive tr { display: grid; grid-template-columns: 1fr 1fr; padding: 12px 4px; border-bottom: 1px solid var(--line); gap: 6px 10px; }
  table.t.responsive td { border: 0; padding: 2px 6px; font-size: 12.5px; }
  table.t.responsive td::before { content: attr(data-l); display: block; font-family: var(--f-label); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
  table.t.responsive td.first { grid-column: 1 / -1; }
  table.t.responsive td.first::before { display: none; }
  table.t.responsive td.r { text-align: left; }
}
@media (max-width: 420px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px; }
  .kpi .ico { display: none; }
  .kpi .val { font-size: 26px; }
}
