/* ==========================================================================
   CASA Mầm non — Hệ thống thiết kế
   Phong cách: gradient mềm, thẻ nhiều lớp, kính mờ (glassmorphism), hỗ trợ nền tối.
   ========================================================================== */

:root {
  /* Màu thương hiệu */
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-300: #a5b4fc;
  --primary-tint: #eef2ff;
  --accent: #ec4899;
  --success: #10b981;
  --success-tint: #ecfdf5;
  --warning: #f59e0b;
  --warning-tint: #fffbeb;
  --danger: #ef4444;
  --danger-tint: #fef2f2;
  --info: #0ea5e9;
  --info-tint: #f0f9ff;

  /* Nền và bề mặt */
  --bg: #f5f6fb;
  --bg-2: #eef1fa;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --surface-glass: rgba(255, 255, 255, .72);
  --line: #e8ecf5;
  --line-strong: #d9e0ee;

  /* Chữ */
  --text: #0f172a;
  --text-2: #334155;
  --muted: #6b7a90;

  /* Bo góc */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --r-full: 999px;

  /* Đổ bóng nhiều lớp */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 26px -8px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 28px 56px -18px rgba(15, 23, 42, .28), 0 6px 16px rgba(15, 23, 42, .08);
  --shadow-glow: 0 10px 24px -8px rgba(79, 70, 229, .5);

  /* Chỗ thanh điều hướng dưới đáy chiếm, TÍNH CẢ vùng an toàn của iPhone có
     vạch Home (34px khi chạy như app đã cài). Dải nổi, hộp báo nổi và lề đáy
     của trang đều đặt theo biến này; trước Đ256 nó là 68px trần nên trên
     iPhone đời mới những thứ ấy đè lên thanh. Máy không có vùng an toàn thì
     env() bằng 0 và mọi thứ ở đúng chỗ cũ. */
  --nav-h: calc(68px + env(safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(.22, .8, .3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e1a;
    --bg-2: #0f1526;
    --surface: #151b2c;
    --surface-2: #1a2136;
    --surface-glass: rgba(21, 27, 44, .78);
    --line: #253048;
    --line-strong: #33415e;
    --text: #e9edf8;
    --text-2: #c3cce0;
    --muted: #8595b0;
    --primary: #7c7cf0;
    --primary-600: #6366f1;
    --primary-tint: #1e2544;
    --success-tint: #10281f;
    --warning-tint: #2a2114;
    --danger-tint: #2b1618;
    --info-tint: #10222f;
    --shadow-md: 0 10px 26px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-lg: 0 28px 56px -18px rgba(0, 0, 0, .8), 0 6px 16px rgba(0, 0, 0, .5);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, .35);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }

body {
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 8% -8%, rgba(99, 102, 241, .16), transparent 62%),
    radial-gradient(900px 560px at 105% 4%, rgba(236, 72, 153, .12), transparent 60%),
    radial-gradient(760px 520px at 50% 108%, rgba(14, 165, 233, .1), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Trải nghiệm chạm trên điện thoại */
  -webkit-tap-highlight-color: transparent;  /* bỏ ô sáng xanh khi chạm */
  overscroll-behavior-y: contain;            /* không kéo bật cả trang nền */
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; touch-action: manipulation; }
/* iOS Safari tự phóng to trang khi ô nhập nhỏ hơn 16px — luôn giữ tối thiểu 16px */
input, select, textarea { font-family: inherit; color: inherit; font-size: max(16px, 1em); }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
svg { display: block; flex: none; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; font-weight: 750; }

::selection { background: var(--primary); color: #fff; }

/* Thanh cuộn thanh mảnh */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Khung ứng dụng ===== */
#app { min-height: 100dvh; }
#view {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + 34px);
  animation: view-in .34s var(--ease);
}
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== Hero trang chủ ===== */
.hero {
  position: relative;
  margin: 0 -16px 22px;
  /* Chừa vùng tai thỏ khi chạy toàn màn hình (đã cài như app) */
  padding: calc(18px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 74px calc(20px + env(safe-area-inset-left));
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6d5ce7 42%, #8b5cf6 72%, #a855f7 100%);
  border-radius: 0 0 34px 34px;
  overflow: hidden;
  isolation: isolate;
}
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}
.hero::before {
  width: 300px; height: 300px;
  top: -130px; right: -80px;
  background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 68%);
}
.hero::after {
  width: 240px; height: 240px;
  bottom: -110px; left: -70px;
  background: radial-gradient(circle, rgba(255, 255, 255, .2), transparent 66%);
}
.hero-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hero-logo {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  backdrop-filter: blur(10px);
}
.hero-brand { flex: 1; min-width: 0; }
.hero-brand b { display: block; font-size: 1rem; font-weight: 750; letter-spacing: -.01em; }
.hero-brand span { font-size: .78rem; opacity: .78; }
.hero-year {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 8px 32px 8px 13px;
  border-radius: var(--r-full);
  font-size: .84rem; font-weight: 650;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.hero-year option { color: #0f172a; }

.hero-greet { display: flex; align-items: center; gap: 14px; }
.hero-greet .avatar {
  border: 2.5px solid rgba(255, 255, 255, .55);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}
.hero-greet-text { flex: 1; min-width: 0; }
.hero-greet-text small { display: block; font-size: .8rem; opacity: .82; font-weight: 500; }
.hero-greet-text b { display: block; font-size: 1.24rem; font-weight: 750; letter-spacing: -.02em; margin-top: 1px; }
.hero-greet-text i { display: block; font-style: normal; font-size: .8rem; opacity: .8; margin-top: 3px; }

/* Dải chọn con trong hero */
.hero .student-bar { margin: 18px -20px -6px; padding: 4px 20px 8px; }
.hero .student-chip {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: none;
}
.hero .student-chip.active {
  background: #fff;
  color: var(--primary-600);
  border-color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

/* Bảng nổi đè lên hero (đặt ngay sau .hero) */
.hero + .tile-sheet { margin-top: -58px; }

/* ===== Tiêu đề trang con ===== */
.page-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  margin: 0 -16px 18px;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 14px calc(16px + env(safe-area-inset-left));
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.page-head .back-btn {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: transform .16s var(--ease), background .16s;
}
.page-head .back-btn:hover { background: var(--primary-tint); color: var(--primary); transform: translateX(-2px); }
.page-head h1 { flex: 1; font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; }
.page-head .head-action {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 10px 16px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), #7c5cf5);
  color: #fff; font-weight: 650; font-size: .87rem;
  box-shadow: var(--shadow-glow);
  transition: transform .16s var(--ease), box-shadow .16s;
}
.page-head .head-action:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(79, 70, 229, .65); }
.page-head .head-action:active { transform: scale(.96); }

/* ===== Lưới icon trang chủ ===== */
.tile-sheet {
  position: relative; z-index: 2;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 22px 14px 10px;
  margin-bottom: 18px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 6px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 4px 2px;
  border-radius: var(--r-md);
  transition: transform .18s var(--ease);
}
.tile:active { transform: scale(.93); }
.tile .tile-icon {
  width: 58px; height: 58px;
  border-radius: 19px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  position: relative;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.tile .tile-icon::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, .34), transparent 52%);
  pointer-events: none;
}
.tile:hover .tile-icon { transform: translateY(-5px) scale(1.06); }
.tile .tile-label {
  font-size: .775rem; font-weight: 650; line-height: 1.25;
  color: var(--text-2); text-align: center;
  max-width: 84px;
  min-height: 2.5em; /* giữ các ô thẳng hàng khi nhãn xuống 2 dòng */
}
.tile .tile-badge {
  position: absolute; top: -3px; right: 50%; margin-right: -37px;
  min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff; font-size: .7rem; font-weight: 750;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid var(--surface);
  box-shadow: 0 3px 8px rgba(244, 63, 94, .45);
}

