/* Hallmark · v2.0.0 · shape: app screen · scope: app · theme: project's own (unslop direction "sổ đầu bài", accent = logo blue #1E6DB5) · signature: weekly timetable in the Lớp & Lịch học page */
/* Hallmark · answered F7: buttons and inputs share the 8px control radius on purpose (one control recipe in an app screen); cards 12px, panels 16px */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V3 · weakest: V, shell reused from the existing app by design; the new screens carry the timetable as the one object this tool is known by */
/* styles.css — giao diện chung Olym Platform.
 * Hướng thiết kế: ngăn nắp, ấm, đáng tin — như sổ đầu bài. Nền xám trung tính, một màu nhấn (--accent = xanh logo),
 * dấu ấn riêng: "lề đỏ vở ô li" (--margin-red) — CHỈ dùng cho mục menu đang chọn + tiêu đề trang.
 * Mọi màu / font đi qua biến ở :root. Đổi màu thương hiệu: sửa --accent / --accent-strong / --accent-soft.
 * Khoảng cách theo lưới 4px. Chữ và nút không sát viền: ≥ 16px máy tính, ≥ 12px điện thoại.
 */
:root {
  /* Nền & chữ (xám trung tính) */
  --bg: #f7f7f8;
  --surface: #fdfdfe;
  --raised: #f0f1f3;
  --text: #16181d;
  --text-2: #4f5560;
  --muted: #6b707b;
  --line: rgba(22, 24, 29, .09);
  --line-strong: rgba(22, 24, 29, .16);

  /* Màu thương hiệu — xanh của logo trung tâm (#1E6DB5, chữ trắng trên nền này đạt 5,4:1) */
  --accent: #1e6db5;
  --accent-strong: #185892;
  --accent-soft: rgba(30, 109, 181, .1);
  --margin-red: #c8483d;

  /* Màu mang nghĩa */
  --positive: #16a34a;
  --negative: #c62828;
  --negative-soft: #fdeeee;
  --positive-soft: #ecf7f0;

  --r-sm: 6px;
  --r-control: 8px;
  --r-card: 12px;
  --r-panel: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, .08);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --on-accent: #f8fbff;
  --row-hover: #fafafb;
  --input-hover: rgba(22, 24, 29, .28);
  --scrim: rgba(16, 18, 24, .4);
  --positive-text: #166534;
  --waiting: #b45309;
  --waiting-soft: #fdf3e6;
  --waiting-text: #8a4508;
  --skeleton: #eceef1;
  --today: rgba(30, 109, 181, .05);
  --dur-micro: 120ms;
  --dur-short: 180ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body {
  font: 400 14px/20px var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; overflow-wrap: break-word; min-width: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 16px; line-height: 24px; }
h3 { font-size: 14px; line-height: 20px; }
p { margin: 0; }
strong { font-weight: 600; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Biểu tượng (lucide, 16px, nét 1.5) ── */
.icon { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }

/* ── Nút ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease), border-color var(--dur-short) var(--ease), transform var(--dur-micro) var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.98); }
.btn .icon { color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-primary .icon { color: var(--on-accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); }
.btn-sm { height: 32px; padding: 0 12px; }
.btn-lg { height: 44px; }
.btn:disabled { background: var(--raised); border-color: var(--line); color: var(--text-2); cursor: not-allowed; transform: none; }
.btn:disabled .icon { color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── Ô nhập ── */
label.field, div.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 500; margin-bottom: 8px; }
label.field small { display: block; color: var(--muted); font-size: 13px; line-height: 20px; margin-top: 4px; }
input[type=text], input[type=password], input[type=tel], input[type=search], input[type=email], input[type=url], input[type=date], input[type=time], input[type=number], input[type=month], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-control);
  transition: border-color var(--dur-short) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--input-hover); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 0; border-color: var(--accent); }
