:root {
  --brand: #0f7a4a; --brand-2: #12965b; --brand-soft: #e3f4ea; --brand-ink: #0b5c38;
  --bg: #f4f6f5; --surface: #ffffff; --surface-2: #f8faf9; --border: #e2e8e5; --border-2: #cfd8d3;
  --text: #17211c; --muted: #64706a; --faint: #93a09a;
  --warn: #b45309; --warn-bg: #fff4e0; --danger: #c0392b; --danger-bg: #fdecea; --ok: #15803d; --ok-bg: #e5f6ea; --info: #1d4ed8; --info-bg: #e8effd;
  --shadow: 0 1px 2px rgba(16, 40, 28, .05), 0 4px 16px rgba(16, 40, 28, .05);
  --shadow-lg: 0 10px 40px rgba(16, 40, 28, .18);
  --r: 12px; --r-s: 8px;
  --side: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #2fb874; --brand-2: #3fd18a; --brand-soft: #143526; --brand-ink: #8ce3b6;
  --bg: #0e1412; --surface: #151d1a; --surface-2: #1a2420; --border: #26332e; --border-2: #33443d;
  --text: #e4ece8; --muted: #9aa9a2; --faint: #6f7d77;
  --warn: #f5b454; --warn-bg: #3a2a10; --danger: #f17b6e; --danger-bg: #3d1a17; --ok: #5ad48d; --ok-bg: #12301f; --info: #8db0ff; --info-bg: #17223d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.hi { color: var(--danger); }
.row { display: flex; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; } .gap { gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.push-right { margin-left: auto; }
.mt { margin-top: 12px; } .mb { margin-bottom: 14px; }
.pad { padding: 18px; } .pad-s { padding: 12px 14px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Khung ---------- */
#app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); padding: 4px 8px 18px; }
.brand b { display: block; font-size: 15px; } .brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.side-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; gap: 9px; align-items: center; min-width: 0; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; } .me small { color: var(--muted); font-size: 11.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 600; flex: none; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.main { margin-left: var(--side); padding: 22px 26px 60px; min-width: 0; }
.tabbar, .menu-scrim { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 10px 12px; margin-bottom: 12px; }
.toolbar > .grow { flex: 1 1 100%; }
@media (min-width: 1500px) { .toolbar > .grow { flex-basis: 0; } }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 48px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spin.sm { width: 13px; height: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.err-box { display: flex; gap: 12px; color: var(--danger); }

/* ---------- Nút & ô nhập ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
:root[data-theme="dark"] .btn-primary { color: #04210f; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.btn-ghost.danger, .menu .danger { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; } .btn-icon.btn-sm { width: 30px; }
.btn .count { background: #fff; color: var(--brand-ink); border-radius: 99px; font-size: 11.5px; font-weight: 700; padding: 0 7px; line-height: 19px; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 4px; font-size: 13px; }
.inp { height: 36px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--surface); padding: 0 11px; min-width: 0; }
textarea.inp { height: auto; padding: 8px 11px; resize: vertical; }
.inp:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
.search-inp { width: 200px; }
.week-picker { width: 42px; padding: 0 6px; color: transparent; cursor: pointer; }
.week-picker::-webkit-datetime-edit { display: none; }
.week-label { font-size: 15px; padding: 0 6px; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.f-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.f-hint { font-size: 12px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; line-height: 1.45; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.pill-check { border: 1px solid var(--border-2); border-radius: 99px; padding: 5px 11px 5px 8px; align-items: center; }
.pill-check input { margin: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio span { display: flex; flex-direction: column; } .radio small { font-size: 12px; }

/* ---------- Pills / chips / badges ---------- */
.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.pill { border: 1px solid var(--border-2); background: var(--surface); border-radius: 99px; padding: 7px 14px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.pill b { color: var(--text); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; } .pill.active b { color: #fff; }
:root[data-theme="dark"] .pill.active, :root[data-theme="dark"] .pill.active b { color: #04210f; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-btn { border: 0; background: none; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-weight: 500; white-space: nowrap; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chip-filter { --c: #888; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.chip-filter.active { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #888); display: inline-block; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { --c: #888; display: inline-flex; align-items: center; gap: 5px; background: color-mix(in srgb, var(--c) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); border-radius: 7px; padding: 2px 7px; font-size: 12.5px; line-height: 1.35; max-width: 100%; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip[draggable=true] { cursor: grab; } .chip.dragging { opacity: .4; }
.nolark { color: var(--warn); font-weight: 700; }
.nolark-tag { font-size: 11px; color: var(--warn); background: var(--warn-bg); border-radius: 5px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.sm { font-size: 10.5px; padding: 0 6px; margin-left: 6px; }
.tag { display: inline-block; font-size: 11.5px; border-radius: 5px; padding: 1px 6px; background: var(--brand-soft); color: var(--brand-ink); margin: 1px 3px 1px 0; white-space: nowrap; }
.tag.other { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-2); }
.tag.off { background: var(--warn-bg); color: var(--warn); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.empty { background: none; color: var(--faint); }
.alert { display: flex; gap: 9px; align-items: flex-start; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.alert .ic { margin-top: 2px; }
.alert-err { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ---------- Lưới lịch ---------- */
.status { display: flex; align-items: center; }
.saving { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.warn-wrap { margin-bottom: 10px; }
.warn-bar { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; cursor: pointer; flex-wrap: wrap; }
.warn-bar .muted { color: inherit; opacity: .85; }
.warn-bar.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; cursor: default; }
.warn-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.warn-list li { font-size: 13px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border-left: 3px solid var(--warn); }
.warn-list li.w-high { border-left-color: var(--danger); }
.grid-scroll { overflow: auto; border-radius: var(--r); }
.grid-wrap > .grid-scroll { border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); max-height: calc(100vh - 230px); }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); vertical-align: top; }
.grid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; padding: 9px 8px; text-align: left; font-weight: 500; }
.grid thead th.today { background: var(--brand-soft); }
.grid .corner { width: 150px; position: sticky; left: 0; z-index: 3; color: var(--muted); font-size: 12.5px; }
.d-name { font-weight: 600; font-size: 13px; } .d-date { color: var(--muted); font-size: 12px; } .d-count { font-size: 11px; color: var(--faint); }
.shift-h { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 10px; font-weight: 400; width: 150px; }
.shift-h b { font-size: 13.5px; display: inline-flex; gap: 5px; align-items: center; }
.grid td { padding: 4px; background: var(--surface); }
.grid td.today { background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.cell { min-height: 74px; height: 100%; border-radius: 8px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; border: 1px dashed transparent; transition: background .12s, border-color .12s; }
.cell:hover { background: var(--surface-2); border-color: var(--border-2); }
.cell.drop { border-color: var(--brand); background: var(--brand-soft); }
.cell.flagged { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent); }
.cell.dirty { position: relative; }
.cell.dirty::after { content: ''; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.cell-empty { color: var(--faint); font-size: 12px; display: flex; align-items: center; gap: 4px; margin: auto 0; }
.cell-foot { display: flex; gap: 6px; margin-top: auto; font-size: 11px; }
.q { font-size: 11px; font-weight: 600; border-radius: 5px; padding: 0 5px; }
.q.ok { color: var(--ok); background: var(--ok-bg); } .q.low { color: var(--warn); background: var(--warn-bg); }
.off-row .shift-h b { color: var(--warn); }
.hint { margin-top: 8px; font-size: 12px; color: var(--faint); }
/* theo nhân sự */
.grid.person { min-width: 1060px; }
.grid.person .corner, .p-name { width: 210px; }
.p-name { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 8px 10px; font-weight: 400; }
.p-name b { font-size: 13px; }
.group-row th { position: sticky; left: 0; background: var(--surface-2); text-align: left; padding: 6px 10px; font-size: 12.5px; font-weight: 600; }
.group-row th .dot { margin-right: 6px; }
.pcell { width: 100%; min-height: 44px; border: 1px dashed transparent; background: none; border-radius: 7px; cursor: pointer; text-align: left; padding: 4px; display: flex; flex-wrap: wrap; align-content: flex-start; }
.pcell:hover:not(.ro) { border-color: var(--border-2); background: var(--surface-2); }
.pcell.ro { cursor: default; opacity: .85; }
.grid td.conflict { background: var(--danger-bg); }
.sum-h, .sum { width: 82px; } .sum { padding: 8px !important; font-size: 12.5px; }
/* mobile theo ngày */
.day-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 10px; }
.day-tab { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; cursor: pointer; font-size: 11.5px; color: var(--muted); }
.day-tab b { font-size: 13px; color: var(--text); }
.day-tab.today { border-color: var(--brand); }
.day-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; } .day-tab.active b { color: #fff; }
.day-list { display: flex; flex-direction: column; gap: 10px; }
.day-shift { padding: 10px; } .ds-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.grid.compact { min-width: 860px; } .grid.compact td { padding: 6px; } .grid.compact .chip { font-size: 12px; }

/* ---------- Modal / ngăn kéo / popover ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 15, .38); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; transition: opacity .18s; padding: 16px; }
.overlay.in { opacity: 1; } .overlay.out { opacity: 0; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; transform: translateY(8px); transition: transform .18s; }
.modal.wide { width: min(820px, 100%); }
.overlay.in .modal { transform: none; }
.overlay-drawer { justify-content: flex-end; padding: 0; }
.drawer { background: var(--surface); width: min(460px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(30px); transition: transform .18s; }
.overlay.in .drawer { transform: none; }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--border); }
.m-head h3 { font-size: 17px; }
.m-body { padding: 14px 18px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.modal, .drawer { overflow: hidden; }
.m-body > *, .field, .stack > *, .form-grid > * { min-width: 0; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.popover { position: absolute; z-index: 120; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu { display: flex; flex-direction: column; }
.menu button { display: flex; gap: 9px; align-items: center; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.pmenu { display: flex; flex-direction: column; gap: 2px; }
.pm-head { padding: 6px 8px 8px; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pm-opt { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.pm-opt:hover { background: var(--surface-2); }
.pm-opt span { display: flex; flex-direction: column; } .pm-opt small { font-size: 11.5px; }
.pm-opt input { width: 17px; height: 17px; }
.pm-foot { display: flex; gap: 6px; justify-content: space-between; padding: 8px 4px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.quota { display: flex; flex-wrap: wrap; gap: 5px; }
.quota .q { font-size: 12px; padding: 2px 8px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 4px 4px; text-transform: uppercase; letter-spacing: .04em; background: none; border: 0; text-align: left; display: flex; align-items: center; gap: 4px; }
.pick-group.toggle { cursor: pointer; }
.pick { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%; }
.pick:hover { background: var(--surface-2); }
.pick.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.pick.ro { opacity: .55; cursor: not-allowed; }
.pick input { width: 18px; height: 18px; flex: none; }
.pick-main { display: flex; flex-direction: column; min-width: 0; }
.pick-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); align-items: center; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(460px, calc(100% - 32px)); }
.toast { display: flex; gap: 9px; align-items: flex-start; background: #17211c; color: #fff; padding: 11px 14px; border-radius: 11px; box-shadow: var(--shadow-lg); animation: tin .2s; font-size: 13.5px; }
.toast-err { background: #9b2c20; } .toast-warn { background: #8a5208; }
.toast .ic { margin-top: 2px; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.stats3, .stats4 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stat b { font-size: 26px; font-weight: 700; } .stat span { color: var(--muted); font-size: 12.5px; } .stat .ic { color: var(--brand); }
.stat.warn .ic, .stat.warn b { color: var(--warn); }

/* ---------- Trang khác ---------- */
.branch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.bcard { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bc-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.bc-head b { display: block; } .bc-head small { display: block; }
.bc-code { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12.5px; border-radius: 7px; padding: 4px 8px; }
.bc-shift { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.bc-s-head { display: flex; gap: 8px; align-items: baseline; }
.bc-shift.off { color: var(--warn); font-size: 13px; display: block; }
.sec-title { margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.table-card { overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.matrix td, .tbl.matrix th { text-align: center; padding: 7px; } .tbl.matrix tbody th { text-align: left; background: none; color: var(--text); font-weight: 500; }
.tbl.matrix input { width: 17px; height: 17px; }
.lark-cell { display: inline-flex; gap: 6px; align-items: center; border: 1px dashed var(--border-2); background: none; border-radius: 8px; padding: 4px 9px; cursor: pointer; color: var(--warn); font-size: 13px; }
.lark-cell.on { border-style: solid; color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.quota-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.att-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.att-row { display: flex; gap: 14px; align-items: center; padding: 10px 14px; flex-wrap: wrap; }
.att-who { display: flex; gap: 10px; align-items: center; min-width: 230px; }
.att-who b, .att-who small { display: block; }
.att-times { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex: 1; }
.att-times input[type=time] { width: 112px; }
details summary { cursor: pointer; font-weight: 500; }
.ho-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.ho { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ho.issue { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.ho-head { display: flex; gap: 8px; align-items: center; }
.ho-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.ho-grid small, .ho-grid b { display: block; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.login-brand { display: flex; gap: 12px; align-items: center; }
.login-brand h1 { font-size: 19px; } .login-brand p { color: var(--muted); font-size: 13px; }
.login-card .btn { height: 42px; }
.code-inp { height: 52px; font-size: 26px; letter-spacing: .5em; text-align: center; font-weight: 600; }
.login-foot { color: var(--faint); font-size: 12px; margin-top: 14px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 960px) {
  .main { padding: 18px 16px 90px; }
  .stats4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  :root { --side: 0px; }
  .sidebar { transform: translateX(-105%); width: 270px; transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .menu-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 25; }
  .main { margin-left: 0; padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 10.5px; padding: 4px 0; border-radius: 9px; }
  .tabbar a.active { color: var(--brand); background: var(--brand-soft); }
  h1 { font-size: 19px; }
  .page-head { margin-bottom: 10px; }
  .page-head > div:first-child p { display: none; }
  .page-head .btn span { display: none; } .page-head .btn { padding: 0 10px; }
  .page-head .btn-primary span { display: inline; }
  .toolbar { gap: 8px; }
  .search-inp { width: 100%; }
  .form-grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .stats3 { grid-template-columns: 1fr 1fr 1fr; } .stat b { font-size: 20px; }
  .grid-wrap > .grid-scroll { max-height: none; }
  .grid.person { min-width: 760px; }
  .grid.person .corner, .p-name { width: 118px; }
  .p-name { padding: 6px; } .p-name b { font-size: 12px; }
  .nolark-tag { display: none; }
  .week-label { font-size: 14px; }
  .modal { max-height: calc(100vh - 24px); }
  .overlay:not(.overlay-drawer) { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; width: 100%; }
  .drawer { width: 100%; }
  .quota-grid { grid-template-columns: 1fr 1fr; }
  .att-who { min-width: 0; }
  .ho-list, .branch-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .tabbar, .toolbar, .page-head .row, .warn-wrap, .hint { display: none !important; }
  .main { margin: 0; padding: 0; }
  .grid-wrap > .grid-scroll { max-height: none; overflow: visible; box-shadow: none; }
}
