/* ================================================
   BDIedu v2 – Đăng nhập + Góc học viên (hoc-vien.html, /dang-nhap)
   và Trang quản lý (quan-ly.html, phần ad-* ở cuối file)
   Dùng token của css/site.css. Tên class pt-* giữ như v1.
   ================================================ */

.pt-body { background: var(--surface-rose); min-height: 100vh; }
.pt-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.pt-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 64px; padding: 0 max(12px, calc((100% - 760px) / 2)) 0 max(20px, calc((100% - 760px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.pt-logo { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-height: 44px; }
.pt-logo:hover { color: var(--ink); }
.pt-logo-img { display: block; width: 104px; height: 32px; flex: none; } /* logo ảnh BDIedu (1× + 2×) */
.pt-logo-text { display: flex; flex-direction: column; gap: 1px; padding-left: 12px; border-left: 1px solid var(--border); }
.pt-logo-sub { font-size: 13px; line-height: 1.3; font-weight: 600; color: var(--text-muted); }
.pt-home-link {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: var(--r-full);
  color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none;
}
.pt-home-link:hover { background: var(--primary-subtle); color: var(--ink); }

.pt-main { max-width: 760px; margin: 0 auto; padding: 16px 20px 140px; }
.pt-main:focus { outline: none; }
.pt-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px; margin-bottom: 12px;
}
.pt-card > :last-child, .pt-class-info > :last-child { margin-bottom: 0; }
.pt-card h1, .pt-test-head h1 { font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 6px; }
.pt-card h2 { font-size: 20px; line-height: 1.3; margin-bottom: 12px; }
.pt-test-head { margin: 4px 0 16px; }
.pt-muted { color: var(--text-muted); font-size: 15px; line-height: 1.5; }
.pt-help { margin-top: 16px; }
.pt-lead { margin-bottom: 16px; }
.pt-hint { margin: -8px 0 16px; font-size: 14px; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* ── Đăng nhập: 2 tab Học viên / Giáo viên – Admin ── */
.pt-tabs { margin: 4px 0 12px; flex-wrap: nowrap; }
.pt-tabs .tab { flex: 1 1 0; min-width: 0; padding: 0 12px; white-space: nowrap; }
.pt-tabs .tab:not([aria-selected="true"]):hover { background: var(--primary-subtle); }
.pt-panel h2 { font-size: 20px; line-height: 1.3; margin-bottom: 8px; }
.pt-panel h2:focus { outline: none; }
.pt-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-inline { display: flex; align-items: flex-start; gap: 10px; }
.pt-inline .icon, .pt-inline .spinner { margin-top: 3px; }

/* ── Nút & ô nhập ── */
.pt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: var(--r-full); border: 1.5px solid var(--primary);
  background: var(--primary); color: var(--on-primary); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.pt-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
/* Nút tắt / đang chạy: nền xám, chữ xám đậm (đạt 4,5:1) thay cho làm mờ */
.pt-btn:disabled, .pt-btn:disabled:hover { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.pt-btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.pt-btn-ghost:hover { background: var(--primary-subtle); color: var(--ink); border-color: var(--ink); }
/* .pt-btn-gold: tên giữ từ v1 (nút "Vào lớp học"); ở v2 là nút chính màu đỏ như .pt-btn */
.pt-btn-full { width: 100%; }
.pt-link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0;
  background: none; border: 0; color: var(--primary); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.pt-link-btn:hover { color: var(--primary-hover); text-decoration: underline; }

.pt-field { display: block; margin-bottom: 16px; }
.pt-field span { display: block; font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.pt-field input, .pt-essay {
  display: block; width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
.pt-field input:focus, .pt-essay:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pt-field input:focus-visible, .pt-essay:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pt-error {
  display: flex; align-items: flex-start; gap: 8px; background: var(--error-subtle); color: var(--error);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 16px; font-weight: 600; font-size: 15px;
}
.pt-error .icon { margin-top: 2px; }
.pt-error:empty { display: none; }
.pt-captcha { border-top: 1px dashed var(--border); padding-top: 16px; margin-bottom: 4px; }
.pt-captcha-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 12px; }
.pt-captcha img { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.pt-note { background: var(--warning-subtle); color: var(--text); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; }

/* ── Trang chính ── */
.pt-class { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pt-class .pt-class-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--primary-subtle); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pt-class-info { flex: 1; min-width: 180px; }
.pt-classes { display: grid; gap: 16px; }
.pt-classes .pt-class + .pt-class { border-top: 1px solid var(--border); padding-top: 16px; }
.pt-class-name { font-weight: 600; color: var(--ink); }
.pt-class-info p { margin-bottom: 2px; }
.pt-class-note { margin-top: 16px; }
.pt-past { margin-top: 12px; font-size: 14px; }
/* Tài liệu của lớp (GĐ-B) */
.pt-files { flex-basis: 100%; }
.pt-files-title { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.pt-file-list { list-style: none; display: grid; gap: 6px; }
.pt-file {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer; text-decoration: none;
}
.pt-file:hover { background: var(--primary-subtle); color: var(--ink); }
.pt-file:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: progress; }
.pt-file .icon { flex-shrink: 0; color: var(--primary); }
.pt-file-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.pt-file-meta { font-size: 13px; white-space: nowrap; }

.pt-tests { list-style: none; display: grid; gap: 12px; }
.pt-test {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px;
}
.pt-test-info { flex: 1; min-width: 200px; }
.pt-test-title { font-weight: 700; color: var(--ink); }
.pt-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: var(--r-full);
  background: var(--surface-rose); color: var(--text-muted); margin-left: 6px; vertical-align: middle;
}
.pt-chip .icon { width: 14px; height: 14px; }
.pt-chip-doing { background: var(--warning-subtle); color: var(--warning); }
.pt-chip-done { background: var(--success-subtle); color: var(--success); }
.pt-chip-grading { background: var(--info-subtle); color: var(--info); }
.pt-chip-comment { background: var(--warning-subtle); color: var(--warning); }

/* ── Làm bài ── */
.pt-back { margin-bottom: 4px; }
.pt-q { scroll-margin-top: 80px; }
.pt-q-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.pt-q-head h2, .pt-q-head h3 { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; color: var(--primary); }
.pt-q-points { color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.pt-q-points:not(:empty)::before { content: '· '; }
.pt-q-text { color: var(--ink); font-size: 18px; line-height: 1.45; font-weight: 600; margin-bottom: 14px; }
.pt-q-hint { color: var(--text-muted); font-size: 14px; margin: -6px 0 10px; }
.pt-passage-label { margin-bottom: 8px; color: var(--text-muted); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.pt-passage .pt-q-text { font-size: 16px; font-weight: 400; line-height: 1.65; color: var(--text); }
.pt-media { margin: 0 0 12px; }
.pt-media img { max-width: 100%; border-radius: var(--r-sm); }
.pt-media audio { width: 100%; }
.pt-embed { position: relative; aspect-ratio: 16 / 9; max-height: 400px; border-radius: var(--r-sm); overflow: hidden; background: var(--ink); }
.pt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pt-teacher { border-left: 4px solid var(--primary); }
.pt-teacher h2 { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.pt-teacher h3 { font-size: 15px; margin: 12px 0 4px; color: var(--text-muted); }

.pt-options { display: grid; gap: 8px; }
.pt-option {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface);
  color: var(--ink); font-size: 16px; line-height: 1.5;
}
.pt-option:hover { background: var(--primary-subtle); }
.pt-option input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); flex-shrink: 0; }
.pt-option:has(input:checked) { border: 2px solid var(--primary); padding: 9px 13px; background: var(--primary-subtle); }
.pt-option:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.pt-option-key { font-weight: 700; color: var(--primary); }
.pt-essay { min-height: 160px; resize: vertical; line-height: 1.6; }

.pt-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(17, 17, 17, 0.08);
  /* + tai thỏ / thanh home khi xoay ngang (viewport-fit=cover ở hoc-vien.html; 0 ở nơi khác) */
  padding: 10px calc(max(20px, (100% - 760px) / 2) + env(safe-area-inset-right, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px)) calc(max(20px, (100% - 760px) / 2) + env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pt-bar-info { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 14px; color: var(--text-muted); min-width: 0; }
.pt-bar-info strong { color: var(--text); font-weight: 600; }
#pt-save { flex-basis: 100%; font-size: 13px; }
.pt-timer { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.pt-timer strong { color: var(--ink); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pt-timer.is-warn, .pt-timer.is-warn strong { color: var(--warning); }
.pt-timer.is-danger, .pt-timer.is-danger strong { color: var(--error); }

/* ── Kết quả ── */
.pt-result h2 { font-size: 22px; }
.pt-score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; }
.pt-score-num { font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.pt-score-pct { font-size: 18px; font-weight: 600; color: var(--text-muted); }
.pt-skills-title { margin: 24px 0 12px; font-size: 16px; }
.pt-skills { list-style: none; display: grid; gap: 14px; }
.pt-skill-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pt-skill-bar { height: 8px; border-radius: var(--r-full); background: var(--surface-rose); overflow: hidden; }
.pt-skill-bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.pt-feedback { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); display: grid; gap: 20px; }
.pt-feedback h3 { font-size: 18px; margin-bottom: 4px; }
.pt-item-ok { color: var(--success); display: inline-flex; }

/* ── Xem lại bài ── */
.pt-review-head h2 { margin-bottom: 4px; }
.pt-badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: var(--r-full); margin-left: 6px; vertical-align: middle; }
.pt-badge-ok { background: var(--success-subtle); color: var(--success); }
.pt-badge-bad { background: var(--error-subtle); color: var(--error); }
.pt-badge-wait { background: var(--surface-rose); color: var(--text-muted); }
.pt-review-options { list-style: none; display: grid; gap: 8px; }
.pt-review-option {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); color: var(--ink);
}
.pt-review-option.is-answer { border: 2px solid var(--success); padding: 9px 13px; background: var(--success-subtle); }
.pt-review-option.is-wrong { border: 2px solid var(--error); padding: 9px 13px; background: var(--error-subtle); }
.pt-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pt-tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-full); background: var(--surface); border: 1px solid currentColor; white-space: nowrap; }
.is-answer .pt-tag { color: var(--success); }
.is-wrong .pt-tag { color: var(--error); }
.pt-answer { background: var(--surface-rose); border-radius: var(--r-sm); padding: 12px 14px; }
.pt-comment { display: flex; gap: 8px; margin-top: 10px; background: var(--warning-subtle); border-radius: var(--r-sm); padding: 10px 14px; }

.pt-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); padding: 40px 0; }

/* ── Hộp thoại trong trang (thay confirm / alert) ── */
.pt-dialog {
  width: min(440px, calc(100vw - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))); padding: 24px; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(17, 17, 17, 0.18);
}
.pt-dialog:not([open]) { display: none; }
.pt-dialog[open] { position: fixed; inset: 0; margin: auto; z-index: 100; height: fit-content; }
.pt-dialog::backdrop { background: rgba(17, 17, 17, 0.5); }
.pt-dialog h2 { font-size: 20px; line-height: 1.3; color: var(--ink); }
.pt-dialog p { margin-top: 8px; color: var(--text); }
.pt-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 24px; }

@media (max-width: 639px) {
  .pt-card { padding: 20px 16px; }
  .pt-card h1, .pt-test-head h1 { font-size: 24px; }
  .pt-home-link span { display: none; }
  .pt-home-link { width: 44px; padding: 0; justify-content: center; }
  .pt-bar .pt-btn { flex: none; }
  .pt-dialog-actions { flex-direction: column-reverse; }
  .pt-dialog-actions .pt-btn { width: 100%; }
}

/* ================================================
   Trang quản lý (quan-ly.html, js/admin.js) – ad-*
   ================================================ */
.ad-main { max-width: 1040px; }

.ad-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ad-head h2 { margin: 0; }
.ad-mail-off { margin: 0 0 16px; }
.ad-filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 16px; }
.ad-filters .pt-field { margin-bottom: 12px; }
/* Người dùng: 3 tab Admin · Giáo viên · Học viên, lọc Lớp / Cấp độ (plan-cap-do-hoc-vien.md) */
.ad-user-tabs { margin: 0 0 16px; }
.ad-user-tabs .tab { padding: 0 8px; }
.ad-tab-count { font-weight: 400; }
.ad-user-filters { display: flex; flex-wrap: wrap; gap: 0 16px; }
.ad-user-filters .pt-field { flex: 1 1 180px; min-width: 0; } /* 390 px: one filter a row (no cut "Đang hoạt động") */
.ad-user-filters .ad-search { flex: 2 1 240px; }
.ad-users-card [data-user-filter][hidden], .ad-user-elsewhere[hidden] { display: none; }
.ad-user-nocls { margin: -4px 0 8px; font-size: 14px; }
.ad-user-classes { font-size: 14px; overflow-wrap: anywhere; }
.ad-count { font-size: 14px; margin-bottom: 12px; }

.ad-users, .ad-list { list-style: none; display: grid; gap: 10px; }
.ad-user, .ad-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px;
}
.ad-user.is-locked, .ad-row.is-locked, .ad-row.is-ended { background: var(--surface-rose); }
/* Kết thúc lớp (plan-ket-thuc-lop.md): the chip "Đã kết thúc dd/mm/yyyy" of a class – neutral, AA */
.ad-ended-chip { background: var(--surface); border: 1px solid var(--disabled-text); color: var(--ink); }
/* "Giao cho lớp" (Spec Change Log 09/11/2026): a chip per class chosen (× = "Bỏ lớp …", a 44 px target), then the select "Thêm lớp";
   an ended class: a grey chip (#555 on #E8E8E8 – AA) */
