/* ==========================================================================
   SmartBaby — Công cụ dạy học
   Màu, phông, bóng đổ lấy từ brand.css (dùng chung với trang chủ WordPress).
   Phong cách: đầu trang tím đậm, thẻ phẳng bo tròn, bóng đổ mềm, nút viên thuốc.
   Viết cho điện thoại trước, mở rộng dần lên máy tính.
   ========================================================================== */

:root {
  /* Tên cũ còn dùng ở vài chỗ, trỏ về bộ màu thương hiệu */
  --cream: var(--bg);
  --sky-50: var(--brand-50);
  --sun-dark: var(--sun-600);
  --grass-dark: var(--grass-700);
  --sky: var(--blue);
  --sky-dark: var(--blue-700);
  --berry: var(--red);
  --berry-dark: var(--red-600);
  --grape: var(--brand-700);

  --ok-bg: #e8f8ef;
  --err-bg: var(--red-50);
  --warn-bg: #fff8dc;

  --field-line: 1.5px solid #dcd8ef;
}

*, *::before, *::after { box-sizing: border-box; }

/* Thuộc tính hidden phải thắng mọi display:flex/grid khai báo sau */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 320px at 50% 0%, var(--brand-100) 0%, transparent 100%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
a { color: var(--brand-700); text-decoration: none; transition: color .15s; }
a:hover { color: var(--red); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 .5em;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.6rem, 4.6vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--brand-200); outline-offset: 2px; border-radius: 10px; }
::selection { background: var(--brand-200); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 780px; }
.container-xs { max-width: 480px; }

main { flex: 1; padding: 24px 0 56px; }

/* ==========================================================================
   Đầu trang — tím đậm như trang chủ
   ========================================================================== */
/* Kích thước lấy đúng theo đầu trang WordPress (flatsome-child/style.css):
   điện thoại cao 70px, logo giữa; máy tính (≥850px) tầng trên 84px + thanh menu trắng 56px
   nằm vắt ngang mép dưới — nửa trên nền tím, nửa dưới nền trang. */
.site-header {
  position: relative; z-index: 50;
  background: linear-gradient(180deg, var(--header-bg) 0%, var(--header-bg-2) 100%);
}
.site-header .container { max-width: 1150px; padding: 0 15px; }
.header-top {
  height: 70px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
}
.header-top .menu-btn { grid-column: 1; justify-self: start; }
.header-top .logo { grid-column: 2; }
.header-top .header-right { grid-column: 3; justify-self: end; }
.logo {
  flex: none;
  display: inline-flex; align-items: center;
  text-decoration: none; color: #fff; white-space: nowrap;
}
.logo:hover { color: #fff; }
.logo img { display: block; height: 46px; width: auto; flex: none; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .2)); }
@media (max-width: 359px) { .header-top .logo img { height: 38px; } }

.header-right { display: flex; align-items: center; gap: 10px; }
.header-top .header-right .btn.btn-head { display: none; }