/* ===== Điều hướng dưới (kính mờ) ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface-glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
}
.bottom-nav .nav-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 66px; padding: 7px 10px 5px;
  border-radius: var(--r-sm);
  color: var(--muted); font-size: .7rem; font-weight: 650;
  transition: color .18s, background .18s, transform .18s var(--ease);
}
.bottom-nav .nav-item:hover { color: var(--text-2); background: var(--bg-2); }
.bottom-nav .nav-item:active { transform: scale(.92); }
.bottom-nav .nav-item.active { color: var(--primary); background: var(--primary-tint); }
.bottom-nav .nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--primary);
}
.bottom-nav .nav-badge {
  position: absolute; top: 2px; right: 9px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff; font-size: .64rem; font-weight: 750;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
/* MÀN HẸP (dưới 390px — iPhone SE, iPhone mini, máy Android nhỏ): năm mục
   không đủ chỗ với bề rộng và lề thường ngày. Trước Đ256 chữ "Thông báo",
   "Trang chủ" rớt xuống hai dòng, thanh cao 89px thay vì 71px, và mọi thứ đặt
   theo --nav-h (dải mời cài, hộp báo nổi, nút nổi) đè lên mép trên của thanh;
   ở 320px mục đầu còn tràn ra ngoài mép trái. Nay chữ luôn một dòng, mục co
   lề lại và chia đều chỗ còn dư. */
.bottom-nav .nav-item { white-space: nowrap; }
@media (max-width: 389px) {
  .bottom-nav { gap: 0; padding-left: 4px; padding-right: 4px; }
  .bottom-nav .nav-item { min-width: 0; flex: 1 1 auto; padding-left: 3px; padding-right: 3px; }
}

/* ===== Thẻ nội dung ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 14px;
  transition: box-shadow .22s var(--ease), transform .22s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
  display: flex; align-items: center; gap: 9px;
  font-size: .98rem; font-weight: 750; letter-spacing: -.015em;
  margin-bottom: 14px;
}
.card-title .spacer { flex: 1; }
.card-title svg { color: var(--primary); }

.section-label {
  margin: 22px 4px 10px;
  font-size: .74rem; font-weight: 750;
  color: var(--muted); text-transform: uppercase; letter-spacing: .08em;
}

/* ===== Dòng danh sách ===== */
.list-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: background .16s;
}
.list-row:last-child { border-bottom: none; }
.list-row .row-main { flex: 1; min-width: 0; }
.list-row .row-title { font-weight: 650; font-size: .94rem; letter-spacing: -.01em; }
.list-row .row-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.list-row .row-end { flex: none; text-align: right; }
.row-icon {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.clickable { cursor: pointer; }
.clickable:hover { background: var(--bg-2); }
.clickable:active { transform: scale(.995); opacity: .8; }

/* ===== Avatar ===== */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex: none;
  color: #fff;
  box-shadow: var(--shadow-xs);
}

/* ===== Huy hiệu ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: .74rem; font-weight: 700; letter-spacing: -.005em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.green { background: var(--success-tint); color: #047857; border-color: rgba(16, 185, 129, .22); }
.badge.red { background: var(--danger-tint); color: #b91c1c; border-color: rgba(239, 68, 68, .22); }
.badge.orange { background: var(--warning-tint); color: #b45309; border-color: rgba(245, 158, 11, .24); }
.badge.blue { background: var(--info-tint); color: #0369a1; border-color: rgba(14, 165, 233, .22); }
.badge.purple { background: var(--primary-tint); color: var(--primary-600); border-color: rgba(99, 102, 241, .22); }
.badge.gray { background: var(--bg-2); color: var(--muted); border-color: var(--line); }
@media (prefers-color-scheme: dark) {
  .badge.green { color: #6ee7b7; }
  .badge.red { color: #fca5a5; }
  .badge.orange { color: #fcd34d; }
  .badge.blue { color: #7dd3fc; }
  .badge.purple { color: var(--primary-300); }
}

/* ===== Nút ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-size: .9rem; font-weight: 700; letter-spacing: -.01em;
  transition: transform .16s var(--ease), box-shadow .18s, background .18s, opacity .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #7c5cf5);
  color: #fff; box-shadow: var(--shadow-glow);
}
.btn.primary:hover { box-shadow: 0 14px 32px -10px rgba(79, 70, 229, .65); transform: translateY(-1px); }
.btn.outline {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--line-strong);
}
.btn.outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-tint); }
.btn.danger-soft { background: var(--danger-tint); color: #b91c1c; border: 1px solid rgba(239, 68, 68, .2); }
.btn.danger-soft:hover { background: #fee2e2; }
.btn.success-soft { background: var(--success-tint); color: #047857; border: 1px solid rgba(16, 185, 129, .2); }
.btn.success-soft:hover { background: #d1fae5; }
@media (prefers-color-scheme: dark) {
  .btn.danger-soft { color: #fca5a5; }
  .btn.danger-soft:hover { background: #3a1c1f; }
  .btn.success-soft { color: #6ee7b7; }
  .btn.success-soft:hover { background: #14352a; }
}
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: .82rem; border-radius: var(--r-xs); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ===== Biểu mẫu ===== */
.field { margin-bottom: 15px; }
.field label {
  display: block; margin-bottom: 7px;
  font-size: .82rem; font-weight: 700; color: var(--text-2);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .13);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .75; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
/* Báo cáo tháng: ô viết của cô (góp ý 20/10, O1). Trên máy tính cho rộng hết
   cột và cao tối thiểu ~8 dòng. */
@media (min-width: 900px) {
  textarea.bc-o-viet { width: 100%; min-height: calc(8 * 1.55em + 24px); line-height: 1.55; resize: vertical; }
}
/* Trên điện thoại (góp ý 18/11): ô rộng hết bề ngang, có viền như ô nhập của
   biểu mẫu (ô của từng dòng mẫu không nằm trong `.field`), cao tối thiểu ~5
   dòng; ô tổng hợp ~6 dòng. */
@media (max-width: 899.98px) {
  textarea.bc-o-viet {
    display: block; width: 100%;
    min-height: calc(5 * 1.55em + 24px); padding: 12px 14px; line-height: 1.55; resize: vertical;
    background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-sm); outline: none;
  }
  textarea.bc-o-viet:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px rgba(79, 70, 229, .13); }
  textarea#bc-tong { min-height: calc(6 * 1.55em + 24px); }
}
.field select {
  appearance: none; cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.field .hint { margin-top: 5px; font-size: .77rem; color: var(--muted); }

/* ===== Dải chọn con ===== */
.student-bar {
  display: flex; gap: 9px;
  overflow-x: auto; scrollbar-width: none;
  padding: 2px 2px 14px;
}
.student-bar::-webkit-scrollbar { display: none; }
.student-chip {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 15px 5px 5px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-xs);
  font-size: .85rem; font-weight: 650; white-space: nowrap;
  transition: all .18s var(--ease);
}
.student-chip:hover { border-color: var(--primary-300); transform: translateY(-1px); }
.student-chip.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary-600);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .4);
}
@media (prefers-color-scheme: dark) { .student-chip.active { color: var(--primary-300); } }