.ad-class-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; padding: 0; list-style: none; }
.ad-class-chip { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 0 4px 0 14px; border: 1px solid var(--border-strong);
  border-radius: var(--r-full); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; }
.ad-class-chip:not(:has(.ad-class-chip-x)) { padding-right: 14px; }
.ad-class-chip-text { overflow-wrap: anywhere; }
.ad-class-chip.is-ended { border-style: dashed; border-color: var(--disabled-text); background: var(--disabled-bg); color: var(--disabled-text); }
.ad-class-chip-x { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; margin-left: 2px; padding: 0;
  border: 0; border-radius: var(--r-full); background: transparent; color: inherit; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.ad-class-chip-x:hover { background: var(--primary-subtle); }
.ad-class-chip-x:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ad-class-none { margin: 4px 0 8px; }
.ad-class-add { max-width: 520px; }
.ad-user-info, .ad-row-info { flex: 1 1 260px; min-width: 0; }
.ad-user-name, .ad-row-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ad-user-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.ad-user-chips .pt-chip { margin-left: 0; }
.ad-user-contact { font-size: 14px; overflow-wrap: anywhere; }
.ad-user-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-empty { padding: 16px 0; }
.ad-btn { min-height: 44px; padding: 0 14px; font-size: 14px; gap: 6px; border-width: 1px; }
.ad-btn .icon { width: 18px; height: 18px; }
.ad-btn-danger { background: var(--error); border-color: var(--error); }
.ad-btn-danger:hover { background: #8F1C13; border-color: #8F1C13; }
.ad-btn-danger-ghost { color: var(--error); border-color: var(--error); }
.ad-btn-danger-ghost:hover { background: var(--error-subtle); color: var(--error); border-color: var(--error); }

.ad-role-admin { background: var(--ink); color: var(--on-ink); }
.ad-role-teacher { background: var(--info-subtle); color: var(--info); }
.ad-role-student { background: var(--surface-rose); color: var(--text-muted); }
.ad-locked { background: var(--error-subtle); color: var(--error); }

.ad-success { display: flex; align-items: flex-start; gap: 8px; color: var(--success); font-weight: 600; margin-bottom: 16px; }
.ad-success:empty { display: none; }
.ad-success .icon { margin-top: 3px; }
.ad-warning { display: block; background: var(--warning-subtle); border-radius: var(--r-sm); padding: 10px 14px; }

/* Hộp thoại có form */
.ad-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.ad-dialog form { margin-top: 12px; }
.ad-dialog .pt-error { margin-top: 0; }
.ad-dialog .pt-note { margin-top: 0; }
.ad-dialog .pt-field select { min-height: 48px; }
.ad-dialog .pt-dialog-actions { margin-top: 20px; }
.ad-kind { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.ad-kind legend { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 8px; padding: 0; }
.ad-kind .pt-option { margin-bottom: 8px; }
.ad-secret { margin: 16px 0 8px; }
.ad-secret input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; background: var(--surface-rose); }
.ad-copy-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ad-copied { font-size: 14px; font-weight: 600; color: var(--success); }

@media (max-width: 639px) {
  .ad-filters { grid-template-columns: 1fr 1fr; }
  .ad-filters .ad-search { grid-column: 1 / -1; }
  .ad-head .pt-btn { width: 100%; }
  .ad-user-actions { width: 100%; }
  .ad-user-actions .ad-btn { flex: 1 1 auto; }
}

/* ── Phần 2: Lớp học, Lớp của tôi, Kết quả, Bài kiểm tra, Đăng ký tư vấn (admin-*.js) ── */
.ad-sheets { margin: 0 0 16px; }
.ad-back { margin-bottom: 4px; }
.ad-row.is-done { border-left: 4px solid var(--success); }
.ad-row-compact { padding: 10px 12px; }
.ad-code { font-size: 14px; font-weight: 600; }
.ad-filters-1 { grid-template-columns: minmax(0, 320px); }
.ad-filters-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ad-filters-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-filters-pair { grid-template-columns: repeat(2, minmax(0, 260px)); } /* Kho đề: Cấp độ + Trạng thái */
.ad-facts { display: grid; gap: 8px; margin: 12px 0 0; }
.ad-facts div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.ad-facts dt { font-weight: 600; color: var(--ink); }
.ad-facts dd { margin: 0; overflow-wrap: anywhere; }
.ad-facts-inline { gap: 2px; margin-top: 6px; font-size: 14px; }
.ad-facts-inline div { grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
.ad-mine h3 { font-size: 20px; line-height: 1.3; color: var(--ink); margin-bottom: 6px; overflow-wrap: anywhere; }
.ad-roster-title { font-size: 16px; color: var(--ink); margin: 20px 0 6px; }
.ad-roster { list-style: none; border-top: 1px solid var(--border); }
.ad-roster li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ad-roster-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ad-done { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 600; font-size: 14px; margin-top: 6px; }
.ad-done .icon { width: 18px; height: 18px; }
.ad-lead-note { margin-top: 6px; background: var(--surface-rose); border-radius: var(--r-sm); padding: 8px 12px; font-size: 15px; }
.ad-result-test { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.ad-result-who { margin-bottom: 2px; overflow-wrap: anywhere; }
.ad-skills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ad-skills li { background: var(--surface-rose); border-radius: var(--r-full); padding: 4px 12px; font-size: 14px; }
.ad-ai-error { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 14px; }
.ad-ai-error .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.ad-q { border-top: 1px solid var(--border); padding: 16px 0; }
.ad-q:first-of-type { border-top: 0; padding-top: 0; }
.ad-q:last-child { padding-bottom: 0; }
.ad-q .pt-q-text { font-size: 16px; margin-bottom: 10px; }
.ad-q-kind { font-size: 13px; margin: -4px 0 8px; }
.ad-q-media { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 8px; }
.ad-q-media .icon { width: 16px; height: 16px; }
.ad-q-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 12px; }
.ad-rubric { margin-top: 10px; font-size: 14px; background: var(--info-subtle); border-radius: var(--r-sm); padding: 8px 12px; }
.ad-h-icon { display: flex; align-items: center; gap: 8px; }
.ad-comments { list-style: none; display: grid; gap: 12px; margin-bottom: 16px; }
.ad-comments li { border-left: 3px solid var(--primary); padding: 2px 0 2px 12px; }
.ad-textarea { min-height: 120px; }
.ad-stats { margin: 12px 0 0 20px; display: grid; gap: 4px; }
.ad-warn-title { font-size: 16px; margin: 16px 0 6px; color: var(--ink); }
.ad-warnings { margin-left: 20px; display: grid; gap: 4px; font-size: 14px; max-height: 240px; overflow-y: auto; }
.ad-pick-search { margin-top: 12px; }
.ad-pick { max-height: 45vh; overflow-y: auto; margin-top: 8px; }

/* ── GĐ-B: Tài liệu lớp, Lớp của tôi (link), Giờ dạy, Lương (admin-files / teaching / payroll.js) ── */
.ad-files { margin-top: 20px; }
.ad-files-card .ad-files { margin-top: 0; }
.ad-files-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ad-files-head h2 { margin: 0; }
.ad-files-head h4 { font-size: 16px; color: var(--ink); margin: 0; }
.ad-files-off { margin: 0 0 12px; }
.ad-usage { font-size: 14px; margin-bottom: 12px; }
.ad-usage.is-warn { color: var(--warning); font-weight: 600; }
.ad-file-list { list-style: none; display: grid; gap: 8px; }
.ad-file { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 8px 6px 12px; }
.ad-file-open {
  flex: 1 1 240px; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 4px 0;
  background: none; border: 0; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
button.ad-file-open:hover .ad-file-title, a.ad-file-open:hover .ad-file-title { text-decoration: underline; }
.ad-file-open.is-pending { cursor: default; }
.ad-file-open .icon { flex-shrink: 0; color: var(--primary); }
.ad-file-title { font-weight: 600; overflow-wrap: anywhere; }
.ad-file-meta { font-size: 13px; }
.ad-dialog input[type="file"] { min-height: 48px; padding: 10px 12px; }
.ad-progress { display: grid; gap: 6px; margin-bottom: 4px; }
.ad-progress[hidden] { display: none; }
.ad-progress progress { width: 100%; height: 12px; accent-color: var(--primary); }
.ad-mine-actions { margin-top: 12px; }
.ad-time-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
/* Ô chọn giờ 24 giờ (plan-o-chon-gio.md – admin.js timeField): "Từ giờ" = Giờ ▾ : Phút ▾, hai <select class="select"> của
   trang thay ô giờ của trình duyệt (input kiểu time). Cỡ, viền, focus theo .select; cao 48 px; "Từ giờ" / "Đến giờ" cạnh
   nhau, dưới 360 px (không đủ chỗ cho 4 ô) mỗi ô một dòng. */
.ad-time { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.ad-time legend { display: block; margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.ad-time-pick { display: flex; align-items: center; gap: 6px; }
.ad-time-pick .select {
  flex: 1 1 0; min-width: 0; padding: 11px 26px 11px 10px; background-position: right 6px center; background-size: 16px;
  font-variant-numeric: tabular-nums;
}
.pt-field .ad-time-sep { display: block; flex: none; margin: 0; font-size: 18px; font-weight: 700; line-height: 1; color: var(--ink); }
@media (max-width: 359px) { .ad-time-pair { grid-template-columns: minmax(0, 1fr); } }
.ad-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 12px; }
.ad-sum div { background: var(--surface-rose); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
.ad-sum dt { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ad-sum dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ad-rate-note { font-size: 14px; }
.ad-money { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ad-missing { color: var(--warning); font-weight: 600; }
.ad-session-note { margin-top: 6px; background: var(--surface-rose); border-radius: var(--r-sm); padding: 6px 10px; font-size: 14px; }
.ad-pay-amount { font-size: 18px; margin: 0; }
.ad-pay-sessions { flex-basis: 100%; }
.ad-pay-sessions[hidden] { display: none; }
.ad-pay-sessions .ad-list { margin-top: 4px; }
.ad-pay-sessions .ad-row { padding: 10px 12px; }
.ad-total { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--ink); font-weight: 700; color: var(--ink); font-size: 17px; }

@media (max-width: 639px) {
  .ad-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-file .ad-btn { width: 100%; }
  .ad-pay-amount { width: 100%; }
}

@media (max-width: 639px) {
  .ad-filters-2, .ad-filters-3, .ad-filters-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-filters-1 { grid-template-columns: minmax(0, 1fr); }
  .ad-facts div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ad-facts-inline div { grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
  .ad-q-foot .ad-btn, .ad-mine .pt-actions .ad-btn { width: 100%; }
}

/* ================================================
   GĐ-C – bài theo format Goethe / DTZ (portal.js) và trình soạn bài (admin-tests.js)
   ================================================ */
/* ── Góc học viên: phần (Teil), lưới chỗ trống, nối, quảng cáo, mẫu đơn, thi nói, trình phát ── */
.pt-part-group + .pt-part-group { margin-top: 28px; }
.pt-part { border-top: 4px solid var(--primary); }
.pt-part-label { color: var(--text-muted); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.pt-card.pt-part h2, .pt-card.pt-part h3 { font-size: 22px; line-height: 1.3; color: var(--ink); margin-bottom: 8px; overflow-wrap: anywhere; }
.pt-part-text { color: var(--text); font-size: 16px; line-height: 1.6; margin-bottom: 12px; }
.pt-q-head h4 { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; color: var(--primary); }
.pt-match-title { font-weight: 600; color: var(--ink); margin: 4px 0 8px; }
.pt-match-list { list-style: none; display: grid; gap: 6px; }
.pt-match-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-rose); color: var(--ink); }
.pt-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-key {
  display: inline-flex; align-items: center; gap: 8px; min-width: 64px; min-height: 48px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--primary); font-size: 17px; font-weight: 700;
}
.pt-key:hover { background: var(--primary-subtle); }
.pt-key input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); flex-shrink: 0; }
.pt-key:has(input:checked) { border: 2px solid var(--primary); padding: 0 13px; background: var(--primary-subtle); }
.pt-key:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.pt-gap { display: inline-block; min-width: 3.2em; padding: 0 4px; border-bottom: 2px solid var(--primary); color: var(--primary); font-weight: 700; text-align: center; }
.pt-grid-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.pt-grid-row:first-child { border-top: 0; padding-top: 0; }
.pt-grid-row:last-child { padding-bottom: 0; }
.pt-grid-num { font-weight: 700; color: var(--primary); font-size: 18px; overflow-wrap: anywhere; }
.pt-grid-text { display: block; font-weight: 400; color: var(--text-muted); font-size: 14px; }
.pt-grid-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pt-options-ads { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch; }
.pt-options-ads .pt-option { align-items: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-options-ads .pt-option input { margin-top: 3px; }
.pt-form-line { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 6px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.pt-form-line:first-child { border-top: 0; padding-top: 0; }
.pt-form-line:last-child { padding-bottom: 0; }
.pt-form-label { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.pt-form-num { color: var(--primary); font-weight: 700; }
.pt-form-value { color: var(--text); overflow-wrap: anywhere; }
.pt-fill {
  display: block; width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
.pt-fill:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pt-fill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pt-speaking { display: flex; gap: 10px; align-items: flex-start; margin-top: 0; }
.pt-speaking .icon { flex-shrink: 0; margin-top: 3px; }
.pt-listen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-rose); }
.pt-listen-btn { flex: none; }
.pt-listen-info { flex: 1 1 180px; min-width: 0; }
.pt-listen-bar { height: 6px; border-radius: var(--r-full); background: var(--surface); overflow: hidden; margin-bottom: 4px; }
.pt-listen-bar span { display: block; width: 0; height: 100%; background: var(--primary); }
.pt-listen-time { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pt-listen-note { flex-basis: 100%; font-size: 14px; color: var(--text); }
.pt-listen-note:empty { display: none; }
.pt-listen audio { display: none; }
.pt-preview { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-left: 4px solid var(--info); background: var(--info-subtle); }
.pt-preview .pt-inline { flex: 1 1 300px; }
.pt-review-pick { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); color: var(--ink); }
.pt-review-pick + .pt-review-pick { margin-top: 8px; }
.pt-review-pick.is-answer { border: 2px solid var(--success); padding: 9px 13px; background: var(--success-subtle); }
.pt-review-pick.is-wrong { border: 2px solid var(--error); padding: 9px 13px; background: var(--error-subtle); }
.pt-accepted { margin-top: 10px; color: var(--success); font-weight: 600; }
/* Nhập đề từ AI (plan-nhap-de-tu-ai.md): "Giải thích" under the correct answer of a reviewed question */
.pt-explain { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--info); background: var(--info-subtle); color: var(--text); border-radius: var(--r-sm); }
.pt-explain strong { font-weight: 600; }

@media (max-width: 639px) {
  .pt-form-line, .pt-grid-row { grid-template-columns: minmax(0, 1fr); }
  .pt-preview .pt-btn { width: 100%; }
  .pt-listen-btn { width: 100%; }
}

/* ── Trang quản lý: trình soạn bài ── */
.ad-test-name { overflow-wrap: anywhere; margin-bottom: 6px; }
.ad-test-actions { margin-top: 12px; }
.ad-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ad-short { min-height: 72px; }
.ad-check { margin-bottom: 8px; }
.ad-show-result { margin-bottom: 16px; }
.ad-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ad-picks .ad-check { margin-bottom: 0; }
.ad-picks-hint { margin: 8px 0 0; }
.ad-class-picks { margin-bottom: 0; }
.ad-part { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--r-md); padding: 16px; margin-bottom: 16px; }
.ad-part-free { border-left-color: var(--border-strong); }
.ad-part-free-title { font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.ad-qe-list { list-style: none; display: grid; gap: 12px; margin: 12px 0 0; }
.ad-qe { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); }
.ad-qe-section { border: 0; padding: 0; background: none; }
.ad-qe-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ad-qe-title { font-size: 17px; line-height: 1.3; color: var(--ink); margin: 0; overflow-wrap: anywhere; }
.ad-qe-section .ad-qe-title { font-size: 19px; }
.ad-qe-type { font-weight: 600; font-size: 14px; }
.ad-qe-tools { display: flex; gap: 6px; }
.ad-icon-btn { width: 44px; padding: 0; }
.ad-icon-btn .icon { width: 20px; height: 20px; }
.ad-qe-error { margin: 0 0 8px; }
.ad-opts { margin-bottom: 12px; }
.ad-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ad-opt-correct { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 56px; cursor: pointer; }
.ad-opt-correct input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.ad-opt-key { font-weight: 700; color: var(--primary); min-width: 20px; }
.ad-opt-text { display: block; min-width: 0; }
.ad-opt-text input, .ad-opt-area {
  display: block; width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.4;
}
.ad-opt-area { resize: vertical; }
.ad-opt-text input:focus, .ad-opt-area:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.ad-opt-text input[readonly] { background: var(--surface-rose); }
.ad-media { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px; }
.ad-media-title { font-weight: 600; color: var(--ink); margin-bottom: 8px; font-size: 15px; }
.ad-media-file { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; overflow-wrap: anywhere; }
.ad-media-file .icon { flex-shrink: 0; color: var(--primary); }
.ad-media > .ad-btn { margin-bottom: 12px; }
.ad-media .ad-user-actions { margin-top: 4px; }
.ad-add-row, .ad-add-part { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; margin-top: 12px; }
.ad-add-row .pt-field, .ad-add-part .pt-field { margin-bottom: 0; }
.ad-add-row .ad-btn, .ad-add-part .ad-btn { min-height: 48px; }
.ad-add-part { padding-top: 16px; border-top: 1px solid var(--border); }
.ad-savebar { padding: 10px max(20px, calc((100% - 1040px) / 2)); }
#ad-save-state.is-dirty { color: var(--warning); font-weight: 600; }
.ad-q.ad-q-part { background: var(--surface-rose); border-radius: var(--r-sm); padding: 12px 14px; margin: 8px 0; border-top: 0; }
.ad-q-part-title { font-size: 17px; color: var(--ink); margin-bottom: 4px; overflow-wrap: anywhere; }
.ad-q-file { min-height: 44px; }

@media (max-width: 639px) {
  .ad-add-row, .ad-add-part { grid-template-columns: minmax(0, 1fr); }
  .ad-add-row .ad-btn, .ad-add-part .ad-btn { width: 100%; }
  .ad-part { padding: 12px; }
  .ad-qe { padding: 12px; }
  .ad-test-actions .ad-btn { flex: 1 1 auto; }
}

/* ================================================
   Chia sẻ bài tập (plan-chia-se-bai-tap.md) – tab của Góc học viên (portal.js)
   và mục cùng tên của Trang quản lý (admin-shares.js)
   ================================================ */
.pt-share-panel h2:focus { outline: none; }
.pt-share-status { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; color: var(--success); font-weight: 600; font-size: 15px; }
.pt-share-status:empty { margin: 0; }
.pt-share-status.is-error { color: var(--error); }
.pt-share-form { border-top: 1px solid var(--border); padding-top: 16px; }
.pt-share-form h3 { font-size: 17px; line-height: 1.3; color: var(--ink); margin-bottom: 12px; }
.pt-share-form .pt-hint { margin-top: -8px; }
.pt-share-note-input { min-height: 96px; }
.pt-share-form-actions { margin-top: 4px; }
.pt-share-count { font-size: 14px; margin-bottom: 10px; }
.pt-shares { list-style: none; display: grid; gap: 10px; }
.pt-share {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px;
}
.pt-share.is-hidden { background: var(--surface-rose); }
.pt-share-info { flex: 1 1 260px; min-width: 0; }
.pt-share-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.pt-share-meta { font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.pt-share-meta .pt-chip { margin-left: 0; }
.pt-share-by { font-size: 14px; }
.pt-share-note { margin-top: 8px; background: var(--surface-rose); border-radius: var(--r-sm); padding: 8px 12px; font-size: 15px; }
.pt-share-hint { font-size: 14px; margin-top: 4px; }
.pt-share-why { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; color: var(--error); font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pt-share-why .icon { flex-shrink: 0; margin-top: 2px; width: 18px; height: 18px; }
.pt-share-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-share-actions .pt-chip { margin-left: 0; }
.pt-share-btn { min-height: 44px; padding: 0 14px; font-size: 14px; gap: 6px; border-width: 1px; }
.pt-share-btn .icon { width: 18px; height: 18px; }
.pt-share-danger { color: var(--error); border-color: var(--error); }
.pt-share-danger:hover { background: var(--error-subtle); color: var(--error); border-color: var(--error); }
.pt-chip-service { background: var(--info-subtle); color: var(--info); }
.pt-chip-hidden { background: var(--error-subtle); color: var(--error); }
.pt-share-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; margin-bottom: 12px; }
.pt-share-search .pt-field { margin-bottom: 0; }
.pt-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 16px; }
.pt-dialog-form { margin-top: 16px; }
.pt-dialog-form .pt-field { margin-bottom: 0; }
.pt-dialog-form .pt-error { margin-top: 0; }

/* Trang quản lý → Chia sẻ bài tập */
.ad-share-url { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; margin-top: 4px; }
.ad-share-hidden { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 14px; color: var(--error); font-weight: 600; overflow-wrap: anywhere; }
.ad-share-hidden .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.ad-share-reports { margin-top: 8px; font-size: 14px; }
.ad-share-reports summary { cursor: pointer; font-weight: 600; color: var(--warning); min-height: 44px; display: flex; align-items: center; }
.ad-share-reports ul { list-style: none; display: grid; gap: 6px; margin-top: 4px; }
.ad-share-reports li { border-left: 3px solid var(--warning); padding: 2px 0 2px 10px; overflow-wrap: anywhere; }
.ad-chip-reports { background: var(--warning-subtle); color: var(--warning); }

@media (max-width: 639px) {
  .pt-share-actions { width: 100%; }
  .pt-share-actions .pt-share-btn { flex: 1 1 auto; }
  .pt-share-search { grid-template-columns: minmax(0, 1fr); }
  .pt-share-search .pt-btn, .pt-share-form-actions .pt-btn { width: 100%; }
  .pt-pager .pt-share-btn { flex: 1 1 auto; }
  .pt-pager > span { order: -1; flex-basis: 100%; text-align: center; }
}

/* ================================================
   Nội dung website (GĐ-D) – Trang quản lý: bài viết, bộ từ vựng, ảnh vị trí, clip
   (admin-content.js, admin-vocab.js, admin-media.js)
   ================================================ */
.ad-subnav { margin: 0 0 12px; }
.ad-subnav .tab { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.ad-subnav .tab:hover { background: var(--primary-subtle); color: var(--ink); }
.ad-subnav .tab[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ad-post-row { align-items: flex-start; }
.ad-post-thumb { flex: none; width: 96px; height: 64px; object-fit: cover; border-radius: var(--r-sm); background: var(--placeholder); }
.ad-return-note { margin-top: 6px; font-size: 14px; color: var(--error); overflow-wrap: anywhere; }
.ad-return-box { margin: 12px 0 0; }
.ad-cover { border-top: 1px dashed var(--border); padding-top: 12px; }
.ad-cover-img, .ad-block-img { display: block; width: 100%; max-width: 360px; max-height: 240px; object-fit: contain; border-radius: var(--r-sm); background: var(--surface-rose); margin-bottom: 12px; }
.ad-cover .ad-user-actions { margin-bottom: 12px; }
.ad-cover-alt { margin-top: 4px; }
.ad-block .ad-user-actions { margin-bottom: 12px; }
.ad-yt-thumb { display: block; width: 240px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-sm); background: var(--ink); }
.ad-add-blocks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ad-dialog.ad-dialog-wide { width: min(860px, calc(100vw - 32px)); }
.ad-preview-article { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 16px; }
.ad-preview-article .article-title { font-size: 30px; }
.ad-preview-article .article-body { font-size: 17px; }
.ad-preview-article .article-body h2 { font-size: 23px; }

/* Bộ từ vựng: mỗi từ một hàng 4 ô (điện thoại: xếp dọc) */
.ad-words { list-style: none; display: grid; gap: 10px; }
.ad-word {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 44px; gap: 4px 10px; align-items: start;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface);
}
.ad-word-num { font-weight: 700; color: var(--primary); padding-top: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.ad-word-fields { display: grid; grid-template-columns: minmax(0, 1.2fr) 130px minmax(0, 1.2fr) minmax(0, 1.6fr); gap: 0 10px; min-width: 0; }
.ad-word-fields .pt-field { margin-bottom: 4px; }
.ad-word-fields .pt-field > span { font-size: 13px; }
.ad-word .ad-icon-btn { margin-top: 24px; }
.ad-word-error { grid-column: 2 / -1; margin: 0; }
.ad-word-error:empty { display: none; }
.ad-import-lines { min-height: 160px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; }
.ad-import-table-wrap { max-height: 40vh; overflow: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.ad-import-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ad-import-table th, .ad-import-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.ad-import-table th { position: sticky; top: 0; background: var(--surface-rose); color: var(--ink); }
.ad-import-table tr.is-bad td { background: var(--error-subtle); }
.ad-import-table .pt-error { margin: 0; font-size: 14px; }

/* Bài kiểm tra → Luyện nói (plan-bai-luyen-noi.md): mỗi câu một hàng 3 ô + ↑ ↓ xóa (dùng khung .ad-word của Bộ từ vựng) */
.ad-ln-item { grid-template-columns: 32px minmax(0, 1fr) auto; }
.ad-ln-fields { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1fr); }
.ad-ln-tools { display: flex; gap: 4px; margin-top: 24px; }
.ad-ln-tools .ad-icon-btn { margin-top: 0; }
.ad-ln-level { max-width: 220px; }
.ad-ln-import-table th { white-space: nowrap; }

/* Ảnh vị trí */
.ad-slot-page { font-size: 17px; color: var(--ink); margin: 20px 0 10px; }
.ad-slots { list-style: none; display: grid; gap: 10px; }
.ad-slot { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; }
.ad-slot-img { flex: none; width: 120px; height: 80px; object-fit: cover; border-radius: var(--r-sm); background: var(--placeholder); }
.ad-slot-img.ad-ratio-1x1 { width: 80px; }
.ad-slot-none { display: inline-flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--text-muted); padding: 4px; }
.ad-slot-info { flex: 1 1 220px; min-width: 0; }

/* Clip */
.ad-clip { align-items: flex-start; }
.ad-clip-thumb { flex: none; width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-sm); background: var(--ink); }

@media (max-width: 767px) {
  .ad-word { grid-template-columns: 24px minmax(0, 1fr) 44px; padding: 10px; }
  .ad-word-num { padding-top: 30px; }
  .ad-word-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ad-word-ex { grid-column: 1 / -1; }
  .ad-ln-fields .ad-ln-de { grid-column: 1 / -1; }
}
@media (max-width: 1023px) {
  .ad-ln-item { grid-template-columns: 24px minmax(0, 1fr); }
  .ad-ln-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ad-ln-fields .ad-ln-de { grid-column: 1 / -1; }
  .ad-ln-tools { grid-column: 2; margin-top: 0; }
}
@media (max-width: 639px) {
  .ad-word-fields { grid-template-columns: minmax(0, 1fr); }
  .ad-ln-fields { grid-template-columns: minmax(0, 1fr); }
  .ad-ln-level { max-width: none; }
  .ad-post-thumb, .ad-clip-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .ad-slot-img { width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .ad-slot-img.ad-ratio-1x1 { width: 120px; aspect-ratio: 1 / 1; }
  .ad-add-blocks .ad-btn { flex: 1 1 calc(50% - 8px); }
}

/* ================================================
   Đăng ký tư vấn – trắc nghiệm công khai (plan-trac-nghiem-cong-khai.md): lọc nguồn, tóm tắt kết quả,
   đánh giá của một khách, chữ gợi ý hướng nghiệp
   ================================================ */
.ad-filters.ad-lead-filters { grid-template-columns: repeat(2, minmax(0, 260px)); }
.ad-quiz-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.ad-quiz-sum .pt-chip { margin-left: 0; }
.ad-quiz-sum .pt-muted { font-size: 14px; }
.ad-quiz-dialog p { margin-top: 6px; }
.ad-quiz-big { margin-top: 16px; font-size: 18px; color: var(--ink); }
.ad-quiz-big strong { font-size: 22px; }
.ad-quiz-h { margin: 20px 0 6px; font-size: 16px; color: var(--ink); }
.ad-quiz-read { padding: 4px 14px 12px; border-left: 4px solid var(--primary); background: var(--primary-subtle); border-radius: var(--r-sm); }
.ad-quiz-read p { margin-top: 8px; overflow-wrap: anywhere; }
.ad-quiz-scores { list-style: none; display: grid; gap: 4px; }
.ad-quiz-scores li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr) minmax(0, 1fr); gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-rose); font-size: 15px; }
.ad-quiz-scores li.is-top { background: var(--success-subtle); font-weight: 600; }
.ad-quiz-scores .icon { width: 16px; height: 16px; color: var(--success); }
.ad-quiz-groups { list-style: none; display: grid; gap: 12px; }
.ad-quiz-groups li { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.ad-quiz-answers { margin-top: 20px; }
.ad-quiz-answers summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ad-quiz-answers summary::-webkit-details-marker { display: none; }
.ad-quiz-answers summary::before { content: '▸'; color: var(--primary); }
.ad-quiz-answers[open] summary::before { content: '▾'; }
.ad-quiz-answers ol { list-style: none; display: grid; gap: 8px; margin-top: 8px; }
.ad-quiz-answers li { padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--surface); font-size: 15px; overflow-wrap: anywhere; }
.ad-quiz-answers li.is-ok { border-left-color: var(--success); }
.ad-quiz-answers li.is-wrong { border-left-color: var(--error); }
.ad-quiz-answers li p { margin-top: 2px; }
.ad-quiz-n { display: block; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.ad-text-group { margin-bottom: 20px; }
.ad-text-group > label > span { margin-bottom: 2px; }
.ad-text-about { margin-bottom: 8px; font-size: 14px; }
.ad-texts-status:empty { display: none; }
.ad-text-group textarea[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
@media (max-width: 639px) {
  .ad-filters.ad-lead-filters { grid-template-columns: minmax(0, 1fr); }
  .ad-quiz-scores li { grid-template-columns: minmax(0, 1fr) auto; }
  .ad-quiz-scores li span:last-child { grid-column: 1 / -1; font-size: 14px; }
  .ad-quiz-scores li span:last-child:empty { display: none; }
}

/* ── Kho đề (plan-kho-de-noi-bo.md): admin-bank.js, trình soạn (bài của kho), tab "Kho đề" của Góc học viên ── */
.ad-chip-missing { background: var(--warning-subtle); color: var(--warning); }
.ad-qe-title .ad-chip-missing { margin-left: 8px; vertical-align: middle; }
.ad-bank-missing { margin: 12px 0 0; }
.ad-bank-noclass { margin: 4px 0 0; }
.ad-bank-src { overflow-wrap: anywhere; }
.ad-bank-remind { margin: 16px 0 0; }
.ad-bank-found-box, .ad-bank-report-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.ad-bank-found-box h3, .ad-bank-report-box h3 { font-size: 17px; color: var(--ink); margin: 0 0 6px; }
.ad-bank-pick-all { margin: 10px 0; }
.ad-bank-found { list-style: none; display: grid; gap: 8px; margin: 0 0 12px; max-height: 55vh; overflow-y: auto; }
.ad-bank-found .ad-check { margin: 0; align-items: flex-start; }
.ad-bank-found .ad-check > span { min-width: 0; overflow-wrap: anywhere; }
.ad-bank-found .ad-share-url { display: inline; }
.ad-bank-had { margin: 2px 0 0 46px; font-size: 14px; }
.ad-bank-lines { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.ad-bank-line { padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--surface); border-radius: var(--r-sm); overflow-wrap: anywhere; }
.ad-bank-line.is-imported { border-left-color: var(--success); }
.ad-bank-line.is-failed { border-left-color: var(--error); }
.ad-bank-line .pt-error { margin: 4px 0 0; font-size: 14px; }
/* "Tải ảnh + lấy đáp án cho mọi bài còn thiếu" (Kho đề, 04/11/2026) */
.ad-bank-all { display: grid; gap: 8px; margin: 4px 0 14px; }
.ad-bank-all .pt-actions { margin: 0; }
.ad-bank-all .ad-bank-report-box { margin-top: 4px; }
.ad-bank-notes { margin: 6px 0 0 18px; font-size: 14px; color: var(--text-muted); }
.ad-bank-log ol li { font-size: 14px; }
/* plan-kho-de-mo-bai-lich-hv.md: "Mở toàn bộ bài nháp", what an opening said, the notes of "Cấp quyền" */
.ad-bank-open-all { display: grid; gap: 8px; margin: 4px 0 14px; }
.ad-bank-open-all .pt-actions, .ad-bank-open-all p { margin: 0; }
.ad-bank-opened { margin: 4px 0 14px; overflow-wrap: anywhere; }
.ad-bank-opened:focus { outline: none; }
.ad-bank-opened .ad-success { margin-bottom: 0; }
#ad-bank-grant [data-grant-test-note] .pt-note, #ad-bank-grant [data-grant-scope="all"] .pt-note { margin: 8px 0; }
#ad-bank-grant [data-grant-scope="all"] .pt-hint { margin-top: 4px; }
/* plan-kho-de-anh-dap-an-chia-se-gv.md: what "Tải ảnh" / "Lấy đáp án từ Google" did, under an import line or a test */
.ad-bank-steps { margin-top: 8px; display: grid; gap: 6px; }
.ad-bank-steps:focus { outline: none; }
.ad-bank-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; color: var(--ink); }
.ad-bank-step .icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--primary); }
.ad-bank-step > span { min-width: 0; overflow-wrap: anywhere; }
.ad-bank-step-note { font-size: 14px; margin: 0; }
.ad-bank-steps .ad-bank-notes { margin-top: 0; }
.ad-bank-steps .pt-error { margin: 0; font-size: 14px; }
.ad-doc-body { margin-top: 16px; padding: 16px; border-radius: var(--r-sm); background: var(--surface-rose); font-size: 16px; line-height: 1.6; max-height: none; }
.ad-doc-edit { min-height: 50vh; font-size: 15px; }
.pt-doc-body { margin-top: 16px; font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.pt-doc h1 { overflow-wrap: anywhere; }

/* ================================================
   Lịch (plan-lich-lop-hoc.md, plan-lich-lap-buoi-le.md) – tab "Lịch" của Trang quản lý (admin-lich.js) và Góc học viên
   (portal.js); lưới tháng / danh sách theo ngày: lich-lop.js. "Lịch học" của một lớp (admin-classes.js): ad-sched*,
   hộp lịch lặp (ad-days, ad-day, ad-rule-preview) và buổi lẻ (ad-extras*), câu hỏi "sẽ mất thay đổi" (ad-lost).
   ================================================ */
.lich-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lich-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 4px 0 12px; }
.lich-month { flex: 0 1 auto; min-width: 8.5em; margin: 0; text-align: center; font-size: 20px; line-height: 1.3; color: var(--ink); }
.lich-month:focus { outline: none; }
.lich-nav { min-height: 44px; padding: 0 14px; gap: 4px; font-size: 14px; border-width: 1px; }
.lich-nav .icon { width: 18px; height: 18px; }
.lich-today-btn { min-height: 44px; padding: 0 18px; font-size: 14px; border-width: 1px; }
.lich-status { margin: 0 0 12px; color: var(--success); font-size: 15px; font-weight: 600; }
.lich-status:empty { display: none; }
.lich-note { margin: 0 0 12px; }