input:disabled, select:disabled { background: var(--raised); color: var(--text-2); opacity: .55; cursor: not-allowed; }
textarea { height: auto; min-height: 64px; padding: 8px 12px; line-height: 20px; resize: vertical; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.check-list label, label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
label.check { margin-bottom: 4px; }
small.hint { display: block; margin: 0 0 0 24px; color: var(--muted); font-size: 13px; line-height: 20px; }

.msg { padding: 12px 16px; border-radius: var(--r-control); margin-bottom: 16px; }
.msg-error { background: var(--negative-soft); color: var(--negative); }
.msg-ok { background: var(--positive-soft); color: var(--positive-text); }

/* ── Logo ── */
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--text); text-decoration: none; }
.wordmark img { height: 36px; width: auto; display: block; }
.wordmark-label { padding-left: 12px; border-left: 1px solid var(--line-strong); font-size: 14px; font-weight: 500; color: var(--text-2); }
.wordmark-lg img { height: 56px; }

/* ── Trang đăng nhập ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow-sm); padding: 32px;
}
.auth-card .wordmark { margin-bottom: 32px; }
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 24px; }
.auth-card .btn-primary { width: 100%; margin-top: 8px; }

/* ── Khung ứng dụng ── */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-text { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 16px; }
.who-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.who-role { color: var(--muted); font-size: 12px; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { padding: 0 12px; margin: 24px 0 8px; font-size: 12px; line-height: 16px; color: var(--muted); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: var(--r-control); color: var(--text-2); text-decoration: none; font-weight: 500;
  transition: background-color var(--dur-short) var(--ease), color var(--dur-short) var(--ease);
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--raised); color: var(--text); }
/* Dấu ấn "lề đỏ": mục đang chọn */
.nav-item.active { background: var(--raised); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--margin-red);
}
.nav-item.active .icon { color: var(--text); }
.nav-item.soon { color: var(--muted); cursor: default; font-weight: 400; }
.nav-item.soon:hover { background: transparent; color: var(--muted); }
.nav-item .soon-note { margin-left: auto; font-size: 12px; color: var(--muted); }
.sidebar-foot { margin-top: auto; padding: 16px 12px 0; font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; max-width: 1440px; padding: 32px 32px 64px; }
.main-foot { display: none; }

