/* ==========================================================================
   Cổng thông tin lớp — hệ thống thiết kế
   Kế thừa phong cách CASA: thẻ mềm, gradient nhẹ, hỗ trợ nền tối.
   ========================================================================== */
:root {
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-tint: #eef2ff;
  --accent: #ec4899;
  --good: #059669;
  --good-tint: #ecfdf5;
  --warn: #d97706;
  --warn-tint: #fffbeb;
  --bad: #dc2626;
  --bad-tint: #fef2f2;
  --info: #0284c7;
  --info-tint: #f0f9ff;

  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e6eaf2;
  --line-strong: #d5dce9;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 26px -10px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 28px 56px -18px rgba(15, 23, 42, .32);
  --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(.22, .8, .3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #141a2b;
    --surface-2: #1a2134;
    --line: #253049;
    --line-strong: #33415e;
    --text: #e8edf8;
    --text-2: #c3cce0;
    --muted: #8b9bb6;
    --primary: #8183f4;
    --primary-600: #6366f1;
    --primary-tint: #1e2447;
    --good: #34d399;
    --good-tint: #0f2a21;
    --warn: #fbbf24;
    --warn-tint: #2b2213;
    --bad: #f87171;
    --bad-tint: #2e1719;
    --info: #38bdf8;
    --info-tint: #0f2433;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 26px -10px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1000px 560px at 5% -10%, rgba(99, 102, 241, .14), transparent 62%),
    radial-gradient(800px 520px at 105% 0%, rgba(236, 72, 153, .10), transparent 60%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; font-size: max(16px, 1em); }
a { color: var(--primary); text-decoration: none; }
svg { display: block; flex: none; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }

/* ===== Khung ===== */
#app { min-height: 100dvh; }
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; }
#view { max-width: 860px; margin: 0 auto; padding: 0 14px calc(var(--nav-h) + 28px); animation: vao .3s var(--ease); }
@keyframes vao { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .7);
}
.t1 { font-weight: 750; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; position: relative;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: scale(.96); }
.dot-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg);
}

/* Thanh điều hướng dưới (điện thoại) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; position: relative;
}
.bottom-nav a.on { color: var(--primary); }
.bottom-nav a.on::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.bottom-nav .dot-badge { top: 4px; right: calc(50% - 22px); }

@media (min-width: 960px) {
  .bottom-nav { display: none; }
  #view { padding-bottom: 48px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; width: 248px; flex: none;
    position: sticky; top: 0; height: 100dvh; padding: 18px 14px; overflow-y: auto;
    border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent);
  }
  .sidebar .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
  .sidebar a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    color: var(--text-2); font-weight: 600; font-size: .95rem; position: relative;
  }
  .sidebar a:hover { background: var(--surface-2); }
  .sidebar a.on { background: var(--primary-tint); color: var(--primary); }
  .sidebar .dot-badge { position: static; margin-left: auto; border: none; }
  .sidebar .sep { height: 1px; background: var(--line); margin: 8px 6px; }
  .topbar .brand.mobile-only { display: none; }
}

/* ===== Tiêu đề trang ===== */
.page-head { display: flex; align-items: flex-end; gap: 12px; padding: 18px 2px 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Thẻ ===== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 16px;
}
.card + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.02rem; margin-bottom: 10px; }
.chip-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.chip-ico.good { background: var(--good-tint); color: var(--good); }
.chip-ico.bad { background: var(--bad-tint); color: var(--bad); }
.chip-ico.info { background: var(--info-tint); color: var(--info); }
.chip-ico.warn { background: var(--warn-tint); color: var(--warn); }
.chip-ico.pri { background: var(--primary-tint); color: var(--primary); }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
.section-head h2 { font-size: 1.05rem; font-weight: 750; }
.section-head .count { color: var(--muted); font-weight: 600; font-size: .9rem; }
.section-head .more { margin-left: auto; font-size: .88rem; font-weight: 600; }

/* ===== Nút ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 650; font-size: .94rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); white-space: nowrap;
  transition: transform .12s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-600)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(79, 70, 229, .8); }
.btn.good { background: var(--good); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .86rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px); z-index: 25;
  height: 54px; padding: 0 20px 0 16px; border-radius: 18px; display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 700;
  box-shadow: 0 16px 30px -12px rgba(79, 70, 229, .8);
}
@media (min-width: 960px) { .fab { bottom: 28px; right: 32px; } }

/* ===== Nhãn ===== */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.pri { background: var(--primary-tint); color: var(--primary); border-color: transparent; }
.pill.good { background: var(--good-tint); color: var(--good); border-color: transparent; }
.pill.bad { background: var(--bad-tint); color: var(--bad); border-color: transparent; }
.pill.warn { background: var(--warn-tint); color: var(--warn); border-color: transparent; }
.pill.info { background: var(--info-tint); color: var(--info); border-color: transparent; }

