/* Thi đua THPT chuyên Hạ Long — giao diện ưu tiên điện thoại, màu theo logo trường:
   xanh dương #0000FE (bút), xanh lơ #00CCFF (nền biển), cam #FF6600, vàng #FFDD20. */
:root {
  --blue: #1020e8; --blue-d: #0a16b0; --blue-50: #edf0ff; --blue-100: #dbe1ff;
  --cyan: #00ccff; --cyan-50: #e6f9ff; --cyan-d: #007fa8;
  --orange: #ff6600; --orange-d: #c24e00; --orange-50: #fff0e6;
  --yellow: #ffdd20;
  --bg: #f2f6ff; --paper: #ffffff; --text: #0b1240; --mute: #566094; --line: #e1e7f8; --line-2: #eef2fc;
  --ok: #0b8f5b; --ok-soft: #e1f6ec; --warn: #b94700; --warn-soft: #fff0e3; --rose: #c8203a; --rose-soft: #ffe8ec;
  --wait: #1020e8; --wait-soft: #e8ebff;
  --link: #1020e8; --on-blue: #ffffff;
  --ink: #0a1052; --ink-2: #131c7a;
  --shadow: 0 1px 2px rgba(11, 18, 64, .06), 0 10px 28px -14px rgba(16, 32, 232, .28);
  --shadow-s: 0 1px 2px rgba(11, 18, 64, .06);
  --ring: rgba(16, 32, 232, .3);
  --r: 20px; --r-s: 14px;
  --rail: 272px; --bar: 60px; --tab: 64px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #7a8dff; --blue-d: #a7b4ff; --blue-50: #151d55; --blue-100: #1f2a73;
    --cyan-50: #08333f; --cyan-d: #5fdcff; --orange-50: #3a1d0a; --orange-d: #ff9a5c;
    --bg: #070b21; --paper: #0f1538; --text: #eaf0ff; --mute: #9ba7d9; --line: #1f2860; --line-2: #171f52;
    --ok: #4fd9a1; --ok-soft: #0c2e22; --warn: #ffa366; --warn-soft: #3a1d0a; --rose: #ff7a8e; --rose-soft: #3a111b;
    --wait: #9fb0ff; --wait-soft: #1a2362; --link: #9fb0ff;
    --ink: #060a2c; --ink-2: #111a63;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 30px -14px rgba(0, 0, 0, .7);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
    --ring: rgba(122, 141, 255, .45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; overscroll-behavior-y: none;
}
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; line-height: 1.3; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
a { color: var(--link); text-underline-offset: 3px; }
code { font: .86em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--line-2); padding: .12em .45em; border-radius: 7px; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--blue); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 8px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--mute); }
.small { font-size: .8125rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.end { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.dim { opacity: .55; }
.grow { flex: 1 1 12rem; min-width: 0; }
.pad { padding: 4px 20px 16px; }
.wide { width: 100%; }

/* ===== Khung ứng dụng ===== */
.appbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + var(--sat)) 14px 8px; min-height: calc(var(--bar) + var(--sat));
  background: linear-gradient(120deg, #0a16b8 0%, #1020e8 55%, #1a78ff 100%); color: #fff;
  box-shadow: 0 6px 20px -10px rgba(16, 32, 232, .7);
}
.appbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, var(--orange) 0 33%, var(--yellow) 33% 55%, var(--cyan) 55% 100%); }
.appbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.appbar-brand img { border-radius: 10px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.appbar-brand b { display: block; font-size: 1.05rem; line-height: 1.1; }
.appbar-brand small { display: block; font-size: .72rem; opacity: .85; line-height: 1.2; }
.bell { position: relative; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .14); text-decoration: none; }
.bell:active { background: rgba(255, 255, 255, .26); }
.badge {
  position: absolute; top: -2px; right: -2px; background: var(--orange); color: #fff; font-style: normal; font-size: .68rem; font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper); line-height: 1;
}
.bell .badge { box-shadow: 0 0 0 2px #1020e8; }

.main { padding: 22px 16px calc(var(--tab) + var(--sab) + 28px); max-width: 1180px; margin: 0 auto; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rail { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--sab));
}
.tabbar a, .tabbar label {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; color: var(--mute);
  font-size: .7rem; font-weight: 600; text-decoration: none; cursor: pointer; min-width: 0; transition: color .15s;
}
.tabbar span:not(.tab-ic) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-ic { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s, color .2s; }
.tabbar a.on { color: var(--blue); }
.tabbar a.on .tab-ic { background: var(--blue-100); color: var(--blue); }
.tabbar a:active .tab-ic, .tabbar label:active .tab-ic { background: var(--blue-50); }
.tab-ic .badge { top: -4px; right: 4px; }

