/* WinP — Management app */

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 400px at 90% 10%, rgba(31,157,85,.45), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-800)); }
.login-art::after { content: ''; position: absolute; width: 360px; height: 360px; border: 2px solid rgba(255,255,255,.07); border-radius: 50%; right: -120px; bottom: -120px; box-shadow: 0 0 0 60px rgba(255,255,255,.02), 0 0 0 120px rgba(255,255,255,.015); }
.login-art > div { position: relative; z-index: 1; text-align: center; }
.login-art img { width: 220px; margin: 0 auto; filter: drop-shadow(0 20px 40px rgba(0,0,0,.45)); }
.login-art > div p { margin-left: auto; margin-right: auto; }
.login-art h1 { font-size: 40px; font-weight: 900; letter-spacing: -.03em; margin: 26px 0 12px; }
.login-art h1 em { color: var(--lime); }
.login-art p { color: rgba(255,255,255,.72); max-width: 440px; font-size: 16px; }
.login-art a { color: var(--lime); text-decoration: none; font-weight: 600; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.login-form { width: min(400px, 100%); display: grid; gap: 18px; }
.login-form h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; height: 38px; border-radius: 9px; font: 600 14px var(--font); color: var(--text-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--navy-800); box-shadow: var(--shadow); }
.demo { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--text-2); }
.demo b { color: var(--text); }
.demo button { border: 0; background: var(--green-50); color: var(--green-700); font: 600 12px var(--font); padding: 4px 10px; border-radius: 999px; margin: 6px 6px 0 0; cursor: pointer; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: -6px 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--navy-900); color: #c9d3ee; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 14px; text-decoration: none; }
.sb-brand img { width: 42px; height: 42px; }
.sb-brand b { display: block; color: var(--lime); font-size: 19px; font-weight: 900; font-style: italic; letter-spacing: -.02em; line-height: 1; }
.sb-brand small { color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.sb-group { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.35); padding: 14px 12px 6px; font-weight: 600; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9d3ee; text-decoration: none; font-weight: 500; position: relative; }
.sb-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sb-link.on { background: linear-gradient(90deg, rgba(182,242,58,.16), rgba(182,242,58,.04)); color: #fff; }
.sb-link.on::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--lime); }
.sb-link.on .icon { color: var(--lime); }
.sb-link .count { margin-left: auto; background: var(--lime); color: var(--navy-900); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.sb-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); }
.sb-user .av { width: 36px; height: 36px; }
.sb-user b { display: block; color: #fff; font-size: 13px; }
.sb-user small { font-size: 12px; color: rgba(255,255,255,.5); }
.sb-user button { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.6); cursor: pointer; padding: 6px; border-radius: 8px; }
.sb-user button:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: rgba(243,246,251,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.view { padding: 24px 28px 48px; display: grid; gap: 20px; align-content: start; }

/* ---------- Cards / KPI ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-2); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .sub { color: var(--muted); font-size: 13px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 18px 20px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-21 { grid-template-columns: 2fr 1fr; }
.g-12 { grid-template-columns: 1fr 2fr; }

.kpi { padding: 18px 20px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi .lbl { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.kpi .ico.g { background: var(--green-50); color: var(--green-700); }
.kpi .ico.r { background: var(--red-50); color: var(--red); }
.kpi .ico.a { background: var(--amber-50); color: #9a6a00; }
.kpi .val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 12px; color: var(--muted); }
.kpi .up { color: var(--green-700); font-weight: 600; }
.kpi .down { color: var(--red); font-weight: 600; }
.kpi.hero { background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: #fff; border: 0; }
.kpi.hero .lbl, .kpi.hero .meta { color: rgba(255,255,255,.7); }
.kpi.hero .ico { background: rgba(182,242,58,.16); color: var(--lime); }

/* ---------- Toolbar & tables ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 240px; }
.search .icon { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.search .input { padding-left: 36px; }
.toolbar select.input, .toolbar input[type=month].input, .toolbar input[type=date].input { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #fafcff; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .actions { text-align: right; white-space: nowrap; }
.t tfoot td { font-weight: 700; background: #fafbfd; border-top: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 10px; }
.person b { display: block; font-weight: 600; }
.person small { display: block; color: var(--muted); font-size: 12px; }
.person .link { display: block; text-align: left; }
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-800); color: var(--lime); font-size: 12px; font-weight: 700; flex: none; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.link { color: var(--blue); cursor: pointer; font-weight: 600; text-decoration: none; background: none; border: 0; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; }
.amount-in { color: var(--green-700); font-weight: 600; }
.amount-out { color: var(--red); font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line-2); }

/* ---------- Lists ---------- */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li b { display: block; font-weight: 600; }
.li small { color: var(--muted); font-size: 12px; }
.time-pill { display: grid; place-items: center; min-width: 60px; padding: 6px 8px; border-radius: 10px; background: var(--bg); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.time-pill small { font-weight: 500; }

/* ---------- Course cards ---------- */
.ccard { padding: 20px; display: grid; gap: 12px; border-top: 4px solid var(--green); }
.ccard h3 { font-size: 17px; }
.ccard .row { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.ccard .row .icon { width: 15px; height: 15px; color: var(--muted); }
.cap { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.cap i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.ccard .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .grid-l { stroke: var(--line-2); }
.chart .bar { transition: opacity .15s; }
.chart .hit:hover + .bar, .chart .bar:hover { opacity: .8; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 12px; font-size: 13px; }
.hbar-row .track { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.hbar-row .track i { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.hbar-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-tip { position: fixed; z-index: 200; pointer-events: none; background: var(--navy-900); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow-lg); line-height: 1.5; }
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Week calendar ---------- */
.wk { display: grid; grid-template-columns: 56px repeat(7, 1fr); min-width: 980px; }
.wk-head { position: sticky; top: 0; background: #fafbfd; border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.wk-head b { display: block; font-size: 18px; color: var(--text); font-weight: 700; }
.wk-head.today b { color: #fff; background: var(--green); width: 32px; height: 32px; line-height: 32px; border-radius: 50%; margin: 2px auto 0; }
.wk-times { position: relative; }
.wk-times span { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-50%); }
.wk-col { position: relative; border-left: 1px solid var(--line-2); background-image: linear-gradient(var(--line-2) 1px, transparent 1px); }
.wk-col.today { background-color: #f7fcf9; }
.ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px; font-size: 12px; overflow: hidden; cursor: pointer; border-left: 4px solid; background: #fff; box-shadow: 0 1px 3px rgba(11,29,74,.12); transition: transform .1s, box-shadow .15s; }
.ev:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(11,29,74,.15); z-index: 2; }
.ev b { display: block; font-size: 12px; line-height: 1.3; }
.ev.narrow { padding: 5px 6px; }
.ev.narrow b { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 14px; }
.ev.narrow small + small { display: none; }
.ev small { color: var(--text-2); display: block; font-size: 11px; }
.ev .st { position: absolute; right: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.ev .st.done { background: var(--green); color: #fff; }
.ev .st.todo { background: var(--amber-50); color: #9a6a00; border: 1px solid #f0d58a; }

/* ---------- Month calendar ---------- */
.mon { display: grid; grid-template-columns: repeat(7, 1fr); }
.mon-h { padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfd; border-bottom: 1px solid var(--line); }
.mon-d { min-height: 118px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.mon-d:nth-child(7n) { border-right: 0; }
.mon-d.out { background: #fbfcfe; }
.mon-d.out .dn { color: #b9c2d6; }
.mon-d .dn { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 2px 4px; }
.mon-d.today .dn { background: var(--green); color: #fff; border-radius: 999px; width: 24px; text-align: center; }
.mev { font-size: 11px; padding: 4px 6px; border-radius: 6px; cursor: pointer; display: flex; gap: 6px; align-items: center; background: var(--bg); border-left: 3px solid; line-height: 1.25; }
.mev:hover { filter: brightness(.96); }
.mev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mev .ok { margin-left: auto; color: var(--green-700); font-weight: 800; }

/* ---------- Attendance ---------- */
.att-list { display: grid; }
.att-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.att-item:last-child { border-bottom: 0; }
.tri { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tri button { border: 0; background: #fff; font: 600 12px var(--font); padding: 7px 12px; cursor: pointer; color: var(--text-2); }
.tri button + button { border-left: 1px solid var(--line); }
.tri button.on.P { background: var(--green); color: #fff; }
.tri button.on.L { background: var(--amber); color: var(--navy-900); }
.tri button.on.A { background: var(--red); color: #fff; }
.att-remark { grid-column: 1 / -1; display: none; }
.att-item.show-remark .att-remark { display: block; }
.att-sum { display: flex; gap: 8px; flex-wrap: wrap; }
.session-card { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.session-card:last-child { border-bottom: 0; }
.session-card .bar { width: 4px; align-self: stretch; border-radius: 4px; }

/* ---------- Evaluation ---------- */
.meter { display: grid; grid-template-columns: 76px 1fr 54px; gap: 10px; align-items: center; font-size: 13px; }
.meter .track { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--green); }
.meter .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.meter .d { font-size: 11px; font-weight: 600; }
.slider-row { display: grid; grid-template-columns: 90px 1fr 36px; gap: 14px; align-items: center; }
.slider-row input[type=range] { width: 100%; accent-color: var(--green); }
.slider-row output { font-weight: 800; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.score { display: inline-grid; place-items: center; min-width: 32px; height: 26px; border-radius: 8px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.score.hi { background: var(--green-50); color: var(--green-700); }
.score.md { background: var(--amber-50); color: #8a5d00; }
.score.lo { background: var(--red-50); color: #b42323; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--navy-800); border-color: var(--green); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(7,20,53,.5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fadeIn .15s; }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.lg { width: min(820px, 100%); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { font-size: 17px; font-weight: 700; }
.modal-h .sub { color: var(--muted); font-size: 13px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 20px 22px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fafbfd; border-radius: 0 0 18px 18px; }
.modal-f .left { margin-right: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.detail-head .av { width: 56px; height: 56px; font-size: 18px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 20px; }
.kv div small { display: block; color: var(--muted); font-size: 12px; }
.kv div b { font-weight: 600; }
.section-t { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }

/* ---------- Report ---------- */
.report-paper { background: #fff; }
.report-paper .t td { white-space: nowrap; }
.report-paper .t td.wrap { white-space: normal; min-width: 220px; }
.report-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--navy-800); }
.report-head img { width: 56px; height: 56px; }
.report-head h2 { font-size: 18px; color: var(--navy-800); }
.report-head small { color: var(--muted); }
.report-head .r { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.report-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.report-kpis small { color: var(--muted); font-size: 12px; display: block; }
.report-kpis b { font-size: 18px; font-variant-numeric: tabular-nums; }
.report-types { display: grid; gap: 8px; }
.rtype { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; background: #fff; text-align: left; font: inherit; color: inherit; }
.rtype:hover { border-color: #c9d2e4; }
.rtype.on { border-color: var(--green); background: var(--green-50); }
.rtype .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--navy-800); flex: none; }
.rtype.on .ico { background: var(--green); color: #fff; }
.rtype b { display: block; font-size: 14px; }
.rtype small { color: var(--muted); font-size: 12px; }

.welcome { padding: 22px 24px; display: flex; align-items: center; gap: 20px; background: linear-gradient(120deg, var(--navy-800), var(--navy-600) 60%, var(--green-700)); color: #fff; border: 0; overflow: hidden; position: relative; }
.welcome h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.welcome p { margin: 4px 0 0; color: rgba(255,255,255,.75); }
.welcome img { width: 84px; margin-left: auto; opacity: .95; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .g-21, .g-12, .g-2 { grid-template-columns: 1fr; }
  .view { padding: 18px 16px 40px; } .topbar { padding: 12px 16px; }
  .kv { grid-template-columns: 1fr 1fr; }
  .report-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) { .g-4, .g-3 { grid-template-columns: 1fr; } .topbar .hide-sm { display: none; } .hbar-row { grid-template-columns: 110px 1fr 40px; } }


/* ---------- Layout safety ---------- */
.view > *, .grid > *, .main { min-width: 0; }
.rep-grid { grid-template-columns: 300px 1fr; align-items: start; }
.sc-main { flex: 1; min-width: 0; }
.login-logo { display: none; }
.bnav, .sb-backdrop, .swipe-hint { display: none; }

/* Agenda + mini month (điện thoại) */
.agenda { display: grid; }
.ag-day { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.ag-day:last-child { border-bottom: 0; }
.ag-day.today { background: #f7fcf9; }
.ag-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.ag-h span:not(.badge) { color: var(--muted); }
.ag-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--line); border-left: 4px solid; border-radius: 12px; background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ag-item:active { background: var(--bg); }
.ag-time { display: flex; flex-direction: column; align-items: center; min-width: 46px; font-variant-numeric: tabular-nums; }
.ag-time small { color: var(--muted); font-size: 11px; }
.ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ag-main b { font-size: 14px; }
.ag-main small { color: var(--muted); font-size: 12px; }
.ag-empty { color: var(--muted); font-size: 13px; padding: 2px 0 4px; }
.mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 12px; border-bottom: 1px solid var(--line-2); }
.mini-h { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.mini-d { aspect-ratio: 1 / 1.05; border: 0; background: none; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 600 14px var(--font); color: var(--text); cursor: pointer; padding: 0; }
.mini-d.out { color: #b9c2d6; }
.mini-d.today span { color: var(--green-700); font-weight: 800; }
.mini-d.sel { background: var(--navy-800); color: #fff; }
.mini-d.sel.today span { color: var(--lime); }
.mini-d i { display: flex; gap: 2px; height: 5px; }
.mini-d em { width: 5px; height: 5px; border-radius: 50%; }
.mini-d.sel em { box-shadow: 0 0 0 1px #fff; }

/* ---------- Tablet & phone ---------- */
@media (max-width: 980px) {
  .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(7,20,53,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .shell.nav-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .bnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(11,29,74,.07); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: 600 11px var(--font); text-decoration: none; cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
  .bnav .icon { width: 22px; height: 22px; }
  .bnav .on { color: var(--navy-800); }
  .bnav .on .icon { color: var(--green); }
  .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toast-wrap { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); align-items: center; }
  .rep-grid { grid-template-columns: 1fr; }
  .report-types { display: flex; overflow-x: auto; gap: 8px; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .rtype { flex: 0 0 230px; scroll-snap-align: start; }
  .login-logo { display: block; width: 96px; margin: 0 auto -4px; }
  .login-form h2, .login-form > div > p { text-align: center; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .input, select.input, textarea.input { font-size: 16px; } /* tránh iOS tự phóng to khi nhập */
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar h1 { font-size: 18px; }
  .view { padding-left: 12px; padding-right: 12px; gap: 14px; }
  .grid { gap: 14px; }
  .g-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .g-3, .g-2, .g-21, .g-12 { grid-template-columns: 1fr; }
  .kpi { padding: 14px; gap: 4px; }
  .kpi .lbl { font-size: 12px; gap: 6px; }
  .kpi .ico { width: 28px; height: 28px; border-radius: 8px; }
  .kpi .ico .icon { width: 15px; height: 15px; }
  .kpi .val { font-size: 21px; }
  .kpi .meta { font-size: 11px; }
  .card-h { padding: 12px 14px; flex-wrap: wrap; }
  .card-b { padding: 14px; }
  .li { padding: 12px 14px; }
  .welcome { padding: 18px; } .welcome img { display: none; } .welcome h2 { font-size: 19px; }
  .hbar-row { grid-template-columns: 112px 1fr 40px; }

  /* Toolbar xếp gọn */
  .toolbar { gap: 8px; }
  .toolbar .search { min-width: 0; flex: 1 1 100%; }
  .toolbar select.input, .toolbar input[type=month].input, .toolbar input[type=date].input { flex: 1 1 140px; min-width: 0; width: auto; }
  .toolbar > .btn:not(.btn-icon) { flex: 1 1 auto; }
  .toolbar .grow:empty { display: none; }
  .toolbar h3 { min-width: 0 !important; flex: 1 1 auto; }
  .toolbar .seg { width: 100% !important; }

  /* Bảng → thẻ */
  .t:not(.keep) thead { display: none; }
  .t:not(.keep), .t:not(.keep) tbody, .t:not(.keep) tfoot, .t:not(.keep) tr { display: block; width: 100%; }
  .t:not(.keep) tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .t:not(.keep) tbody tr:last-child { border-bottom: 0; }
  .t:not(.keep) td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
  .t:not(.keep) td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; }
  .t:not(.keep) td[data-label=""]::before, .t:not(.keep) td:first-child::before { display: none; }
  .t:not(.keep) td:first-child { justify-content: flex-start; text-align: left; padding-bottom: 8px; }
  .t:not(.keep) td:empty { display: none; }
  .t:not(.keep) td.actions { justify-content: flex-end; padding-top: 8px; gap: 6px; }
  .t:not(.keep) td.actions::before { display: none; }
  .t:not(.keep) td.empty { display: block; text-align: center; padding: 28px 0; }
  .t:not(.keep) tbody tr:hover td { background: none; }
  .t:not(.keep) tfoot tr { background: #fafbfd; border-top: 1px solid var(--line); }
  .t:not(.keep) tfoot td { background: none; border: 0; }
  .t .tdv { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Thẻ buổi học */
  .session-card { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .session-card .sc-main { flex: 1 1 calc(100% - 100px); }
  .session-card > .badge { margin-left: 18px; }
  .session-card > .btn { margin-left: auto; }

  /* Modal → bottom sheet */
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal, .modal.lg { width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 20px 20px 0 0; animation: sheet .22s ease-out; }
  .modal-h { padding: 14px 16px; }
  .modal-h::before { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
  .modal-h { position: relative; }
  .modal-b { padding: 16px; }
  .modal-f { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; }
  .modal-f .btn { flex: 1; height: 44px; }
  .modal-f { flex-wrap: wrap; }
  .modal-f .left { flex: 1 1 100%; margin-right: 0; }
  .kv { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .detail-head .av { width: 46px; height: 46px; }
  .att-item { grid-template-columns: 1fr; gap: 8px; }
  .att-item > div:nth-child(2) { justify-content: flex-end; }
  .tri { flex: 1; } .tri button { flex: 1; padding: 10px 6px; font-size: 13px; }
  .slider-row { grid-template-columns: 72px 1fr 30px; gap: 10px; }
  .slider-row + small { margin-left: 0 !important; }
  .form-grid .form-grid { grid-template-columns: 1fr 1fr; }

  .report-head { flex-wrap: wrap; }
  .report-head .r { margin-left: 0; text-align: left; width: 100%; }
  .report-kpis { grid-template-columns: 1fr 1fr; }
  .swipe-hint { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
  .card-b.report-paper { padding: 14px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }

@media (max-width: 380px) {
  .g-4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}


/* ---------- Chấm công & lương HLV ---------- */
.seg3 { grid-template-columns: repeat(3, 1fr); }
/* Supabase: màn hình chờ, trạng thái đồng bộ */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: var(--bg); }
.boot img { width: 96px; }
.boot h2 { font-size: 22px; }
.boot p { color: var(--text-2); max-width: 440px; margin: 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync-st { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font: 600 12px var(--font); color: var(--muted); cursor: default; white-space: nowrap; }
.sync-st.ok { color: var(--green-700); }
.sync-st.saving { color: var(--blue); }
.sync-st.error { color: var(--red); border-color: #f3c4c4; background: var(--red-50); cursor: pointer; }
@media (max-width: 600px) { .sync-st { padding: 4px 8px; font-size: 11px; } }
/* Buổi đã hủy · học bù */
.ev.cancelled, .mev.cancelled, .ag-item.cancelled, .session-card.cancelled { opacity: .6; }
.ev.cancelled { background: repeating-linear-gradient(135deg, #f6f7fa 0 6px, #eef1f6 6px 12px) !important; border-left-color: #c3cad8 !important; }
.ev.cancelled b, .mev.cancelled span:not(.ok), .ag-item.cancelled .ag-main b, .session-card.cancelled .sc-main b { text-decoration: line-through; }
.ev .st.off { background: #eef1f6; color: var(--muted); }
/* VietQR */
.qr-inline { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; background: #fafbfd; }
.qr-inline img { width: 132px; height: auto; border-radius: 8px; background: #fff; flex: none; }
.qr-inline b { display: block; margin-bottom: 4px; } .qr-inline small { color: var(--text-2); font-size: 13px; }
.qr-preview { width: 200px; min-height: 120px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 12px; padding: 8px; }
.qr-preview img { width: 100%; }
.notice-grid { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
.notice-grid > * { min-width: 0; }
.modal { min-width: 0; max-width: 100%; }
.notice-grid .t th, .notice-grid .t td { padding: 10px 12px; }
.notice-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.notice-qr img { width: 100%; max-width: 260px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.notice-qr small { color: var(--muted); }
@media (max-width: 760px) { .notice-grid { grid-template-columns: 1fr; } #fBank { grid-template-columns: 1fr !important; } .qr-preview { width: 100%; } .qr-inline { flex-direction: column; text-align: center; } }
.setup-step { text-decoration: none; color: inherit; }
.setup-step:hover { background: #fafcff; }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--bg); color: var(--navy-800); font-weight: 800; font-size: 13px; }
.setup-step.done .step-n { background: var(--green); color: #fff; }
.setup-step.done b { color: var(--muted); }
.welcome-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 7px 14px; border-radius: 999px; background: rgba(182,242,58,.16); color: var(--lime); text-decoration: none; font-size: 13px; font-weight: 600; }
.welcome-link:hover { background: rgba(182,242,58,.26); }
.welcome-link .icon { width: 16px; height: 16px; }
.li-btn { width: 100%; border: 0; border-bottom: 1px solid var(--line-2); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.li-btn:hover { background: #fafcff; }
.li-btn.on { background: var(--green-50); box-shadow: inset 3px 0 0 var(--green); }
.paytbl .person b { white-space: nowrap; }
.paytbl .tdv { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.paytbl td, .paytbl th { padding-left: 12px; padding-right: 12px; }
.note-box { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-50); color: #1f3a7a; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.note-box.warn { background: var(--amber-50); color: #7a5200; border: 1px solid #f3dc9c; margin-bottom: 0; }
.note-box .icon { width: 16px; height: 16px; margin-top: 1px; }
.calc { background: var(--bg); border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.7; }
label.check { display: flex; align-items: center; gap: 8px; height: 40px; font-weight: 500; color: var(--text); cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--green); }
.ps { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ps-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.ps-row:last-child { border-bottom: 0; }
.ps-row span { color: var(--text-2); }
.ps-row.strong { background: #fafbfd; } .ps-row.strong b { color: var(--navy-800); }
.ps-row.neg b { color: var(--red); }
.ps-row.total { background: var(--navy-800); color: #fff; font-size: 16px; }
.ps-row.total span { color: #fff; font-weight: 700; } .ps-row.total b { color: var(--lime); font-size: 18px; }
.sign-row { display: flex; justify-content: space-around; text-align: center; margin-top: 28px; padding-bottom: 50px; }
.sign-row small { display: block; color: var(--muted); }
.tsgrid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.tsgrid th, .tsgrid td { padding: 6px 2px; text-align: center; border-bottom: 1px solid var(--line-2); }
.tsgrid th { font-size: 11px; text-transform: none; letter-spacing: 0; line-height: 1.2; }
.tsgrid th small { display: block; font-weight: 500; font-size: 10px; }
.tsgrid th.we { color: var(--red); } .tsgrid th.td { color: #fff; background: var(--green); border-radius: 6px 6px 0 0; }
.tsgrid .sticky { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 8px 12px; min-width: 200px; border-right: 1px solid var(--line); }
.tsgrid th.sticky { background: #fafbfd; }
.tsgrid td.num, .tsgrid th.num { padding: 6px 10px; text-align: right; white-space: nowrap; }
.cell { display: inline-grid; place-items: center; width: 32px; height: 26px; border: 0; border-radius: 6px; font: 700 11px var(--font); cursor: pointer; font-variant-numeric: tabular-nums; padding: 0; }
.cell:hover { filter: brightness(.95); }
.c-ok { background: var(--green-50); color: var(--green-700); }
.c-auto { background: #fff; color: var(--green-700); box-shadow: inset 0 0 0 1.5px #8fd3ab; }
.c-late { background: var(--amber-50); color: #8a5d00; box-shadow: inset 0 0 0 1px #ecd08a; }
.c-abs { background: var(--red-50); color: #b42323; }
.c-sub { background: var(--blue-50); color: var(--blue); }
.c-miss { background: #eef1f6; color: var(--muted); }
.c-up { background: transparent; color: #b9c2d6; }
.ts-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 20px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--line-2); }
.ts-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ts-legend .cell { cursor: default; width: 28px; height: 20px; }
@media (max-width: 760px) {
  .tsgrid .sticky { min-width: 150px; padding: 6px 8px; }
  .tsgrid .sticky .av { display: none; }
  .form-grid[style*="repeat(3"] { grid-template-columns: 1fr !important; }
}
@media print {
  body.print-modal #root, body.print-modal .toast-wrap { display: none !important; }
  body.print-modal .modal-bg { position: static; background: none; backdrop-filter: none; padding: 0; display: block; animation: none; }
  body.print-modal .modal { box-shadow: none; max-height: none; width: 100% !important; border-radius: 0; animation: none; }
  body.print-modal .modal-h, body.print-modal .modal-f { display: none; }
  body.print-modal .modal-b { overflow: visible; padding: 0; }
}

/* ---------- Print (xuất PDF) ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .toast-wrap { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; }
  .card { box-shadow: none; border: 0; }
  .print-only-area { display: block !important; }
  .t th { background: #f1f3f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .t td, .t th { padding: 6px 8px; }
  .report-paper { padding: 0 !important; }
  .view > .grid { display: block !important; }
  .table-wrap { overflow: visible; }
}