/* ── plan-lich-thang-gon.md (ux-lich-thang/DESIGN.md): lưới tháng gọn – thẻ buổi một dòng, mỗi lớp một màu, đỏ chỉ cho hôm nay ──
   Màu lớp: bảng cố định 8 màu (không đỏ / cam gần đỏ, mỗi màu ≥ 4.5:1 trên trắng), lớp nhận màu theo id lớp mod 8
   (lich-lop.js colorOf → .lich-c1 … .lich-c8 đặt --tone). "Chưa ghi giờ": đồng hồ nâu – hình khác hẳn chấm lớp. */
:root {
  --class-1: #1D4ED8; --class-2: #047857; --class-3: #6D28D9; --class-4: #0F766E;
  --class-5: #92400E; --class-6: #4338CA; --class-7: #4D7C0F; --class-8: #475569;
  --status-pending: #92400E;
}
.lich-c1 { --tone: var(--class-1); } .lich-c2 { --tone: var(--class-2); } .lich-c3 { --tone: var(--class-3); } .lich-c4 { --tone: var(--class-4); }
.lich-c5 { --tone: var(--class-5); } .lich-c6 { --tone: var(--class-6); } .lich-c7 { --tone: var(--class-7); } .lich-c8 { --tone: var(--class-8); }

/* Tab Lịch dùng hết vùng nội dung tới 1200 px (các mục khác giữ: Trang quản lý 1040 px, Góc học viên 760 px) */
.ad-main:has(.lich-card), .pt-main:has(> #pt-home-lich:not([hidden])) { max-width: calc(1200px + 40px); } /* + lề 20 px hai bên */
.pt-body:has(#pt-home-lich:not([hidden])) .pt-header { padding: 0 max(12px, calc((100% - 1240px) / 2)) 0 max(20px, calc((100% - 1240px) / 2)); }

/* Thanh tháng: ‹ Tháng trước · Tháng 11/2026 · Tháng sau › · Hôm nay · Tháng | Danh sách */
.lich-bar-end { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; } /* tháng trước · tháng · tháng sau bên trái, Hôm nay + kiểu xem bên phải */
.lich-views { display: inline-flex; flex: none; border: 1px solid var(--border-strong); border-radius: var(--r-full); }
.lich-view {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.lich-view:not([aria-pressed="true"]):not(:disabled):hover { background: var(--primary-subtle); }
.lich-view[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.lich-view:disabled { opacity: .5; cursor: not-allowed; }
.lich-view:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Chú thích lớp (trên lịch) + chú thích trạng thái (một hàng, dưới lịch) */
.lich-classes { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0; }
.lich-class { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; font-weight: 500; line-height: 18px; color: var(--ink); overflow-wrap: anywhere; }
.lich-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: var(--r-full); background: var(--tone, var(--class-8)); }
.pt-dialog h2 .lich-dot { margin-right: 8px; vertical-align: 2px; }
.lich-keys {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 12px 0 0; padding: 0;
  font-size: 12px; font-weight: 500; line-height: 18px; color: var(--text-muted);
}
.lich-keys li { display: inline-flex; align-items: center; gap: 6px; }
.lich-key-icon { width: 14px; height: 14px; stroke-width: 2.25; }
.lich-key-icon.is-done { color: var(--text-muted); }
.lich-key-icon.is-pending { color: var(--status-pending); }
.lich-key-icon.is-sub { color: var(--ink); }
.lich-key-sample {
  display: inline-flex; align-items: center; height: 18px; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px;
  color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums;
}
.lich-key-sample.is-cancelled { text-decoration: line-through; opacity: .6; }
.lich-key-sample.is-moved { border: 1px dashed var(--text-muted); }
.lich-key-plus { font-size: 14px; font-weight: 800; line-height: 1; color: var(--ink); }

/* Lưới tháng: 7 cột, thứ 2 đầu tuần; đường kẻ mảnh, bo 12 px bốn góc ngoài */
.lich-grid {
  width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.lich-grid th {
  padding: 8px; text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.lich-grid abbr { text-decoration: none; }
.lich-grid th + th, .lich-day + .lich-day { border-left: 1px solid var(--border); }
.lich-grid tbody tr + tr > td { border-top: 1px solid var(--border); }
.lich-grid tbody tr:last-child > td:first-child { border-bottom-left-radius: 11px; }
.lich-grid tbody tr:last-child > td:last-child { border-bottom-right-radius: 11px; }
.lich-day { height: 112px; padding: 6px; vertical-align: top; background: var(--surface); } /* height của ô bảng = cao tối thiểu */
.lich-day.is-out { background: var(--surface); } /* ngoài tháng: trắng, không số */
.lich-day.is-today { background: var(--primary-subtle); } /* hôm nay: nền rất nhạt + số trong vòng tròn đỏ – không viền đỏ cả ô */
.lich-day:focus { outline: none; } /* review vòng 1: "Hôm nay" bằng chuột không vẽ khung quanh ô (đỏ chỉ cho vòng tròn hôm nay) */
.lich-day:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; } /* bàn phím: vòng focus trung tính */
.lich-day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 24px; margin-bottom: 4px; }
.lich-num { display: inline-flex; min-width: 0; padding-left: 2px; font-size: 13px; font-weight: 600; line-height: 22px; color: var(--ink); }
.lich-num-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; font-variant-numeric: tabular-nums; } /* rộng = cao: vòng tròn cả ngày 2 chữ số */
.lich-day.is-before .lich-num { color: var(--text-muted); }
.lich-day.is-today .lich-num-n { border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.lich-cell { list-style: none; display: grid; gap: 3px; margin: 0; padding: 0; }
.lich-cell > li { min-width: 0; } /* thẻ dài cắt "…" trong ô của nó, không bao giờ làm lưới rộng ra */
.lich-empty-grid { padding: 0 0 12px; }

/* "+" thêm buổi lẻ: 24 px góc trên phải ô; chỉ hiện khi rê chuột / focus ô (máy có chuột); không có trên màn cảm ứng */
.lich-add {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface); color: var(--ink);
  cursor: pointer; opacity: 0; transition: opacity .12s ease;
}
.lich-add .icon { width: 14px; height: 14px; stroke-width: 2.25; }
.lich-add:hover { border-color: var(--ink); background: var(--primary-subtle); color: var(--ink); } /* trung tính – đỏ chỉ cho hôm nay + kiểu xem */
.lich-add:focus-visible { opacity: 1; outline: 2px solid var(--ink); outline-offset: 2px; } /* vòng focus trong lịch: đen trung tính (07/11) */
@media (hover: hover) {
  .lich-day:hover .lich-add, .lich-day:focus-within .lich-add { opacity: 1; }
}
@media (hover: none) {
  .lich-add { display: none; }
}

/* Thẻ buổi (lưới): một dòng 24 px – [vạch 3 px màu lớp] [+ buổi thêm] 19:30 A1-05.11… [✓ / đồng hồ] */
.lich-s {
  display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; height: 24px; padding: 0 6px 0 5px;
  border: 1px solid var(--border); border-left: 3px solid var(--tone, var(--class-8)); border-radius: 6px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; line-height: 18px;
  text-align: left; white-space: nowrap; cursor: pointer;
}
.lich-s:hover { background: var(--primary-subtle); }
.lich-s:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; } /* như ô ngày – đỏ chỉ cho vòng tròn hôm nay + kiểu xem (07/11) */
.lich-s-plus { flex: none; font-size: 12px; font-weight: 800; line-height: 1; color: var(--tone, var(--class-8)); }
.lich-s-time { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.lich-s-code { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lich-s-icon { width: 14px; height: 14px; stroke-width: 2.25; }
.lich-s-icon.is-done { color: var(--text-muted); }
.lich-s-icon.is-pending { color: var(--status-pending); }
.lich-s-sub { flex: none; width: 13px; height: 13px; stroke-width: 2.25; color: var(--tone, var(--class-8)); } /* dạy thay (plan-day-thay.md) */
.lich-s.is-cancelled { opacity: .6; }
.lich-s.is-cancelled .lich-s-time, .lich-s.is-cancelled .lich-s-code { text-decoration: line-through; }
.lich-s.is-moved { border-style: dashed; border-color: var(--text-muted); border-left-style: solid; border-left-color: var(--tone, var(--class-8)); }
.lich-more {
  display: block; width: 100%; min-height: 24px; margin-top: 3px; padding: 0 6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer;
}
.lich-more:hover { background: var(--primary-subtle); }
.lich-more:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Danh sách theo ngày (vùng lịch hẹp, hoặc chọn "Danh sách"): chỉ ngày có buổi; mỗi buổi 2 dòng, mã lớp đầy đủ, chạm ≥ 44 px */
.lich-days { list-style: none; display: grid; gap: 16px; margin: 0; padding: 0; }
.lich-date-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; font-size: 16px; line-height: 1.3; color: var(--ink); }
.lich-today-word { color: var(--primary); font-size: 14px; font-weight: 700; }
.lich-rows { gap: 6px; }
.lich-row {
  flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; height: auto; min-height: 44px;
  padding: 6px 12px 6px 10px; font-size: 15px; line-height: 1.35; white-space: normal;
}
.lich-row-top { display: block; min-width: 0; overflow-wrap: anywhere; }
.lich-row-sep { color: var(--text-muted); }
.lich-row-code { font-weight: 600; }
.lich-row-sub { display: block; min-width: 0; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.lich-row.is-cancelled { opacity: 1; }
.lich-row.is-cancelled .lich-row-top { color: var(--text-muted); text-decoration: line-through; }
.lich-row.is-cancelled .lich-s-time, .lich-row.is-cancelled .lich-row-code { text-decoration: none; } /* gạch cả dòng 1 một lần */
.lich-empty { padding: 16px 0; }

/* Đang tải tháng khác: khung xám giữ chiều cao (không nhấp nháy khi giảm chuyển động) */
.lich-skel { display: grid; gap: 6px; }
.lich-skel.is-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.lich-skel-cell, .lich-skel-bar { display: block; border-radius: 8px; background: var(--disabled-bg); animation: ad-skel 1.4s ease-in-out infinite; }
.lich-skel-cell { height: 104px; }
.lich-skel-bar { height: 56px; }
@media (prefers-reduced-motion: reduce) {
  .lich-skel-cell, .lich-skel-bar { animation: none; }
  .lich-add { transition: none; }
}

/* Khung chi tiết của một buổi / một ngày */
.lich-when { font-weight: 600; color: var(--ink); }
.lich-flag { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); }
.lich-flag .icon { flex-shrink: 0; margin-top: 2px; }
.lich-flag span { min-width: 0; overflow-wrap: anywhere; }
.lich-flag.is-cancelled, .pt-dialog .lich-flag.is-cancelled { background: var(--error-subtle); color: var(--error); }
.lich-flag.is-moved, .pt-dialog .lich-flag.is-moved { background: var(--info-subtle); color: var(--info); }
.lich-flag.is-extra, .pt-dialog .lich-flag.is-extra { background: var(--success-subtle); color: var(--success); }
.lich-flag.is-sub, .pt-dialog .lich-flag.is-sub { background: var(--primary-subtle); color: var(--ink); } /* dạy thay */
.lich-facts { display: grid; gap: 6px; margin: 12px 0 0; }
.lich-facts div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; }
.lich-facts dt { font-weight: 600; color: var(--ink); }
.lich-facts dd { margin: 0; overflow-wrap: anywhere; }
.ad-facts.lich-facts div { grid-template-columns: 110px minmax(0, 1fr); }
.lich-actions { margin-top: 16px; }
.lich-join { margin-top: 16px; }
.lich-day-list { margin-top: 12px; }

/* Lớp học → một lớp, Lớp của tôi: "Lịch học (tab Lịch)" – Lịch lặp + Buổi lẻ; hộp lịch lặp / buổi lẻ */
.ad-sched-short { margin-top: 2px; }
.ad-sched-note { margin-top: 12px; }
.ad-sched-box { min-width: 0; }
.ad-sched-box:focus { outline: none; }
.ad-mine .ad-sched-box { margin-top: 16px; }
.ad-sched-empty { margin: 0 0 8px; font-weight: 600; }
.ad-sched-status { margin: 0 0 8px; color: var(--success); font-weight: 600; }
.ad-sched-status:empty { display: none; }
.ad-sched-part + .ad-sched-part { margin-top: 16px; }
.ad-sched-head { margin-bottom: 4px; }
.ad-sched-sub { margin: 0; font-size: 17px; color: var(--ink); }
.ad-rule-text, .ad-extra-text { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ad-extras-past { margin-top: 8px; }
.ad-extras-past > summary {
  display: flex; align-items: center; min-height: 44px; padding: 0 4px; cursor: pointer; font-weight: 600; color: var(--ink);
}
.ad-extras-past > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.ad-days-field { min-width: 0; margin: 0 0 12px; padding: 0; border: 0; }
.ad-days-field legend { margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.ad-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.ad-day {
  min-height: 48px; min-width: 0; padding: 0 4px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.ad-day:hover { background: var(--primary-subtle); }
.ad-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ad-day[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.ad-rule-preview { margin: 4px 0 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-rose); color: var(--text-muted); font-size: 15px; }
.ad-rule-preview.is-ready { background: var(--success-subtle); color: var(--success); font-weight: 600; }
.ad-lost[hidden] { display: none; }

/* Dạy thay (plan-day-thay.md): hộp "Dạy thay" (chọn người, "Chỉ buổi này" / "Mọi buổi của lớp từ … đến …", lý do), mục "Dạy thay"
   ở trang lớp / Lớp của tôi, "Lớp dạy thay" (chỉ xem) ở Lớp của tôi */
.ad-scope { min-width: 0; margin: 0 0 12px; padding: 0; border: 0; }
.ad-scope legend { margin-bottom: 4px; padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.ad-radio { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.ad-radio input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.ad-sub-range[hidden], .ad-sub-hint[hidden] { display: none; }
.ad-sub-text { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ad-sub-who { margin: 8px 0 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ad-sub-card .ad-facts { margin-top: 8px; }
.ad-readonly { margin: 8px 0 0; }
.ad-sub-tests { list-style: none; display: grid; gap: 6px; margin: 8px 0 0; padding: 0; }
.ad-sub-tests a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }

@media (max-width: 639px) {
  .lich-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lich-month { grid-column: 1 / -1; order: -1; text-align: left; }
  .lich-bar-end { grid-column: 1 / -1; margin-left: 0; }
  .lich-today-btn { flex: 1 1 auto; }
  .lich-filters { grid-template-columns: minmax(0, 1fr); }
  .lich-facts div, .ad-facts.lich-facts div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lich-actions .pt-btn { flex: 1 1 100%; }
  .ad-days { grid-template-columns: repeat(4, minmax(0, 1fr)); } /* 7 thứ xuống dòng gọn: 4 + 3, mỗi nút ≥ 44 px */
}

/* ================================================
   Điều hướng (plan-dieu-huong-moi.md – ux-dieu-huong/DESIGN.md + EXPERIENCE.md)
   Trang quản lý: ≥ 1024px thanh bên cố định có nhóm (DẠY HỌC, TRUNG TÂM), nút tài khoản ở đáy;
   < 1024px thanh trên (☰ · tên mục · tài khoản) và thanh bên thành ngăn kéo trượt từ trái.
   Góc học viên (plan-hoc-vien-thanh-ben.md, 05/11/2026): < 1024px thanh dưới cố định; ≥ 1024px thanh bên như Trang quản lý
   (cùng các quy tắc .ad-sidebar / .ad-nav / .ad-nav-item / nút tài khoản ở đáy, một nhóm không tên), đầu trang ẩn; không còn tab ngang.
   Màu chỉ từ token của site.css: đỏ chỉ cho mục đang chọn (kèm chữ đậm / vạch trái), không vàng cho chữ.
   ================================================ */
:root {
  --nav-sidebar-w: 248px;
  --nav-topbar-h: 56px;
  --nav-bottom-h: 64px;
  --nav-scrim: rgba(17, 17, 17, 0.45);
}

/* ── Menu tài khoản (cả hai trang): ảnh đại diện + tên ▾ → tên, email / mã lớp, vai trò, các dòng ── */
.pt-account { position: relative; flex: none; min-width: 0; }
.pt-account-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 44px; min-height: 44px; padding: 6px;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink);
  font-size: 15px; font-weight: 600; line-height: 1.3; text-align: left;
}
.pt-account-btn:hover { background: var(--primary-subtle); color: var(--ink); }
.pt-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px;
  border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); font-size: 15px; font-weight: 700; line-height: 1;
}
.pt-avatar .icon { width: 18px; height: 18px; }
.pt-account-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pt-account-caret { width: 18px; height: 18px; color: var(--text-muted); transition: transform .15s ease; }
.pt-account-btn[aria-expanded="true"] .pt-account-caret { transform: rotate(180deg); }
.pt-account-menu {
  position: absolute; z-index: 60; min-width: 240px; padding: 8px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); box-shadow: 0 8px 24px rgba(17, 17, 17, 0.12);
}
.pt-account-who { padding: 6px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.pt-account-title { font-weight: 700; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.pt-account-sub { margin-top: 2px; font-size: 14px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.pt-account-who .pt-chip { margin: 8px 0 0; }
.pt-account-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.3; text-align: left; text-decoration: none;
}
.pt-account-item:hover { background: var(--primary-subtle); color: var(--ink); }
.pt-account-item[aria-current="page"] { color: var(--primary); }
/* chỉ ảnh đại diện (tên vẫn đọc được cho trình đọc màn hình) */
.ad-topbar .pt-account-name {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ad-topbar .pt-account-caret { display: none; }
.ad-topbar .pt-account-menu, .pt-header .pt-account-menu { top: calc(100% + 6px); right: 0; }

/* ── Trang quản lý: thanh trên (< 1024px) ── */
.ad-topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  height: var(--nav-topbar-h); padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.ad-menu-btn, .ad-drawer-close {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink);
}
.ad-menu-btn:hover, .ad-drawer-close:hover { background: var(--primary-subtle); color: var(--ink); }
.ad-menu-btn .icon, .ad-drawer-close .icon { width: 24px; height: 24px; }
.ad-topbar-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.ad-account-slot:empty { display: none; }

/* ── Trang quản lý: thanh bên / ngăn kéo (+ thanh bên của Góc học viên ≥ 1024px: .pt-side) ── */
.ad-sidebar, .pt-side {
  display: flex; flex-direction: column; gap: 16px; width: var(--nav-sidebar-w); height: 100vh; height: 100dvh;
  padding: 16px; background: var(--surface); border-right: 1px solid var(--border);
}
.ad-sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex: none; }
.ad-sidebar .pt-logo, .pt-side .pt-logo { flex-direction: column; align-items: flex-start; gap: 4px; min-height: 0; padding: 4px; margin: -4px; border-radius: var(--r-sm); }
.ad-sidebar .pt-logo-text, .pt-side .pt-logo-text { padding-left: 0; border-left: 0; }
/* chỉ phần các mục cuộn khi màn hình thấp; khoảng 4px để vòng focus không bị cắt */
.ad-nav {
  display: flex; flex-direction: column; gap: 20px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -4px; padding: 4px;
}
.ad-nav[aria-busy="true"] { gap: 16px; padding-top: 12px; }
.ad-skel { display: block; flex: none; height: 14px; margin: 0 12px; border-radius: var(--r-sm); background: var(--disabled-bg); animation: ad-skel 1.4s ease-in-out infinite; }
.ad-skel:nth-child(3n + 2) { margin-right: 48px; }
@keyframes ad-skel { 50% { opacity: .45; } }
.ad-nav-label { padding: 0 12px 6px; font-size: 12px; font-weight: 700; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.ad-nav-list { list-style: none; display: grid; gap: 2px; }
.ad-nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); font-size: 15px; font-weight: 500; line-height: 20px; text-decoration: none; overflow-wrap: anywhere;
}
.ad-nav-item .icon { width: 20px; height: 20px; }
.ad-nav-item:hover { background: var(--primary-subtle); color: var(--ink); }
.ad-nav-item[aria-current="page"] { background: var(--primary-subtle); color: var(--primary); font-weight: 700; }
.ad-nav-item[aria-current="page"]::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--primary);
}
.ad-sidebar .ad-account-slot, .pt-side .ad-account-slot { flex: none; margin: 0 -8px -8px; padding-top: 8px; border-top: 1px solid var(--border); }
.ad-sidebar .pt-account-menu, .pt-side .pt-account-menu { left: 0; bottom: calc(100% + 6px); }