.sheet-toggle { position: absolute; opacity: 0; pointer-events: none; }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(6, 10, 44, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--paper); border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + var(--sab));
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -20px 50px -20px rgba(6, 10, 44, .5); max-height: 86vh; overflow: auto;
}
.sheet-toggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }
.sheet-toggle:checked ~ .sheet { transform: none; }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid a, .sheet-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 18px; background: var(--blue-50); color: var(--text);
  text-decoration: none; font-size: .78rem; font-weight: 600; text-align: center; border: 0; font-family: inherit; cursor: pointer;
}
.sheet-grid a.on { background: var(--blue-100); color: var(--blue); }
.sheet-grid .tab-ic { background: var(--paper); color: var(--blue); width: 46px; height: 46px; border-radius: 15px; }
.sheet-btn[hidden] { display: none; }
.sheet-out { margin-top: 16px; }
.sheet-out .btn { gap: 8px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--yellow)); color: #3b1a00; display: grid; place-items: center; font-weight: 800; flex: none; }
.who { min-width: 0; flex: 1; line-height: 1.25; }
.who b { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; font-size: .75rem; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.offline-bar { position: sticky; top: calc(var(--bar) + var(--sat)); z-index: 39; display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--yellow); color: #3b2f00; font-size: .85rem; font-weight: 600; }
.offline-bar[hidden] { display: none; }
.offline-bar .ic { width: 18px; height: 18px; }

/* Màn hình rộng: thanh bên thay cho thanh tab */
@media (min-width: 900px) {
  .appbar, .tabbar, .scrim, .sheet { display: none; }
  .offline-bar { top: 0; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: var(--rail); display: flex; flex-direction: column; z-index: 30; overflow: auto;
    background: linear-gradient(180deg, #0a1052 0%, #0d1788 70%, #1020e8 100%); color: #d6dcff;
  }
  .rail::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, var(--orange) 0 33%, var(--yellow) 33% 55%, var(--cyan) 55% 100%); }
  .brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 18px; color: #fff; text-decoration: none; }
  .brand img { border-radius: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .3); }
  .brand b { display: block; font-size: 1.15rem; line-height: 1.1; }
  .brand small { display: block; font-size: .76rem; color: #a9b4f5; margin-top: 2px; }
  .menu { display: flex; flex-direction: column; gap: 3px; padding: 8px 14px; }
  .menu a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px; color: #cbd3ff; text-decoration: none; font-weight: 550; position: relative; transition: background .15s, color .15s; }
  .menu a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
  .menu a.on { background: #fff; color: var(--blue-d, #0a16b0); }
  .menu .badge { position: static; margin-left: auto; box-shadow: none; }
  .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 16px 22px; border-top: 1px solid rgba(255, 255, 255, .12); }
  .me .who b { color: #fff; } .me .who small { color: #a9b4f5; }
  .me form { margin: 0; }
  .iconbtn { background: transparent; border: 0; color: #b9c3ff; padding: 9px; border-radius: 11px; cursor: pointer; display: grid; place-items: center; }
  .iconbtn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
  .main { margin: 0 0 0 var(--rail); padding: 36px clamp(24px, 4vw, 56px) 72px; max-width: none; }
  .main > * { max-width: 1180px; }
  h1 { font-size: 1.85rem; }
}

/* ===== Đầu trang, thanh công cụ ===== */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.sub { color: var(--mute); margin-top: 6px; max-width: 70ch; font-size: .95rem; }
.pact { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.pick { margin: 0; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--mute); font-weight: 600; font-size: .875rem; white-space: nowrap; }
.seg a.on { background: var(--blue); color: #fff; }

.toast { padding: 13px 16px; border-radius: var(--r-s); margin-bottom: 14px; font-weight: 550; border: 1px solid transparent; animation: rise .25s ease both; }
.toast-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.toast-err { background: var(--rose-soft); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 25%, transparent); }
.toast-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

/* ===== Thẻ ===== */
.panel { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; border: 1px solid var(--line-2); }
.panel.flush { padding: 0; overflow: hidden; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel.flush .panel-h { padding: 16px 18px 0; margin-bottom: 8px; }
.panel-h.pad { padding: 16px 18px 6px; }
.panel-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.panel.narrow { max-width: 30rem; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.actions { align-items: center; }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
.cols > .panel, .cols > section { margin-bottom: 0; }
.grid4 { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) {
  .cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .cols-wide { grid-template-columns: 1.55fr 1fr; }
  .grid4 { grid-template-columns: repeat(4, 1fr); }
}
.subhead { margin: 18px 0 8px; color: var(--mute); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.empty { text-align: center; padding: 36px 20px; background: var(--paper); border: 2px dashed var(--line); border-radius: var(--r); color: var(--mute); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty.small { padding: 22px; border: 0; background: transparent; }
.empty .btn { margin-top: 14px; }
.link { font-weight: 600; text-decoration: none; }
.hint { color: var(--mute); font-size: .85rem; }
.formula { background: var(--blue-50); border-radius: var(--r-s); padding: 12px 14px; font-size: .9rem; color: var(--text); }
.note { background: var(--line-2); border-radius: var(--r-s); padding: 12px 14px; }
.reply { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.big { font-size: 1.5rem; font-weight: 800; }

/* ===== Nút, ô nhập ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--text); font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--blue-50); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 8px 18px -8px rgba(16, 32, 232, .75); }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { background: #4560ff; border-color: #4560ff; color: #fff; } .btn-primary:hover { background: #5b73ff; border-color: #5b73ff; } }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff; box-shadow: 0 8px 18px -8px rgba(255, 102, 0, .8); }
.btn-accent:hover { background: #e55a00; color: #fff; }
.btn-danger { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--rose); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .85rem; border-radius: 12px; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 8px 6px; color: var(--link); font: 600 .875rem var(--font); cursor: pointer; text-decoration: none; border-radius: 8px; }
.linkbtn:hover { background: var(--blue-50); }
.linkbtn.danger, .danger { color: var(--rose); }
.inline { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 0; }
.iconbtn { cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0; border: 0; min-width: 0; }
.field > span, .field > legend { font-size: .85rem; font-weight: 600; color: var(--mute); padding: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); color: var(--text); font: 1rem var(--font);
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
select { 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='%23566094' 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 14px center; padding-right: 38px; }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { width: 100%; padding: 10px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--paper); color: var(--text); font: .9rem var(--font); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--ring); }
.cinput { width: 5.5rem; min-height: 42px; text-align: right; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.secret { display: block; margin: 8px 0; padding: 10px 12px; font-size: 1rem; word-break: break-all; user-select: all; }
.pick select { min-width: 12rem; }

.radios, .checks { display: flex; gap: 10px; flex-wrap: wrap; }
.radio, .check { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 48px; }
.radio { padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); font-weight: 600; flex: 1 1 10rem; }
.radio input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blue-50); color: var(--blue); box-shadow: 0 0 0 3px var(--ring); }
.radio:has(input:focus-visible) { outline: 3px solid var(--ring); }
.radio-dat:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.radio-khong_dat:has(input:checked) { border-color: var(--rose); background: var(--rose-soft); color: var(--rose); box-shadow: none; }
.radio-tra_lai:has(input:checked) { border-color: var(--orange); background: var(--orange-50); color: var(--orange-d); box-shadow: none; }
.check { padding: 6px 14px 6px 10px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line); flex: 1 1 14rem; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.check small { display: block; color: var(--mute); font-size: .75rem; }
.check:has(input:checked) { border-color: var(--blue); background: var(--blue-50); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--blue); }

/* ===== Nhãn trạng thái ===== */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-wait { background: var(--wait-soft); color: var(--wait); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-idle { background: var(--line-2); color: var(--mute); }

/* ===== Bảng (máy tính) → thẻ (điện thoại) ===== */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--blue-50) 60%, transparent); }
.tbl a { font-weight: 550; text-decoration: none; }
.tbl a:hover { text-decoration: underline; }
.tbl .wide { min-width: 16rem; }
@media (max-width: 760px) {
  .tablewrap { overflow: visible; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .panel.flush { background: transparent; box-shadow: none; border: 0; overflow: visible; }
  .panel.flush > .panel-h, .panel.flush > .pad { padding-left: 4px; padding-right: 4px; }
  .tbl tr { background: var(--paper); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-s); padding: 12px 14px; margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .tbl tbody tr:hover { background: var(--paper); }
  .tbl td { padding: 0; border: 0; text-align: left !important; }
  .tbl td::before { content: attr(data-label); display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 700; margin-bottom: 1px; }
  .tbl td:first-child { grid-column: 1 / -1; font-size: 1rem; font-weight: 600; }
  .tbl td:first-child::before, .tbl td[data-label=""]::before, .tbl td.end::before { display: none; }
  .tbl td.end { grid-column: 1 / -1; text-align: left !important; white-space: normal; padding-top: 6px; border-top: 1px dashed var(--line); }
  .tbl td[colspan] { grid-column: 1 / -1; }
  .tbl td:has(input.wide), .tbl td:has(.chip-warn) { grid-column: auto; }
  .tbl td .wide { min-width: 0; }
}

/* ===== Tổng quan ===== */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 22px 20px 20px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, #0a16b8 0%, #1020e8 45%, #1a8cff 100%); box-shadow: 0 22px 40px -22px rgba(16, 32, 232, .85);
  display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center;
}
.hero::before { content: ""; position: absolute; right: -50px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 204, 255, .6), transparent 70%); }
.hero::after { content: ""; position: absolute; left: -30px; bottom: -70px; width: 170px; height: 170px; border-radius: 40px; transform: rotate(24deg); background: linear-gradient(135deg, rgba(0, 204, 255, .5), rgba(255, 255, 255, .15)); filter: blur(.5px); opacity: .5; }
.hero > * { position: relative; z-index: 1; }
.hero-kicker { font-size: .82rem; opacity: .9; font-weight: 600; }
.hero-score { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 6px; }
.hero-score b { font-size: 3.2rem; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.hero-score span { opacity: .85; font-size: .95rem; }
.hero-note { font-size: .9rem; opacity: .95; grid-column: 1 / -1; background: rgba(255, 255, 255, .14); padding: 10px 14px; border-radius: 14px; backdrop-filter: blur(6px); }
.hero-note b { font-weight: 800; }
.ring { width: 112px; height: 112px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .trk { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 11; }
.ring .val { fill: none; stroke: url(#ringg); stroke: #ffdd20; stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.15rem; font-weight: 800; }
.hero-chip { display: inline-flex; margin-bottom: 8px; padding: 3px 11px; background: rgba(255, 255, 255, .2); border-radius: 999px; font-size: .75rem; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stats > div { background: var(--paper); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-s); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 1.7rem; line-height: 1.1; font-weight: 800; color: var(--blue); }
.stats span { font-size: .8rem; color: var(--mute); font-weight: 550; }
.stats .warn b { color: var(--orange); }
.stats > div:first-child { grid-column: 1 / -1; background: var(--cyan-50); border-color: transparent; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(5, 1fr); } .stats > div:first-child { grid-column: auto; } }

.months { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.months li { display: grid; grid-template-columns: 6.5rem 1fr 3.2rem; align-items: center; gap: 10px; font-size: .9rem; }
.months .bar { height: 10px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.months .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.months b { text-align: right; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: baseline; }
.kv dt { color: var(--mute); font-size: .9rem; }
.kv dd { font-weight: 650; text-align: right; }
.todo { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-bottom: 6px; }
.todo-i { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--blue-50); text-decoration: none; color: var(--text); }
.todo-i b { font-size: 1.8rem; line-height: 1; color: var(--blue); min-width: 2ch; }
.todo-i span { font-size: .85rem; font-weight: 550; line-height: 1.3; }
.todo-i:active { transform: scale(.98); }

/* Danh sách việc dạng thẻ (trang chủ) */
.tasklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tasklist a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--bg); text-decoration: none; color: var(--text); border: 1px solid var(--line-2); }
.tasklist a:active { background: var(--blue-50); }
.tasklist .tcode { flex: none; min-width: 2.7rem; height: 2.7rem; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: .82rem; background: var(--blue-100); color: var(--blue); }
.tasklist .tgrp-extra { background: var(--orange-50); color: var(--orange-d); }
.tasklist .tmain { flex: 1; min-width: 0; }
.tasklist .tmain b { display: block; font-size: .92rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tasklist .tmain small { color: var(--mute); font-size: .78rem; }

/* ===== Chi tiết nhiệm vụ ===== */
.evlist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.evlist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--line-2); font-size: .9rem; min-width: 0; }
.evlist a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.evlist small { color: var(--mute); }
.timeline { list-style: none; display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--paper); }
.timeline li span { display: block; color: var(--mute); font-size: .8rem; }
.timeline li p { margin-top: 4px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.review-box { border: 2px solid var(--blue-100); }
.pop { display: inline-block; position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.popbox { position: absolute; right: 0; z-index: 10; margin-top: 6px; width: min(19rem, 80vw); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; white-space: normal; }
@media (max-width: 760px) { .popbox { position: static; width: 100%; margin-top: 8px; } .pop { display: block; } }
.dept-row { align-items: center; }
.temp { border: 2px solid var(--orange); background: var(--orange-50); }

/* ===== Thông báo, cài ứng dụng ===== */
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; margin-bottom: 14px; background: linear-gradient(120deg, var(--cyan-50), var(--blue-50)); border: 1px solid var(--blue-100); }
.banner[hidden] { display: none; }
.banner .ic { width: 28px; height: 28px; color: var(--blue); }
.banner > div { flex: 1; min-width: 0; }
.banner b { display: block; }
.banner p { color: var(--mute); font-size: .85rem; line-height: 1.4; }
.banner .x { background: none; border: 0; color: var(--mute); padding: 6px; cursor: pointer; border-radius: 10px; }
.notif { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.notif a { display: flex; gap: 12px; padding: 14px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line-2); text-decoration: none; color: var(--text); box-shadow: var(--shadow-s); }
.notif .dot { flex: none; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: transparent; }
.notif .unread .dot { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-50); }
.notif .unread { border-color: var(--blue-100); background: color-mix(in srgb, var(--blue-50) 60%, var(--paper)); }
.notif b { display: block; font-size: .95rem; }
.notif p { color: var(--mute); font-size: .88rem; margin-top: 2px; }
.notif small { color: var(--mute); font-size: .75rem; }
.switch { display: flex; align-items: center; gap: 12px; }
.devices { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.devices li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--line-2); flex-wrap: wrap; }
.devices .grow { flex: 1 1 10rem; }
.devices small { color: var(--mute); display: block; }

/* ===== Đăng nhập ===== */
.bare-main { min-height: 100vh; min-height: 100dvh; }
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.login-hero {
  position: relative; overflow: hidden; padding: calc(40px + var(--sat)) 24px 70px; color: #fff; text-align: center;
  background: linear-gradient(160deg, #ff6600 0%, #ff6600 18%, #1020e8 18.2%, #1020e8 62%, #00ccff 100%);
}
.login-hero::before { content: ""; position: absolute; inset: auto -10% -60% -10%; height: 70%; background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .35), transparent 65%); }
.login-logo { position: relative; width: 112px; height: 112px; margin: 0 auto 14px; border-radius: 28px; box-shadow: 0 0 0 4px rgba(255, 255, 255, .45), 0 18px 34px -10px rgba(0, 0, 40, .6); background: #fff; display: block; }
.login-hero h2 { position: relative; font-size: 1.1rem; font-weight: 600; opacity: .95; max-width: 26ch; margin: 0 auto; }
.login-hero .school-name { position: relative; font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.login-form { flex: 1; margin-top: -34px; background: var(--paper); border-radius: 32px 32px 0 0; padding: 28px 22px calc(28px + var(--sab)); position: relative; box-shadow: 0 -10px 30px -14px rgba(0, 0, 60, .35); }
.login-form form { max-width: 26rem; margin: 0 auto; }
.login-form h1 { font-size: 1.5rem; }
.school { color: var(--orange-d); font-weight: 700; font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; }
.login-single .login-hero { padding-bottom: 60px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; width: 44px; height: 44px; color: var(--mute); cursor: pointer; border-radius: 12px; display: grid; place-items: center; }
@media (min-width: 900px) {
  .login { flex-direction: row; }
  .login-hero { flex: 1.1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 60px; background: linear-gradient(160deg, #ff6600 0%, #ff6600 14%, #1020e8 14.2%, #1020e8 64%, #00ccff 100%); }
  .login-hero h2 { font-size: 1.4rem; max-width: 24ch; }
  .login-logo { width: 190px; height: 190px; border-radius: 44px; }
  .login-form { flex: 1; margin: 0; border-radius: 0; display: grid; place-items: center; box-shadow: none; }
  .login-form form { width: 100%; }
}

/* Trang tối giản khi chưa đăng nhập: bỏ khung */
body.bare { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .appbar, .tabbar, .rail, .sheet, .scrim, .offline-bar, .btn, .banner { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}

[hidden] { display: none !important; }

/* ===== Bảng điều khiển nhiệm vụ ===== */
.dash { display: grid; gap: 12px; margin-bottom: 16px; }
.dash-main { display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #1020e8, #0a6cff 70%, #00ccff); box-shadow: var(--shadow-m, 0 10px 30px rgba(16, 32, 232, .25)); }
.dash-ring { flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(closest-side, #1230f0 78%, transparent 80%), conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .28) 0); }
.dash-ring b { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.dash-ring span { font-size: .68rem; opacity: .85; }
.dash-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.dash-txt b { font-size: 1.05rem; font-weight: 700; }
.dash-txt span { font-size: .84rem; opacity: .92; }
.dash-bar { display: flex; height: 8px; border-radius: 9px; background: rgba(255, 255, 255, .25); overflow: hidden; margin-top: 6px; }
.dash-bar i { display: block; height: 100%; }
.dash-bar .ok { background: #5ff0b0; } .dash-bar .wait { background: #ffd84d; }
.dash-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dash-tiles a { background: var(--paper); border: 1px solid var(--line-2); border-radius: 18px; padding: 12px 8px; text-align: center; text-decoration: none; color: var(--text); box-shadow: var(--shadow-s); display: flex; flex-direction: column; gap: 2px; }
.dash-tiles b { font-size: 1.5rem; font-weight: 800; color: var(--blue); line-height: 1.1; }
.dash-tiles span { font-size: .74rem; color: var(--mute); font-weight: 600; }
.dash-tiles a.hot b { color: var(--orange); }
.dash-tiles a.bad { background: var(--rose-soft); border-color: transparent; }
.dash-tiles a.bad b { color: var(--rose); }
.dl { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--line-2); color: var(--mute); white-space: nowrap; }
.dl-soon { background: var(--warn-soft); color: var(--warn); }
.dl-late { background: var(--rose-soft); color: var(--rose); }
.dl-done { background: transparent; padding-left: 0; font-weight: 600; }
.banner-warn { background: var(--warn-soft); border-color: transparent; }
.banner-warn .ic { color: var(--warn); }
@media (min-width: 900px) { .dash { grid-template-columns: 1.4fr 1fr; align-items: stretch; } .dash-tiles { grid-template-columns: repeat(2, 1fr); } }

/* ===== Nhập Excel ===== */
.import-sum { margin-bottom: 14px; }
@media (min-width: 900px) { .import-sum { grid-template-columns: repeat(4, 1fr) !important; } }
.import-sum a { pointer-events: none; }
.panel-h .check, .panel-f .check { border: 0; background: none; padding: 0; min-height: 0; box-shadow: none; }
.panel-f.stack { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; }
@media (min-width: 760px) { .tbl td:nth-child(4) { min-width: 120px; } }

/* ===== Báo cáo: bản xem và in kiểu văn bản hành chính ===== */
.paper { background: #fff; color: #000; font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.5; max-width: 820px; margin: 0 auto 24px; padding: 34px 28px 40px; border-radius: 12px; box-shadow: var(--shadow-s), 0 10px 30px rgba(11, 18, 64, .08); overflow-x: auto; }
@media (prefers-color-scheme: dark) { .paper { background: #fff; color: #000; } }
.paper hr { border: 0; border-top: 1px solid #000; margin: 4px auto 6px; width: 40%; }
.p-head { display: grid; grid-template-columns: 38% 62%; text-align: center; font-size: .86em; }
.p-head b { display: block; } .p-head .tn { font-size: 1.05em; }
.p-l > div:last-child, .p-r i { font-size: 1.05em; display: block; margin-top: 8px; }
.p-r hr { width: 55%; }
.p-title { text-align: center; font-size: 1.1em; margin: 20px 0 0; }
.p-sub { text-align: center; font-size: 1.1em; margin: 0; }
.paper .p-short { width: 22%; margin-bottom: 14px; }
.p-h { margin: 14px 0 6px; font-size: 1em; }
.p-subh { margin: 10px 0 4px 8px; font-size: 1em; font-style: italic; }
.paper p { text-align: justify; text-indent: 1.2em; margin: 0 0 4px; }
.paper .p-note { font-size: .93em; }
.p-tbl { width: 100%; border-collapse: collapse; font-size: .85em; margin: 6px 0 14px; line-height: 1.35; }
.p-tbl th, .p-tbl td { border: 1px solid #000; padding: 3px 6px; }
.p-tbl th { background: #e7e6e6; text-align: center; }
.p-tbl td.c { text-align: center; } .p-tbl td.l { text-align: left; }
.p-tbl tr.ft td { font-weight: 700; background: #f2f2f2; }
.p-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; break-inside: avoid; }
.p-sg { text-align: center; } .p-sg b { display: block; } .p-sg .gap { display: block; height: 70px; }
.p-rc small { font-size: .85em; line-height: 1.35; }
@media (max-width: 640px) { .paper { padding: 20px 14px; font-size: 13.5px; } .p-head { font-size: .8em; } }
@media print {
  .noprint, .toolbar, .page-head { display: none !important; }
  .paper { box-shadow: none; border-radius: 0; max-width: none; margin: 0; padding: 0; overflow: visible; font-size: 13pt; }
  .p-tbl { font-size: 11pt; } .p-tbl tr { break-inside: avoid; }
  @page { size: A4; margin: 2cm 1.5cm 2cm 3cm; }
}
.tbl td, code { overflow-wrap: anywhere; }

/* Chữ ký thiết kế cuối trang */
.credit { text-align: center; padding: 4px 16px calc(var(--tab) + var(--sab) + 22px); max-width: 1180px; margin: -14px auto 0; color: var(--mute); font-size: 12px; line-height: 1.6; }
.credit p { margin: 0; }
.credit b { color: var(--blue); font-weight: 700; letter-spacing: .01em; }
.credit-sub { font-size: 11px; opacity: .85; }
.credit-line { display: block; width: 44px; height: 3px; margin: 0 auto 10px; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--cyan), var(--orange)); }
@media (min-width: 900px) { .credit { margin: 0 0 0 var(--rail); max-width: none; padding: 0 24px 28px; } }
body.bare .credit { margin: 0; max-width: none; padding: 14px 16px calc(16px + var(--sab)); background: var(--paper); }
@media print { .credit { display: none; } }
.login-form .check { flex: none; }
body.bare .login { min-height: calc(100vh - 90px); min-height: calc(100dvh - 90px); }
