[hidden] { display: none !important; }
:root {
  --bg: #f5f7fa; --panel: #fff; --text: #1f2933; --muted: #616e7c; --line: #e4e7eb; --brand: #1d5fd1; --brand-2: #e8f0fe;
  --ok: #18794e; --ok-bg: #e3f6ec; --warn: #a15c00; --warn-bg: #fff4dc; --bad: #c62a2a; --bad-bg: #fde8e8; --radius: 10px;
  --nav-w: 232px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.12rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Bố cục */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--nav-w); background: #102a43; color: #d9e2ec; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { padding: 16px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #243b53; }
.brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: #fff; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: #d9e2ec; border-left: 3px solid transparent; }
.nav a:hover { background: #243b53; text-decoration: none; }
.nav a.active { background: #243b53; color: #fff; border-left-color: #63a4ff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav-foot { margin-top: auto; padding: 12px 16px; font-size: .85rem; border-top: 1px solid #243b53; }
.nav-foot a, .nav-foot button { color: #bcccdc; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { padding: 20px 24px 60px; max-width: 1240px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.demo-banner { background: #ffe58f; color: #613400; text-align: center; padding: 6px; font-weight: 600; font-size: .9rem; }

/* Thẻ, lưới */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.bad .value { color: var(--bad); } .stat.ok .value { color: var(--ok); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr.void td { color: #9aa5b1; text-decoration: line-through; }
tfoot td { font-weight: 700; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-plain li:last-child { border-bottom: 0; }

/* Huy hiệu */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef2f7; color: #3e4c59; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--brand-2); color: var(--brand); }

/* Thông báo */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: #0f5132; border-color: #b7e4c7; }
.alert.error { background: var(--bad-bg); color: #842029; border-color: #f5c2c7; }
.alert.warn { background: var(--warn-bg); color: #664d03; border-color: #ffe69c; }
.alert.info { background: var(--brand-2); color: #0b3d91; border-color: #c4d7fb; }

/* Form */
form.stack > * + * { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .lbl { font-weight: 600; font-size: .9rem; }
.field .hint, .hint { color: var(--muted); font-size: .82rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cbd2d9; border-radius: 8px; font: inherit; background: #fff; min-height: 40px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ff; border-color: var(--brand); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid #cbd2d9; background: #fff; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #f0f4f8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: #174ea9; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f1a7a7; } .btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .86rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 10px; background: #fff; }

/* Tabs đơn giản bằng neo */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 12px; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--brand); border-bottom: 2px solid var(--brand); }

/* Điểm danh */
.att-row { display: grid; grid-template-columns: minmax(160px, 1.3fr) 2.4fr 90px 1.6fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #cbd2d9; border-radius: 8px; overflow: hidden; }
.seg label { padding: 7px 10px; cursor: pointer; font-size: .88rem; border-right: 1px solid #cbd2d9; user-select: none; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { font-weight: 700; }
.seg label.present:has(input:checked) { background: var(--ok-bg); color: var(--ok); }
.seg label.excused:has(input:checked) { background: var(--warn-bg); color: var(--warn); }
.seg label.unexcused:has(input:checked) { background: var(--bad-bg); color: var(--bad); }
.seg label.unmarked:has(input:checked) { background: #eef2f7; }
.sticky-save { position: sticky; bottom: 0; background: var(--panel); padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; z-index: 2; }

/* Lịch tuần */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 120px; padding: 8px; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day h3 { margin: 0 0 6px; font-size: .88rem; }
.sess { display: block; border-radius: 6px; padding: 6px 7px; margin-bottom: 6px; font-size: .82rem; background: var(--brand-2); color: #0b3d91; }
.sess:hover { text-decoration: none; filter: brightness(.97); }
.sess.completed { background: var(--ok-bg); color: #0f5132; }
.sess.cancelled { background: #f1f3f5; color: #9aa5b1; text-decoration: line-through; }
.sess.pending { background: var(--warn-bg); color: #664d03; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: 8px 0 8px 36px; position: relative; border-bottom: 1px dashed var(--line); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; width: 26px; height: 26px; border-radius: 50%; background: #eef2f7; text-align: center; line-height: 26px; font-weight: 700; font-size: .85rem; }
.steps li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.calc { background: #fafbfc; border: 1px dashed #cbd2d9; border-radius: 8px; padding: 10px 12px; font-size: .92rem; }
.calc table td, .calc table th { padding: 6px 8px; }
.big-total { font-size: 1.25rem; font-weight: 800; }
.msg-box { white-space: pre-wrap; font-family: inherit; min-height: 200px; }

/* Đăng nhập */
.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }

@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: #102a43; color: #fff; padding: 10px 12px; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.4rem; line-height: 1; padding: 4px 8px; }
  .topbar a { color: #fff; font-weight: 700; }
  .content { padding: 14px 12px 70px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .stats.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: 0; }
  .att-row { grid-template-columns: 1fr; gap: 6px; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .seg label { border-bottom: 1px solid #cbd2d9; text-align: center; padding: 9px 6px; }
  .seg label:nth-child(2n) { border-right: 0; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.responsive td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 6px; text-align: right; }
  table.responsive td::before { content: attr(data-l); color: var(--muted); font-size: .82rem; text-align: left; font-weight: 600; }
  table.responsive td.num { justify-content: space-between; }
  table.responsive tfoot { display: block; }
}
@media print {
  .sidebar, .topbar, .no-print, .demo-banner { display: none !important; }
  body { background: #fff; } .content { padding: 0; } .card { border: 0; }
}
