:root {
  --brand: #1a7f5a; --brand-d: #12603f; --brand-l: #e7f5ee; --accent: #f5b841;
  --bg: #f4f7f5; --card: #fff; --text: #17201b; --muted: #66736c; --line: #e5eae7;
  --red: #c0392b; --red-l: #fdecea; --orange: #c46f12; --orange-l: #fff1e0; --blue: #2d6cdf; --blue-l: #e7efff;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.04); --shadow-lg: 0 12px 32px rgba(16,24,40,.14);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --line2: #dbe1de; --soft: #eef1f4; --hover: #f5f8f6; --th: #f7f9f8; --label: #4f5d55;
  /* Chủ đề: menu trái, nền trang */
  --side-a: #0f2a1f; --side-b: #0a1d15; --side-text: rgba(225,240,232,.74); --side-strong: #fff; --side-muted: #6f8f7f; --side-hover: rgba(255,255,255,.06);
  --bg-tint: 9%; --bg-dots: rgba(16,40,28,.045);
  /* Màu của phân hệ đang mở (đặt theo body[data-mod]) */
  --m: #1a7f5a;
  --m-l: color-mix(in srgb, var(--m) 11%, var(--card)); --m-d: color-mix(in srgb, var(--m) 78%, #000);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--text); }
/* Nền trang: ánh màu của phân hệ đang mở + chấm hoa văn mờ */
body.authed { background: radial-gradient(1100px 520px at 100% -8%, color-mix(in srgb, var(--m) var(--bg-tint), transparent), transparent 70%), radial-gradient(800px 480px at 0% 105%, color-mix(in srgb, var(--m) calc(var(--bg-tint) * .6), transparent), transparent 70%), radial-gradient(var(--bg-dots) 1px, transparent 1.4px) 0 0 / 18px 18px, var(--bg); background-attachment: fixed; transition: background-color .3s; }
body.noscroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 14px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15.5px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 12px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.i { flex: none; vertical-align: -.2em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.warn { color: var(--orange) !important; }
.err { color: var(--red); white-space: pre-wrap; }
.pre { white-space: pre-wrap; }
.mt { margin-top: 12px; } .mt0 { margin-top: 0; } .mb { margin-bottom: 12px; } .m0 { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 160px; width: auto; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty { color: var(--muted); padding: 16px 0; text-align: center; font-size: 14px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.li:last-child { border: 0; }

/* Khung */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--side-a) 0%, var(--side-b) 100%); color: var(--side-text); border-right: 1px solid var(--side-border, transparent); padding: 16px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.logo { display: flex; align-items: center; gap: 11px; color: var(--side-strong); font-weight: 700; font-size: 16.5px; padding: 4px 8px 18px; line-height: 1.2; }
.logo small { display: block; font-size: 11.5px; font-weight: 400; color: var(--side-muted); margin-top: 2px; }
.logo span, .login-logo { background: linear-gradient(135deg, #2bb37f, #157a52); box-shadow: 0 4px 12px rgba(26,127,90,.35); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; }
.nav a { display: flex; gap: 11px; align-items: center; color: var(--side-text); padding: 8px 12px; border-radius: 10px; margin-bottom: 2px; font-size: 14px; font-weight: 500; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: var(--side-hover); color: var(--side-strong); }
.nav a.active { background: color-mix(in srgb, var(--m) 26%, transparent); color: var(--side-strong); }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: color-mix(in srgb, var(--m) 70%, #fff); }
.nav a.active .ico { color: color-mix(in srgb, var(--m) 55%, #fff); }
.nav .ico { width: 20px; display: grid; place-items: center; opacity: .95; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 16px 12px 6px; font-weight: 600; }
.count { margin-left: auto; background: var(--accent); color: #10251c; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
.main { min-width: 0; padding: 0 28px 36px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 0; position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(10px); -webkit-backdrop-filter: saturate(1.6) blur(10px); z-index: 20; }
.page-title { font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.user-chip { display: flex; gap: 8px; align-items: center; line-height: 1.2; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #d7f0e4, #b9e4cf); color: var(--brand-d); display: grid; place-items: center; font-weight: 700; flex: none; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 8px; position: relative; color: var(--text); border-radius: 10px; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(16,24,40,.05); }
.dot { position: absolute; top: 0; right: -2px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 4px; }
.menu-btn { display: none; }
.backdrop { display: none; }
.bottom-nav { display: none; }
.notif-panel { border: 1px solid var(--line); position: fixed; right: 16px; top: 62px; width: 360px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; background: var(--card); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(16,24,40,.18); padding: 12px; z-index: 45; }
.notif { display: block; padding: 8px; border-radius: 8px; color: var(--text); border-bottom: 1px solid var(--line); }
.notif.unread { background: var(--brand-l); }

/* Thành phần */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; display: block; color: inherit; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.stat .num, .mini .num { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .lbl, .mini .lbl { color: var(--muted); font-size: 13px; }
.mini { margin-bottom: 12px; }
.btn { border: 1px solid var(--line2); background: var(--card); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s, box-shadow .15s; box-shadow: 0 1px 1px rgba(16,24,40,.04); display: inline-flex; align-items: center; gap: 4px; justify-content: center; }
.btn:hover { border-color: #c2cbc6; background: var(--hover); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: linear-gradient(180deg, #1f8d64, #187a55); border-color: #167050; color: #fff; box-shadow: 0 1px 2px rgba(18,96,63,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger:hover { background: var(--red-l); border-color: #f3c3bd; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 12px; padding: 12px; }
input, select, textarea { font: inherit; font-size: 14.5px; padding: 9px 12px; border: 1px solid var(--line2); border-radius: 10px; transition: border-color .15s, box-shadow .15s; background: var(--card); color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,127,90,.15); }
input[type=checkbox] { width: auto; margin-right: 6px; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--label); margin-bottom: 5px; font-weight: 500; }
.inline { width: auto; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form .full, .form h3 { grid-column: 1 / -1; }
.form h3 { margin: 6px 0 0; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: var(--card); border-radius: 99px; padding: 6px 13px; font-weight: 500; transition: all .15s; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--text); }
.chip.static { cursor: default; display: inline-block; margin: 2px; }
.chips { margin-top: 6px; }
.quick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.banner { display: flex; gap: 10px; align-items: center; background: var(--brand-l); }
.banner span { flex: 1; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 14px; }
th { background: var(--th); font-weight: 600; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
thead th:first-child { border-top-left-radius: 8px; } thead th:last-child { border-top-right-radius: 8px; }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 240px; }
tfoot td { font-weight: 700; background: var(--th); }
.clickable tbody tr { cursor: pointer; }
.clickable tbody tr:hover td { background: var(--hover); }
.kv td { white-space: normal; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 38%; }
.thumb { max-width: 160px; border-radius: 8px; margin-top: 6px; }

.att td, .att th { padding: 4px 3px; text-align: center; font-size: 12px; min-width: 28px; }
.att td.name, .att th.name { text-align: left; min-width: 150px; position: sticky; left: 0; background: var(--card); z-index: 1; }
.att .sun { background: var(--soft); }
.cell { border-radius: 5px; padding: 3px 0; cursor: pointer; display: inline-block; min-width: 22px; }
.cell.ok { background: var(--brand-l); color: var(--brand-d); }
.cell.late { background: var(--orange-l); color: var(--orange); font-weight: 700; }
.cell.half { background: var(--blue-l); color: var(--blue); }
.cell.fix { background: #f0e8ff; color: #6b3fc4; }
.cell.miss { color: #b8c0c8; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.cho_duyet, .badge.trung_binh, .badge.sua_chua { background: var(--orange-l); color: var(--orange); }
.badge.da_duyet, .badge.dang_dung { background: var(--brand-l); color: var(--brand-d); }
.badge.tu_choi, .badge.cao, .badge.thanh_ly { background: var(--red-l); color: var(--red); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; transition: color .15s; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--m-d); border-color: var(--m); font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.cards .card { margin: 0; }
.req { cursor: pointer; }
.req > div { margin-top: 4px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.type-btn { justify-content: flex-start; text-align: left; padding: 12px; }
.timeline { list-style: none; padding: 0 0 0 18px; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ''; position: absolute; left: -26px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); }
.timeline li.ok::before { background: var(--brand); border-color: var(--brand); }
.timeline li.no::before { background: var(--red); border-color: var(--red); }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); }
.timeline li.skip::before { background: #ccd3da; border-color: #ccd3da; }

.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kanban.wide { grid-template-columns: repeat(6, minmax(200px, 1fr)); overflow-x: auto; }
.col { background: var(--soft); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.col h3 { margin: 4px 4px 10px; display: flex; justify-content: space-between; text-transform: none; color: var(--text); letter-spacing: 0; }
.col.over { outline: 2px dashed var(--brand); }
.task { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; }
.task .t { font-weight: 600; margin-bottom: 4px; }
.task .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.task .overdue { color: var(--red); font-weight: 600; }
.task .move { display: none; gap: 4px; margin-top: 6px; }
.comments { max-height: 260px; overflow-y: auto; margin-bottom: 8px; }
.comment { background: var(--hover); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.job { cursor: pointer; } .job.sel { outline: 2px solid var(--brand); }

.post { border-bottom: 1px solid var(--line); padding: 12px 0; }
.post:last-child { border: 0; }
.post .title { font-weight: 600; }
.post .content { white-space: pre-wrap; margin-top: 4px; }
.person { display: flex; gap: 12px; align-items: center; }

.hello h1 { margin: 0; }
.hello { margin: 4px 0 14px; }
.checkin-card { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: radial-gradient(120% 140% at 0% 0%, #2bb37f 0%, #1a7f5a 45%, #0f4f36 100%); color: #fff; border: 0; box-shadow: 0 10px 28px rgba(26,127,90,.28); }
.checkin-card .muted { color: #cfe3d8; }
.checkin-card .btn.primary { background: #fff; color: #12603f; border-color: #fff; font-weight: 700; }
.io { display: flex; gap: 18px; margin-top: 4px; }
.io b { font-size: 20px; }
.io.big { justify-content: center; gap: 40px; margin: 14px 0; }
.io.big b { font-size: 26px; }
.punch { text-align: center; padding: 24px 16px; }
.punch .clock { font-size: 46px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.punch-btn { width: 170px; height: 170px; border-radius: 50%; border: 0; margin: 8px auto 14px; display: block; font: inherit; font-size: 18px; font-weight: 800; color: #fff; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #2fc08a, #12603f); box-shadow: 0 0 0 10px rgba(26,127,90,.08), 0 0 0 20px rgba(26,127,90,.05), 0 14px 32px rgba(26,127,90,.45), inset 0 -6px 0 rgba(0,0,0,.12); transition: transform .1s; }
.punch-btn.out { background: radial-gradient(circle at 30% 30%, #f6b04c, #c46f12); box-shadow: 0 0 0 10px rgba(196,111,18,.08), 0 0 0 20px rgba(196,111,18,.05), 0 14px 32px rgba(196,111,18,.4), inset 0 -6px 0 rgba(0,0,0,.12); }
.punch-btn:active { transform: scale(.97); }
.punch-btn:disabled { opacity: .6; }
.punch #punch-status { margin-bottom: 10px; }

.bar-row { display: grid; grid-template-columns: minmax(120px, 40%) 1fr 40px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.bar { background: var(--soft); border-radius: 99px; height: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #2bb37f, var(--brand)); border-radius: 99px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; white-space: normal; min-width: 240px; position: sticky; left: 0; background: var(--card); }
.matrix tr.grp td { background: var(--soft); font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.matrix select { width: 130px; padding: 4px 6px; font-size: 13px; }
.sc { font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.sc-none { color: #a0a9b2; } .sc-own { background: var(--soft); } .sc-department { background: var(--blue-l); color: var(--blue); }
.sc-company { background: var(--orange-l); color: var(--orange); } .sc-all { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.step-row { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.org { border-bottom: 1px solid var(--line); padding: 10px 0; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 48px; padding: 32px max(24px, 7vw);
  background: radial-gradient(900px 600px at 0% 0%, rgba(60,207,148,.28), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(245,184,65,.16), transparent 60%), linear-gradient(135deg, #0b1f17, #12402c); }
.login-hero { color: #e3f2ea; max-width: 520px; }
.login-hero h1 { font-size: 40px; color: #fff; margin: 18px 0 10px; letter-spacing: -.02em; }
.login-hero p { font-size: 16px; color: #b6d3c4; margin: 0 0 22px; }
.login-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.login-hero li { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.login-hero li .i { color: #3ccf94; }
.login .card { width: 100%; max-width: 400px; padding: 32px; justify-self: center; border: 0; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login .card h2 { font-size: 22px; margin-bottom: 4px; }
.login .card .mt0 { margin-bottom: 18px; }
.login-logo { width: 56px; height: 56px; font-size: 26px; border-radius: 16px; }
.payslip { max-width: 640px; }
.payslip td { white-space: normal; }
.payslip .total td { font-weight: 800; font-size: 17px; color: var(--brand-d); }

.modal { position: fixed; inset: 0; background: rgba(10,20,15,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--card); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-lg); width: 680px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #17201b; font-weight: 500; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.error { background: var(--red); }

/* Điện thoại */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -290px; width: 272px; transition: left .22s ease; height: 100%; }
  .nav a.active::before { left: -12px; }
  .login { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 16px; align-content: center; }
  .login-hero { text-align: center; } .login-hero .login-logo { margin: 0 auto; } .login-hero h1 { font-size: 30px; margin-top: 12px; } .login-hero ul { display: none; } .login-hero p { font-size: 14.5px; margin: 0; }
  .login .card { padding: 24px; }
  .sidebar.open { left: 0; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-btn { display: inline-block; }
  .hide-sm { display: none !important; }
  .main { padding: 0 14px calc(84px + var(--safe-b)); }
  .page-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
  .card { padding: 16px; }
  .topbar { padding: 8px 0; padding-top: max(8px, env(safe-area-inset-top)); }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-top: 1px solid var(--line); z-index: 30; padding-bottom: var(--safe-b); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; font-weight: 500; color: var(--muted); position: relative; }
  .bottom-nav a .ico { display: grid; place-items: center; width: 44px; height: 28px; border-radius: 99px; transition: background .15s; }
  .bottom-nav a.active { color: var(--m-d); font-weight: 600; }
  .bottom-nav a.active .ico { background: var(--m-l); }
  .bottom-nav .count { position: absolute; top: 2px; left: 55%; margin: 0; }
  .g2, .form, .kanban { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: 1fr; }
  .task .move { display: flex; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-box { border-radius: 16px 16px 0 0; max-height: 92vh; padding: 18px 16px calc(18px + var(--safe-b)); width: 100%; }
  .toast { bottom: calc(80px + var(--safe-b)); }
  .step-row { grid-template-columns: 1fr 1fr; }
  .notif-panel { right: 8px; left: 8px; width: auto; }
  .stat .num { font-size: 22px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .row.mb, .btn { display: none !important; }
  .layout { display: block; } .main { padding: 0; } .card { box-shadow: none; }
}

/* Nhận diện khuôn mặt */
.face-overlay { position: fixed; inset: 0; background: rgba(8,20,14,.92); z-index: 70; display: grid; place-items: center; padding: 16px; }
.face-box { text-align: center; color: #fff; width: 100%; max-width: 420px; }
.face-title { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.face-cam { position: relative; width: 280px; height: 280px; margin: 0 auto; border-radius: 50%; overflow: hidden; background: #000; }
.face-cam video, .kiosk-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.face-ring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--accent); box-shadow: inset 0 0 0 4px rgba(255,255,255,.15); pointer-events: none; }
.face-status { margin: 14px 0 8px; font-size: 16px; min-height: 24px; }
.face-steps { text-align: left; display: inline-block; margin-bottom: 14px; font-size: 14px; color: #cfe3d8; }
.face-steps .ok { color: #fff; }
.consent { color: var(--text); font-size: 14px; background: var(--hover); border-radius: 9px; padding: 10px; }
.warnbox { background: var(--orange-l); text-align: left; }
.kiosk { min-height: calc(100vh - 80px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.kiosk-head { width: 100%; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.kiosk-clock { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kiosk-cam { position: relative; width: min(70vw, 420px); height: min(70vw, 420px); border-radius: 50%; overflow: hidden; background: #000; }
.face-ring.big { border-width: 6px; }
.kiosk-msg { font-size: 22px; font-weight: 700; text-align: center; min-height: 34px; padding: 8px 16px; border-radius: 12px; }
.kiosk-msg.good { background: var(--brand-l); color: var(--brand-d); }
.kiosk-msg.bad { background: var(--red-l); color: var(--red); font-size: 17px; }
.kiosk-log { width: 100%; max-width: 520px; font-size: 14px; }
.kiosk-log div { padding: 6px 0; border-bottom: 1px solid var(--line); }
.kiosk-mode .sidebar, .kiosk-mode .bottom-nav, .kiosk-mode .menu-btn { display: none !important; }
.kiosk-mode .layout { grid-template-columns: 1fr; }
.kiosk-mode .main { padding-bottom: 16px; }
/* Giám sát chấm công */
.mon { cursor: pointer; }
.num.good { color: var(--brand); } .num.bad { color: var(--red); }
.site .bar.w120 { width: 120px; display: inline-block; }
.st { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.st.ok { background: var(--brand-l); color: var(--brand-d); } .st.late { background: var(--orange-l); color: var(--orange); }
.st.bad { background: var(--red-l); color: var(--red); } .st.leave { background: var(--blue-l); color: var(--blue); }
.st.muted { background: var(--soft); color: var(--muted); } .st.warnbg { background: var(--card)4cc; color: #8a6100; }
.cell.off { background: var(--card)4cc; color: #8a6100; }
.site-dist { margin: 6px 0 10px; font-size: 14px; }
.site-dist .in { color: var(--brand-d); font-weight: 600; } .site-dist .outz { color: var(--red); font-weight: 600; }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; }
.pick-list label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 3px 0; }
.pick-list .grp { font-weight: 700; margin-top: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.check-item { display: grid; grid-template-columns: 28px 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-item .lv { font-size: 18px; }
/* Bảng công, phân ca */
.seg { display: inline-flex; gap: 2px; }
.dropdown { position: relative; }
.dropdown .menu { position: absolute; right: 0; top: 110%; background: var(--card); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.18); padding: 6px; z-index: 30; min-width: 290px; }
.dropdown .menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 14px; }
.dropdown .menu a:hover { background: var(--brand-l); }
.att td.tot { font-weight: 700; color: var(--brand-d); }
.cell.absent { color: var(--red); } .cell.offday { color: transparent; }
.cell.fix { box-shadow: inset 0 0 0 2px #b598ea; }
.roster-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; position: sticky; top: 56px; z-index: 5; }
.chip-shift { border-left: 4px solid var(--c); }
.roster td, .roster th { padding: 3px; text-align: center; min-width: 92px; font-size: 12px; }
.roster td.name, .roster th.name { text-align: left; min-width: 170px; position: sticky; left: 0; background: var(--card); z-index: 1; }
.roster th.today { background: var(--brand-l); color: var(--brand-d); } .roster th.hol { background: #fdecea; color: var(--red); }
.roster .rc.ed { cursor: pointer; user-select: none; }
.roster .rc.sel .sh { outline: 3px solid var(--blue); }
.roster .sh { position: relative; border-radius: 6px; padding: 4px 2px; background: color-mix(in srgb, var(--c) 12%, var(--card)); border-left: 3px solid var(--c); color: var(--text); line-height: 1.3; }
.roster .sh span { color: var(--muted); font-size: 11px; }
.roster .sh.as { border: 2px solid var(--c); border-left-width: 4px; }
.roster .sh.off { background: var(--soft); border-left-color: #ccd3da; color: var(--muted); }
.roster .sh i { position: absolute; top: 1px; right: 4px; font-style: normal; color: var(--brand-d); font-weight: 700; }
.ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 6px; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--soft) 0); }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 18px; text-align: center; line-height: 1.1; }
.stat2 { text-align: center; }
.stat2 h4 { margin: 0 0 6px; font-size: 13px; color: var(--brand-d); background: var(--brand-l); border-radius: 6px; padding: 3px; }
.stat2 .pair { display: flex; justify-content: space-around; }
.stat2 .pair b { display: block; font-size: 20px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; font-size: 12px; text-align: center; }
.week div { border-radius: 6px; padding: 4px 2px; background: var(--soft); }
.week div.has { background: color-mix(in srgb, var(--c) 14%, var(--card)); border-top: 3px solid var(--c); }
.week div.now { outline: 2px solid var(--brand); }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.hours div { flex: 1; background: linear-gradient(180deg, #5b9bec, #a8cbf4); border-radius: 3px 3px 0 0; position: relative; min-height: 1px; }
.hours div span { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.hours-x { display: flex; gap: 3px; font-size: 10px; color: var(--muted); } .hours-x span { flex: 1; text-align: center; }
.viol { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.viol b { color: var(--red); text-align: right; }
.req-table td.wrap { min-width: 180px; }
.tabs .n { color: var(--muted); font-weight: 400; }
.dash { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.dash-cards .card { margin: 0; }
.mon { position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.mon:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16,24,40,.08); }
.mon::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--mc, var(--brand)); }
.mon .num { color: var(--mc, var(--text)); }
.mon.c1 { --mc: #d9534f; } .mon.c2 { --mc: #7b5cd6; } .mon.c3 { --mc: #2d6cdf; } .mon.c4 { --mc: #1a7f5a; }
.mon.c5 { --mc: #c98a12; } .mon.c6 { --mc: #5f6b74; } .mon.c7 { --mc: #d39b00; } .mon.c8 { --mc: #2f9e5b; }
.mon.sel { outline: 2px solid var(--mc, var(--brand)); outline-offset: -1px; }
.viol-card { background: linear-gradient(180deg, #fff5f4, #fff); border-color: #f6d4cf; } .viol-card .big { font-size: 26px; } .viol a { color: var(--red); }
b.bad { color: var(--red); }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
a[role=button] { cursor: pointer; }
.grid > .card { margin: 0; }
.grid { margin-bottom: 16px; }
.checkin-card .btn { white-space: nowrap; flex: none; }
.cc { display: inline-block; min-width: 34px; padding: 2px 4px; border-radius: 5px; }
.cc.ho_so { background: var(--blue-l); color: var(--blue); font-weight: 600; }
.cc.ky { background: #f0e8ff; color: #6b3fc4; font-weight: 600; }
.cc.ed { cursor: pointer; box-shadow: inset 0 -1px 0 currentColor; }
/* Thanh tab của phân hệ (kiểu Fastwork) */
.mtabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 16px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); position: sticky; top: 66px; z-index: 15; }
.mtabs::-webkit-scrollbar { display: none; }
.mtabs a { white-space: nowrap; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.mtabs a:hover { color: var(--text); background: var(--hover); }
.mtabs a.active { background: var(--m-l); color: var(--m-d); font-weight: 600; box-shadow: inset 0 -2px 0 var(--m); }
.mtabs .count { margin: 0; }
/* Lưới ứng dụng trên trang chủ */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.app { display: flex; flex-direction: column; gap: 8px; padding: 14px; color: var(--text); margin: 0; transition: transform .12s, box-shadow .12s; }
.app:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,24,40,.08); }
.app .ai { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--ac, var(--brand)); }
.app b { font-size: 14.5px; } .app span.muted { font-size: 12px; line-height: 1.35; }
@media (max-width: 900px) {
  .mtabs { top: 56px; margin: 0 -14px 14px; border-radius: 0; border-left: 0; border-right: 0; }
  .apps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .app { padding: 10px 4px; align-items: center; text-align: center; background: transparent; border: 0; box-shadow: none; }
  .app .ai { width: 48px; height: 48px; border-radius: 14px; }
  .app b { font-size: 12px; font-weight: 500; } .app span.muted { display: none; }
}
/* Biểu mẫu */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tpl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 14px; transition: border-color .15s, background .15s; }
.tpl:hover { border-color: var(--brand); background: var(--brand-l); }
.tpl .dl { margin-left: auto; color: var(--muted); }
.ti { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.ti.doc { background: #2b579a; } .ti.xls { background: #1d6f42; width: 42px; height: 42px; }
.tpl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tpl-row pre:empty { display: none; }
@media (max-width: 900px) { .tpl-row .btn { flex: 1; } }
/* Bộ lọc công ty / đơn vị */
.scope-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; border: 1px solid var(--line2); background: var(--card); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.scope-btn span:not(.caret) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-btn.on { background: var(--brand-l); border-color: #b9e0cd; color: var(--brand-d); }
.scope-btn .caret { color: var(--muted); font-size: 11px; }
.scope-panel { position: fixed; z-index: 60; width: 360px; max-width: calc(100vw - 16px); max-height: 70vh; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; }
.scope-panel input { margin-bottom: 6px; }
.sc-list { overflow-y: auto; }
.sc-item { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-item:hover { background: var(--hover); }
.sc-item.on { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.sc-item.sc-co { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.scope-note { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--brand-d); background: var(--brand-l); border-radius: 99px; padding: 3px 10px; }
@media (max-width: 900px) { .scope-btn { max-width: 150px; padding: 5px 10px; font-size: 12.5px; } .user-chip .avatar { display: none; } }
body:not(.has-scope) .scope-note { display: none; }
.tree { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tree-row { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tree-row:last-child { border-bottom: 0; }
.tree-row:hover { background: var(--hover); }
.tree-row a { padding: 2px 6px; border-radius: 6px; color: var(--muted); }
.tree-row a:hover { background: var(--brand-l); color: var(--brand-d); }
@media (max-width: 600px) { .scope-panel { left: 8px !important; right: 8px !important; width: auto; } }
/* Chế độ lương */
.pol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 12px; align-items: start; }
.pol { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--text); margin: 0; font-weight: 400; }
.pol:has(input:checked) { border-color: #9fd3bb; background: var(--brand-l); }
.pol input { margin-top: 3px; width: auto; flex: none; }
.pol span { display: flex; flex-direction: column; gap: 2px; }
.pc-table td { padding: 4px 6px; } .pc-table input:not([type=checkbox]) { padding: 6px 8px; font-size: 14px; }
.pc-table td:nth-child(2) input, .pc-table td:nth-child(5) input { width: 130px; }
/* Mẫu bảng lương */
.tpl-cols { display: grid; gap: 6px; }
.tpl-col { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.tpl-col.off { background: var(--hover); opacity: .75; }
.tpl-col.cus { border-color: #b9d6f5; background: #f5f9ff; }
.tpl-col > input[type=checkbox] { margin-top: 12px; }
.tpl-col .grow input[data-f=label] { font-weight: 600; }
.tpl-col .row { gap: 8px; margin-top: 6px; }
.tpl-col select.inline { padding: 5px 8px; font-size: 13px; }
.tpl-btns { display: flex; gap: 4px; flex: none; }
.mono { font-family: ui-monospace, Consolas, monospace; margin-top: 6px; }
.cell-in { width: 110px; padding: 4px 6px; text-align: right; font-size: 13px; border-color: #b9d6f5; background: #f5f9ff; }
.payroll-table td, .payroll-table th { font-size: 13px; padding: 7px 8px; }
.tpl-cols { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.tpl-col { padding: 5px 8px; align-items: center; }
.tpl-col > input[type=checkbox] { margin-top: 0; }
.tpl-col .grow.sys { display: flex; gap: 8px; align-items: center; }
.tpl-col .grow.sys input { padding: 5px 8px; font-size: 14px; }
.tpl-col .grow.sys .muted { white-space: nowrap; font-size: 11.5px; }
.tpl-col.cus { grid-column: 1 / -1; align-items: flex-start; }
@media (max-width: 900px) { .tpl-cols { grid-template-columns: 1fr; } }
/* Hộp thoại in */
.col-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.col-picks label { font-size: 13px; font-weight: 400; color: var(--text); white-space: nowrap; }
.print-form .sg { margin-bottom: 6px; flex-wrap: nowrap; }

/* ---------- Ảnh bìa phân hệ ---------- */
.mhero { position: relative; overflow: hidden; border-radius: 18px; padding: 18px 22px; margin: 2px 0 14px; color: #fff; display: flex; align-items: center; gap: 16px; min-height: 92px;
  background: radial-gradient(circle at 88% 18%, rgba(255,255,255,.16) 0 54px, transparent 55px), radial-gradient(circle at 99% 120%, rgba(255,255,255,.12) 0 120px, transparent 121px), radial-gradient(circle at 70% 140%, rgba(255,255,255,.08) 0 70px, transparent 71px),
    linear-gradient(118deg, color-mix(in srgb, var(--m) 88%, #fff) 0%, var(--m) 42%, color-mix(in srgb, var(--m) 58%, #06140d) 100%);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--m) 26%, transparent); }
.mhero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(rgba(255,255,255,.16) 1px, transparent 1.5px) 0 0 / 14px 14px; -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); mask-image: linear-gradient(90deg, transparent 30%, #000); pointer-events: none; }
.mhero > * { position: relative; z-index: 1; }
.mh-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); backdrop-filter: blur(4px); }
.mh-kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.mhero h1 { color: #fff; margin: 0; font-size: 23px; line-height: 1.25; }
.mh-desc { font-size: 13.5px; opacity: .85; margin-top: 2px; }
.mh-art { position: absolute !important; right: 26px; top: 50%; transform: translateY(-50%) rotate(-12deg); opacity: .16; z-index: 0 !important; }
.mhero .mh-side { margin-left: auto; text-align: right; font-size: 13px; opacity: .92; }
.mhero .mh-side b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.mhero.home { min-height: 120px; }
.mhero.home .btn.primary { background: #fff; color: #12603f; border-color: #fff; font-weight: 700; }
@media (min-width: 901px) { body.authed .page-title { visibility: hidden; } }
@media (max-width: 900px) {
  .mhero { padding: 14px 16px; min-height: 0; border-radius: 14px; gap: 12px; margin-top: 4px; }
  .mhero:not(.home) .mh-kicker, .mhero:not(.home) .mh-desc { display: none; }
  .mhero h1 { font-size: 18px; } .mh-ico { width: 40px; height: 40px; border-radius: 12px; }
  .mh-art { right: 10px; } .mh-art svg { width: 76px; height: 76px; }
}
/* Thẻ, số liệu theo màu phân hệ */
.stat { position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--m-l); }
.stat > * { position: relative; z-index: 1; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card > h2:first-child::before { content: ''; width: 4px; height: 16px; border-radius: 4px; background: var(--m); flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--m); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 18%, transparent); }

/* ---------- Bảng chọn giao diện ---------- */
.theme-panel { position: fixed; z-index: 60; width: 340px; max-width: calc(100vw - 16px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px; }
.theme-panel h2 { margin-bottom: 10px; }
.th-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.th-opt { border: 2px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer; background: var(--card); color: var(--text); font: inherit; text-align: left; }
.th-opt.on { border-color: var(--m); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 20%, transparent); }
.th-prev { height: 58px; display: grid; grid-template-columns: 28% 1fr; }
.th-prev i { display: block; }
.th-prev span { position: relative; }
.th-prev span::before { content: ''; position: absolute; left: 8px; right: 8px; top: 8px; height: 16px; border-radius: 5px; background: var(--pm, #1a7f5a); }
.th-prev span::after { content: ''; position: absolute; left: 8px; right: 30%; top: 30px; height: 18px; border-radius: 5px; background: var(--pc, #fff); }
.th-opt b { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 9px; }
.th-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13.5px; }
.th-row label { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13.5px; }

/* ---------- Chủ đề ---------- */
:root[data-theme="dai-duong"] { --side-a: #0d2440; --side-b: #071629; --side-text: rgba(220,232,250,.76); --side-muted: #7f97b8; --bg: #f2f6fb; --bg-dots: rgba(16,40,80,.05); }
:root[data-theme="hoang-hon"] { --side-a: #3b1d2e; --side-b: #23101b; --side-text: rgba(250,226,232,.78); --side-muted: #b08a9a; --bg: #fbf5f1; --bg-tint: 11%; --bg-dots: rgba(80,30,20,.05); }
:root[data-theme="tinh-te"] { --side-a: #ffffff; --side-b: #fbfcfc; --side-text: #4a5650; --side-strong: #10201a; --side-muted: #8b978f; --side-hover: #f1f4f2; --side-border: #e5eae7; --bg: #f6f7f8; --bg-tint: 6%; --bg-dots: rgba(0,0,0,.035); }
:root[data-theme="tinh-te"] .nav a.active { color: var(--m-d); }
:root[data-theme="tinh-te"] .nav a.active .ico, :root[data-theme="tinh-te"] .nav a.active::before { color: var(--m); background: var(--m); }
:root[data-theme="tinh-te"] .nav a.active .ico { background: none; }
:root[data-theme="ban-dem"] {
  color-scheme: dark;
  --bg: #0e1512; --card: #151f1a; --text: #e3ece7; --muted: #93a39a; --line: #24312a; --line2: #33433a; --soft: #1d2923; --hover: #1a2620; --th: #1a2520; --label: #b3c2b9;
  --brand-l: #173528; --red-l: #3a1d1a; --orange-l: #3a2a14; --blue-l: #18263f; --brand-d: #6fdcae; --red: #f0796c; --orange: #f0a64b; --blue: #7fa8f5;
  --side-a: #0b110e; --side-b: #070b09; --side-border: #1c2721; --bg-tint: 13%; --bg-dots: rgba(255,255,255,.035);
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  --m-d: color-mix(in srgb, var(--m) 55%, #fff); --m-l: color-mix(in srgb, var(--m) 20%, var(--card));
}
:root[data-theme="ban-dem"] .btn { box-shadow: none; }
:root[data-theme="ban-dem"] .btn:hover { background: var(--hover); border-color: var(--line2); }
:root[data-theme="ban-dem"] .btn.primary:hover { background: #12603f; }
:root[data-theme="ban-dem"] .cell.fix, :root[data-theme="ban-dem"] .cc.ky { background: #2a2040; color: #c3a8f5; }
:root[data-theme="ban-dem"] .st.warnbg, :root[data-theme="ban-dem"] .cell.off { background: #3a3014; color: #f0c85b; }
:root[data-theme="ban-dem"] .viol-card { background: var(--card); border-color: #4a2622; }
:root[data-theme="ban-dem"] .tpl-col.cus, :root[data-theme="ban-dem"] .cell-in { background: #17233a; border-color: #2c3f63; }
:root[data-theme="ban-dem"] .toast { background: #e3ece7; color: #0e1512; }
:root[data-theme="ban-dem"] code { background: var(--soft); }
:root[data-theme="ban-dem"] .avatar { background: #1d3a2d; color: #8fe0bd; }
:root[data-theme="ban-dem"] .dropdown .menu { border: 1px solid var(--line); }
:root[data-theme="ban-dem"] img.thumb { opacity: .9; }
@media print { body.authed { background: #fff !important; } .mhero, .theme-panel { display: none !important; } }

/* ---------- Menu trái: phân hệ mở ra danh sách tab ---------- */
.nav-close { display: none; margin-left: auto; color: inherit; }
.nav .lb { flex: 1; min-width: 0; }
.nav-exp { margin: -6px -6px -6px 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; opacity: .75; transition: transform .2s, background .15s; flex: none; }
.nav-exp:hover { background: var(--side-hover); opacity: 1; }
.nav-exp svg { width: 18px; height: 18px; }
.nav-grp.open .nav-exp { transform: rotate(180deg); }
.nav .count + .nav-exp { margin-left: 4px; }
.nav-sub { display: none; margin: 0 0 4px 22px; padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--side-text) 25%, transparent); }
.nav-grp.open .nav-sub { display: block; }
.nav-sub a { padding: 6px 10px; font-size: 13.5px; font-weight: 400; }
.nav-sub a.on { color: var(--side-strong); font-weight: 600; background: var(--side-hover); }
.nav-sub a.on::before { display: none; }
/* Điện thoại: menu kéo ra toàn màu, chữ in hoa, mỗi mục một dòng lớn */
@media (max-width: 900px) {
  .sidebar { --dr: #55b794; width: min(86vw, 360px); left: calc(-1 * min(86vw, 360px) - 20px); padding: 0 0 calc(24px + var(--safe-b)); background: var(--dr); color: #fff; border: 0; box-shadow: 8px 0 30px rgba(0,0,0,.18); }
  :root[data-theme="ban-dem"] .sidebar { --dr: color-mix(in srgb, var(--m) 45%, #0b110e); }
  :root[data-theme="dai-duong"] .sidebar { --dr: #4c8cc6; }
  :root[data-theme="hoang-hon"] .sidebar { --dr: #c27387; }
  .sidebar .logo { padding: max(14px, env(safe-area-inset-top)) 10px 14px 18px; color: #fff; position: sticky; top: 0; background: var(--dr); z-index: 2; }
  .sidebar .logo small { color: rgba(255,255,255,.8); }
  .nav-close { display: grid; color: #fff; }
  .nav-close:hover { background: rgba(255,255,255,.15); }
  .nav { border-top: 2px solid rgba(255,255,255,.9); }
  .nav-grp { border-bottom: 2px solid rgba(255,255,255,.9); }
  .nav a { color: #fff; border-radius: 0; margin: 0; }
  .nav-grp > a { padding: 17px 16px 17px 20px; font-size: 15.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; gap: 12px; }
  .nav-grp > a:hover, .nav a.active { background: rgba(255,255,255,.14); color: #fff; }
  .nav a.active::before { left: 0; top: 0; bottom: 0; width: 5px; border-radius: 0; background: #fff; }
  .nav a.active .ico, .nav .ico { color: #fff; }
  .nav-exp { opacity: 1; width: 40px; height: 40px; margin: -10px -6px -10px 0; }
  .nav-exp svg { width: 26px; height: 26px; stroke-width: 3; }
  /* Phân hệ đang mở: dòng tiêu đề xanh nhạt, các tab nền sáng chữ đậm in hoa */
  .nav-grp.open > a, .nav-grp.open > a.active { background: #a9cfe6; color: #fff; }
  .nav-grp.open > a.active::before { display: none; }
  .nav-sub { margin: 0; padding: 0; border: 0; background: #f3f4f4; }
  .nav-sub a { padding: 16px 20px 16px 26px; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #1d2723; border-bottom: 3px solid #fff; }
  .nav-sub a:last-child { border-bottom: 0; }
  .nav-sub a:hover { background: #e9eded; color: #1d2723; }
  .nav-sub a.on { background: #e1eef6; color: #0f4c75; box-shadow: inset 5px 0 0 #5aa3cf; }
  .nav-sub .count { background: var(--m); color: #fff; }
  :root[data-theme="ban-dem"] .nav-grp.open > a { background: #2c4f63; }
  :root[data-theme="ban-dem"] .nav-sub { background: var(--card); }
  :root[data-theme="ban-dem"] .nav-sub a { color: var(--text); border-color: var(--bg); }
  :root[data-theme="ban-dem"] .nav-sub a:hover { background: var(--hover); color: var(--text); }
  :root[data-theme="ban-dem"] .nav-sub a.on { background: #18263f; color: #9cc4f0; }
  .nav-sep { color: rgba(255,255,255,.85); padding: 18px 20px 8px; font-size: 11.5px; border-bottom: 2px solid rgba(255,255,255,.9); }
  #nav-logout { padding: 17px 20px; font-size: 15.5px; font-weight: 700; text-transform: uppercase; border-bottom: 2px solid rgba(255,255,255,.9); }
  .count { background: #fff; color: var(--m-d); }
}