/* ===== Tab phân đoạn ===== */
.seg {
  display: flex; gap: 4px;
  padding: 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 15px;
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1; min-width: fit-content;
  padding: 9px 12px;
  border-radius: var(--r-xs);
  font-size: .85rem; font-weight: 700; color: var(--muted);
  white-space: nowrap;
  transition: all .18s var(--ease);
}
.seg button:hover { color: var(--text-2); }
.seg button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
/* Ba tab của màn Thực đơn (Đ260d): tên tab dài, cho xuống dòng thay vì cuộn
   ngang trên điện thoại 390px. */
.seg.seg-tab button { white-space: normal; min-width: 0; line-height: 1.25; padding: 8px 6px; }

/* ===== Ô thống kê ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 9px;
  margin-bottom: 15px;
}
.stat-box {
  padding: 15px 10px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.stat-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-box .stat-num {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
}
.stat-box .stat-label {
  margin-top: 3px;
  font-size: .72rem; font-weight: 650; color: var(--muted);
}

/* ===== Bảng ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
table.simple { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.simple th, table.simple td { padding: 11px 13px; text-align: left; }
table.simple th {
  background: var(--bg-2);
  font-size: .72rem; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
table.simple td { border-top: 1px solid var(--line); }
table.simple tbody tr:hover td { background: var(--surface-2); }

/* ===== Dòng thời gian ===== */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: '';
  position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--primary-300), var(--line));
  border-radius: 2px;
}
.timeline .tl-item { position: relative; padding-bottom: 18px; }
.timeline .tl-item:last-child { padding-bottom: 0; }
.timeline .tl-item::before {
  content: '';
  position: absolute; left: -24px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .16);
}
.timeline .tl-time { font-size: .76rem; font-weight: 700; color: var(--muted); }

/* ===== Trạng thái trống ===== */
.empty-state {
  padding: 52px 22px;
  text-align: center;
  color: var(--muted);
}
.empty-state .es-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; margin-bottom: 14px;
  font-size: 40px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 28px;
}
.empty-state p { font-size: .92rem; max-width: 320px; margin: 0 auto; line-height: 1.6; }

/* ===== Thông báo nổi (toast) ===== */
#toast-zone {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--nav-h) + 18px);
  z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  pointer-events: none;
}
.toast {
  max-width: 90vw;
  padding: 12px 20px;
  border-radius: var(--r-full);
  background: rgba(15, 23, 42, .92);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: .88rem; font-weight: 650;
  box-shadow: var(--shadow-lg);
  animation: toast-in .32s var(--ease);
}
.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }

/* ===== Hộp thoại ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  /* `inset: 0` căng theo khung BỐ CỤC, không phải khung NHÌN THẤY. Trên điện
     thoại hai khung này lệch nhau bất cứ lúc nào thanh trình duyệt còn hiện,
     hoặc ngay khi bàn phím bật lên — mà bàn phím thì bật đúng lúc cô vừa gõ
     xong nhận xét và với tay xuống nút Lưu. Khi đó đáy modal tụt xuống dưới mép
     màn hình: nút Lưu vẫn nằm trong trang, vẫn cuộn tới được, nhưng KHÔNG chạm
     vào được, và modal ngắn thì cuộn hết cỡ cũng không kéo nó lên nổi.
     `100dvh` bám theo khung nhìn thấy nên đáy modal luôn ở đúng mép màn hình. */
  height: 100dvh;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 14, 26, .55);
  backdrop-filter: blur(5px);
  animation: fade-in .2s var(--ease);
}
.modal {
  width: 100%; max-width: 560px;
  max-height: 88dvh; overflow-y: auto;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up .3s var(--ease);
}
.modal::before {
  content: '';
  display: block; width: 42px; height: 4px; margin: 4px auto 14px;
  background: var(--line-strong); border-radius: 99px;
}
.modal .modal-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  font-size: 1.08rem; font-weight: 750; letter-spacing: -.02em;
}
.modal .modal-title .close-x {
  margin-left: auto;
  /* Vùng chạm tối thiểu 44px theo hướng dẫn của Apple/Google */
  width: 44px; height: 44px; margin-right: -8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs);
  color: var(--muted);
  transition: background .16s, color .16s;
}
.modal .modal-title .close-x:hover { background: var(--bg-2); color: var(--text); }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .modal { border-radius: var(--r-xl); }
  .modal::before { display: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { opacity: .3; transform: translateY(46px); } to { opacity: 1; transform: none; } }

/* ===== Nhắn tin ===== */
.chat-list-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .16s;
}
.chat-list-row:last-child { border-bottom: none; }
.chat-list-row:hover { background: var(--bg-2); }

/* Phòng chat chiếm trọn màn hình: ẩn thanh điều hướng và banner thông báo
   để ô nhập tin luôn nằm sát đáy (giống ứng dụng nhắn tin quen thuộc). */
body:has(.chat-screen) .bottom-nav,
body:has(.chat-screen) .push-banner { display: none; }
body:has(.chat-screen) #view { padding-bottom: 0; }
body:has(.chat-screen) #toast-zone { bottom: 96px; }

.chat-screen {
  display: flex; flex-direction: column;
  height: calc(100dvh - 4px);
  max-width: 820px; margin: 0 auto;
}
/* Trình duyệt cũ không có :has() — chừa chỗ cho thanh điều hướng */
@supports not selector(:has(*)) {
  .chat-screen { height: calc(100dvh - var(--nav-h) - 10px); }
}
.chat-screen .page-head { margin-bottom: 6px; }
.chat-msgs {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 12px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;  /* cuộn có quán tính trên iOS */
  overscroll-behavior: contain;
}
.bubble-row {
  display: flex; align-items: flex-end; gap: 8px;
  margin-bottom: 8px;
  animation: bubble-in .26s var(--ease);
}
.bubble-row.mine { flex-direction: row-reverse; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bubble {
  max-width: 76%;
  padding: 10px 15px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  font-size: .92rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.bubble-row:not(.mine) .bubble { border-bottom-left-radius: 7px; }
.bubble-row.mine .bubble {
  background: linear-gradient(135deg, var(--primary), #7c5cf5);
  color: #fff; border: none;
  border-bottom-right-radius: 7px;
  box-shadow: var(--shadow-glow);
}
.bubble .bubble-name {
  display: block; margin-bottom: 3px;
  font-size: .74rem; font-weight: 750; color: var(--primary);
}
.bubble-row.mine .bubble .bubble-name { display: none; }
.bubble .bubble-time { display: block; margin-top: 4px; font-size: .68rem; opacity: .62; }

.chat-input-bar {
  position: sticky; bottom: 0;
  display: flex; align-items: flex-end; gap: 9px;
  padding: 12px 4px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-top: 1px solid var(--line);
  margin: 0 -4px;
}
.chat-input-bar textarea {
  flex: 1;
  max-height: 110px; resize: none; outline: none;
  padding: 11px 17px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  transition: border-color .16s, box-shadow .16s;
}
.chat-input-bar textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .13); }
.chat-input-bar .send-btn {
  width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c5cf5);
  color: #fff;
  box-shadow: var(--shadow-glow);
  transition: transform .16s var(--ease);
}
.chat-input-bar .send-btn:hover { transform: scale(1.07); }
.chat-input-bar .send-btn:active { transform: scale(.92); }