/* Góc học viên ≥ 1024px: .pt-body.has-nav = thanh bên đang hiện (js/portal.js); đầu trang ẩn như thanh trên của Trang quản lý,
   nội dung giữ độ rộng đọc 760px ở cột bên phải */
@media (min-width: 1024px) {
  .ad-body, .pt-body.has-nav { display: grid; grid-template-columns: var(--nav-sidebar-w) minmax(0, 1fr); align-items: start; }
  .ad-topbar, .ad-scrim, .ad-drawer-close, .has-nav .pt-header { display: none; }
  .ad-sidebar, .pt-side { grid-column: 1; grid-row: 1; position: sticky; top: 0; z-index: 30; }
  .ad-main, .has-nav .pt-main { grid-column: 2; grid-row: 1; width: 100%; }
  .ad-body .pt-bar, .has-nav .pt-bar { left: var(--nav-sidebar-w); } /* thanh lưu của trình soạn: cạnh thanh bên, không đè lên */
}
@media (max-width: 1023.98px) {
  .ad-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(84vw, 300px); height: auto;
    border-right: 0; box-shadow: 0 8px 24px rgba(17, 17, 17, 0.12);
    transform: translateX(-100%); visibility: hidden; transition: transform .2s ease-out, visibility 0s linear .2s;
  }
  .ad-sidebar.is-open { transform: none; visibility: visible; transition: transform .2s ease-out, visibility 0s; }
  .ad-scrim { position: fixed; inset: 0; z-index: 40; background: var(--nav-scrim); }
  .ad-drawer-open { overflow: hidden; }
  .ad-nav-item { min-height: 44px; } /* vùng chạm trên điện thoại / máy tính bảng */
}