/* ===== Điều hướng ngày ===== */
.day-nav {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; box-shadow: var(--shadow-sm);
}
.day-nav .d { flex: 1; text-align: center; min-width: 0; }
.day-nav .d .big { font-weight: 800; font-size: 1.12rem; }
.day-nav .d .lab { font-size: .8rem; color: var(--muted); }
.day-nav input[type=date] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ===== Hero / lời chào ===== */
.hero {
  margin-top: 14px; padding: 18px; border-radius: var(--r-lg); color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%);
  box-shadow: 0 18px 40px -20px rgba(79, 70, 229, .9);
}
.hero h2 { font-size: 1.25rem; font-weight: 800; }
.hero p { opacity: .9; font-size: .92rem; }
.hero .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero .stat { background: rgba(255, 255, 255, .16); border-radius: 14px; padding: 10px; text-align: center; }
.hero .stat b { display: block; font-size: 1.4rem; line-height: 1.1; }
.hero .stat span { font-size: .75rem; opacity: .9; }
.hero a { color: #fff; }

/* ===== Ghi nhận (tuyên dương / phê bình) ===== */
.entry { padding: 12px 0; border-top: 1px dashed var(--line); }
.entry:first-child { border-top: none; padding-top: 2px; }
.entry .names { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.name-chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-weight: 650; font-size: .88rem;
  background: var(--surface-2); border: 1px solid var(--line);
}
.good-list .name-chip { background: var(--good-tint); color: var(--good); border-color: transparent; }
.bad-list .name-chip { background: var(--bad-tint); color: var(--bad); border-color: transparent; }
.name-chip.me { outline: 2px solid currentColor; outline-offset: 1px; }
.entry .reason { font-weight: 650; }
.entry .ctx { color: var(--muted); font-size: .86rem; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.entry .tools { display: flex; gap: 4px; margin-top: 6px; }

/* ===== Thông báo ===== */
.notice { position: relative; }
.notice + .notice { margin-top: 12px; }
.notice.unread::after {
  content: ""; position: absolute; top: 18px; right: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
}
.notice h3 { font-size: 1.04rem; font-weight: 750; padding-right: 18px; }
.notice .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; color: var(--muted); font-size: .84rem; }
.notice .body { margin-top: 10px; color: var(--text-2); }
.notice.important { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.facts { display: grid; gap: 8px; margin-top: 12px; }
.fact { display: grid; grid-template-columns: 22px 92px 1fr; gap: 8px; align-items: start; font-size: .93rem; }
.fact svg { color: var(--primary); margin-top: 2px; }
.fact .k { color: var(--muted); font-weight: 600; }
@media (max-width: 420px) { .fact { grid-template-columns: 22px 1fr; } .fact .k { grid-column: 2; } .fact .v { grid-column: 2; } }

/* ===== Bài tập ===== */
.hw { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.hw:first-child { border-top: none; padding-top: 0; }
.hw .check {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center;
  color: transparent; margin-top: 1px;
}
.hw .check.on { background: var(--good); border-color: var(--good); color: #fff; }
.hw .content { flex: 1; min-width: 0; }
.hw .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.hw.done .text { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.hw .foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 5px; font-size: .84rem; color: var(--muted); }

/* ===== Lịch thi ===== */
.exam { display: flex; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.exam:first-child { border-top: none; padding-top: 0; }
.date-box {
  width: 58px; flex: none; border-radius: 14px; overflow: hidden; text-align: center; border: 1px solid var(--line);
  background: var(--surface);
}
.date-box .m { background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 0; text-transform: uppercase; }
.date-box .d { font-size: 1.4rem; font-weight: 800; line-height: 1.25; }
.date-box .w { font-size: .7rem; color: var(--muted); padding-bottom: 3px; }
.exam.past .date-box .m { background: var(--muted); }
.exam .content { flex: 1; min-width: 0; }
.exam h3 { font-size: 1rem; font-weight: 750; }

/* ===== Kết quả học tập ===== */
.score-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.score-table th, .score-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.score-table th { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; background: var(--surface-2); position: sticky; top: 0; }
.score-table td:first-child, .score-table th:first-child { text-align: left; }
.score-table tr:last-child td { border-bottom: none; }
.score-table .tb { font-weight: 800; color: var(--primary); }
.score-table .tx { color: var(--text-2); letter-spacing: .02em; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.score-cards { display: none; }
@media (max-width: 600px) {
  .score-table.responsive { display: none; }
  .score-cards { display: block; }
}
.subject-card { padding: 12px 14px; border-top: 1px solid var(--line); }
.subject-card:first-child { border-top: none; }
.subject-card .hd { display: flex; align-items: center; gap: 8px; }
.subject-card .hd b { flex: 1; }
.subject-card .tbv { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.subject-card .mini { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.subject-card .mini div { background: var(--surface-2); border-radius: 10px; padding: 5px 8px; }
.subject-card .mini span { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.subject-card .mini b { font-weight: 650; font-size: .92rem; }

.grid-input { width: 100%; min-width: 0; text-align: center; padding: 7px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.grid-input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.grid-input.err { border-color: var(--bad); background: var(--bad-tint); }
.entry-grid th, .entry-grid td { padding: 5px 4px; }
.entry-grid td.nm { text-align: left; white-space: nowrap; font-weight: 600; padding-right: 10px; }
.entry-grid input { width: 56px; }

/* ===== Phân đoạn / tab ===== */
.seg {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); max-width: 100%; overflow-x: auto;
}
.seg button { padding: 7px 14px; border-radius: 10px; font-weight: 650; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--primary); color: #fff; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select, .toolbar input { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }

/* ===== Danh sách ===== */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: inherit; }
.list-item:first-child { border-top: none; }
.list-item:hover { background: var(--surface-2); }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  font-weight: 750; font-size: .9rem; color: var(--primary); background: var(--primary-tint);
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 650; }
.list-item .s { color: var(--muted); font-size: .84rem; }

.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty svg { margin: 0 auto 8px; opacity: .55; }
.loading { text-align: center; padding: 48px 0; color: var(--muted); }
.loading::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary); animation: quay .8s linear infinite;
}
@keyframes quay { to { transform: rotate(360deg); } }
.notice-bar {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-tint); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); margin-top: 12px;
}
.notice-bar svg { color: var(--warn); }
.pending-tag { color: var(--warn); }

/* ===== Biểu mẫu ===== */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 650; font-size: .88rem; margin-bottom: 6px; color: var(--text-2); }
.field > span em { font-style: normal; color: var(--bad); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); border-color: transparent; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.check-line { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-weight: 600; }
.check-line input { width: 20px; height: 20px; accent-color: var(--primary); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.quick button { padding: 4px 11px; border-radius: 99px; font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.quick button:hover { border-color: var(--primary); color: var(--primary); }

/* Chọn học sinh */
.picker-search { margin-bottom: 8px; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; max-height: 230px; overflow-y: auto; padding: 2px; }
.picker button {
  padding: 6px 12px; border-radius: 99px; font-size: .9rem; font-weight: 600; border: 1.5px solid var(--line-strong); background: var(--surface);
}
.picker button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.picker-count { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* ===== Hộp thoại ===== */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: mo .2s;
}
@keyframes mo { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 620px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  animation: len .28s var(--ease);
}
@keyframes len { from { transform: translateY(40px); opacity: .5; } }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; }
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; font-size: 1.08rem; font-weight: 750; }
.sheet-body { padding: 16px 18px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.sheet-foot .btn { min-width: 110px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translateX(-50%); z-index: 200;
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: .92rem;
  box-shadow: var(--shadow-lg); animation: len .25s var(--ease); max-width: calc(100vw - 32px);
}
.toast.err { background: var(--bad); }

/* ===== Đăng nhập ===== */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .logo-big {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 16px 30px -12px rgba(79, 70, 229, .8);
}
.login-card h1 { text-align: center; font-size: 1.4rem; }
.login-card .sub { text-align: center; color: var(--muted); margin: 4px 0 20px; }
.err-text { color: var(--bad); font-size: .9rem; margin-bottom: 10px; font-weight: 600; }

/* Bảng tài khoản in ra */
.cred-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cred-table td, .cred-table th { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.cred-table code { font-size: .95rem; font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.stat-box b { font-size: 1.5rem; display: block; line-height: 1.2; }
.stat-box span { color: var(--muted); font-size: .84rem; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.menu-tile {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 650; box-shadow: var(--shadow-sm);
}

@media print {
  .topbar, .bottom-nav, .sidebar, .fab, .no-print { display: none !important; }
  body { background: #fff; }
  .overlay { position: static; background: none; }
  .sheet { box-shadow: none; max-height: none; }
}

/* Biểu tượng nằm cùng dòng chữ */
.meta a, .foot a, .ctx > span, .pill, .card-title a { display: inline-flex; align-items: center; gap: 4px; }
p svg, .hint svg { display: inline-block; vertical-align: -2px; }

/* Thông báo đẩy: dải mời bật + hướng dẫn iPhone */
.tb-moi { margin: 0 0 12px; background: var(--primary-tint); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.tb-moi > svg { color: var(--primary); flex: none; }
.tb-moi .icon-btn { width: 32px; height: 32px; flex: none; }
.tb-buoc { display: grid; grid-template-columns: 28px 120px 1fr; gap: 10px; align-items: center; font-size: .92rem; }
.tb-so { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 750; }
.tb-hinh { color: var(--text-2); }
@media (max-width: 420px) { .tb-buoc { grid-template-columns: 28px 1fr; } .tb-hinh { grid-column: 2; } .tb-buoc > div:last-child { grid-column: 2; } }