/* ===== Album ảnh ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .24s var(--ease), box-shadow .24s;
}
.photo:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-md); }
.photo .photo-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 11px 9px;
  font-size: .74rem; font-weight: 650; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}

/* ===== Lịch điểm danh ===== */
.att-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-cal .cal-head {
  padding: 5px 0; text-align: center;
  font-size: .7rem; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.att-cal .cal-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .82rem; font-weight: 650;
  transition: transform .16s var(--ease), border-color .16s;
}
.att-cal .cal-cell:hover { transform: scale(1.07); border-color: var(--primary-300); }
.att-cal .cal-cell.dim { opacity: .3; background: transparent; border-color: transparent; }
.att-cal .cal-cell .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; }
/* Đ126: một ngày có thể có hai chấm — trạng thái sáng và "có ghi sổ trả bé" chiều */
.att-cal .cal-cell .dots { display: flex; gap: 3px; margin-top: 4px; }
.att-cal .cal-cell .dots .dot { margin-top: 0; }
.dot.tra { background: #2f9e7e; }

/* ===== Đăng nhập ===== */
.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 18px;
  background: linear-gradient(150deg, #4f46e5 0%, #6d5ce7 34%, #8b5cf6 56%, #a855f7 100%);
  position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.login-wrap::before {
  width: 420px; height: 420px; top: -160px; left: -130px;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 66%);
}
.login-wrap::after {
  width: 520px; height: 520px; bottom: -230px; right: -180px;
  background: radial-gradient(circle, rgba(255, 255, 255, .17), transparent 66%);
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 410px;
  padding: 30px 26px 24px;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: login-in .5s var(--ease);
}
@keyframes login-in { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-color-scheme: dark) {
  .login-card { background: rgba(21, 27, 44, .93); border-color: rgba(255, 255, 255, .1); }
}
.login-logo {
  width: 74px; height: 74px; margin: -62px auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border: 4px solid var(--surface);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { text-align: center; font-size: 1.42rem; letter-spacing: -.03em; }
.login-card .sub {
  text-align: center; margin-bottom: 24px; margin-top: 5px;
  font-size: .87rem; color: var(--muted); line-height: 1.5;
}

/* ===== Dải nổi ở đáy: mời cài app, báo có bản mới ===== */
/* `sticky` chứ không `fixed`: dải vẫn đứng yên ngay trên thanh điều hướng,
   nhưng nó có chỗ thật ở cuối trang, nên cuộn hết trang thì nút cuối cùng
   (Đăng xuất, Lưu…) nằm TRÊN dải chứ không nằm dưới. Chỗ chừa tự bằng đúng
   chiều cao của dải — chữ xuống mấy dòng cũng đủ, và tắt dải là hết chừa. */
.push-banner {
  position: sticky; bottom: calc(var(--nav-h) + 18px);
  margin: 0 auto;
  z-index: 60;
  display: flex; align-items: center; gap: 12px;
  width: min(430px, 92vw);
  padding: 13px 15px;
  background: var(--surface-glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: sheet-up .38s var(--ease);
}
.push-banner .pb-logo {
  width: 42px; height: 42px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 14px;
}
.push-banner .pb-text { flex: 1; min-width: 0; }
.push-banner .pb-text b { display: block; font-size: .91rem; font-weight: 700; }
.push-banner .pb-text span { font-size: .78rem; color: var(--muted); }
.push-banner .pb-bell {
  width: 40px; height: 40px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #7c5cf5);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.push-banner .pb-close {
  flex: none; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); border-radius: var(--r-xs);
}
.push-banner .pb-close:hover { background: var(--bg-2); }

/* ===== Đang tải ===== */
.loading {
  padding: 56px 0;
  text-align: center; color: var(--muted); font-size: .9rem;
}
.loading::after {
  content: '';
  display: block;
  width: 34px; height: 34px; margin: 14px auto 0;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Tiện ích ===== */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-14 { margin-top: 14px; }
.mb-8 { margin-bottom: 8px; }
.flex { display: flex; align-items: center; gap: 9px; }
.flex .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 13px; }

/* ===== Thực đơn: cả tuần nhìn một lượt trên máy tính =====
   Nhà trường nói "giao diện máy tính hơi khó nhìn": 5 ngày xếp dọc thành một
   cột hẹp dài, phải cuộn mới so được thứ Hai với thứ Sáu. Trên màn rộng thì
   xếp ngang; trên điện thoại vẫn một cột như cũ. */
.luoi-tuan { display: grid; gap: 13px; }
.luoi-tuan > .card { margin: 0; }
@media (min-width: 700px) {
  .luoi-tuan { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); align-items: start; }
  /* Khi ĐANG SOẠN thì mỗi ô cần chỗ để gõ, nên cột rộng hơn và ít cột hơn. */
  .luoi-tuan.dang-soan { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
}

/* Đ264c — góp ý 01/12: "dùng trên máy tính thì nhìn đủ được 5 ngày luôn k phải
   4, số lượng món ăn ở các ô cũng cân đối lại cho vừa ô". Lưới của người soạn
   (`.luoi-5`): từ 1100px đủ mọi ngày một hàng (`--so-cot`: 5, hay 6–7 khi tuần
   có ngày học bù), các thẻ cao bằng nhau, mỗi ô bữa cao cố định, chữ nhỏ lại
   một chút và xuống dòng gọn — không ô nào tràn. Điện thoại vẫn một cột. */
.luoi-5 > * { min-width: 0; }
.mn-chon-tuan { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.mn-chon-tuan b, .mn-chon-tuan input { flex: 1; min-width: 0; text-align: center; }
.mn-nguon { line-height: 1.6; margin-bottom: 10px; }
.o-ngay-dau { flex-wrap: wrap; row-gap: 6px; margin-bottom: 8px; }
.o-ngay-dau .head-action { padding: 5px 10px; font-size: .74rem; }
.o-ngay-nhan { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; margin-bottom: 8px; }
.o-ngay-nhan .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.o-bua { margin-bottom: 10px; }
.o-bua label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field.o-bua textarea {
  height: calc(4 * 1.45em + 22px); min-height: 0; line-height: 1.45;
  overflow-wrap: anywhere; resize: vertical;
}
.mn-mau-dau {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  width: 100%; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; color: inherit;
}
.luoi-xem { gap: 8px; }
.o-xem { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
.o-xem-thu { font-weight: 700; font-size: .8rem; margin-bottom: 4px; }
.o-xem-bua { display: flex; gap: 6px; font-size: .8rem; line-height: 1.4; padding: 2px 0; }
.o-xem-mon {
  min-width: 0; overflow-wrap: anywhere; color: #46536a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 1100px) {
  .luoi-tuan.luoi-5 { grid-template-columns: repeat(var(--so-cot, 5), minmax(0, 1fr)); align-items: stretch; gap: 10px; }
  .luoi-5 > .card { padding: 12px; }
  .luoi-5 .o-ngay-dau { font-size: .9rem; }
  .field.o-bua textarea { font-size: .84rem; padding: 8px 9px; }
  .o-bua label { font-size: .8rem; }
}

/* ===== Màn hình lớn ===== */
@media (min-width: 700px) {
  body { font-size: 16px; }
  #view { padding-bottom: calc(var(--nav-h) + 40px); }
  .hero { border-radius: 0 0 40px 40px; padding: 22px 30px 80px; margin: 0 -16px 24px; }
  .tile-sheet { padding: 26px 22px 16px; }
  .tile-grid { grid-template-columns: repeat(7, 1fr); gap: 24px 8px; }
  .tile .tile-icon { width: 64px; height: 64px; border-radius: 21px; }
  .tile .tile-badge { margin-right: -40px; }
  .tile .tile-label { font-size: .8rem; max-width: 96px; }
  .card { padding: 22px; }
  .bottom-nav { gap: 8px; padding-bottom: 10px; }
  .bottom-nav .nav-item { min-width: 84px; flex-direction: row; gap: 7px; padding: 10px 16px; border-radius: var(--r-full); font-size: .82rem; }
  .bottom-nav .nav-item.active::before { display: none; }
  .bottom-nav .nav-badge { top: 4px; right: 6px; }
}

@media (min-width: 1024px) {
  #view { max-width: 1000px; }
  .tile-grid { gap: 26px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Đ124 — Trang chủ cho cô và văn phòng: "hôm nay ở nhóm", cây cơ sở → nhóm,
   và bộ co giao diện cho hai vai này (dữ liệu dày hơn, ô và chữ nhỏ hơn).
   Gia đình (không có data-vai="teacher"/"admin") không đổi một pixel.
   ========================================================================== */

/* Chỗ trống dưới hero: trống thì giấu, lưới biểu tượng vẫn đè lên hero như cũ */
.hero + #hom-nay { position: relative; z-index: 2; margin-top: -58px; }
#hom-nay:empty { display: none; }
#hom-nay:empty + .tile-sheet { margin-top: -58px; }
#hom-nay + .tile-sheet { margin-top: 0; }

.hn-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 16px 14px 12px;
  margin-bottom: 14px;
}
.hn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hn-title { font-weight: 750; font-size: .98rem; letter-spacing: -.015em; }
.hn-sub { color: var(--muted); font-size: .76rem; margin-top: 1px; }
.hn-head .seg { margin: 0 0 0 auto; padding: 3px; }
.hn-head .seg button { padding: 6px 10px; font-size: .78rem; }
.hn-nhom {
  margin-left: auto; flex: none;
  font-size: .78rem; font-weight: 700; color: var(--primary);
  background: var(--primary-tint); padding: 4px 10px; border-radius: var(--r-full);
}

/* Dãy số đếm việc */
.dem-hang { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dem-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: .74rem; font-weight: 650; color: var(--text-2); white-space: nowrap;
}
.dem-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* Lưới bé của nhóm: 20–25 bé nhìn một lượt trên điện thoại */
.be-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px 4px; }
.be-chip {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 2px; border-radius: var(--r-sm);
  transition: transform .16s var(--ease), background .16s;
}
.be-chip:hover { background: var(--bg-2); }
.be-chip:active { transform: scale(.94); }
.be-chip-avatar { position: relative; }
.be-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.be-chip-ten {
  font-size: .68rem; font-weight: 650; line-height: 1.15;
  text-align: center; color: var(--text-2); max-width: 72px;
}
.be-chip-dau { font-size: .62rem; line-height: 1; min-height: .7em; letter-spacing: 1px; }
.hn-chu-thich { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 2px; font-size: .68rem; color: var(--muted); }
.hn-chu-thich i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }

/* Nút việc hằng ngày */
.hn-viec { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.viec-nut {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 11px; border-radius: var(--r-sm); text-align: left;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: transform .16s var(--ease), border-color .16s;
}
.viec-nut:active { transform: scale(.97); }
.viec-nut b { font-size: .82rem; }
.viec-nut span { font-size: .72rem; color: var(--muted); }
.viec-nut.con { border-color: var(--primary-300); background: var(--primary-tint); }
.viec-nut.con span { color: var(--primary-600); }
.hn-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: .8rem; font-weight: 650; }

/* Cây cơ sở → nhóm của văn phòng */
.tq-luoi { display: grid; gap: 10px; }
.tq-coso {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 10px 4px; background: var(--surface-2);
}
.tq-coso-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.tq-coso-head b { font-size: .9rem; }
.tq-coso-head span { margin-left: auto; font-size: .74rem; color: var(--muted); white-space: nowrap; }
/* Mỗi cơ sở một khối gập (Đ241f): tiêu đề là chỗ bấm, mũi tên nói đang mở hay gập. */
summary.tq-coso-head { cursor: pointer; list-style: none; padding: 2px 0 6px; margin-bottom: 0; }
summary.tq-coso-head::-webkit-details-marker { display: none; }
summary.tq-coso-head::after { content: '▾'; color: var(--muted); font-size: .8rem; transition: transform .16s; }
details.tq-coso:not([open]) > summary.tq-coso-head::after { transform: rotate(-90deg); }
/* "Cần gọi xác nhận" ở màn Điểm danh của văn phòng: gập sẵn, cùng kiểu mũi tên. */
#att-can-goi > summary { cursor: pointer; list-style: none; }
#att-can-goi > summary::-webkit-details-marker { display: none; }
#att-can-goi > summary::after { content: '▾'; margin-left: auto; color: var(--muted); font-size: .85rem; transition: transform .16s; }
#att-can-goi:not([open]) > summary { margin-bottom: 0; }
#att-can-goi:not([open]) > summary::after { transform: rotate(-90deg); }
.tq-nhom {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; border-top: 1px solid var(--line); text-align: left;
  border-radius: var(--r-xs);
  transition: background .16s;
}
.tq-nhom:first-of-type { border-top: none; }
.tq-nhom:not([disabled]):hover { background: var(--bg-2); }
.tq-nhom[disabled] { cursor: default; }
.tq-nhom-ten { flex: 1; min-width: 0; }
.tq-nhom-ten b { display: block; font-size: .88rem; }
.tq-nhom-ten small { display: block; color: var(--muted); font-size: .72rem; }
.tq-nhom-dem { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 62%; }

@media (min-width: 700px) {
  .tq-luoi { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .be-luoi { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .hn-sheet { padding: 20px 20px 14px; }
}

/* ---- Giao diện co lại cho cô và văn phòng ---- */
body[data-vai="teacher"] .hero,
body[data-vai="admin"] .hero { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 68px; margin-bottom: 16px; }
body[data-vai="teacher"] .hero-top,
body[data-vai="admin"] .hero-top { margin-bottom: 12px; }
body[data-vai="teacher"] .hero-greet .avatar,
body[data-vai="admin"] .hero-greet .avatar { width: 42px !important; height: 42px !important; font-size: 22px !important; }
body[data-vai="teacher"] .hero-greet-text b,
body[data-vai="admin"] .hero-greet-text b { font-size: 1.05rem; }
body[data-vai="teacher"] .tile-sheet,
body[data-vai="admin"] .tile-sheet { padding: 14px 10px 6px; }
body[data-vai="teacher"] .tile-grid,
body[data-vai="admin"] .tile-grid { gap: 12px 4px; }
body[data-vai="teacher"] .tile .tile-icon,
body[data-vai="admin"] .tile .tile-icon { width: 48px; height: 48px; border-radius: 15px; }
body[data-vai="teacher"] .tile .tile-icon svg,
body[data-vai="admin"] .tile .tile-icon svg { width: 24px; height: 24px; }
body[data-vai="teacher"] .tile .tile-icon span,
body[data-vai="admin"] .tile .tile-icon span { font-size: 22px !important; }
body[data-vai="teacher"] .tile .tile-label,
body[data-vai="admin"] .tile .tile-label { font-size: .7rem; min-height: 2.3em; }
body[data-vai="teacher"] .tile .tile-badge,
body[data-vai="admin"] .tile .tile-badge { margin-right: -32px; }
body[data-vai="teacher"] .card,
body[data-vai="admin"] .card { padding: 14px; margin-bottom: 12px; }
body[data-vai="teacher"] .list-row,
body[data-vai="admin"] .list-row { padding: 9px 4px; gap: 10px; }
body[data-vai="teacher"] .list-row .avatar,
body[data-vai="admin"] .list-row .avatar { width: 36px !important; height: 36px !important; font-size: 19px !important; }
body[data-vai="teacher"] .row-icon,
body[data-vai="admin"] .row-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
body[data-vai="teacher"] .stat-box,
body[data-vai="admin"] .stat-box { padding: 10px 8px; }
body[data-vai="teacher"] .stat-box .stat-num,
body[data-vai="admin"] .stat-box .stat-num { font-size: 1.3rem; }
body[data-vai="teacher"] .page-head h1,
body[data-vai="admin"] .page-head h1 { font-size: 1.08rem; }
body[data-vai="teacher"] .field,
body[data-vai="admin"] .field { margin-bottom: 11px; }
body[data-vai="teacher"] .field input, body[data-vai="teacher"] .field select, body[data-vai="teacher"] .field textarea,
body[data-vai="admin"] .field input, body[data-vai="admin"] .field select, body[data-vai="admin"] .field textarea { padding: 10px 12px; }
body[data-vai="teacher"] .section-label,
body[data-vai="admin"] .section-label { margin: 16px 4px 8px; }

@media (min-width: 1024px) {
  body[data-vai="teacher"] #view,
  body[data-vai="admin"] #view { max-width: 1180px; }
  body[data-vai="teacher"] .tile-grid,
  body[data-vai="admin"] .tile-grid { grid-template-columns: repeat(8, 1fr); }
}

/* ============================================================
   Đ258 — GIAO DIỆN MỚI THEO BẢN VẼ ĐÃ DUYỆT (14/11/2026)
   Ba khối dưới đây, mỗi khối do MỘT đơn vị viết. Không sửa ngoài
   khối của mình, không xoá các dòng mốc.
   ============================================================ */

/* == Đ258-N: thanh điều hướng dưới đáy theo vai == */
/* Ô NỔI Ở GIỮA THANH CỦA CÔ ("Ghi nhanh"): một vòng tròn tím nhô lên khỏi mép
   trên của thanh. Vòng tròn đặt tuyệt đối nên KHÔNG làm ô cao lên — thanh vẫn
   71px, và mọi thứ đặt theo --nav-h (dải mời cài, hộp báo nổi) vẫn đúng chỗ.
   --nav-nho là phần nhô lên: dải mời cài chỉ cách mép thanh 18px. */
.bottom-nav { --nav-nho: 10px; --nav-vong: 50px; }
.bottom-nav .nav-noi,
.bottom-nav .nav-noi:hover,
.bottom-nav .nav-noi.active { justify-content: flex-end; background: none; color: var(--primary); font-weight: 700; }
.bottom-nav .nav-noi.active::before { display: none; }
/* Chữ của ô nổi thấp dòng hơn để nhường chỗ cho vòng tròn, lề đáy bù lại 2px
   cho chữ vẫn thẳng hàng với chữ các ô bên cạnh. */
.bottom-nav .nav-noi { padding-bottom: 7px; }
.bottom-nav .nav-noi > span:last-child { line-height: 1.2; }
.bottom-nav .nav-noi-vong {
  /* Ô cách mép trên của thanh 9px (viền 1 + lề 8). */
  position: absolute; left: 50%; top: calc(-9px - var(--nav-nho)); margin-left: calc(var(--nav-vong) / -2);
  width: var(--nav-vong); height: var(--nav-vong); box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--surface); border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  box-shadow: 0 8px 16px -8px rgba(79, 70, 229, .9);
}
.bottom-nav .nav-noi.active .nav-noi-vong { box-shadow: 0 0 0 3px var(--primary-tint), 0 8px 16px -8px rgba(79, 70, 229, .9); }
@media (max-width: 699px) {
  /* Thanh của cô chia đều năm cột để vòng tròn đứng đúng giữa màn. `min-width:
     auto` giữ cho cột không bao giờ hẹp hơn chữ của nó: máy nào chữ rộng hơn
     thì cột ấy nới ra, chứ chữ không tràn sang ô bên cạnh. */
  body[data-vai="teacher"] .bottom-nav .nav-item { flex: 1 1 0; min-width: auto; max-width: 96px; padding-left: 2px; padding-right: 2px; }
}
@media (max-width: 379px) {
  /* Màn hẹp: nút nổi "Ghi nhanh" của Hành trình (cách đáy 76px, tức cách mép
     thanh 5px) vươn tới gần giữa màn — vòng tròn không được nhô cao hơn thế. */
  .bottom-nav { --nav-nho: 5px; --nav-vong: 46px; }
}
@media (min-width: 700px) {
  /* Màn rộng: thanh nằm ngang, ô nổi thành một viên tím cùng cỡ các ô khác. */
  .bottom-nav .nav-noi,
  .bottom-nav .nav-noi:hover,
  .bottom-nav .nav-noi.active { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
  .bottom-nav .nav-noi { padding-bottom: 10px; }
  .bottom-nav .nav-noi.active { box-shadow: 0 0 0 3px var(--primary-tint); }
  .bottom-nav .nav-noi > span:last-child { line-height: inherit; }
  .bottom-nav .nav-noi-vong,
  .bottom-nav .nav-noi.active .nav-noi-vong { position: static; margin: 0; width: auto; height: auto; border: 0; border-radius: 0; background: none; box-shadow: none; }
}
/* == hết Đ258-N == */

/* ------------------------------------------------------------
   mốc ngăn N | P — ba dòng này không đổi
   ------------------------------------------------------------ */

/* == Đ258-P: trang chủ của phụ huynh == */
/* Chữ phụ của bản vẽ (#55627a). Không dùng var(--muted): cỡ 12–13px nó chỉ
   đạt 4.3:1. Nền tối thì đổi sang một xám sáng cùng họ. */
.ph-hero, .ph-than { --ph-phu: #55627a; }
@media (prefers-color-scheme: dark) { .ph-hero, .ph-than { --ph-phu: #a9b4c9; } }

/* Phần đầu: tên trường, một dòng chào, dải chọn con. Thẻ bên dưới đè lên 34px. */
.ph-hero {
  margin-bottom: 0;
  padding-top: calc(22px + env(safe-area-inset-top));
  padding-bottom: 52px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 0 0 32px 32px;
}
.ph-truong { font-size: 13px; font-weight: 500; color: #e7e5ff; }
.ph-chao { margin-top: 2px; font-size: 22px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: #fff; }
.ph-hero .student-bar { margin: 14px -20px -4px; padding: 0 20px 6px; }
.ph-hero .student-chip { min-height: 46px; font-size: 14px; }
.ph-hero .student-chip.active { color: #3730a3; }

.ph-than { position: relative; z-index: 2; margin-top: -34px; display: flex; flex-direction: column; gap: 12px; }
/* Không có thẻ "Hôm nay" (đường điểm danh hỏng, cuối tuần không có gì để nói,
   tài khoản chưa gắn bé) thì thân trang thôi gối lên phần đầu tím. */
.ph-than.ph-khong-the { margin-top: 14px; }

/* Thẻ "Hôm nay của <tên bé>" */
.ph-the {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 16px 14px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 18px 36px -16px rgba(49, 46, 129, .35), 0 2px 6px rgba(15, 23, 42, .05);
}
.ph-the-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-the-dau h2 { min-width: 0; font-size: 17px; font-weight: 800; letter-spacing: 0; color: var(--text); }
.ph-ngay {
  flex: none; display: flex; align-items: center;
  height: 26px; padding: 0 10px; border-radius: 13px;
  background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 700;
}
.ph-the-than { position: relative; display: flex; flex-direction: column; gap: 14px; }
/* Đường nối các mốc trong ngày, chạy sau lưng các vòng tròn. */
.ph-the-than::before {
  content: ''; position: absolute; left: 19px; top: 22px; bottom: 22px;
  width: 2px; background: var(--line);
}
.ph-dang-nap { font-size: 13px; color: var(--ph-phu); }
.ph-dong { position: relative; display: flex; align-items: center; gap: 12px; }
.ph-dong[data-ph="loi-co"] { align-items: flex-start; }
.ph-cham {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 20px;
  border: 3px solid var(--surface);
}
.ph-k-xanh .ph-cham { background: #d1fae5; color: #065f46; }
.ph-k-cam .ph-cham { background: #ffedd5; color: #c2410c; }
.ph-k-duong .ph-cham { background: #e0f2fe; color: #0369a1; }
.ph-k-xam .ph-cham { background: #f1f3f8; color: #334155; }
/* Việc người lớn chưa ghi: vòng nét đứt xám, không màu cảnh báo (QUY TẮC 2). */
.ph-k-ngo .ph-cham { background: var(--surface); border: 2px dashed #b6c0d4; color: var(--ph-phu); }
.ph-dong-than { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ph-dong-dau { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.ph-dong-ten { font-size: 15px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.ph-k-xam .ph-dong-ten, .ph-k-ngo .ph-dong-ten { color: var(--text-2); }
.ph-gio {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px; border-radius: 11px;
  background: #f1f3f8; color: #334155; font-size: 12px; font-weight: 700;
}
.ph-k-xanh .ph-gio { background: #d1fae5; color: #065f46; }
.ph-phu { font-size: 13px; color: var(--ph-phu); overflow-wrap: anywhere; }
/* Dòng nhật ký (con ăn, ngủ) là nội dung chính, chữ đậm màu; dòng chỉ đường
   ("Xem thực đơn cả ngày →") cao đủ một cú chạm. */
.ph-nk { font-size: 14px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.ph-xem { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 -10px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.ph-loi {
  margin-top: 4px; padding: 10px 12px;
  border-radius: 4px 16px 16px 16px;
  background: #f0f9ff; color: #0f172a;
  font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ph-loi .ph-phu { color: #55627a; font-weight: 600; }
.ph-anh { flex: none; width: 64px; height: 64px; border-radius: 18px; overflow: hidden; background: #eef2ff; }
.ph-anh img { width: 100%; height: 100%; object-fit: cover; }

/* Dòng "N khảo sát chờ gia đình trả lời" */
.ph-ks {
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 8px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .04);
}
.ph-ks-hinh {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 12px;
  background: #fffbeb; color: #7c2d12;
}
.ph-ks-chu { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; }
.ph-ks > svg { flex: none; color: var(--ph-phu); }

/* Nhóm ô "Hằng ngày" và các ô còn lại, hiện hết ngay — vẫn MỘT lưới. Lưới
   chia 60 phần để năm ô hằng ngày đứng một hàng (mỗi ô 12 phần) còn các ô khác
   đứng bốn ô một hàng (15 phần); phần hằng ngày nào tắt thì các ô còn lại giãn
   cho kín hàng. */
.ph-o.tile-sheet { margin: 2px 0 18px; padding: 0; background: none; border: 0; box-shadow: none; }
.ph-nhom { margin: 0 4px 10px; font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--ph-phu); }
.ph-o .tile-grid { grid-template-columns: repeat(60, minmax(0, 1fr)); gap: 14px 0; }
.ph-o .tile { grid-column: span 15; min-width: 0; gap: 6px; padding: 0 2px; }
.ph-o .tile-grid[data-hn="6"] .tile:not(.tile-phu) { grid-column: span 20; }
.ph-o .tile-grid[data-hn="5"] .tile:not(.tile-phu) { grid-column: span 12; }
.ph-o .tile-grid[data-hn="3"] .tile:not(.tile-phu) { grid-column: span 20; }
.ph-o .tile-grid[data-hn="2"] .tile:not(.tile-phu) { grid-column: span 30; }
.ph-o .tile-grid[data-hn="1"] .tile:not(.tile-phu) { grid-column: span 60; }
.ph-o .tile .tile-icon { width: 52px; height: 52px; border-radius: 18px; }
.ph-o .tile .tile-icon svg { width: 24px; height: 24px; }
.ph-o .tile .tile-label { max-width: 100%; font-size: 12px; font-weight: 600; color: var(--text); overflow-wrap: break-word; }
.ph-o .tile .tile-badge { margin-right: -34px; }
/* == hết Đ258-P == */

/* ------------------------------------------------------------
   mốc ngăn P | T — ba dòng này không đổi
   ------------------------------------------------------------ */

/* == Đ258-T: điểm danh của cô == */
/* Màu lấy đúng bảng màu của bản vẽ. Nhãn và ô đếm tự mang nền + chữ nên giữ
   nguyên ở nền tối; chữ phụ (#55627a) và khối vàng chỉ đủ tương phản trên nền
   sáng nên đi qua biến, nền tối đổi sang cặp màu khác. */
.dd-dau, .dd-o-so, .dd-the, .dd-can-goi {
  --dd-phu: #55627a;
  --dd-vang-nen: #fffbeb; --dd-vang-vien: #f3d98a; --dd-vang-chu: #7c2d12;
}
@media (prefers-color-scheme: dark) {
  .dd-dau, .dd-o-so, .dd-the, .dd-can-goi {
    --dd-phu: #a3b0c8;
    --dd-vang-nen: #2a2114; --dd-vang-vien: #5b4514; --dd-vang-chu: #fcd34d;
  }
}

/* Năm cặp màu dùng chung cho ô đếm và nhãn trạng thái. */
.dd-la { background: #d1fae5; color: #065f46; }
.dd-duong { background: #e0f2fe; color: #0369a1; }
.dd-xam { background: #f1f3f8; color: #334155; }
.dd-cam { background: #ffedd5; color: #c2410c; }
.dd-vang { background: #fffbeb; color: #7c2d12; box-shadow: inset 0 0 0 1px #f3d98a; }

/* Phần đầu màu tím: nút quay lại, tên màn, ô chọn nhóm, hai nút ngày. */
.dd-dau {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 -16px 14px;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 16px calc(16px + env(safe-area-inset-left));
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 0 0 32px 32px;
}
.dd-dau::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  right: -46px; top: -58px; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
/* Có hàng ô đếm ngay dưới thì chừa chỗ cho hàng ấy gối lên 26px. */
.dd-dau.dd-dau-co-o { margin-bottom: 0; padding-bottom: 40px; }
.dd-dau-tren { display: flex; align-items: center; gap: 10px; }
.dd-dau .back-btn {
  flex: none; width: 44px; height: 44px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .16); color: #fff;
}
.dd-dau h1 { font-size: 20px; font-weight: 800; color: #fff; }
.dd-dau-phu { margin-top: 1px; font-size: 13px; font-weight: 500; color: #e7e5ff; }
.dd-dau > .muted { margin-top: -4px !important; color: #e7e5ff; }
.dd-chon-nhom > span { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #e7e5ff; }
.dd-chon-nhom select {
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 14px; background: #fff; color: #0f172a; font-weight: 600;
}

.dd-ngay { display: flex; gap: 6px; padding: 4px; border-radius: 18px; background: rgba(255, 255, 255, .16); }
.dd-ngay-nut {
  position: relative; flex: none; min-height: 44px; padding: 4px 14px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; line-height: 1.25; text-align: center; color: #fff; cursor: pointer;
}
#att-hom-nay { flex: 1; min-width: 0; }
.dd-ngay-nut.dd-dang-chon { background: #fff; color: #3730a3; font-weight: 700; box-shadow: 0 6px 14px -8px rgba(15, 23, 42, .45); }
.dd-ngay-nut:focus-visible, .dd-ngay-nut:focus-within { outline: 2px solid #fff; outline-offset: 2px; }
/* Ô ngày của hệ điều hành phủ trong suốt lên cả nút "Ngày khác". Trên máy tính
   Chromium chỉ mở lịch khi bấm đúng biểu tượng lịch, nên biểu tượng ấy cũng
   được kéo ra phủ kín ô. */
.dd-ngay-nut input[type=date] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
}
.dd-ngay-nut input[type=date]::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer;
}

/* Hàng ô đếm. */
.dd-o-so {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin: 0 0 12px; padding: 10px;
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 18px 36px -16px rgba(49, 46, 129, .35), 0 2px 6px rgba(15, 23, 42, .05);
}
.dd-dau-co-o + .dd-o-so { margin-top: -26px; }
.dd-o-so.dd-o-so-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dd-o {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 4px; border-radius: 14px; text-align: center;
}
.dd-o b { font-size: 20px; font-weight: 800; line-height: 1.2; }
.dd-o span { font-size: 12px; font-weight: 600; line-height: 1.25; }

/* Khối "Cần văn phòng gọi xác nhận" của cô: một dòng, bấm mới mở. */
.dd-can-goi {
  margin: 0 0 12px;
  border: 1px solid var(--dd-vang-vien); border-radius: 18px; background: var(--dd-vang-nen);
}
.dd-can-goi > summary {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 12px; cursor: pointer; list-style: none;
}
.dd-can-goi > summary::-webkit-details-marker { display: none; }
.dd-can-goi-hinh {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f59e0b; color: #fff;
}
.dd-can-goi-chu { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dd-can-goi-chu b { font-size: 14px; font-weight: 700; color: var(--dd-vang-chu); }
.dd-can-goi-chu span { font-size: 13px; color: var(--text-2); }
.dd-can-goi-mui { flex: none; color: var(--dd-vang-chu); transform: rotate(90deg); transition: transform .16s; }
.dd-can-goi[open] .dd-can-goi-mui { transform: rotate(-90deg); }
.dd-can-goi-than { padding: 0 12px 12px; }

/* Thẻ của một bé. `#view` đứng đầu để thắng luật thu gọn `.list-row` của vai
   cô và quản trị ở phần trên của tệp. */
.dd-ds { margin: 0 0 12px; }
#view .dd-the {
  align-items: flex-start; gap: 0;
  margin-bottom: 8px; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .05);
}
.dd-the .att-ten {
  flex: 1; min-width: 0; min-height: 60px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "anh ten nhan" "anh duoi duoi";
  column-gap: 10px; row-gap: 2px; align-items: center; align-content: center;
  padding: 8px 4px 8px 10px; text-align: left; color: var(--text);
}
.dd-anh {
  grid-area: anh; align-self: start;
  display: inline-flex; padding: 2px; border: 2px solid #b6c0d4; border-radius: 50%;
}
.dd-anh.dd-anh-vuong { border-radius: 16px; }
.dd-anh img { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; }
.dd-vien-chua { border-style: dashed; }
.dd-vien-xam { border-color: #b6c0d4; }
.dd-vien-la { border-color: #10b981; }
.dd-vien-duong { border-color: #60a5fa; }
.dd-vien-cam { border-color: #fb923c; }
.dd-the .row-title { grid-area: ten; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.dd-duoi { grid-area: duoi; min-width: 0; }
.dd-duoi svg { display: inline-block; vertical-align: -2px; }
.dd-the .row-sub { margin-top: 0; font-size: 13px; color: var(--dd-phu); overflow-wrap: anywhere; }
.dd-ghi {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
  margin-top: 2px; font-size: 13px; color: var(--dd-phu);
}
.dd-chua { font-weight: 600; }
.dd-nhan, .dd-vao-lop {
  grid-area: nhan; align-self: start;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; line-height: 1.25;
}
.dd-nhan { min-height: 28px; max-width: 124px; padding: 4px 10px; border-radius: 14px; }
.dd-nhan.dd-du-kien { border: 1px dashed #38bdf8; background: #f0f9ff; }
.dd-vao-lop { min-height: 32px; padding: 0 12px; border-radius: 16px; background: #4f46e5; color: #fff; white-space: nowrap; }
.dd-viec-khac {
  flex: none; width: 44px; height: 44px; margin: 8px 2px 0 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--dd-phu); font-size: 1.4rem; line-height: 1;
}

.btn.dd-ca-nhom {
  min-height: 46px; border: 1px dashed #818cf8; border-radius: 16px;
  background: #eef2ff; color: #3730a3; white-space: normal;
}

/* Màn hẹp: nhãn xuống dưới tên bé, bốn ô đếm xếp hai hàng. */
@media (max-width: 359px) {
  .dd-the .att-ten { grid-template-areas: "anh ten ten" "anh nhan nhan" "anh duoi duoi"; }
  .dd-nhan, .dd-vao-lop { justify-self: start; max-width: none; margin: 2px 0; }
  .dd-o-so.dd-o-so-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* == hết Đ258-T == */
