:root {
  --bg: #f4f6f9; --panel: #ffffff; --text: #1b2430; --muted: #6b7686; --line: #e2e7ee;
  --brand: #0b6bcb; --brand-ink: #ffffff; --ok: #1e8e3e; --warn: #b26a00; --bad: #c62828; --chip: #eef3fa;
  --r: 10px; --sh: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --panel: #1a2029; --text: #e6ebf1; --muted: #93a0b0; --line: #2a323e;
          --brand: #4c9bf0; --brand-ink: #0b1220; --chip: #222a36; --sh: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 18px; }
.login { width: 100%; max-width: 360px; }
.login h1 { margin: 8px 0 2px; font-size: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo img { width: 28px; height: 28px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
input, select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.pri { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; }
.ac-i { padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; }
.ac-i span { font-size: 12px; }
.ac-i.on, .ac-i:hover { background: var(--chip); }
.full { width: 100%; justify-content: center; margin-top: 16px; }
.err { color: var(--bad); margin-top: 10px; min-height: 1em; }
.okmsg { color: var(--ok); }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side .logo { padding: 4px 8px 14px; }
.nav { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); cursor: pointer; }
.nav:hover { background: var(--chip); }
.nav.on { background: var(--chip); color: var(--brand); font-weight: 600; }
.side .me { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.main { padding: 22px 26px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head h2 { margin: 0; font-size: 20px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat .n { font-size: 26px; font-weight: 600; }
.stat .l { color: var(--muted); font-size: 12px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
tr:hover td { background: color-mix(in srgb, var(--chip) 60%, transparent); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; margin: 1px 2px 1px 0; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > div { flex: 1 1 160px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--text); padding: 20px; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; opacity: 0;
  transition: opacity .2s; pointer-events: none; max-width: 80vw; }
.toast.show { opacity: 1; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .d { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 58px; background: var(--panel); font-size: 12px; }
.cal .d .dn { color: var(--muted); }
.cal .d.off { opacity: .45; }
.cal .d.miss { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.cal .h { font-size: 11px; color: var(--muted); text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .side .logo, .side .me { display: none; }
  .main { padding: 16px; }
  .cal .d { min-height: 46px; padding: 4px; }
}

/* Book giờ */
table.book td { padding: 6px 6px; }
table.book input { padding: 6px 8px; }
table.luoi { font-size: 12px; }
table.luoi th, table.luoi td { padding: 4px 6px; white-space: nowrap; }
table.luoi .c { text-align: center; }
table.luoi th.ng { cursor: pointer; text-align: center; font-weight: 500; }
table.luoi th.ng:hover { color: var(--brand); }
table.luoi th.ng.on { background: var(--chip); color: var(--brand); }
table.luoi th.cn { opacity: .5; }
table.luoi td.thieu { color: var(--warn); }
table.luoi tfoot td { border-top: 2px solid var(--line); }
b.err { color: var(--bad); }
