:root {
  --brand: #0878E8;
  --brand-ink: #fff;
  --bg: #F4F6F9;
  --panel: #fff;
  --ink: #1D2939;
  --muted: #667085;
  --line: #E4E7EC;
  --danger: #D92D20;
  --ok: #12B76A;
  --warn: #F79009;
  --radius: 10px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }

/* ----- Nut, o nhap ----- */
button, .btn {
  font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { border-color: #c5cad3; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.danger { color: var(--danger); }
button.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
button.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; }
button.link.danger { color: var(--danger); }
button.sm { padding: 4px 8px; font-size: 12px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea {
  font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); width: 100%;
}
input[type=checkbox] { width: auto; }
input[type=color] { width: 44px; height: 36px; padding: 2px; }
textarea { min-height: 70px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ----- Dang nhap ----- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background-size: cover; background-position: center; }
.login .card { width: 100%; max-width: 380px; }
.login .logo { height: 56px; max-width: 200px; object-fit: contain; display: block; margin: 0 auto 12px; }
.login h1 { text-align: center; }

/* ----- Khung chinh ----- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #101828; color: #d0d5dd; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.side .org { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; color: #fff; font-weight: 600; }
.side .org img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; }
.side a.nav { color: inherit; text-decoration: none; padding: 9px 12px; border-radius: 8px; display: block; }
.side a.nav:hover { background: rgba(255,255,255,.06); }
.side a.nav.on { background: var(--brand); color: var(--brand-ink); }
.side .foot { margin-top: auto; padding: 12px 8px 0; font-size: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.side .foot button { background: transparent; color: #d0d5dd; border-color: rgba(255,255,255,.2); margin-top: 6px; }
.main { padding: 24px; min-width: 0; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; margin-bottom: 12px; }
  .main { padding: 16px; }
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: 12px; }

/* ----- Bang ----- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FAFBFC; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12px; }
td.act { white-space: nowrap; text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #F2F4F7; color: #344054; white-space: nowrap; }
.badge.ok { background: #ECFDF3; color: #027A48; }
.badge.off { background: #FEF3F2; color: #B42318; }
.badge.warn { background: #FFFAEB; color: #B54708; }
.badge.brand { background: color-mix(in srgb, var(--brand) 14%, #fff); color: var(--brand); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #D0D5DD; margin-right: 6px; }
.dot.on { background: var(--ok); }

/* ----- Hop thoai ----- */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.modal header h2 { margin: 0; }
.modal .body { padding: 18px; overflow: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.secret { font: 600 18px ui-monospace, Menlo, Consolas, monospace; background: #F2F4F7; padding: 12px; border-radius: 8px; text-align: center; letter-spacing: 1px; user-select: all; word-break: break-all; }
.picker { border: 1px solid var(--line); border-radius: 8px; max-height: 240px; overflow: auto; }
.picker label { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker label:last-child { border-bottom: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: 90vw; }
.toast.bad { background: var(--danger); }

/* ----- Thuong hieu ----- */
.brand-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .brand-grid { grid-template-columns: 1fr; } }
.imgbox { display: flex; gap: 12px; align-items: center; }
.imgbox .prev { width: 96px; height: 64px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: #FAFBFC; }
.imgbox .prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cfgbox { background: #F9FAFB; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.cfgbox .k { color: var(--muted); font-size: 12px; }
.cfgbox .v { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; margin-bottom: 8px; }

/* ===================== Giao dien nang cap ===================== */
:root { --bg: #F5F7FA; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06); }
body { -webkit-font-smoothing: antialiased; }
h1 { font-size: 22px; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead p { margin: 4px 0 0; max-width: 680px; }
.card, .stat, .tablewrap { box-shadow: var(--shadow); }
.card { border-radius: 12px; }
.stat { border-radius: 12px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); opacity: .8; }
tbody tr:hover td { background: #FAFBFC; }
button { transition: background .15s, border-color .15s, box-shadow .15s; }
button.primary:hover { filter: brightness(1.06); box-shadow: 0 2px 6px color-mix(in srgb, var(--brand) 35%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.side { background: linear-gradient(180deg, #0C111D, #161B26); }
.side .org { font-size: 15px; }
.side a.nav { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.side a.nav .ico { display: inline-flex; opacity: .75; }
.side a.nav.on .ico { opacity: 1; }
.login { background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 35%, transparent), transparent), linear-gradient(160deg, #0C111D, #1D2939); }
.login .card { padding: 28px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* Thuong hieu */
.brand-grid > div > .stack > .card + .card { margin-top: 0; }
.sticky { position: sticky; top: 16px; }
.savebar { position: sticky; bottom: 0; margin-top: 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); padding: 12px 0; display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.preset { display: flex; align-items: center; gap: 8px; text-align: left; white-space: normal; padding: 10px 12px; }
.preset .sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.08); flex: none; }
input[type=color].auto { background: repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%) 50% / 10px 10px; }
input[type=range] { padding: 0; border: 0; box-shadow: none; accent-color: var(--brand); }
.rangeval { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.seg { display: flex; background: #F2F4F7; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px; border-radius: 8px; font-size: 13px; }
.seg button.on { background: #fff; box-shadow: var(--shadow); font-weight: 600; }

.phone { width: 300px; height: 600px; border: 11px solid #0C111D; border-radius: 44px; overflow: hidden; margin: 0 auto; display: flex; flex-direction: column; position: relative; box-shadow: 0 18px 40px rgba(16,24,40,.18); font-size: 13px; }
.pstatus { display: flex; justify-content: space-between; padding: 10px 22px 4px; font-size: 11px; font-weight: 600; }
.plogin { flex: 1; display: flex; flex-direction: column; background-size: cover; background-position: center; color: #fff; }
.plogin-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; }
.plogo { width: 72px; height: 72px; border-radius: 18px; background: #fff; display: grid; place-items: center; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.plogo.sm { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.plogo img { max-width: 80%; max-height: 80%; object-fit: contain; }
.plogo-ph { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 22px; }
.plogo.sm .plogo-ph { font-size: 15px; }
.pname { font-size: 22px; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.25); }
.ptag { opacity: .9; font-size: 13px; }
.psheet { border-radius: 22px 22px 0 0; padding: 20px 18px 26px; display: flex; flex-direction: column; gap: 10px; }
.pin { border: 1px solid; border-radius: 10px; padding: 11px 12px; font-size: 13px; }
.pbtn { padding: 12px; text-align: center; font-weight: 600; }
.psupport { text-align: center; font-size: 11px; }
.phead { padding-bottom: 10px; }
.phead-row { display: flex; align-items: center; gap: 10px; padding: 4px 14px 0; }
.ptitle { font-weight: 650; font-size: 15px; }
.psub { font-size: 11px; opacity: .8; }
.plist { flex: 1; }
.pitem { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid; }
.pav { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; }
.pav.sm { width: 30px; height: 30px; font-size: 13px; }
.pitem-n { font-weight: 600; }
.pitem-p { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbadge { border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.pwelcome { text-align: center; padding: 10px 20px 20px; font-size: 12px; }
.pchat { flex: 1; position: relative; padding: 12px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.pwall { position: absolute; inset: 0; background-size: cover; background-position: center; pointer-events: none; }
.pchat > *:not(.pwall) { position: relative; }
.psys { text-align: center; font-size: 11px; margin: 4px 0; }
.pb { max-width: 78%; padding: 8px 11px; align-self: flex-start; line-height: 1.35; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.pb.me { align-self: flex-end; }
.pwho { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.pcompose { display: flex; gap: 8px; padding: 10px 12px 16px; border-top: 1px solid; align-items: center; }
.pinput { flex: 1; border: 1px solid; border-radius: 99px; padding: 8px 12px; font-size: 12px; }
.psend { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.login h1 { margin-bottom: 10px; }
@media (min-width: 861px) { .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }

/* 3B.1 tuy chon nhom theo phong ban */
label.opt { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
label.opt input { width: auto; margin-top: 3px; flex: none; }

/* 3B.2 thanh ti le da doc */
.readbar { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.readbar-track { flex: 1; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 60px; }
.readbar-fill { height: 100%; background: var(--brand); border-radius: 99px; }

/* 3B.3 bang tin */
.post { max-width: 820px; }
.hidden-post { opacity: .6; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs .thumb { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; background: var(--line); }

.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { opacity: .75; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 10px; }
.card h2 { margin-top: 0; }

/* =====================================================================
   GIAO DIEN CHUYEN NGHIEP (v2) - ghi de cac kieu phia tren
   ===================================================================== */
:root {
  --bg: #F4F5FA;
  --panel: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E6E8F0;
  --line-2: #EEF0F6;
  --side: #0B1020;
  --side-2: #121833;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.05);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-feature-settings: "cv11", "ss01";
}
body { background: var(--bg); color: var(--ink); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }

/* ---------- Khung ---------- */
.layout { grid-template-columns: 256px 1fr; }
.content { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.main { padding: 28px 32px 48px; max-width: 1480px; width: 100%; }
.page { animation: pageIn .22s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.side {
  background: radial-gradient(420px 260px at 0 0, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%), linear-gradient(180deg, var(--side), var(--side-2));
  color: #A9B1C7; padding: 18px 14px 14px; gap: 0; border-right: 1px solid rgba(255,255,255,.04);
}
.side .org { padding: 4px 6px 18px; gap: 12px; }
.org-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #000)); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 40%, transparent); overflow: hidden; }
.org-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.org-logo.lg { width: 44px; height: 44px; border-radius: 13px; font-size: 16px; }
.side .org img { width: 100%; height: 100%; border-radius: 0; }
.org-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.org-sub { font-size: 12px; color: #7C86A2; margin-top: 2px; }
.nav-scroll { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #5D6785; padding: 6px 12px; }
.side a.nav { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; color: #B4BCD0; position: relative; margin: 1px 0; }
.side a.nav:hover { background: rgba(255,255,255,.05); color: #fff; }
.side a.nav.on { background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 32%, transparent), color-mix(in srgb, var(--brand) 10%, transparent)); color: #fff; }
.side a.nav.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side a.nav .ico { opacity: .7; }
.side a.nav.on .ico { opacity: 1; color: #fff; }
.side .foot { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.07); }
.foot-txt { flex: 1; min-width: 0; }
.foot-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-sub { font-size: 12px; color: #7C86A2; }
.side .foot .icon-btn { color: #B4BCD0; border-color: rgba(255,255,255,.12); background: transparent; }
.side .foot .menu { bottom: 40px; top: auto; right: 0; }

.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; padding: 12px 32px; min-height: 60px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-crumb { font-size: 12px; color: var(--muted); }
.top-title { font-weight: 650; font-size: 14px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { width: 272px; }
  .side.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 19; }
  .menu-btn { display: inline-grid; margin: 0; }
  .topbar { padding: 10px 16px; }
  .main { padding: 20px 16px 40px; }
  .live { display: none; }
}

/* ---------- Avatar, menu ---------- */
.av { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; overflow: hidden; background: #94A3B8; letter-spacing: .02em; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.icon-btn { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; font-size: 16px; line-height: 1; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); }
.menu-wrap { position: relative; display: inline-block; vertical-align: middle; }
.menu { position: absolute; right: 0; top: 36px; z-index: 40; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; text-align: left; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink); }
.menu-item:hover { background: var(--line-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: #FEF2F2; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---------- Nut, o nhap ---------- */
button, .btn { border-radius: 10px; padding: 8px 14px; font-weight: 500; border-color: var(--line); color: var(--ink); background: var(--panel); }
button:hover, .btn:hover { border-color: #CBD2E0; background: #FBFCFE; }
button.primary, .btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand)); border-color: color-mix(in srgb, var(--brand) 80%, #000); color: var(--brand-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 6px color-mix(in srgb, var(--brand) 28%, transparent); }
button.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand)); }
button.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.light { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; backdrop-filter: blur(4px); }
.btn.light:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.4); }
input, select, textarea { border-radius: 10px; padding: 9px 12px; border-color: var(--line); background: var(--panel); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #94A3B8; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background: var(--panel) 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='%2364748B' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; }
label.f > span { font-weight: 500; color: var(--ink-2); font-size: 12.5px; }

/* ---------- Tieu de trang ---------- */
.pagehead { margin-bottom: 22px; align-items: center; }
.pagehead p { color: var(--muted); font-size: 13.5px; }

/* ---------- The, so lieu ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { --c: var(--brand); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat::before { width: auto; height: 3px; right: 0; bottom: auto; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent)); opacity: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat .l { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.stat-ico .ico { display: inline-flex; }
.stat .v { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px 26px; margin-bottom: 20px; border-radius: 18px; color: #fff;
  background: radial-gradient(500px 220px at 100% 0, rgba(255,255,255,.22), transparent 60%), linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #1E1B4B));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--brand) 30%, transparent); }
.hero::after { content: ""; position: absolute; right: -40px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero-hi { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.hero-sub { opacity: .88; margin-top: 4px; }
.hero-act { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.cfgbox { border-radius: 12px; background: #F8FAFC; padding: 14px 16px; }

/* ---------- Bang ---------- */
.tablewrap { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); overflow: visible; }
.tablewrap table { border-radius: var(--radius); }
th { background: #F8FAFC; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #64748B; padding: 11px 14px; position: sticky; top: 60px; z-index: 2; }
thead tr th:first-child { border-top-left-radius: var(--radius); }
thead tr th:last-child { border-top-right-radius: var(--radius); }
td { padding: 12px 14px; border-bottom-color: var(--line-2); }
tbody tr:hover td { background: #F8FAFF; }
td.act { text-align: right; }
.who { display: flex; align-items: center; gap: 12px; }
.who-av { position: relative; display: inline-flex; }
.who-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #CBD5E1; border: 2px solid #fff; }
.who-dot.on { background: #10B981; }
.who-name { font-weight: 600; }
.empty { padding: 40px; }

.badge { border-radius: 99px; padding: 3px 9px; font-size: 12px; font-weight: 500; background: #F1F5F9; color: #334155; }
.badge.ok { background: #ECFDF5; color: #047857; }
.badge.ok::before, .badge.off::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.badge.off { background: #FEF2F2; color: #B91C1C; }
.badge.warn { background: #FFFBEB; color: #B45309; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- Hop thoai, thong bao ---------- */
.modal-bg { background: rgba(2,6,23,.5); backdrop-filter: blur(3px); }
.modal { border-radius: 18px; box-shadow: 0 24px 60px rgba(2,6,23,.35); animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal header { padding: 18px 22px; }
.modal .body { padding: 20px 22px; }
.modal footer { padding: 14px 22px; background: #F8FAFC; border-radius: 0 0 18px 18px; }
.toast { border-radius: 12px; padding: 12px 18px; box-shadow: var(--shadow-lg); font-weight: 500; }
.seg { border-radius: 12px; background: #EEF1F6; }

/* ---------- Dang nhap ---------- */
.login2 { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--panel); }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 40px 48px; display: flex; flex-direction: column; background-size: cover; background-position: center;
  background-image: radial-gradient(700px 420px at 15% 10%, color-mix(in srgb, var(--brand) 60%, transparent), transparent 70%), radial-gradient(500px 400px at 90% 90%, rgba(236,72,153,.35), transparent 70%), linear-gradient(160deg, #0B1020, #1E1B4B); }
.art-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.art-copy { margin-top: auto; max-width: 480px; }
.art-copy h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; font-weight: 800; margin: 0 0 14px; }
.art-copy p { font-size: 15px; opacity: .85; line-height: 1.6; margin: 0 0 20px; }
.art-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.art-points li { display: flex; align-items: center; gap: 10px; opacity: .92; }
.art-points li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.16); }
.art-foot { margin-top: 40px; font-size: 12px; opacity: .6; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { font-size: 28px; margin-bottom: 6px; }
.login-box > p.muted { margin: 0 0 24px; }
.login-box form button.primary { padding: 11px; font-size: 14.5px; font-weight: 600; }
.login-alt { margin-top: 22px; text-align: center; }
@media (max-width: 900px) { .login2 { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- Bieu do ---------- */
.chart .bar { fill: url(#barGrad); fill: var(--brand); rx: 3; }
.topbar .menu-btn { display: none; }
@media (max-width: 860px) { .topbar .menu-btn { display: inline-grid; } }
.stack > * + * { margin-top: 16px; }
.brand-grid > div > .stack > .card + .card { margin-top: 16px; }
.sticky { top: 80px; }
.savebar { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.art-copy { max-width: 560px; }
.art-copy h2 { font-size: 32px; }
.login-box .err:empty { min-height: 0; }
.menu { position: fixed; right: auto; top: 0; left: 0; }
.side .foot .menu { bottom: auto; top: 0; right: auto; }
.who-name { white-space: nowrap; }
@media (max-width: 860px) {
  .tablewrap { overflow-x: auto; }
  th { position: static; }
  .pagehead .right { margin-left: 0; }
  .hero-act { margin-left: 0; }
}
.av { position: relative; }
.av img { position: absolute; inset: 0; }

/* ===== Cau hinh database / nhieu cong ty (fix-35) ===== */
.setup-page { min-height: 100vh; padding: 40px 16px 60px; background: radial-gradient(1000px 500px at 0% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), #F6F7FB; }
.setup-head { max-width: 860px; margin: 0 auto 18px; display: flex; gap: 16px; align-items: center; }
.setup-head h1 { margin: 0 0 4px; font-size: 26px; }
.setup-head p { margin: 0; }
.setup-logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(145deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #000)); box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 35%, transparent); }
.setup-logo .ico svg { width: 26px; height: 26px; }
.setup-box { max-width: 860px; margin: 0 auto; }
.setup-alert { max-width: 860px; margin: 0 auto 16px; padding: 12px 16px; border-radius: 12px; background: #FFFAEB; color: #93370D; border: 1px solid #FEDF89; }
.setup-key { max-width: 520px; margin: 0 auto; }
.code-hint { background: #0F172A; color: #A5F3FC; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin: 6px 0 14px; overflow-x: auto; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: 1fr; } }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
label.check input { width: auto; }
.company-list { display: grid; gap: 10px; }
.company { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.company.on { border-color: color-mix(in srgb, var(--brand) 45%, #fff); background: color-mix(in srgb, var(--brand) 5%, #fff); }
.company-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, #fff); }
.company-txt { flex: 1; min-width: 0; }
.company-name { font-weight: 600; }
.company-txt .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-result:empty { display: none; }
.db-ok { padding: 12px 14px; border-radius: 12px; background: #ECFDF3; border: 1px solid #ABEFC6; color: #054F31; }
.db-bad { padding: 12px 14px; border-radius: 12px; background: #FEF3F2; border: 1px solid #FECDCA; color: #912018; }
.db-step { margin-top: 12px; padding: 14px; border-radius: 12px; border: 1px dashed var(--line); background: #FCFCFD; }
.db-step p { margin: 0 0 10px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--brand) 20%, #fff); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Quan tri he thong: nhieu cong ty */
.sys-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 4px; }
.sys-stats > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.sys-stats b { font-size: 20px; }
.company-group { font-weight: 600; margin-top: 8px; }
.company-links { display: grid; gap: 2px; margin-top: 6px; }
.company-link { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.company-link > .muted { width: 72px; flex: none; }
.company-link > .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.company-link button.link { flex: none; padding: 0; }
details.adv summary { cursor: pointer; color: var(--muted, #667085); font-size: 13px; }