/* Nút đầu trang: đỏ "Vào lớp học", vàng "Tạo tài khoản" — y như trang chủ */
.btn.btn-head { min-height: 46px; padding: 0 26px; font-size: 1rem; border: 0; }
.btn.btn-head-red { --bg: var(--red); --fg: #fff; --glow: rgba(232, 36, 63, .9); }
.btn.btn-head-red:hover { --bg: var(--red-600); }
.btn.btn-head-sun { --bg: var(--sun); --fg: var(--ink); --glow: rgba(240, 185, 11, .9); }
.btn.btn-head-sun:hover { --bg: #ffdb5c; }
.btn.btn-head-fb { --bg: #1877f2; --fg: #fff; --glow: rgba(24, 119, 242, .9); gap: 8px; }
.btn.btn-head-fb:hover { --bg: #0f63d6; }

/* Thanh menu trắng nổi (chỉ máy tính; điện thoại dùng ngăn trượt) */
.header-nav { display: none; }
.nav-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  min-height: 56px; padding: 0 10px;
  background: var(--paper); border-radius: 18px;
  box-shadow: 0 16px 36px -18px rgba(38, 31, 110, .55);
}
.nav-bar a {
  position: relative;
  padding: 16px 20px;
  font-weight: 700; font-size: 1rem; line-height: 1.5; color: var(--ink); white-space: nowrap;
}
.nav-bar a + a::before {
  content: ""; position: absolute; left: 0; top: 50%; height: 16px; margin-top: -8px;
  border-left: 1.5px solid var(--line-soft);
}
.nav-bar a:hover { color: var(--brand); }
.nav-bar a.is-active { color: var(--brand-700); }
.nav-bar a.is-active::after {
  content: ""; position: absolute; left: 20px; right: 20px; bottom: 9px;
  height: 3px; border-radius: 3px; background: var(--red);
}

@media (min-width: 850px) {
  .site-header {
    background: linear-gradient(180deg, var(--header-bg) 0%, var(--header-bg-2) calc(100% - 28px), transparent calc(100% - 28px));
  }
  .header-top { height: 84px; display: flex; gap: 12px; }
  .header-top .menu-btn { display: none; }
  .header-top .header-right { margin-left: auto; gap: 20px; }
  .header-top .header-right .btn.btn-head { display: inline-flex; }
  .site-header .header-nav { display: block; max-width: 1180px; }
}

.avatar {
  --size: 40px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: var(--sun); color: var(--ink);
  font-family: var(--font-display); font-weight: 700;
  font-size: calc(var(--size) * .44);
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .85);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { --size: 96px; }
main .avatar { box-shadow: 0 0 0 3px #fff, var(--shadow-sm); }

.menu-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: none; margin-left: -10px;
  display: inline-grid; place-items: center; cursor: pointer; padding: 0;
}
.menu-btn:hover { background: rgba(255, 255, 255, .1); }
.menu-btn span, .menu-btn span::before, .menu-btn span::after {
  display: block; width: 20px; height: 2.5px; border-radius: 3px; background: #fff;
  position: relative; content: "";
}
.menu-btn span::before { position: absolute; top: -7px; }
.menu-btn span::after { position: absolute; top: 7px; }

.user-menu { position: relative; }
/* Nút tài khoản: điện thoại chỉ ảnh đại diện; máy tính là viên thuốc kính mờ cao bằng nút trang chủ */
.user-menu > button {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0; border-radius: 999px;
  cursor: pointer; font: inherit; color: #fff;
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.user-menu .user-name { display: none; font-weight: 700; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .user-caret { display: none; flex: none; opacity: .85; transition: transform .2s var(--ease); }
.user-menu > button[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
@media (min-width: 850px) {
  .user-menu > button {
    min-height: 46px; padding: 3px 18px 3px 3px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .28);
  }
  .user-menu > button:hover, .user-menu > button[aria-expanded="true"] {
    background: rgba(255, 255, 255, .2);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .45);
  }
  .user-menu .user-name, .user-menu .user-caret { display: block; }
  .user-menu .avatar { box-shadow: none; }
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 12px);
  min-width: 240px; padding: 8px;
  background: var(--paper); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.dropdown.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink); font: inherit; font-weight: 600;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--brand-50); color: var(--brand-700); }
.dropdown hr { border: 0; border-top: 1px solid var(--line-soft); margin: 6px 4px; }

/* Ngăn trượt điều hướng trên điện thoại */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(38, 31, 110, .45); backdrop-filter: blur(2px);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  width: min(84vw, 320px);
  background: var(--paper); box-shadow: var(--shadow-lg);
  padding: 18px 14px; overflow-y: auto;
  transform: translateX(-105%); transition: transform .3s var(--ease);
  display: flex; flex-direction: column; gap: 4px;
}
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
body.drawer-open { overflow: hidden; }
.drawer .logo { margin: 0 6px 14px; }
.drawer .logo img { filter: none; }
.drawer a.drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  font-weight: 700; font-size: 1.02rem; color: var(--ink);
}
.drawer a.drawer-link:hover { background: var(--brand-50); }
.drawer a.drawer-link .ico { font-size: 1.3rem; width: 28px; text-align: center; }
.drawer a.drawer-link.is-active { background: var(--brand); color: #fff; }
.drawer-actions { display: grid; gap: 10px; margin-top: 14px; padding: 16px 6px 0; border-top: var(--line); }

/* ==========================================================================
   Nút — viên thuốc, màu đặc, bóng mềm
   ========================================================================== */
.btn {
  --bg: var(--paper); --fg: var(--ink); --glow: rgba(46, 42, 82, .10);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem; line-height: 1.1;
  color: var(--fg); background: var(--bg);
  border: 1px solid transparent; border-radius: 999px;
  box-shadow: 0 6px 16px -8px var(--glow);
  cursor: pointer; user-select: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, filter .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:not(.btn-primary):not(.btn-sun):not(.btn-green):not(.btn-sky):not(.btn-berry):not(.btn-ghost):not(.btn-danger):not(.btn-head) { border-color: var(--line-soft); }
.btn:hover { color: var(--fg); transform: translateY(-2px); box-shadow: 0 10px 22px -10px var(--glow); }
.btn:active { transform: translateY(0); box-shadow: 0 3px 8px -6px var(--glow); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-primary { --bg: var(--brand); --fg: #fff; --glow: rgba(111, 103, 214, .75); }
.btn-primary:hover { --bg: var(--brand-600); }
.btn-sun { --bg: var(--sun); --fg: var(--ink); --glow: rgba(240, 185, 11, .7); }
.btn-green { --bg: var(--grass); --fg: #fff; --glow: rgba(47, 191, 113, .7); }
.btn-sky { --bg: var(--blue); --fg: #fff; --glow: rgba(56, 152, 211, .7); }
.btn-berry { --bg: var(--red); --fg: #fff; --glow: rgba(232, 36, 63, .65); }
.btn-ghost { --bg: transparent; box-shadow: none; }
.btn-ghost:hover { box-shadow: none; background: var(--brand-50); }
.btn-danger { --bg: #fff; --fg: var(--red-600); --glow: rgba(232, 36, 63, .35); border-color: #f6c6cf !important; }
.btn-danger:hover { --bg: var(--red-50); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .92rem; }
.btn-lg { min-height: 54px; padding: 12px 30px; font-size: 1.12rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ==========================================================================
   Thẻ
   ========================================================================== */
.card {
  background: var(--paper);
  border: var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card + .card { margin-top: 20px; }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-title h2, .card-title h3 { margin: 0; white-space: nowrap; }
.card-title .btn-row { margin-left: auto; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; }
.page-head .btn-row { margin-left: auto; }
.page-head .sub { flex-basis: 100%; margin: -6px 0 0; color: var(--ink-soft); font-weight: 600; }
.crumb { font-weight: 700; display: inline-flex; gap: 4px; margin-bottom: 8px; font-size: .95rem; }

.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

/* ==========================================================================
   Biểu mẫu
   ========================================================================== */
.field { margin-bottom: 18px; }
.field > label, .label { display: block; font-weight: 700; margin-bottom: 7px; }
.field .hint { font-size: .88rem; color: var(--ink-soft); margin-top: 5px; }
.req { color: var(--red); }

.input, .select, .textarea {
  width: 100%; min-height: 48px;
  padding: 10px 14px;
  font: inherit; font-size: 16px; /* 16px để iPhone không tự phóng to khi chạm */
  color: var(--ink); background: var(--paper);
  border: var(--field-line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #c7c2e6; }
.textarea { min-height: 110px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M1.5 1.5 7 7.5l5.5-6' fill='none' stroke='%236e6a92' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(111, 103, 214, .18); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.error { color: var(--red-600); font-weight: 600; font-size: .9rem; margin-top: 5px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

/* Nhóm lựa chọn dạng thẻ (dạng câu hỏi, cách gọi, giới tính…) */
.choice-group { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 12px; text-align: center;
  border: var(--field-line); border-radius: var(--radius-sm); background: var(--paper);
  font-weight: 700; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .15s var(--ease);
}
.choice span:hover { border-color: var(--brand-200); }
.choice span small { font-weight: 500; color: var(--ink-soft); font-size: .84rem; }
.choice span .emo { font-size: 1.7rem; line-height: 1; }
.choice input:checked + span {
  border-color: var(--brand); background: var(--brand-50); color: var(--brand-800);
  box-shadow: 0 0 0 3px rgba(111, 103, 214, .15);
}
.choice input:focus-visible + span { outline: 3px solid var(--brand-200); outline-offset: 2px; }
.choice input:disabled + span { opacity: .45; cursor: not-allowed; }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 56px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 38px; border: 0; background: none; cursor: pointer; font-size: 1.15rem;
}

/* ==========================================================================
   Thông báo, nhãn
   ========================================================================== */
.flash {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  animation: sb-drop .35s var(--ease) both;
}
.flash .emo { font-size: 1.3rem; line-height: 1.2; }
.flash-ok { background: var(--ok-bg); color: #16603a; }
.flash-err { background: var(--err-bg); color: #8f1424; }
.flash-warn { background: var(--warn-bg); color: #7a5a00; }
.flash ul { margin: 4px 0 0; padding-left: 18px; font-weight: 500; }
@keyframes sb-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-700);
  font-size: .8rem; font-weight: 700; white-space: nowrap;
}
.badge-sun { background: #fff3c4; color: #7a5a00; }
.badge-green { background: #dcf5e7; color: #16603a; }
.badge-red { background: var(--red-50); color: #a3122a; }
.badge-sky { background: var(--blue-50); color: var(--blue-800); }
.badge-grey { background: #efeef5; color: var(--ink-soft); }

.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   Bảng — trên điện thoại mỗi dòng thành một thẻ
   ========================================================================== */
.table-wrap { width: 100%; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--brand-50); }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
.table tr.is-inactive td { opacity: .55; }

@media (max-width: 719px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr {
    border: var(--line); border-radius: var(--radius-sm); background: var(--paper);
    padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
  }
  .table-cards tbody tr:hover { background: var(--paper); }
  .table-cards td { border: 0; padding: 4px 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: right; }
  .table-cards td::before { content: attr(data-label); font-weight: 700; color: var(--ink-soft); text-align: left; flex: none; }
  .table-cards td.cell-main { font-size: 1.08rem; text-align: left; justify-content: flex-start; }
  .table-cards td.cell-main::before { display: none; }
  .table-cards td.actions { padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line-soft); justify-content: flex-end; }
  .table-cards td.actions::before { display: none; }
  .table-cards td:empty { display: none; }
  .table-cards .hide-sm { display: none; }
}

/* ---------- Trạng thái trống ---------- */
.empty { text-align: center; padding: 40px 16px; }
.empty .mascot { width: 120px; margin: 0 auto 12px; display: block; animation: bob 3s ease-in-out infinite; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-soft); max-width: 420px; margin: 0 auto 18px; }

/* ==========================================================================
   Bảng điều khiển
   ========================================================================== */
.hello { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.hello h1 { margin: 0; }
.hello p { margin: 2px 0 0; color: var(--ink-soft); font-weight: 600; }

.feature-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-bottom: 26px; }
.feature {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 190px; padding: 24px;
  border-radius: 24px; box-shadow: var(--shadow);
  color: #fff; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.feature::before {
  content: ""; position: absolute; z-index: -1; width: 220px; height: 220px; border-radius: 50%;
  right: -60px; bottom: -90px; background: rgba(255, 255, 255, .12);
}
.feature:hover { color: #fff; transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature h2 { font-size: clamp(1.6rem, 5.5vw, 2.1rem); margin: 0; color: #fff; position: relative; z-index: 1; }
.feature p { margin: 4px 0 0; font-weight: 600; position: relative; z-index: 1; max-width: 62%; opacity: .95; }
.feature .art { position: absolute; right: 4px; top: 14px; width: 40%; max-width: 190px; transition: transform .35s var(--ease); }
.feature:hover .art { transform: translateY(-4px) rotate(-4deg); }
.feature-lucky { background: linear-gradient(135deg, var(--blue-400) 0%, var(--blue-700) 100%); }
.feature-quiz { background: linear-gradient(135deg, #8f88ea 0%, var(--brand-700) 100%); }
.feature-tv { background: linear-gradient(135deg, #4fd08e 0%, var(--grass-700) 100%); }
.feature .art-abc {
  top: 50%; right: 18px; width: auto; transform: translateY(-50%);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 14vw, 6rem); line-height: 1;
  color: var(--sun); text-shadow: 0 6px 0 rgba(0, 0, 0, .15);
}
.feature:hover .art-abc { transform: translateY(-50%) rotate(-6deg) scale(1.05); }
.feature-pea { background: linear-gradient(135deg, #ffb86b 0%, #e0781a 100%); }
.feature .art-emoji { top: 50%; right: 18px; width: auto; transform: translateY(-50%); font-size: clamp(4.2rem, 14vw, 6.2rem); line-height: 1; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .18)); }
.feature:hover .art-emoji { transform: translateY(-50%) rotate(-6deg) scale(1.05); }
.feature .go {
  position: relative; z-index: 1; align-self: flex-start; margin-top: 16px;
  background: #fff; color: var(--ink); border-radius: 999px;
  padding: 7px 18px; font-weight: 700; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .35);
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.stat {
  background: var(--paper); border: var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 14px; text-align: center; color: var(--ink);
  transition: transform .2s var(--ease), box-shadow .2s;
}
a.stat:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--brand-700); }
.stat span { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }

/* Thẻ lớp học */
.class-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.class-card {
  display: block; color: var(--ink);
  background: var(--paper); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.class-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); }
.class-card .name { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--brand-700); }
.class-card .meta { color: var(--ink-soft); font-weight: 600; margin-top: 6px; }
.class-card .tag { display: inline-block; margin-top: 12px; }

/* Thẻ lớp có thanh thao tác (trang Lớp học của tôi) */
div.class-card { display: flex; flex-direction: column; padding: 0; overflow: clip; }
.class-card .class-main { display: block; flex: 1; padding: 18px 18px 14px; color: var(--ink); }
.class-card .class-main:hover { color: var(--ink); }
.class-card .class-main .meta.small { font-weight: 500; font-size: .85rem; margin-top: 8px; }
.class-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px; border-top: 1px solid var(--line-soft); background: var(--brand-50);
}
.class-actions .btn:first-child { margin-right: auto; }
.mini-round { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.mini-round .progress { flex: 1; height: 8px; border-radius: 99px; background: var(--brand-100); overflow: hidden; min-width: 50px; }
.mini-round .progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--grass), #5fd896); }
.year-head { font-size: 1.2rem; margin: 28px 0 12px; color: var(--ink-soft); }
.year-head:first-of-type { margin-top: 4px; }

/* Dải trạng thái vòng gọi — chỉ giáo viên thấy */
.round-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 12px 16px; margin-bottom: 18px;
  background: var(--paper); border: var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.round-bar .progress { flex: 1 1 160px; height: 10px; border-radius: 99px; background: var(--brand-100); overflow: hidden; }
.round-bar .progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--grass), #5fd896); }
.round-bar form { margin-left: auto; }

.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--grass); }
.dots i.off { background: var(--brand-100); }

.gender { font-size: 1.1rem; }

/* ==========================================================================
   Câu hỏi
   ========================================================================== */
.subject-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 12px; margin: 0 -16px 8px;
  scrollbar-width: thin;
}
.subject-pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--paper); box-shadow: var(--shadow-sm);
  font-weight: 700; color: var(--ink); white-space: nowrap;
  transition: background .15s, color .15s, transform .15s var(--ease);
}
.subject-pill:hover { color: var(--brand-700); transform: translateY(-1px); }
.subject-pill.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.subject-pill .n { font-size: .76rem; background: var(--brand-50); color: var(--brand-700); border-radius: 99px; padding: 0 7px; }
.subject-pill.is-active .n { background: rgba(255, 255, 255, .22); color: #fff; }

.filter-bar { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 16px; }

.q-item {
  display: grid; gap: 8px; grid-template-columns: 1fr;
  padding: 18px; margin-bottom: 14px;
  background: var(--paper); border: var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.q-item .q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-item .q-text { font-weight: 700; font-size: 1.05rem; white-space: pre-line; word-break: break-word; }
.q-item .q-img { max-height: 120px; border-radius: 10px; }
.q-opts { display: grid; gap: 6px; grid-template-columns: 1fr; margin: 0; padding: 0; list-style: none; }
.q-opts li { padding: 7px 12px; border-radius: 10px; background: var(--bg); font-weight: 500; }
.q-opts li.is-correct { background: #dcf5e7; color: #16603a; font-weight: 700; }
.q-opts li b { margin-right: 6px; }
.q-item .actions { display: flex; gap: 8px; justify-content: flex-end; }

.opt-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.opt-row .opt-label {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: var(--field-line); border-radius: 12px; font-weight: 700; font-size: 1.2rem;
  cursor: pointer; background: var(--paper); position: relative; transition: background .15s, color .15s;
}
.opt-row input[type=radio] { position: absolute; opacity: 0; }
.opt-row .opt-label:has(input:checked) { background: var(--grass); border-color: var(--grass); color: #fff; box-shadow: 0 6px 14px -8px rgba(47, 191, 113, .9); }
.opt-row .opt-label:has(input:focus-visible) { outline: 3px solid var(--brand-200); outline-offset: 2px; }

/* ---------- Xem trước nhập Excel ---------- */
.import-table td { vertical-align: top; }
.import-table tr.has-error { background: var(--err-bg); }
.import-table tr.has-warn { background: var(--warn-bg); }
.import-table .notes { font-size: .88rem; font-weight: 600; margin: 4px 0 0; padding-left: 16px; }
.import-table .notes .e { color: var(--red-600); }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5;
  margin: 16px -22px -22px; padding: 14px 22px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--radius) var(--radius);
}

/* ==========================================================================
   Đăng nhập / đăng ký
   ========================================================================== */
.auth-wrap { min-height: calc(100dvh - 180px); display: grid; place-items: center; padding: 10px 0 30px; }
.auth-card { width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); border: 0; padding: 30px 28px; }
.auth-card .mascot { width: 100px; display: block; margin: -76px auto 6px; animation: bob 3s ease-in-out infinite; }
.auth-card h1 { text-align: center; font-size: 1.8rem; }
.auth-card .sub { text-align: center; color: var(--ink-soft); font-weight: 600; margin-top: -6px; }
.auth-alt { text-align: center; margin-top: 16px; font-weight: 600; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-7px) rotate(3deg); }
}

/* ---------- Chân trang: giống hệt chân trang trang chủ (flatsome-child .sb-footer) ---------- */
.site-footer { background: var(--footer-bg); color: rgba(255, 255, 255, .8); }
.site-footer .container { max-width: 1150px; padding: 0 15px; }
.site-footer .footer-cols { display: grid; gap: 30px; grid-template-columns: 1fr; padding: 56px 15px 36px; }
.site-footer h3 { font-size: 1.1rem; margin: 0 0 16px; color: #fff; }
.site-footer p, .site-footer li { font-size: .97rem; color: rgba(255, 255, 255, .8); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 10px; }
.site-footer a { color: #fff; font-weight: 600; }
.site-footer a:hover { color: var(--sun); }
/* Dòng email thu nhỏ để nằm gọn một hàng khi chân trang chia 4 cột đủ rộng */
@media (min-width: 1200px) { .site-footer .footer-email { font-size: .84rem; white-space: nowrap; } }
.footer-logo { display: block; height: 42px; width: auto; margin-bottom: 14px; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .25)); }
.site-footer .footer-legal { font-size: .88rem; color: rgba(255, 255, 255, .6); }
.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social a {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px;
  background: rgba(255, 255, 255, .1); color: #fff; font-weight: 800; font-size: .8rem;
  transition: background .2s, transform .2s var(--ease);
}
.footer-social a:hover { background: var(--sun); color: var(--ink); transform: translateY(-2px); }
.footer-bottom { background: #1d1756; padding: 16px 0; font-size: .88rem; color: rgba(255, 255, 255, .7); }
.footer-bottom .container { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; text-align: center; }
.footer-bottom .bct-badge { line-height: 0; }
.footer-bottom .bct-badge img { width: 120px; height: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.footer-bottom .tnm-badge { line-height: 0; }
.footer-bottom .tnm-badge img { height: 39px; width: auto; border-radius: 6px; } /* cao bằng huy hiệu Bộ Công Thương */
@media (min-width: 900px) {
  /* giữ khớp với chân trang trang chủ (flatsome-child .sb-footer) */
  .site-footer .footer-cols { grid-template-columns: 1.35fr .85fr 1fr 1.35fr; gap: 40px; }
}

/* ---------- Phân trang ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 10px;
  display: inline-grid; place-items: center;
  border: var(--line); border-radius: 12px; background: var(--paper);
  font-weight: 700; color: var(--ink);
}
.pager a:hover { border-color: var(--brand-200); color: var(--brand-700); }
.pager .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .is-disabled { opacity: .4; }

/* ---------- Hộp thoại ---------- */
dialog.modal {
  width: min(92vw, 460px); padding: 24px;
  border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  background: var(--paper); color: var(--ink);
}
dialog.modal[open] { animation: sb-pop .22s var(--ease) both; }
dialog.modal::backdrop { background: rgba(38, 31, 110, .45); backdrop-filter: blur(2px); }
dialog.modal h3 { margin-top: 0; }
@keyframes sb-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Lịch sử, học sinh ---------- */
.result-dot { font-size: 1.2rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { font-weight: 700; color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 600; }
.contact-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Văn bản trang chính sách */
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; color: var(--brand-700); }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }

/* ==========================================================================
   Máy tính bảng trở lên
   ========================================================================== */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .feature { min-height: 220px; }
  .q-opts { grid-template-columns: 1fr 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr 2fr auto; align-items: end; }
  .card { padding: 26px; }
  .sticky-actions { margin: 16px -26px -26px; padding: 14px 26px; }
}

@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .q-item { grid-template-columns: 1fr auto; align-items: start; }
  .q-item .actions { grid-row: 1 / span 3; grid-column: 2; flex-direction: column; }
  main { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .btn, .drawer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ==========================================================================
   Khu quản trị
   ========================================================================== */
/* Thanh ngang cho thống kê: nhãn — thanh — số */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: 12px; font-weight: 600; }
.hbar > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar > i, .hbar.hbar-only > i { display: block; height: 12px; border-radius: 999px; background: var(--brand-100); position: relative; overflow: hidden; }
.hbar > i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--blue)); }
.hbar > b { min-width: 3ch; text-align: right; }
.hbar.hbar-only { display: block; }
.admin-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--brand-700); color: #fff; font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.stats-admin { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .stats-admin { grid-template-columns: repeat(4, 1fr); } }
.stat small { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }

.bars { display: flex; align-items: flex-end; gap: 5px; height: 150px; padding-top: 18px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar i {
  display: block; width: 100%; max-width: 32px; min-height: 3px; position: relative;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-700) 100%); border-radius: 8px 8px 3px 3px;
}
.bars .bar i b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: .75rem; }
.bars .bar span { font-size: .68rem; font-weight: 600; color: var(--ink-soft); margin-top: 4px; white-space: nowrap; }
.bars .bar.is-weekend span { color: var(--red); }
@media (max-width: 639px) { .bars .bar:nth-child(odd) span { visibility: hidden; } }

.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: .93rem; }
.log-list li:last-child { border-bottom: 0; }
.log-list time { color: var(--ink-soft); font-size: .82rem; font-weight: 600; display: block; }

.danger-zone { border-color: #f6c6cf; }
.danger-zone h3 { color: var(--red-600); }
.user-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 20px; }
.user-head h1 { margin: 0; }
.privacy-note { font-size: .88rem; color: var(--ink-soft); font-weight: 500; }

@media (max-width: 479px) { .hide-xs { display: none !important; } }
.auth-need { margin: 4px 0 18px; font-size: .95rem; }