/* Dấu ấn "lề đỏ": tiêu đề trang */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { padding-left: 12px; border-left: 2px solid var(--margin-red); }
.page-title p { margin-top: 4px; color: var(--text-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 24px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head > a { white-space: nowrap; }
.section { margin-top: 32px; }

/* ── Tổng quan ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 20px 24px; }
.stat-label { color: var(--text-2); }
.stat-value { margin-top: 8px; font-size: 28px; line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat-note { margin-top: 4px; color: var(--muted); font-size: 13px; }
.overview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }

.bars { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 8px 16px; }
.bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-name .muted { margin-left: 4px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-row.off .bar-fill { background: var(--line-strong); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.list .step { font-size: 12px; color: var(--muted); white-space: nowrap; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-weight: 500; }

/* ── Bảng ── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { height: 56px; padding: 8px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { height: 40px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--bg); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--dur-short) var(--ease); }
tbody tr:hover { background: var(--row-hover); }
tr.row-off td { color: var(--muted); }
td.nowrap { white-space: nowrap; }
td.actions { width: 1%; white-space: nowrap; text-align: right; }
.cell-sub { font-size: 13px; color: var(--muted); }
.empty { padding: 32px 24px; color: var(--muted); text-align: center; }

.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--text-2); }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--positive); }
.status.off { color: var(--muted); }
.status.off::before { background: var(--line-strong); }
.status.wait::before { background: var(--waiting); }
.status.bad::before { background: var(--negative); }

/* ── Hộp thoại ── */
.modal-back {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px; overflow-y: auto; animation: fade 180ms var(--ease);
}
.modal {
  width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-float); padding: 24px;
  animation: rise 220ms var(--ease);
}
.modal h2 { font-size: 18px; line-height: 28px; margin-bottom: 20px; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ── Thanh lọc, tab ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.toolbar select { width: auto; min-width: 160px; }
.toolbar input[type=month] { width: auto; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; display: inline-flex; align-items: center; height: 40px; padding: 0 12px; color: var(--text-2);
  text-decoration: none; font-weight: 500; white-space: nowrap; transition: color var(--dur-short) var(--ease); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; color: var(--text-2); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--text); }
.btn-icon { width: 32px; padding: 0; }
.btn-danger { background: var(--negative); border-color: var(--negative); color: var(--on-accent); }
.btn-danger:hover { filter: brightness(.92); }

/* ── Trạng thái vùng dữ liệu: đang tải / trống / lỗi ── */
.region { min-height: 96px; }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card .skeleton, .card-flush .skeleton { border: 0; }
.sk-line { height: 12px; border-radius: 6px; background: var(--skeleton); }
.state { padding: 32px 24px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card .state { border: 0; }
.state-title { font-weight: 500; }
.state-text { margin: 4px auto 0; max-width: 46ch; color: var(--text-2); }
.state .btn { margin-top: 16px; }
.table-note { margin-top: 12px; color: var(--text-2); font-size: 13px; }

/* ── Bố cục trang chi tiết ── */
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.split-wide { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 20px 24px 0; margin-bottom: 12px; }
.card-flush table th { background: var(--bg); }
.card-tools { display: flex; align-items: center; gap: 12px; }
.table-scroll { overflow-x: auto; }
.list-pad { padding: 4px 24px 20px; }
.pre { white-space: pre-wrap; }
.row-link { color: var(--text); font-weight: 500; text-decoration: none; }
.row-link:hover { color: var(--accent); text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--r-sm); background: var(--raised);
  color: var(--text); text-decoration: none; font-size: 13px; white-space: nowrap; }
.chip:hover { background: var(--accent-soft); color: var(--accent-strong); }
.chip .muted { margin-left: 4px; }
details.gone { border-top: 1px solid var(--line); }
details.gone summary { padding: 16px 24px; cursor: pointer; color: var(--text-2); }
details.gone summary:hover { color: var(--text); }

/* ── Lịch tuần (sổ đầu bài) ── */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label { min-width: 168px; text-align: center; font-weight: 500; }
.week-summary { margin-bottom: 12px; color: var(--text-2); }
.week { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.week-corner, .week-day { padding: 12px; border-bottom: 1px solid var(--line-strong); background: var(--bg); }
.week-day { display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); font-weight: 500; }
.week-day .num { font-size: 12px; font-weight: 400; color: var(--muted); }
.week-day.today { color: var(--accent-strong); background: var(--accent-soft); }
.week-day.today .num { color: var(--accent-strong); }
.week-band { padding: 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.week-cell { display: flex; flex-direction: column; gap: 8px; min-height: 96px; padding: 8px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.week-cell.today { background: var(--today); }
.lesson { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-short) var(--ease), background-color var(--dur-short) var(--ease); }
.lesson:hover { border-color: var(--accent); background: var(--accent-soft); }
.lesson-time { font-size: 12px; color: var(--text-2); }
.lesson-code { font-weight: 600; overflow-wrap: anywhere; }
.lesson-meta { font-size: 12px; line-height: 16px; color: var(--muted); overflow-wrap: anywhere; }
.lesson-meta:empty { display: none; }
.day-list { display: flex; flex-direction: column; gap: 16px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.day-head .num { color: var(--muted); font-weight: 400; }
.today-note { margin-left: auto; font-size: 12px; color: var(--accent-strong); font-weight: 500; }
.day-lessons { display: flex; flex-direction: column; gap: 8px; }

/* ── Biểu mẫu ── */
.modal-wide { max-width: 680px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-label { display: block; font-weight: 500; margin-bottom: 8px; }
.slots { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.slot-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 32px; gap: 8px; align-items: center; }
.pick-list { max-height: 320px; overflow-y: auto; margin: 12px 0 16px; border: 1px solid var(--line); border-radius: var(--r-control); }
.pick { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-top: 1px solid var(--line); cursor: pointer; }
.pick:first-child { border-top: 0; }
.pick:hover { background: var(--row-hover); }
.pick input { margin-top: 2px; }
.pick .cell-sub { display: block; }


/* ── Điểm danh ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.notice { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r-control); background: var(--waiting-soft); color: var(--waiting-text); }
.list li.session-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; }
.session-time { color: var(--text-2); white-space: nowrap; }
.session-main { min-width: 0; }
.lesson .status { margin-top: 4px; font-size: 12px; line-height: 16px; white-space: normal; align-items: baseline; }
.lesson-off { background: var(--bg); box-shadow: none; }
.lesson-off .lesson-code { color: var(--muted); text-decoration: line-through; }
.comment-cell { min-width: 240px; max-width: 48ch; white-space: pre-wrap; }

.att-card { padding: 24px 24px 8px; }
.att-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.att-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; align-items: center; gap: 8px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.att-row-note .att-name .cell-sub { color: var(--waiting-text); }
.att-name { min-width: 0; }
.att-tools { display: flex; gap: 4px; justify-content: flex-end; }
.att-comment { grid-column: 1 / -1; }
.att-comment textarea { width: 100%; }
.seg-group { display: inline-flex; margin: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; }
.seg { position: relative; display: inline-flex; cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; color: var(--text-2); white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease); }
.seg:hover span { background: var(--raised); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg input:disabled + span { cursor: not-allowed; }
.seg-present input:checked + span { background: var(--positive-soft); color: var(--positive-text); font-weight: 500; }
.seg-late input:checked + span { background: var(--waiting-soft); color: var(--waiting-text); font-weight: 500; }
.seg-excused input:checked + span { background: var(--raised); color: var(--text); font-weight: 500; }
.seg-absent input:checked + span { background: var(--negative-soft); color: var(--negative); font-weight: 500; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-top: 16px; padding: 12px 16px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-float); }
.save-bar .btn-row { margin-top: 0; }
.save-note { color: var(--text-2); }
.save-note.pending { color: var(--waiting-text); font-weight: 500; }


/* ── Học phí ── */
.region-stats { min-height: 0; margin-bottom: 24px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-bad .stat-value { color: var(--negative); }
.text-bad { color: var(--negative); }
.money { text-align: right; }
th.money { text-align: right; }
tfoot td { height: 48px; font-weight: 600; background: var(--bg); border-bottom: 0; }
.inv-list { max-height: 360px; margin: 0 0 8px; }
.inv-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px 12px; padding: 8px 12px; border-top: 1px solid var(--line); }
.inv-row:first-child { border-top: 0; }
.inv-row .check { margin: 0; min-width: 0; }
.inv-row .check .cell-sub { display: block; }
.inv-row input[type=text] { height: 36px; }
.inv-total { margin-top: 8px; font-weight: 500; }
.pay-amount { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; padding: 16px; border-radius: var(--r-control); background: var(--bg); }
.pay-amount strong { font-size: 28px; line-height: 32px; font-weight: 500; }
small.hint-flush { margin-left: 0; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: var(--r-control); background: var(--text); color: var(--on-accent); box-shadow: var(--shadow-float); animation: rise var(--dur-short) var(--ease); }
.toast a { color: var(--on-accent); font-weight: 600; white-space: nowrap; }

.receipt { max-width: 720px; margin: 0 auto; padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.receipt-head { display: flex; align-items: center; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.receipt-logo { height: 56px; width: auto; }
.receipt-branch { color: var(--text); font-weight: 600; font-size: 16px; }
.receipt-title { margin-top: 28px; text-align: center; font-size: 22px; line-height: 28px; }
.receipt-no { margin: 4px 0 24px; text-align: center; color: var(--text-2); }
.receipt-facts { gap: 12px 32px; }
.receipt-note { margin-top: 24px; color: var(--text-2); font-size: 13px; }
.receipt-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 32px; text-align: center; }
.receipt-sign > div { display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.receipt-sign span { color: var(--muted); font-size: 13px; }
.receipt-sign .receipt-signer { margin-top: auto; color: var(--text); font-size: 14px; }
@media print {
  .topbar, .sidebar, .page-head, .main-foot, .sidebar-foot, .toast { display: none !important; }
  .layout { display: block; min-height: 0; }
  .main { padding: 0; max-width: none; }
  body { background: var(--surface); }
  .receipt { border: 0; padding: 0; max-width: none; }
}


/* ── Hoá đơn điện tử ── */
th.check-cell, td.check-cell { width: 1%; padding-right: 0; }
a.status { text-decoration: none; }
a.status:hover { color: var(--accent); }
.sel-bar .btn-row { flex-wrap: wrap; }
.field-tight { margin: 0 0 12px; }
.modal-intro { margin-bottom: 12px; }
.field-tight > span.cell-sub { margin-bottom: 4px; font-weight: 400; }
.issue-list { max-height: 400px; }
.issue-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 112px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px 12px; padding: 12px; border-top: 1px solid var(--line); }
.issue-row-2 { grid-template-columns: minmax(0, 1.6fr) 112px minmax(0, 1fr); }
.issue-row:first-child { border-top: 0; }
.issue-row input { height: 36px; }
.issue-who { min-width: 0; }
.einv { max-width: 880px; padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.einv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; padding-bottom: 20px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.einv-seller { min-width: 0; max-width: 52ch; }
.einv-seller-name { color: var(--text); font-weight: 600; font-size: 16px; }
.einv-meta { display: grid; grid-template-columns: max-content auto; gap: 4px 16px; margin: 0; }
.einv-meta dt { color: var(--text-2); }
.einv-meta dd { margin: 0; color: var(--text); font-weight: 500; }
.einv-buyer { margin-bottom: 24px; }
.einv-lines { margin: 0 -40px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.einv-lines th:first-child, .einv-lines td:first-child { padding-left: 40px; }
.einv-lines th:last-child, .einv-lines td:last-child { padding-right: 40px; }
.einv-item { min-width: 280px; }
.einv-totals { max-width: 400px; margin: 20px 0 0 auto; }
.einv-words { margin-top: 12px; text-align: right; color: var(--text-2); }
.einv-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
@media print { .einv { border: 0; padding: 0; max-width: none; } .einv-lines { margin: 0; } }

/* ── Báo cáo ── */
.range { display: inline-flex; align-items: center; gap: 8px; }
.range input[type=date] { width: auto; }
.section-title { margin-bottom: 12px; }
.stats-report .stat-value { font-size: 24px; line-height: 32px; white-space: nowrap; }
tr.row-full td { background: var(--waiting-soft); }
.chart-scroll { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--line-strong); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-family: var(--font); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--accent); transition: fill var(--dur-micro) var(--ease); }
.chart-hit { fill: transparent; }
.chart-col { cursor: default; outline: none; }
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { fill: var(--accent-strong); }
.chart-col:focus-visible .chart-hit { fill: var(--accent-soft); }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); min-width: 132px; padding: 8px 12px; border-radius: var(--r-control);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-float); pointer-events: none; font-size: 13px; }
.chart-tip-title { color: var(--text-2); }
.chart-tip .num { font-weight: 600; font-size: 14px; }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.chart-table summary:hover { color: var(--text); }
.chart-table[open] summary { margin-bottom: 12px; }

/* ── Lương ── */
.toolbar-split { justify-content: space-between; }
.toolbar-split > p { flex: 1 1 360px; max-width: 72ch; }
.section-sm { margin-top: 16px; }
.notice-ok { background: var(--positive-soft); color: var(--positive-text); }
.facts-money dd { text-align: right; }
.facts-total { padding-top: 12px; border-top: 1px solid var(--line); font-weight: 600; }
dd.facts-total { font-size: 18px; }
.adj-amount { display: flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ── Dữ liệu mẫu (public/demo-seed.js) ── */
.demo-card { margin-bottom: 16px; }
.demo-text { max-width: 72ch; }
.demo-text + .demo-text { margin-top: 8px; }
.demo-pass { padding: 2px 8px; border-radius: 4px; background: var(--raised); font-variant-numeric: tabular-nums; user-select: all; }
.btn-row-start { justify-content: flex-start; margin-top: 16px; }
.modal p + p { margin-top: 8px; }
.progress { margin-top: 16px; }
.progress-track { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.progress-label { margin-top: 8px; color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── Dữ liệu gốc (public/page-data.js) ── */
.data-wrap { container-type: inline-size; }
.data-table th, .data-table td { height: 44px; }
.data-table .data-toggle-col { width: 1%; padding-right: 0; }
.data-row { cursor: pointer; }
.data-row.open { background: var(--row-hover); }
.data-row .icon { transition: transform var(--dur-short) var(--ease); }
.data-row.open .icon { transform: rotate(180deg); }
.data-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-detail td { height: auto; padding: 16px 24px 20px; background: var(--bg); }
.data-detail:hover { background: transparent; }
/* Bảng nhiều cột cuộn ngang: khung chi tiết đứng yên ở mép trái, rộng bằng phần đang nhìn thấy */
.data-facts { position: sticky; left: 24px; max-width: min(880px, calc(100cqi - 48px)); }
.data-facts dt { overflow-wrap: anywhere; }
.data-facts dd { font-weight: 400; overflow-wrap: anywhere; min-width: 0; }
.data-full { white-space: pre-wrap; }
.data-json { margin: 0; font: inherit; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.data-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.data-foot .table-note { flex: 1 1 240px; margin: 0; }

/* ── Máy tính bảng ── */
@media (max-width: 1100px) {
  .overview, .split, .split-wide, .split-even { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ── Điện thoại ── */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; }
  .who-role, .wordmark-label { display: none; }
  .wordmark img { height: 32px; }
  .who-name { max-width: 150px; }
  .layout { flex-direction: column; }
  .sidebar { width: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-section, .nav-item.soon, .sidebar-foot { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item.active::before { left: 12px; right: 12px; top: auto; bottom: 0; width: auto; height: 2px; }
  .main { padding: 24px 12px 32px; }
  .main-foot { display: block; margin-top: 32px; padding-left: 4px; font-size: 12px; color: var(--muted); }
  h1 { font-size: 24px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .card-flush { padding: 0; }
  .lark-note { margin: 0 16px 16px; }
  .stat { padding: 16px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 12px; }
  .stat-value { grid-column: 2; grid-row: 1; margin-top: 0; font-size: 24px; line-height: 28px; }
  .stat-note { grid-column: 1 / -1; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 32px; gap: 8px 12px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  /* Điện thoại: bảng giữ nguyên dòng, cuộn ngang thay vì gãy chữ */
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .modal-back { padding: 24px 12px; }
  .modal { padding: 20px 16px; }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .inv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .inv-row .check { grid-column: 1 / -1; }
  .receipt { padding: 20px 16px; }
  .einv { padding: 20px 16px; }
  .einv-lines { margin: 0 -16px; }
  .einv-lines th:first-child, .einv-lines td:first-child { padding-left: 16px; }
  .einv-lines th:last-child, .einv-lines td:last-child { padding-right: 16px; }
  .einv-totals { max-width: none; }
  .issue-row, .issue-row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .issue-who { grid-column: 1 / -1; }
  .receipt-sign { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .toast { right: 12px; left: 12px; bottom: 12px; }
  .att-card { padding: 16px 16px 4px; }
  .att-row { grid-template-columns: minmax(0, 1fr) auto; }
  .seg-group { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seg span { justify-content: center; width: 100%; padding: 0 4px; font-size: 13px; }
  .att-tools { grid-column: 2; grid-row: 1; }
  .att-tools .btn span, .att-tools .btn { font-size: 13px; }
  .list li.session-row { grid-template-columns: 96px minmax(0, 1fr); }
  .session-row > .status, .session-row > .muted:last-child { grid-column: 2; }
  .save-bar { margin-left: -4px; margin-right: -4px; }
  .slot-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; }
  .slot-row > :nth-child(1) { grid-column: 1 / 3; }
  .slot-row > :nth-child(4) { grid-column: 1 / 3; }
  .slot-row > :nth-child(5) { grid-column: 3; grid-row: 1; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .search { flex-basis: 100%; max-width: none; }
  .range { flex: 1 1 100%; }
  .range input[type=date] { flex: 1 1 0; min-width: 0; }
  .chart-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
  .chart { min-width: 560px; }
  .chart-axis { font-size: 15px; }
  .page-head .head-actions { width: 100%; }
  .card-flush > .card-head { padding: 16px 16px 0; }
  .list-pad { padding: 4px 16px 16px; }
  details.gone summary { padding: 16px; }
  input, select, textarea { font-size: 16px; }
  .auth-card { padding: 24px 16px; }
}

/* Đồng bộ Lark */
.lark-note { margin: 0 24px 20px; }
.lark-warnings li { display: block; }
.lark-owner dd { font-weight: 400; max-width: 72ch; }