/* ── Góc học viên: thanh dưới (< 1024px) / thanh bên (≥ 1024px) – plan-hoc-vien-thanh-ben.md ──
   Một <nav id="pt-nav" class="ad-nav pt-nav"> (link .ad-nav-item.pt-nav-item) trong #pt-side (.pt-side): ≥ 1024px là thanh bên của
   Trang quản lý (quy tắc .ad-* ở trên, không viết lại); < 1024px .pt-side không tạo khung (display: contents) – chỉ còn thanh dưới,
   logo / "Trang chủ" / tài khoản ở đầu trang. */
.pt-header-end { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pt-header .pt-account-btn { max-width: 240px; }
.pt-nav-short { display: none; }

@media (max-width: 767.98px) {
  .pt-header .pt-account-name {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .pt-header .pt-account-caret { display: none; }
}
@media (max-width: 1023.98px) {
  .pt-side { display: contents; }
  .pt-side > :not(.pt-nav) { display: none; } /* logo, "Trang chủ", tài khoản: ở đầu trang */
  .pt-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: block; margin: 0; overflow: visible;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .pt-nav-list { display: flex; gap: 0; height: var(--nav-bottom-h); }
  .pt-nav-list li { display: flex; flex: 1 1 0; min-width: 0; }
  .pt-nav-item {
    flex: 1; flex-direction: column; justify-content: center; gap: 4px; min-width: 44px; padding: 8px 4px; border-radius: 0;
    color: var(--text-muted); font-size: 12px; font-weight: 600; line-height: 14px; text-align: center; white-space: nowrap;
  }
  .pt-nav-item .icon { width: 24px; height: 24px; }
  .pt-nav-item:hover { background: transparent; color: var(--ink); }
  .pt-nav-item[aria-current="page"] { background: transparent; color: var(--primary); font-weight: 700; }
  .pt-nav-item[aria-current="page"]::before { content: none; } /* vạch trái chỉ ở thanh bên */
  .pt-nav-item:focus-visible { outline-offset: -4px; border-radius: var(--r-sm); }
  .pt-nav-long { display: none; }
  .pt-nav-short { display: inline; }
  /* nội dung không bị thanh dưới che */
  .has-nav .pt-main { padding-bottom: calc(var(--nav-bottom-h) + 76px + env(safe-area-inset-bottom, 0px)); }
}
/* tai thỏ / thanh home của điện thoại (viewport-fit=cover ở hoc-vien.html): nội dung theo lề an toàn; phần cố định
   (.pt-bar, .pt-nav, .pt-dialog) tự cộng env(safe-area-inset-*) ở quy tắc của chúng */
.pt-body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
/* đang làm bài: không có menu tên ("Đăng xuất") – chế độ tập trung như thanh dưới */
.pt-account.is-taking { display: none; }
.ad-sidebar:focus { outline: none; } /* ngăn kéo mở: bấm vào chỗ trống giữ focus trong ngăn kéo */

@media (prefers-reduced-motion: reduce) {
  .ad-skel { animation: none; }
  .ad-sidebar, .ad-sidebar.is-open, .pt-account-caret { transition: none; }
}

/* ================================================
   Bộ thẻ (plan-bo-the.md) – tab "Bộ thẻ" của Góc học viên (portal.js): hôm nay, Bộ của tôi, Thư viện; buổi ôn thẻ lật
   (chế độ tập trung: thanh dưới ẩn, 4 nút ở đáy trên điện thoại); "Xong hôm nay"; thống kê; soạn bộ tự tạo.
   Màu chỉ từ token của site.css (không mã màu mới). Biểu đồ: một màu (--primary), thanh mảnh, bo 4px ở đầu, 2px khe; trạng thái
   thẻ: dải một sắc đỏ nhạt → đậm – Mới = --primary pha 50% với --surface (≈ #E9848A), Đang học = --primary, Đã thuộc =
   --primary-deep (đã kiểm bằng validate_palette --ordinal: thứ bậc, khoảng cách bậc, bậc nhạt 2,58:1 trên nền trắng). Chữ luôn
   màu chữ, không màu dữ liệu.
   ================================================ */
:root { --flash-new: color-mix(in srgb, var(--primary) 50%, var(--surface)); } /* bậc nhạt của --primary, không phải màu mới */

/* Chấm số thẻ cần ôn trên "Thẻ" (thanh dưới) / "Bộ thẻ" (thanh bên, cuối dòng) */
.pt-nav-item { position: relative; }
.pt-nav-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-full); background: var(--primary); color: var(--on-primary);
  font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
@media (max-width: 1023.98px) {
  .pt-nav-count { position: absolute; top: 4px; left: calc(50% + 4px); box-shadow: 0 0 0 2px var(--surface); }
}
@media (min-width: 1024px) {
  .pt-nav-count { margin-left: auto; }
}

/* Tab: hôm nay */
.bt-kpis { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.bt-kpis li { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-md); background: var(--surface-rose); min-width: 0; }
.bt-kpi-n { display: inline-flex; align-items: center; gap: 4px; font-size: 26px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.bt-kpi-n .icon { width: 22px; height: 22px; color: var(--primary); }
.bt-kpi-l { font-size: 14px; line-height: 1.35; color: var(--text-muted); }
.bt-keep { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; font-weight: 600; color: var(--ink); }
.bt-keep .icon { flex-shrink: 0; margin-top: 3px; color: var(--primary); }
.bt-today .pt-actions { margin-top: 12px; }
.bt-none { flex-basis: 100%; }
.bt-status { margin-top: 12px; color: var(--success); font-size: 15px; font-weight: 600; }
.bt-status:empty { display: none; }
.bt-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.bt-head h2 { margin: 0; }
.bt-note { margin-bottom: 12px; }
.bt-panel h2:focus, .bt-done h1:focus, .bt-deck:focus, .bt-lib-item:focus { outline: none; }

/* Bộ của tôi + Thư viện */
.bt-decks, .bt-lib { list-style: none; display: grid; gap: 10px; }
.bt-deck, .bt-lib-item {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px;
}
.bt-deck-info, .bt-lib-info { flex: 1 1 240px; min-width: 0; }
.bt-deck-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.bt-deck-meta { font-size: 14px; overflow-wrap: anywhere; }
.bt-deck-counts { margin-top: 4px; font-size: 14px; color: var(--text); }
.bt-deck-counts strong { color: var(--ink); }
.bt-deck-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-deck-actions .pt-btn, .bt-lib-item .pt-btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.bt-added { margin-left: 0; }
.bt-level { margin: 16px 0 8px; font-size: 16px; color: var(--ink); }
.bt-level:first-of-type { margin-top: 0; }

/* Buổi ôn */
.bt-review { max-width: 560px; margin: 0 auto; }
.bt-review-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.bt-progress { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bt-review-title { margin: 4px 0 12px; font-size: 20px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.bt-notice { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--info-subtle); color: var(--info); font-weight: 600; }
.bt-notice:empty { display: none; }
.bt-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 260px;
  padding: 28px 20px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  text-align: center; box-shadow: 0 8px 24px rgba(17, 17, 17, 0.06);
}
.bt-card:focus { outline: none; }
.bt-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.bt-card.is-back { animation: bt-flip .22s ease-out; }
@keyframes bt-flip { from { transform: perspective(900px) rotateY(70deg); opacity: .4; } to { transform: none; opacity: 1; } }
.bt-card-deck { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.bt-new-chip { margin-left: 4px; background: var(--info-subtle); color: var(--info); }
.bt-word { font-size: 32px; line-height: 1.25; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.bt-art { font-weight: 600; }
.bt-art-der { color: var(--info); }
.bt-art-die { color: var(--primary); }
.bt-art-das { color: var(--success); }
.bt-back { width: 100%; padding-top: 14px; border-top: 1px solid var(--border); }
.bt-meaning { font-size: 22px; line-height: 1.35; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.bt-example { margin-top: 8px; font-size: 16px; font-style: italic; color: var(--text); overflow-wrap: anywhere; }
.bt-listen:empty { display: none; }
.bt-listen-btn { min-height: 44px; padding: 0 18px; font-size: 14px; }
.bt-no-voice { font-size: 14px; }
.bt-actions { display: flex; justify-content: center; margin-top: 16px; }
.bt-flip { min-width: 220px; }
.bt-actions.is-rating { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bt-rate {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 56px; padding: 6px 4px;
  border: 1.5px solid currentColor; border-radius: var(--r-md); background: var(--surface); font: inherit; cursor: pointer;
}
.bt-rate-l { font-size: 15px; font-weight: 700; line-height: 1.2; }
.bt-rate-d { font-size: 13px; line-height: 1.2; color: var(--text); }
.bt-rate-1 { color: var(--error); }
.bt-rate-2 { color: var(--warning); }
.bt-rate-3 { color: var(--success); }
.bt-rate-4 { color: var(--info); }
.bt-rate-1:hover { background: var(--error-subtle); }
.bt-rate-2:hover { background: var(--warning-subtle); }
.bt-rate-3:hover { background: var(--success-subtle); }
.bt-rate-4:hover { background: var(--info-subtle); }
.bt-rate:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.bt-rate:disabled { border-color: var(--disabled-bg); background: var(--disabled-bg); color: var(--disabled-text); cursor: progress; }
.bt-rate:disabled .bt-rate-d { color: var(--disabled-text); }
.bt-keys { margin-top: 16px; font-size: 13px; text-align: center; }
@media (max-width: 767.98px) {
  /* 4 nút ở đáy, trong tầm ngón cái (thanh dưới đang ẩn) */
  .bt-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; background: var(--surface);
    border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(17, 17, 17, 0.08);
    padding: 10px calc(12px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  }
  .bt-flip { width: 100%; }
  .bt-keys { display: none; }
  .bt-card { min-height: 220px; }
  .bt-word { font-size: 28px; }
}

/* Xong hôm nay */
.bt-done { text-align: center; }
.bt-done .pt-actions { justify-content: center; }
.bt-done-n { font-size: 17px; color: var(--ink); }
.bt-done-streak { display: inline-flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-weight: 600; color: var(--ink); text-align: left; }
.bt-done-streak .icon { flex-shrink: 0; margin-top: 3px; color: var(--primary); }
.bt-done .pt-note { text-align: left; }

/* Thống kê */
.bt-page-title { margin: 4px 0 12px; font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; }
.bt-hero { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--ink); }
.bt-hero .icon { width: 40px; height: 40px; color: var(--primary); }
.bt-hero-n { font-size: 48px; font-weight: 700; line-height: 1; }
.bt-hero-l { font-size: 16px; color: var(--text-muted); }
.bt-chart-sub { margin-bottom: 12px; }
.bt-chart-sub strong { color: var(--ink); }
.bt-chart { margin: 0; }
.bt-chart-plot { position: relative; padding-top: 18px; }
.bt-chart-max { position: absolute; top: 0; left: 0; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bt-bars {
  list-style: none; display: flex; align-items: flex-end; gap: 2px; height: 140px; margin: 0; padding: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border-strong);
}
.bt-bar-slot { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bt-bar { display: block; width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; background: var(--primary); }
.bt-bar-slot:hover .bt-bar { background: var(--primary-hover); }
.bt-bar-slot.is-today { background: var(--primary-subtle); }
.bt-chart-x { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bt-table { margin-top: 12px; }
.bt-table summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--primary); cursor: pointer; }
.bt-table table { width: 100%; max-width: 320px; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.bt-table th, .bt-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.bt-split { display: flex; gap: 2px; height: 8px; margin: 4px 0 14px; }
.bt-split span { min-width: 4px; border-radius: var(--r-full); }
.bt-split-new, .bt-sw-new { background: var(--flash-new); }
@supports not (background: color-mix(in srgb, red 50%, white)) { /* trình duyệt cũ: cùng màu đó = --primary nửa trong suốt trên nền trắng */
  .bt-split-new, .bt-sw-new { background: var(--primary); opacity: .5; }
}
.bt-split-learning, .bt-sw-learning { background: var(--primary); }
.bt-split-mastered, .bt-sw-mastered { background: var(--primary-deep); }
.bt-states { list-style: none; display: grid; gap: 8px; }
.bt-states li { display: grid; grid-template-columns: 12px minmax(0, auto) auto minmax(0, 1fr); align-items: baseline; gap: 4px 10px; }
.bt-sw { width: 12px; height: 12px; border-radius: 3px; align-self: center; }
.bt-state-l { font-weight: 600; color: var(--ink); }
.bt-state-n { color: var(--ink); font-variant-numeric: tabular-nums; }
.bt-state-about { font-size: 14px; }

/* Soạn bộ tự tạo */
.bt-editor h1 { overflow-wrap: anywhere; }
.bt-cards-title { margin: 8px 0 10px; font-size: 18px; }
.bt-rows { list-style: none; display: grid; gap: 12px; margin: 0 0 12px; padding: 0; }
.bt-row-box { min-width: 0; margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.bt-row-n { padding: 0 4px; font-size: 14px; font-weight: 700; color: var(--ink); }
.bt-row-fields { display: grid; grid-template-columns: minmax(0, 1.3fr) 120px minmax(0, 1.4fr); gap: 0 10px; }
.bt-f-example { grid-column: 1 / -1; }
.bt-row-fields .pt-field { margin-bottom: 8px; }
.bt-row-fields .pt-field > span { font-size: 14px; margin-bottom: 4px; }
.bt-row-fields select {
  display: block; width: 100%; min-height: 48px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
}
.bt-row-fields select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.bt-editor [aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.bt-row-remove { min-height: 44px; padding: 0 14px; font-size: 14px; }
.bt-editor .pt-error .pt-link-btn { margin-left: 8px; }
@media (max-width: 639px) {
  .bt-kpis { grid-template-columns: minmax(0, 1fr); }
  .bt-kpis li { flex-direction: row; align-items: baseline; gap: 10px; }
  .bt-kpi-n { font-size: 22px; min-width: 52px; }
  .bt-deck-actions { width: 100%; }
  .bt-deck-actions .pt-btn { flex: 1 1 auto; }
  .bt-lib-item .pt-btn { width: 100%; }
  .bt-row-fields { grid-template-columns: minmax(0, 1fr) 110px; }
  .bt-f-meaning { grid-column: 1 / -1; }
  .bt-states li { grid-template-columns: 12px minmax(0, auto) auto; }
  .bt-state-about { grid-column: 2 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .bt-card.is-back { animation: none; } /* lật thẻ không hoạt ảnh */
}

/* ================================================
   Luyện nói (plan-luyen-noi.md) – mục "Luyện nói" / "Nói" của Góc học viên (js/luyen-noi.js): nói tự do, luyện theo bộ từ vựng
   (chế độ tập trung như ôn Bộ thẻ), tổng kết. Màu chỉ từ token của site.css: Đúng = --success (xanh), Gần đúng = --warning
   (vàng-nâu), Chưa đúng = --error (đỏ chữ, nền nhạt) – luôn kèm chữ + biểu tượng, không dựa vào màu đơn thuần (từ của câu: gạch
   dưới liền = đúng, gạch sóng = sai, khung nét đứt = thiếu, kèm chữ cho trình đọc màn hình). Mọi cặp chữ / nền ≥ 4,5:1.
   Hiệu ứng "Đang nghe" (vòng sáng quanh nút micro) tắt khi prefers-reduced-motion.
   ================================================ */
.ln-privacy { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.ln-panel h2:focus, .ln-done h1:focus, .ln-unsupported h1:focus { outline: none; }
.ln-hint { margin: -8px 0 12px; font-size: 14px; }

/* Nút micro */
.ln-mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0; }
.ln-mic {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; min-width: 220px;
  max-width: 100%; padding: 0 28px; border: 0; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary);
  font: inherit; font-size: 17px; font-weight: 700; line-height: 1.2; cursor: pointer; box-shadow: 0 6px 18px rgba(17, 17, 17, 0.12);
}
.ln-mic .icon { width: 24px; height: 24px; flex-shrink: 0; }
.ln-mic:hover { background: var(--primary-hover); color: var(--on-primary); }
.ln-mic:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.ln-mic.is-on { background: var(--primary-deep); }
.ln-mic.is-on::after {
  content: ''; position: absolute; inset: -6px; border: 3px solid var(--primary); border-radius: inherit; pointer-events: none;
  animation: ln-pulse 1.2s ease-out infinite;
}
@keyframes ln-pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
.ln-state { min-height: 22px; font-size: 15px; font-weight: 600; color: var(--primary); text-align: center; }

/* Kết quả */
.ln-result-box:empty { display: none; }
.ln-result { margin-top: 8px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-rose); }
.ln-heard-l, .ln-alts-l { font-size: 13px; color: var(--text-muted); }
.ln-alts-l { margin-top: 8px; }
.ln-heard { font-size: 24px; line-height: 1.3; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ln-conf { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ln-alts { list-style: none; display: grid; gap: 2px; font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.ln-say-slot:empty { display: none; }
.ln-say-slot { margin-top: 10px; }
.ln-say { min-height: 44px; padding: 0 16px; font-size: 14px; }
.ln-no-voice { font-size: 14px; }
.ln-verdict { margin-top: 12px; padding: 12px 14px; border-left: 4px solid currentColor; border-radius: var(--r-md); }
.ln-verdict.is-right { background: var(--success-subtle); color: var(--success); }
.ln-verdict.is-close { background: var(--warning-subtle); color: var(--warning); }
.ln-verdict.is-wrong { background: var(--error-subtle); color: var(--error); }
.ln-verdict-t { display: flex; align-items: center; gap: 8px; font-size: 18px; line-height: 1.3; }
.ln-verdict-t .icon { flex-shrink: 0; }
.ln-note, .ln-said { margin-top: 6px; color: var(--text); overflow-wrap: anywhere; }
.ln-said span { color: var(--ink); font-weight: 600; }
.ln-words { margin-top: 8px; font-size: 18px; line-height: 1.9; color: var(--ink); overflow-wrap: anywhere; }
.ln-w-ok { color: var(--success); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ln-w-wrong { color: var(--error); font-weight: 600; text-decoration: underline wavy; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.ln-w-missing { padding: 0 4px; border: 1.5px dashed var(--border-strong); border-radius: 4px; color: var(--text-muted); }
.ln-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; font-size: 13px; }
.ln-problem { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--warning-subtle); color: var(--text); }
.ln-problem p + p { margin-top: 4px; }
.ln-problem-t { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); }
.ln-problem-t .icon { flex-shrink: 0; margin-top: 3px; color: var(--warning); }
.ln-chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: var(--r-full);
  background: var(--disabled-bg); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.ln-chip.is-right { background: var(--success-subtle); color: var(--success); }
.ln-chip.is-close { background: var(--warning-subtle); color: var(--warning); }
.ln-chip.is-wrong { background: var(--error-subtle); color: var(--error); }

/* Lịch sử (nói tự do) */
.ln-h-title { margin: 20px 0 2px; font-size: 16px; }
.ln-h-note { margin-bottom: 8px; font-size: 14px; }
.ln-history { list-style: none; display: grid; }
.ln-history li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ln-h-text { flex: 1 1 180px; min-width: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ln-history .ln-say-slot { margin-top: 0; }

/* Bài của giáo viên (plan-bai-luyen-noi.md): danh sách bài được giao */
.ln-lessons { list-style: none; display: grid; gap: 10px; }
.ln-lesson { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.ln-lesson-info { flex: 1 1 240px; min-width: 0; }
.ln-lesson-t { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ln-lesson-m { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-size: 14px; color: var(--text-muted); }
.ln-lesson-m .pt-chip { margin-left: 0; }
.ln-lesson-go { flex: none; }
@media (max-width: 639px) {
  .ln-lesson-go { width: 100%; }
}

/* Chọn bộ */
.ln-select {
  display: block; width: 100%; min-height: 48px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
}
.ln-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ln-modes { display: grid; gap: 8px; min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.ln-modes legend { margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.ln-radio {
  display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); cursor: pointer;
}
.ln-radio input { flex-shrink: 0; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); }
.ln-radio:has(input:checked) { padding: 9px 11px; border: 2px solid var(--primary); background: var(--primary-subtle); }
.ln-radio:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.ln-radio-t { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.ln-radio-d { font-size: 14px; color: var(--text-muted); }
.ln-link input { font-size: 15px; }
.ln-copied { margin-top: 10px; font-weight: 600; color: var(--success); }
.ln-copied:empty { display: none; }
.ln-unsupported .ln-problem, .ln-copy-box .ln-problem { margin: 12px 0 16px; }
/* "Mở bằng Chrome / Safari" + link + "Sao chép link": trình duyệt không nghe được, trình duyệt trong ứng dụng, lỗi trong ứng dụng */
.ln-copy-box + .ln-privacy { margin-top: 16px; }
.ln-in-app { margin-top: 4px; }
.ln-practice .ln-in-app { margin-bottom: 12px; }
.ln-result-box .ln-copy-box .ln-problem { margin-top: 8px; }

/* Luyện theo bộ */
.ln-practice { max-width: 560px; margin: 0 auto; }
.ln-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.ln-progress { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ln-practice-title { margin: 4px 0 0; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.ln-practice-mode { margin-bottom: 12px; font-size: 14px; }
.ln-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; padding: 22px 18px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); text-align: center;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.06);
}
.ln-card-l { font-size: 13px; color: var(--text-muted); }
.ln-target { font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ln-practice[data-mode="cau"] .ln-target, .ln-practice[data-mode="bai"] .ln-target { font-size: 22px; line-height: 1.4; }
.ln-meaning { font-size: 17px; color: var(--text); overflow-wrap: anywhere; }
/* Bài của giáo viên (plan-bai-luyen-noi.md): gợi ý dưới nghĩa, hướng dẫn trước câu đầu / thu gọn trong lúc luyện */
.ln-tip { font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.ln-tip-l { font-weight: 600; color: var(--ink); }
.ln-guide-t { white-space: pre-line; overflow-wrap: anywhere; color: var(--text); }
.ln-intro-card { align-items: stretch; text-align: left; }
.ln-intro-card .ln-guide-t { font-size: 17px; line-height: 1.6; }
.ln-guide { margin-bottom: 12px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ln-guide summary { display: list-item; min-height: 44px; padding: 11px 0; line-height: 22px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ln-guide summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ln-guide .ln-guide-t { padding-bottom: 12px; font-size: 15px; }
.ln-card .ln-say-slot { margin-top: 4px; }
.ln-actions { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.ln-actions .pt-btn { min-width: 160px; }

/* Tổng kết */
.ln-done h1 { overflow-wrap: anywhere; }
.ln-sum { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.ln-sum li { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px; border-radius: var(--r-md); }
.ln-sum .is-right { background: var(--success-subtle); color: var(--success); }
.ln-sum .is-close { background: var(--warning-subtle); color: var(--warning); }
.ln-sum .is-wrong { background: var(--error-subtle); color: var(--error); }
.ln-sum-n { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ln-sum-l { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.ln-sum-l .icon { width: 18px; height: 18px; flex-shrink: 0; }
.ln-again-title { margin: 16px 0 8px; font-size: 17px; }
.ln-again { list-style: none; display: grid; gap: 8px; }
.ln-again li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.ln-again-w { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ln-again-m { flex-basis: 100%; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.ln-all-right { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; font-weight: 600; color: var(--success); }
.ln-all-right .icon { flex-shrink: 0; margin-top: 3px; }
.ln-only-here { margin-top: 14px; font-size: 14px; }
@media (max-width: 639px) {
  .ln-mic { width: 100%; }
  .ln-target { font-size: 26px; }
  .ln-actions .pt-btn { flex: 1 1 0; min-width: 0; }
  .ln-sum { grid-template-columns: minmax(0, 1fr); }
  .ln-sum li { flex-direction: row; align-items: baseline; gap: 10px; padding: 10px 12px; }
  .ln-sum-n { min-width: 40px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .ln-mic.is-on::after { animation: none; opacity: 1; } /* vẫn có vòng viền "đang nghe", không nhấp nháy */
}

/* ================================================
   Đoán chữ (plan-doan-chu.md) – mục "Đoán chữ" / "Đoán" của Góc học viên (js/doan-chu.js): diễn giải tiếng Đức, các ô chữ (một ô
   một chữ cái, chỉ để nhìn – ô nhập thật nằm đè lên, trong suốt), nút ä ö ü ß, bước đọc (nút micro, kết quả và hộp hướng dẫn của
   Luyện nói: .ln-*), đã lưu, hết từ. Màu chỉ từ token của site.css: đúng = --success, sai = --error, con trỏ = --primary, giống
   der / die / das = .bt-art-* của Bộ thẻ; luôn kèm chữ. Rung nhẹ khi gõ sai: tắt khi prefers-reduced-motion.
   ================================================ */
.dc-panel h2:focus { outline: none; }
.dc-notice { margin-bottom: 16px; }
.dc-unsaved { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; font-weight: 600; color: var(--ink); }
.dc-unsaved .icon { flex-shrink: 0; margin-top: 3px; color: var(--warning); }
.dc-card { margin: 4px 0 16px; padding: 16px; border-radius: var(--r-md); background: var(--surface-rose); }
.dc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.dc-hint { margin-top: 6px; font-size: 20px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }

/* Các ô chữ: một hàng tới 12 chữ cái (--dc-cols do doan-chu.js đặt), hẹp lại trên màn nhỏ */
.dc-word { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 8px 0 4px; }
.dc-art { font-size: 22px; line-height: 1; }
.dc-field { position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.dc-boxes {
  display: grid; grid-template-columns: repeat(var(--dc-cols, 6), minmax(0, 48px)); justify-content: center; gap: 6px;
  padding: 4px; border-radius: var(--r-md);
}
.dc-box {
  display: flex; align-items: center; justify-content: center; min-width: 0; height: 56px; border: 2px solid var(--border-strong);
  border-radius: var(--r-sm); background: var(--surface); font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink);
}
.dc-box.is-filled { border-color: var(--ink); }
.dc-field:focus-within .dc-boxes { outline: 2px solid var(--primary); outline-offset: 2px; }
.dc-field:focus-within .dc-box.is-caret { border-color: var(--primary); box-shadow: inset 0 -4px 0 var(--primary); }
.dc-boxes.is-wrong .dc-box.is-filled { border-color: var(--error); color: var(--error); }
.dc-boxes.is-wrong { animation: dc-shake .35s ease-in-out; }
@keyframes dc-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.dc-boxes.is-right .dc-box { border-color: var(--success); background: var(--success-subtle); color: var(--success); }
/* ô nhập thật: đè lên các ô, trong suốt (16px: iPhone không phóng to); các ô hiện chữ trong nó */
.dc-input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: var(--r-md);
  background: transparent; color: transparent; caret-color: transparent; font-size: 16px; opacity: 0; cursor: text;
}
.dc-input:focus { outline: none; }
.dc-keys { display: flex; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.dc-key {
  min-width: 48px; height: 48px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface);
  font: inherit; font-size: 22px; font-weight: 700; line-height: 1; color: var(--ink); cursor: pointer;
}
.dc-key:hover { background: var(--primary-subtle); }
.dc-key:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dc-msg { min-height: 24px; margin-top: 6px; text-align: center; font-weight: 600; color: var(--error); }
.dc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin-top: 14px; }
.dc-actions .pt-btn { min-width: 160px; }

/* Gõ đúng: nghĩa, bước đọc, đã lưu, hết từ */
.dc-right { margin-top: 8px; font-size: 17px; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.dc-right .icon { margin: -3px 6px 0 0; color: var(--success); }
.dc-right strong { color: var(--success); }
.dc-read { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; }
.dc-read-l { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.dc-say { margin: 2px 0 8px; font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.dc-say .bt-art { font-weight: 700; }
.dc-say-slot { margin-bottom: 12px; }
.dc-say-slot:empty { display: none; }
.dc-result { margin-top: 4px; text-align: left; }
.dc-result:empty { display: none; }
.dc-again { margin-top: 6px; font-size: 14px; color: var(--text); }
.dc-cant { text-align: left; }
.dc-saved { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--success-subtle); color: var(--ink); text-align: center; }
.dc-saved-t { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; }
.dc-saved-t .icon, .dc-saved-t strong { color: var(--success); }
.dc-done { padding: 20px 16px; border-radius: var(--r-md); background: var(--success-subtle); color: var(--ink); text-align: center; }
.dc-done-t { font-size: 20px; line-height: 1.4; }
.dc-done-t .icon { display: block; width: 32px; height: 32px; margin: 0 auto 8px; color: var(--success); }
.dc-done-t strong { color: var(--success); }
.dc-done p + p { margin-top: 6px; }
@media (max-width: 639px) {
  .dc-hint { font-size: 18px; }
  .dc-boxes { grid-template-columns: repeat(var(--dc-cols, 6), minmax(0, 40px)); gap: 4px; }
  .dc-box { height: 48px; font-size: 22px; }
  .dc-actions .pt-btn { flex: 1 1 0; min-width: 0; }
  .dc-say { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-boxes.is-wrong { animation: none; }
}

/* ── Cấp độ (plan-cap-do.md): A1 / A2 / B1 / B2 of a class, a test, a document of Kho đề, a word of Đoán chữ – a chip with its text
   (never colour alone), neutral colours (never red – red is for the main button / today): dark text on white with a grey ring (AA);
   "Chưa chọn" (Trang quản lý only) pale like the default chip. The reminder "Lớp X là A2, bài này là B1." is a note, never a block. ── */
.ad-level, .pt-level { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); }
.ad-level.is-unset { background: var(--surface-rose); color: var(--text-muted); box-shadow: none; }
.ad-level-note:empty { display: none; }
.ad-level-note .pt-note { margin: 8px 0 0; }
/* Giao cho học viên cấp độ (plan-cap-do-hoc-vien.md): A1 · A2 · B1 · B2, an Admin ticks */
.ad-level-audience { margin-top: 16px; }
.ad-level-checks { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.ad-level-checks .pt-option { margin: 0; }
.ad-level-audience .pt-hint { margin: 8px 0 0; }
p.ad-level-audience { margin: 12px 0 0; }
.pt-file .pt-level { flex-shrink: 0; margin-left: 0; }
.dc-meta .pt-level { margin-left: 0; }

/* ── Nhập đề từ AI (plan-nhap-de-tu-ai.md – admin-ai-import.js): "Tạo bài bằng AI" next to "Tạo bài mới" / "Cấp quyền", the dialog
   of 3 steps (Lời nhắc · Nhập kết quả · Xem trước). ── */
.ad-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-ai-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 4px; padding: 0; font-size: 14px; color: var(--text-muted); }
.ad-ai-steps li { display: flex; align-items: center; gap: 6px; }
.ad-ai-steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.ad-ai-step-n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 13px; }
.ad-ai-steps li[aria-current="step"] .ad-ai-step-n { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.ad-ai-steps li.is-done .ad-ai-step-n { background: var(--success-subtle); color: var(--success); box-shadow: none; }
.ad-ai-part-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.ad-ai-part { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: end; gap: 8px; }
.ad-ai-part .ad-check { margin-bottom: 0; }
.ad-ai-part .ad-ai-count { margin-bottom: 0; }
.ad-ai-part .ad-ai-count > span { font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-muted); }
.ad-ai-part .ad-ai-count input:disabled { background: var(--disabled-bg); color: var(--disabled-text); }
.ad-ai-prompt { min-height: 200px; font-size: 14px; line-height: 1.5; background: var(--surface-rose); }
.ad-ai-copied.is-warn { color: var(--warning); }
.ad-ai-summary { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.ad-ai-summary p { margin-top: 4px; }
.ad-ai-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 17px; color: var(--ink); }
.ad-ai-part-sum { margin: 8px 0 0 20px; font-size: 15px; }
.ad-ai-audio ul { margin: 6px 0 0 20px; }
.ad-ai-errors ul { margin: 6px 0 0 20px; font-weight: 500; }
.ad-ai-errors li + li { margin-top: 2px; }
@media (max-width: 639px) {
  .ad-head-actions { width: 100%; }
  .ad-ai-part-list { grid-template-columns: 1fr; }
}

/* ── Tab theo kỹ năng bên trong một bài (js/skill-tabs.js, plan-tab-ky-nang.md, 17/11/2026) ──
   Trắc nghiệm · Nghe · Viết · Nói (+ "Tất cả" ở trình soạn). Điện thoại: thanh xuống dòng, không dính (đỡ chiếm màn hình – cuối mỗi tab có
   nút "Tiếp: …"); từ 640px: một hàng, dính dưới đầu trang (Góc học viên: dưới thanh 64px; Trang quản lý < 1024px: dưới thanh trên). */
.pt-skilltabs { gap: 8px; margin: 4px 0 16px; padding: 8px 0; }
.pt-skilltab { flex: 0 0 auto; white-space: nowrap; }
.pt-skilltab-count { font-weight: 400; }
.pt-skillnext { display: flex; justify-content: flex-end; margin: 8px 0 24px; }
/* "Tiếp: …" cuộn tới thanh tab: không nằm dưới đầu trang dính */
.pt-body:not(.ad-body) .pt-skilltabs-wrap { scroll-margin-top: 72px; }
.ad-body .pt-skilltabs-wrap { scroll-margin-top: calc(var(--nav-topbar-h) + 8px); }
@media (min-width: 640px) {
  .pt-skilltabs { position: sticky; top: 0; z-index: 6; flex-wrap: nowrap; overflow-x: auto; background: var(--surface-rose); }
  .pt-card .pt-skilltabs { background: var(--surface); }
  .pt-body:not(.ad-body) .pt-skilltabs { top: 64px; }
  .ad-body .pt-skilltabs { top: var(--nav-topbar-h); }
}
@media (min-width: 1024px) {
  .pt-body.has-nav .pt-skilltabs, .ad-body .pt-skilltabs { top: 0; }
  .pt-body.has-nav .pt-skilltabs-wrap, .ad-body .pt-skilltabs-wrap { scroll-margin-top: 8px; }
}
/* trình soạn: đổi thứ tự (↑ ↓) chỉ ở tab "Tất cả" */
.pt-skilltabs-wrap[data-skillfilter="on"]:not([data-skillopen="tat-ca"]) [data-act="tq-up"],
.pt-skilltabs-wrap[data-skillfilter="on"]:not([data-skillopen="tat-ca"]) [data-act="tq-down"] { display: none; }
.ad-skill-hint { display: none; margin: 0 0 12px; }
.pt-skilltabs-wrap[data-skillfilter="on"]:not([data-skillopen="tat-ca"]) .ad-skill-hint { display: block; }
