:root {
  --bg: #f4f6f9; --panel: #fff; --text: #1f2937; --muted: #6b7280; --line: #d9dee6;
  --primary: #1d4ed8; --primary-weak: #e8efff; --danger: #b91c1c; --danger-weak: #fde8e8;
  --ok: #15803d; --ok-weak: #e6f6ec; --warn: #92400e; --warn-weak: #fef3c7;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: #0f2a5c; color: #dbe4f6; padding: 16px 0; flex-shrink: 0; }
.side h1 { font-size: 16px; margin: 0 16px 16px; color: #fff; }
.side a { display: block; padding: 9px 16px; color: inherit; text-decoration: none; }
.side a.active, .side a:hover { background: rgba(255,255,255,.12); color: #fff; }
.side .foot { margin: 20px 16px 0; font-size: 12px; opacity: .8; }
main { flex: 1; padding: 20px 24px; min-width: 0; }
h2 { margin: 0 0 14px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { display: block; margin-top: 3px; width: 100%; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit; }
input[type=checkbox] { width: auto; display: inline; }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.danger { color: var(--danger); }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
table.list th { background: #f8fafc; font-weight: 600; }
table.list input, table.list select { width: 100%; }
table.list td.num input { width: 70px; }
.stat { font-size: 26px; font-weight: 700; }
.muted { color: var(--muted); }
.msg { padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.msg.err { background: var(--danger-weak); color: var(--danger); }
.msg.ok { background: var(--ok-weak); color: var(--ok); }
.msg.warn { background: var(--warn-weak); color: var(--warn); }
.conflicts li { color: var(--danger); margin: 2px 0; }

/* Lưới thời khóa biểu */
table.tkb { border-collapse: collapse; background: #fff; width: 100%; table-layout: fixed; }
table.tkb th, table.tkb td { border: 1px solid #aab3c2; padding: 4px; text-align: center; vertical-align: middle; }
table.tkb th { background: #eef2f8; font-weight: 600; }
table.tkb th.p { width: 52px; }
table.tkb td { height: 46px; font-size: 13px; }
table.tkb td .s { font-weight: 600; }
table.tkb td .t { font-size: 12px; color: #374151; }
table.tkb td.lesson { cursor: grab; position: relative; }
table.tkb td.bad { outline: 2px solid var(--danger); outline-offset: -2px; }
table.tkb td.drop-ok { background: #e6f6ec !important; }
table.tkb td.drop-bad { background: #fde8e8 !important; }
table.tkb td.busy { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 4px, #e5e7eb 4px, #e5e7eb 8px); }
table.tkb td .lock { position: absolute; top: 1px; right: 3px; font-size: 11px; cursor: pointer; opacity: .35; }
table.tkb td .lock.on { opacity: 1; }
table.school td { font-size: 12px; height: 34px; }
.sheet { margin-bottom: 22px; }
.sheet .title { text-align: center; margin-bottom: 8px; }
.sheet .title b { font-size: 16px; }
.scroll { overflow-x: auto; }

/* Lưới chọn giờ bận / tiết cố định */
table.slots { border-collapse: collapse; }
table.slots th, table.slots td { border: 1px solid var(--line); padding: 3px 6px; text-align: center; font-size: 12px; }
table.slots td { cursor: pointer; width: 46px; height: 24px; }
table.slots td.on { background: #fca5a5; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal { background: #fff; border-radius: 10px; padding: 18px; max-width: 760px; width: calc(100% - 32px); max-height: 90vh; overflow: auto; }
.login { max-width: 340px; margin: 12vh auto; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: 100%; padding: 8px 0; }
  .side nav { display: flex; overflow-x: auto; }
  .side a { white-space: nowrap; }
  .side .foot { display: none; }
  main { padding: 14px 16px; }
}
@media print {
  .side, .no-print { display: none !important; }
  main { padding: 0; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
  .sheet { page-break-after: always; }
  table.tkb td .lock { display: none; }
}

/* v2.0 */
.side h1 small { font-size: 11px; font-weight: 400; opacity: .7; }
table.tkb th.sess { background: #f8fafc; font-weight: 500; font-size: 12px; color: var(--muted); }
table.tkb td.avoid { background: repeating-linear-gradient(45deg, #fff7ed, #fff7ed 4px, #ffedd5 4px, #ffedd5 8px); }
table.tkb td.focus { outline: 3px solid var(--primary); outline-offset: -3px; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pane { margin: 0; padding: 10px; min-width: 0; }
.pane table.tkb td { height: 36px; font-size: 11px; padding: 2px; }
.pane table.tkb td .t { font-size: 10px; }
.pane .title { font-size: 12px; }
.pane .title b { font-size: 13px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 14px; background: var(--danger-weak); color: var(--danger); border: 1px solid #f5b5b5; cursor: grab; font-size: 13px; }
ol.moves li { margin: 3px 0; }
@media (max-width: 1000px) { .panes { grid-template-columns: 1fr; } }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #fff4d6; color: #8a5a00; border: 1px solid #f3d27a; }

/* v4.0: thanh menu, thanh công cụ, màn hình soạn thảo */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 8; background: #fff; border-bottom: 1px solid var(--line); }
.menubar { display: flex; align-items: center; gap: 2px; padding: 0 8px; background: #0f2a5c; color: #fff; min-height: 34px; flex-wrap: wrap; }
.menubar .brand { margin-right: 10px; font-size: 14px; white-space: nowrap; }
.menubar .brand small { font-weight: 400; opacity: .7; font-size: 11px; }
.menubar .school { margin-left: auto; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.menu { position: relative; }
.menu .mbtn { background: none; border: 0; color: #fff; padding: 7px 10px; border-radius: 4px; }
.menu .mbtn:hover, .menu.open .mbtn { background: rgba(255,255,255,.16); }
.menu .drop { display: none; position: absolute; left: 0; top: 100%; background: #fff; color: var(--text); min-width: 290px; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px 0; z-index: 20; }
.menu.open .drop { display: block; }
.menu .drop a { display: flex; justify-content: space-between; gap: 16px; padding: 7px 14px; color: inherit; text-decoration: none; cursor: pointer; }
.menu .drop a:hover { background: var(--primary-weak); }
.msep { border-top: 1px solid var(--line); margin: 4px 0; }
kbd { font: 11px ui-monospace, monospace; background: #f1f5f9; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 5px 8px; flex-wrap: wrap; background: #f8fafc; }
.toolbar button { padding: 4px 9px; font-size: 13px; }
.toolbar .tsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.toolbar input { margin-left: auto; min-width: 260px; padding: 4px 8px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #14532d; color: #fff; padding: 9px 16px; border-radius: 6px; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }
.app main { padding: 16px 20px; }
body.wide .app main { padding: 8px; }
.ed { display: grid; grid-template-columns: 210px minmax(0, 1fr) 270px; gap: 8px; align-items: start; }
.ed-left, .ed-right { background: #fff; border: 1px solid var(--line); border-radius: 6px; position: sticky; top: 84px; max-height: calc(100vh - 96px); overflow: auto; }
.ed-left .tabs { display: flex; border-bottom: 1px solid var(--line); }
.ed-left .tabs button { flex: 1; border: 0; border-radius: 0; padding: 7px 4px; background: #f8fafc; font-size: 13px; }
.ed-left .tabs button.on { background: #fff; font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
.ed-left > input { width: calc(100% - 12px); margin: 6px; }
.olist a { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 10px; cursor: pointer; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.olist a:hover { background: #f1f5f9; }
.olist a.on { background: var(--primary-weak); border-left-color: var(--primary); }
.olist .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 5px; vertical-align: middle; }
.warn { color: #b45309; font-weight: 600; }
.ed-center { min-width: 0; }
.ed-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; }
.ed-head > b { font-size: 15px; }
.ed-head .cnt { font-size: 13px; padding: 2px 8px; border-radius: 10px; background: #f1f5f9; }
.ed-head .cnt.ok { background: var(--ok-weak); color: var(--ok); }
.ed-head .cnt.bad { background: var(--danger-weak); color: var(--danger); }
label.inline { display: flex; align-items: center; gap: 6px; margin-left: auto; }
label.inline select { padding: 3px 6px; }
.ed .tray { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-grid { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.ed-grid .sheet { margin-bottom: 0; }
.ed-grid .title { display: none; }
.ed-bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.bpane { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; min-width: 0; }
.bpane .bhead { font-weight: 600; font-size: 12px; padding: 2px 4px 4px; display: flex; gap: 6px; }
.bpane .bhead a { text-decoration: none; }
.bpane .title { font-size: 11px; margin-bottom: 2px; }
.bpane .title b { font-size: 12px; }
.bpane .title > div:first-child { display: none; }
.bpane table.tkb td { height: 28px; font-size: 10px; padding: 1px; }
.bpane table.tkb td .t { font-size: 9px; }
.bpane table.tkb th { font-size: 10px; padding: 2px; }
.bpane table.tkb th.p { width: 22px; }
.bpane .sheet { margin: 0; }
.ed-right details { border-bottom: 1px solid var(--line); padding: 6px 10px; }
.ed-right summary { font-weight: 600; cursor: pointer; padding: 2px 0; }
.ed-right textarea { width: 100%; margin: 6px 0; resize: vertical; }
table.kv { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; width: 82px; vertical-align: top; padding: 2px 4px 2px 0; }
table.kv td { padding: 2px 0; }
table.kv.mini td { border-bottom: 1px solid #eef1f5; padding: 3px 0; }
table.kv.mini td:last-child { text-align: right; }
table.tkb td.off { color: #9ca3af; font-style: italic; background: #fafafa; }
table.tkb td.busy { color: #6b7280; font-size: 11px; }
table.tkb td.locked .s { color: #1d4ed8; }
table.tkb td.multi .sep { border-top: 1px dashed #94a3b8; margin: 2px 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.checks label { color: var(--text); }
@media (max-width: 1250px) { .ed { grid-template-columns: 190px minmax(0, 1fr); } .ed-right { grid-column: 1 / -1; position: static; max-height: none; } }
@media (max-width: 900px) {
  .ed { grid-template-columns: 1fr; } .ed-left { position: static; max-height: 260px; }
  .ed-bottom { grid-template-columns: 1fr; }
  .menubar { flex-wrap: nowrap; overflow-x: auto; } .menubar .school { display: none; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; } .toolbar input { min-width: 180px; }
  .app main { padding: 12px 16px; }
}
@media print { .top, .ed-left, .ed-right, .ed-bottom, .ed-head { display: none !important; } .ed { display: block; } .ed-grid { border: 0; } .ed-grid .title { display: block; } }
label.inline { white-space: nowrap; }
.bpane table.tkb td .lock:not(.on) { display: none; }
.modal .form { display: grid; gap: 8px; }
.modal .hint { font-size: 12px; margin-top: -4px; }
label.chk { color: var(--text); }
.ed-left > select { width: calc(100% - 12px); margin: 0 6px 6px; }
.ctx { position: fixed; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px 0; min-width: 240px; max-width: 420px; }
.ctx a { display: block; padding: 6px 14px; cursor: pointer; }
.ctx a:hover { background: var(--primary-weak); }
.ctx a { color: var(--text); text-decoration: none; }
/* màu như phần mềm TKB quen thuộc: ô trùng nền đỏ, tiết cố định chữ xanh đậm */
table.tkb td.bad { background: #ef4444 !important; color: #fff; }
table.tkb td.bad .t { color: #fff; }
table.tkb td.fixed .s { color: #1d4ed8; font-weight: 800; }
.bpane .bhead .pin { margin-left: auto; display: flex; align-items: center; gap: 2px; font-size: 12px; cursor: pointer; }
.bpane .bsel { display: flex; gap: 4px; margin: 0 2px 4px; }
.bpane .bsel select { flex: 1; min-width: 0; padding: 2px 4px; font-size: 12px; }
table.tkb.stat td { height: 30px; font-size: 14px; }

/* v5.0: Khung giờ học, Lịch năm học, QR */
.small { font-size: 12px; }
.tsep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.tl { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.tl-l { width: 44px; font-size: 12px; color: var(--muted); }
.tl-r { width: 92px; font-size: 12px; color: var(--muted); text-align: right; }
.tl-bar { position: relative; flex: 1; height: 24px; background: #f1f4f9; border-radius: 5px; }
.tl-p { position: absolute; top: 2px; bottom: 2px; background: var(--primary); color: #fff; border-radius: 4px; font-size: 11px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tl-p.act { background: #f59e0b; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 16px; align-items: start; }
.cal-wrap > .card { margin-bottom: 0; }
@media (max-width: 1000px) { .cal-wrap { grid-template-columns: 1fr; } }
.cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.cal-h { text-align: center; font-weight: 600; color: var(--muted); font-size: 12px; padding: 2px 0; }
.cal-d { min-height: 78px; padding: 4px; text-align: left; display: flex; flex-direction: column; gap: 2px; align-items: stretch; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.cal-d:hover { border-color: var(--primary); }
.cal-d .n { font-weight: 600; font-size: 13px; }
.cal-d.empty { border: 0; background: transparent; }
.cal-d.sun .n { color: var(--danger); }
.cal-d.out { background: #f6f7f9; color: #9aa3af; }
.cal-d.off { background: #fff4f4; }
.cal-d.today { outline: 2px solid var(--primary); outline-offset: -1px; }
.ev { display: block; font-size: 11px; line-height: 1.3; padding: 1px 4px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #eef2f8; }
.ev-nghi { background: #fde8e8; color: #991b1b; }
.ev-hoc_theo_thu { background: #e0f2fe; color: #075985; }
.ev-khung_gio { background: #fef3c7; color: #92400e; }
.ev-truc_tuyen { background: #ede9fe; color: #5b21b6; }
.ev-thi { background: #e6f6ec; color: #166534; }
.ev-doi_phong, .ev-phong_dong { background: #f3f4f6; color: #374151; }
.ev-su_kien { background: #fce7f3; color: #9d174d; }
.more { font-size: 11px; color: var(--muted); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.qr { border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qr img { width: 110px; height: 110px; }
.slotgrid th.sess { background: #eef2f8; text-align: left; }
table.slotgrid { border-collapse: collapse; } table.slotgrid th, table.slotgrid td { border: 1px solid var(--line); padding: 3px 8px; }
label > input[type=radio], label > input[type=checkbox] { display: inline; width: auto; margin: 0 4px 0 0; }
label:has(> input[type=radio]), label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; color: var(--text); }
.grid2 > label:has(> input[type=checkbox]) { display: flex; }
table.lostm th, table.lostm td { text-align: center; white-space: nowrap; font-size: 12px; }
table.lostm th:first-child, table.lostm td:first-child { text-align: left; }
table.lostm td.z { color: #c3c9d3; }
table.lostm td.hi { background: #fde8e8; color: #991b1b; font-weight: 700; }
details.card > summary { cursor: pointer; }
.sheet .title { position: relative; }
.sheet .title .org { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.sheet .title .plogo { position: absolute; left: 0; top: 0; height: 48px; max-width: 90px; object-fit: contain; }
.pane .title .plogo, .bpane .title .plogo, .bpane .title .org { display: none; }
.sheet .pfoot { text-align: right; margin-top: 8px; font-style: italic; font-size: 13px; }
.pprev { border: 1px dashed var(--line); border-radius: 6px; padding: 12px; background: #fff; max-width: 720px; margin-top: 6px; }
.pprev .ptable { border: 1px solid #aab3c2; color: var(--muted); text-align: center; padding: 18px; font-size: 12px; }

/* v5.1: trang Hôm nay, tài khoản */
.tdcard { border: 1px solid var(--line); border-left: 4px solid #f59e0b; border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: #fffdf7; display: flex; flex-direction: column; gap: 6px; }
.tdcard.short { border-left-color: var(--danger); background: #fff8f8; }
.tdcard .row button { font-size: 13px; }
.cnt-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
details.card > summary { cursor: pointer; }
table.list tr.muted td { color: var(--muted); }

/* v5.2: bản đang sửa, kế hoạch, lịch xếp, sổ tiết */
.ban-ind { margin-left: 12px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.ban-ind a { color: var(--primary); text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban-ind .ab button { padding: 0 7px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.hint { font-size: 12px; display: block; }
table.kh-table td.kh { min-width: 118px; vertical-align: top; }
table.kh-table td.kh input { width: 70px; }
table.kh-table td.kh select { font-size: 11px; margin-top: 3px; width: auto; max-width: 150px; display: block; }
.kh-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kh-sub a { text-decoration: none; font-weight: 700; margin-left: 4px; }
td.kh-warn { background: var(--warn-weak); }
td.kh-dirty { outline: 2px dashed var(--primary); }
tr.kh-child td:first-child { padding-left: 22px; color: var(--muted); }
th.kh-over { color: var(--danger); }
.gantt { min-width: 760px; }
.gantt-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; min-height: 26px; }
.gantt-row.head { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.gantt-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.gantt-track { display: grid; border-left: 1px solid var(--line); }
.gantt-week { font-size: 10px; text-align: center; padding: 3px 0; cursor: pointer; border-right: 1px solid var(--line); }
.gantt-week.hk2 { background: #f1f5f9; }
.gantt-week.now { background: var(--primary); color: #fff; border-radius: 3px; }
.gantt-week:hover { outline: 1px solid var(--primary); }
.gantt-bar { position: relative; height: 18px; border-radius: 4px; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; margin: 2px 0; }
.gantt-bar.draft { opacity: .85; background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.18) 6px 12px); }
.gantt-bar .gh { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(0,0,0,.25); }
.gantt-bar .gh.l { left: 0; border-radius: 4px 0 0 4px; } .gantt-bar .gh.r { right: 0; border-radius: 0 4px 4px 0; }
.gantt-bar .gl { pointer-events: none; overflow: hidden; white-space: nowrap; padding: 0 10px; }
.modal.wide-modal { max-width: 1100px; }
.lech { height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.lech span { display: block; height: 100%; }
.lech span.neg { background: var(--danger); } .lech span.pos { background: var(--ok); }
td.neg, b.neg, .neg { color: var(--danger); }
.up { color: var(--ok); font-weight: 600; font-size: 11px; } .down { color: var(--danger); font-weight: 600; font-size: 11px; }
table.list tr.chg td { background: #f8fbff; }
.desk ul { margin: 6px 0 10px; padding-left: 20px; }
@media print {
  body.print-modal .app, body.print-modal .shell { display: none; }
  body.print-modal .modal-bg { position: static; background: none; }
  body.print-modal .modal { max-height: none; overflow: visible; box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- v5.3: năm học, chuyển năm, hồ sơ ---------- */
.nam-ind { display: inline-flex; gap: 4px; align-items: center; margin-left: 8px; }
.nam-ind select { font-size: 12px; padding: 2px 4px; max-width: 220px; }
.tag.ro { background: #fee2e2; color: #991b1b; }
.tag.other { background: #fef3c7; color: #92400e; }
.tag.ok { background: #dcfce7; color: #166534; }
body.chi-xem .menubar { box-shadow: inset 0 -3px 0 #ef4444; }
body.nam-khac:not(.chi-xem) .menubar { box-shadow: inset 0 -3px 0 #f59e0b; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.steps .step { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 999px; text-decoration: none; color: inherit; font-size: 13px; }
.steps .step.done { background: #ecfdf5; border-color: #86efac; }
.steps .step.cur { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
ul.checklist { list-style: none; padding: 0; }
ul.checklist li { padding: 4px 0; }
ul.checklist li.ok { color: #166534; } ul.checklist li.warn { color: #92400e; } ul.checklist li.err { color: #991b1b; font-weight: 600; }
tr.warn td { background: #fffbeb; }
.nowrap { white-space: nowrap; }
.khoa-svg rect { fill: #eff6ff; stroke: #3b82f6; } .khoa-svg rect.off { fill: #f3f4f6; stroke: #9ca3af; stroke-dasharray: 3 2; }
.khoa-svg text { font-size: 12px; fill: #111827; } .khoa-svg text.yh { font-weight: 700; } .khoa-svg text.el { font-size: 11px; fill: #b45309; }
.khoa-svg line.e { stroke: #6b7280; stroke-width: 1.4; } .khoa-svg line.tach, .khoa-svg line.gop { stroke: #d97706; stroke-width: 2; }
@media (prefers-color-scheme: dark) {
  .khoa-svg rect { fill: #1e293b; stroke: #60a5fa; } .khoa-svg text { fill: #e5e7eb; }
  .steps .step.done { background: #14532d; } tr.warn td { background: #422006; }
}
.nam-ind select { color: #111827; background: #fff; border-radius: 6px; border: 1px solid #cbd5e1; }
/* v5.4: Báo sự cố, khẩn cấp, vi phạm khi chỉnh tay (RB6) */
.kc-on { border: 2px solid var(--danger); background: var(--danger-weak); }
label.pa, div.pa { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: pointer; }
label.pa.on { border-color: var(--primary); background: var(--primary-weak); }
label.pa input { margin-right: 6px; }
table.tkb td.drop-soft { background: var(--warn-weak) !important; }
table.tkb td.soft { box-shadow: inset 0 0 0 2px #f59e0b; }
table.tkb td.has-reason::after { content: "✎"; position: absolute; right: 2px; top: 0; font-size: 10px; color: var(--warn); }
table.tkb td { position: relative; }
.tag.kc { background: var(--danger); color: #fff; }
a.btn { display: inline-block; font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; }
a.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
#sc-loai.tabs { flex-wrap: wrap; gap: 4px; margin: 6px 0; }
#sc-loai.tabs button.on { background: var(--primary-weak); border-color: var(--primary); font-weight: 600; }
table.cmp td.best { background: #dcfce7; font-weight: 600; }
@media (prefers-color-scheme: dark) { table.cmp td.best { background: #14532d; } }
.lien-tuc { background: #dcfce7; border-radius: 4px; padding: 0 3px; }
tr.lien-tuc-row td { background: #f0fdf4; }
.bar { background: #e5e7eb; height: 10px; border-radius: 5px; overflow: hidden; } .bar i { display: block; height: 100%; background: #f97316; }
@media (prefers-color-scheme: dark) { .lien-tuc { background: #14532d; } tr.lien-tuc-row td { background: #052e16; } .bar { background: #374151; } }

/* =====================================================================
   v5.7: giao diện mới (sang trọng, gọn, dễ đọc). Lớp này đặt sau cùng nên ghi đè các kiểu cũ ở trên.
   Màu chủ đạo: xanh than (navy) + điểm nhấn vàng đồng; chữ Be Vietnam Pro (lưu kèm phần mềm).
   ===================================================================== */
:root {
  --bg: #f3f5f9; --panel: #fff; --text: #121a2b; --muted: #5d6878; --line: #e2e6ee; --line2: #d3d9e3;
  --primary: #2350c8; --primary-weak: #edf2ff; --primary-ink: #173a99;
  --navy: #0f1f44; --navy2: #1b3a7a; --gold: #c9a227; --gold-weak: #fbf5e3;
  --danger: #c0262d; --danger-weak: #fdeeee; --ok: #0f7b4b; --ok-weak: #e8f6ee; --warn: #9a4b05; --warn-weak: #fff5e0;
  --r: 12px; --r-sm: 8px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05); --sh-2: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px -8px rgba(16, 24, 40, .12);
  --sh-3: 0 12px 40px -12px rgba(15, 31, 68, .35);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: #c9d7ff; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--navy); margin: 2px 0 12px; }
h3 { font-size: 15px; font-weight: 600; color: var(--navy); }
.muted { color: var(--muted); }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1f4f9; border-radius: 5px; padding: 1px 5px; }

/* Thanh menu */
.top { background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: var(--sh-1); }
.menubar { background: linear-gradient(100deg, var(--navy) 0%, #142b5e 55%, var(--navy2) 100%); min-height: 44px; padding: 0 12px; gap: 2px; }
.menubar .brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: .01em; margin-right: 14px; }
.menubar .brand .mark { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #e7c75a, var(--gold)) ; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  -webkit-mask: none; position: relative; }
.menubar .brand .mark::before { content: ""; position: absolute; inset: 6px 5px 5px; border: 2px solid var(--navy); border-top-width: 4px; border-radius: 3px; }
.menubar .brand small { font-weight: 500; opacity: .6; font-size: 11px; }
.menu .mbtn { color: #dfe6f5; padding: 8px 11px; border-radius: 8px; font-weight: 500; font-size: 13.5px; }
.menu .mbtn:hover, .menu.open .mbtn { background: rgba(255,255,255,.12); color: #fff; }
.menu.open .mbtn { box-shadow: inset 0 -2px 0 var(--gold); }
.menu .drop { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); padding: 6px; min-width: 300px; margin-top: 4px; }
.menu .drop a { border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.menu .drop a:hover { background: var(--primary-weak); color: var(--primary-ink); }
.msep { border-top-color: var(--line); margin: 5px 6px; }
.menubar .school { color: #c9d3ea; opacity: 1; font-size: 12.5px; }
kbd { background: #f4f6fa; border-color: var(--line); border-radius: 5px; font-size: 10.5px; }
.toolbar { background: var(--panel); padding: 7px 12px; gap: 6px; }
.toolbar button { padding: 5px 11px; font-size: 13px; border-color: transparent; background: transparent; border-radius: 8px; color: #2a3446; }
.toolbar button:hover:not(:disabled) { background: #f1f4f9; border-color: var(--line); }
.toolbar .tsep { background: var(--line); height: 20px; }
.toolbar input { border-radius: 999px; padding: 6px 14px; background: #f5f7fa; border-color: var(--line); min-width: 160px; flex: 0 1 280px; }
.toolbar button, .toolbar a button { box-shadow: none; }
.toolbar input:focus { background: #fff; }
.app main { padding: 20px 24px 40px; }

/* Thẻ, lưới */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); padding: 18px; }
.card > h3:first-child { margin-top: 0; }
.grid2 { gap: 14px; }
.row { gap: 8px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head p { margin: 0 0 6px; max-width: 760px; }

/* Ô nhập */
label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
input, select, textarea { border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 7px 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
select { padding-right: 26px; }
input:hover, select:hover, textarea:hover { border-color: #b9c2d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(35, 80, 200, .14); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
input[type=color] { padding: 2px; height: 32px; width: 48px; }
input:disabled, select:disabled, textarea:disabled { background: #f4f6f9; color: var(--muted); }

/* Nút */
button, a.btn { border: 1px solid var(--line2); border-radius: var(--r-sm); background: #fff; color: #1f2a3d; font-weight: 500; padding: 7px 14px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; box-shadow: var(--sh-1); }
button:hover:not(:disabled), a.btn:hover { border-color: #aab4c5; background: #f8f9fc; }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary, a.btn.primary { background: linear-gradient(180deg, #2b5ad6, var(--primary)); border-color: #1e46b3; color: #fff; box-shadow: 0 1px 2px rgba(35,80,200,.3), inset 0 1px 0 rgba(255,255,255,.15); }
button.primary:hover:not(:disabled), a.btn.primary:hover { background: linear-gradient(180deg, #2552c9, #1d45b0); }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-weak); border-color: #f2b8bb; }
button.danger-ghost { color: var(--danger); background: #fff; }
button.danger-ghost:hover:not(:disabled) { background: var(--danger-weak); border-color: #f2b8bb; }
button.small { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
button.block { width: 100%; padding: 11px 16px; font-size: 15px; }
button:disabled { opacity: .45; box-shadow: none; }
.btn-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.btn-col button { text-align: left; }
.btn-link { font-size: 12px; font-weight: 500; text-decoration: none; padding: 4px 6px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Bảng danh sách */
table.list { background: transparent; border-collapse: separate; border-spacing: 0; }
table.list th { background: #f6f8fb; color: #4a5568; font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list tr:first-child th:first-child { border-top-left-radius: 8px; } table.list tr:first-child th:last-child { border-top-right-radius: 8px; }
table.list td { padding: 8px 10px; border-bottom: 1px solid #edf0f5; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafbfd; }
table.list td > input:where(:not([type=checkbox]):not([type=color]):not([type=radio])) { min-width: 110px; }
table.list td > input[data-f="name"], table.list td > input[data-f="full_name"] { min-width: 200px; }
table.list td > input[data-f="short"] { min-width: 90px; }
table.list td > input[data-f="email"], table.list td > input[data-f="online_link"] { min-width: 170px; }
table.list td > select { min-width: 120px; }
table.list td.num input, table.list td > input[type=number] { min-width: 72px; width: 80px; }
table.list td:last-child:has(> button) { white-space: nowrap; }
table.list td.num { font-variant-numeric: tabular-nums; }
.card.scroll, .scroll { overflow-x: auto; }
.card.scroll { padding: 6px; }
.card.scroll > table.list { min-width: 100%; }

/* Thông báo, thẻ trạng thái */
.msg { border-radius: 10px; padding: 10px 14px; border: 1px solid transparent; }
.msg.err { background: var(--danger-weak); color: var(--danger); border-color: #f5c6c8; }
.msg.ok { background: var(--ok-weak); color: var(--ok); border-color: #bfe5cf; }
.msg.warn { background: var(--warn-weak); color: var(--warn); border-color: #f5dcae; font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef1f6; color: #4a5568; white-space: nowrap; }
.badge.ok { background: var(--ok-weak); color: var(--ok); } .badge.warn { background: var(--warn-weak); color: var(--warn); } .badge.err { background: var(--danger-weak); color: var(--danger); }
.tag { border-radius: 6px; font-weight: 600; }
.toast { background: var(--navy); border-radius: 12px; padding: 11px 18px; font-weight: 500; box-shadow: var(--sh-3); bottom: 24px; }
.toast.err { background: var(--danger); }
.cnt-badge { background: var(--danger); }

/* Hộp thoại */
.modal-bg { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.modal { border-radius: 16px; padding: 22px 24px; box-shadow: var(--sh-3); border: 1px solid var(--line); }
.modal h3:first-child { margin-top: 0; font-size: 17px; }
.ctx { border-radius: 10px; box-shadow: var(--sh-3); padding: 5px; }
.ctx a { border-radius: 7px; }

/* Lưới TKB */
table.tkb { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
table.tkb th, table.tkb td { border: 0; border-right: 1px solid #dfe4ec; border-bottom: 1px solid #dfe4ec; }
table.tkb tr > :last-child { border-right: 0; }
table.tkb tr:last-child > * { border-bottom: 0; }
table.tkb th { background: #f3f6fa; color: #334155; font-size: 12.5px; }
table.tkb td .s { font-weight: 600; }
table.tkb td .t { color: #475569; }
table.tkb td.lesson:hover { filter: brightness(.97); }

/* Soạn thảo */
.ed-left, .ed-right, .ed-head, .ed .tray, .ed-grid, .bpane { border-radius: 12px; border-color: var(--line); box-shadow: var(--sh-1); }
.ed-left .tabs button { background: #f6f8fb; box-shadow: none; }
.ed-left .tabs button.on { box-shadow: inset 0 -2px 0 var(--primary); color: var(--primary-ink); }
.olist a { border-radius: 0 8px 8px 0; margin-right: 6px; }
.olist a.on { color: var(--primary-ink); font-weight: 600; }
.ed-head .cnt { border-radius: 999px; font-weight: 500; }
.tabs button { box-shadow: none; }

/* Trang Link xem TKB của lớp */
.grid-lk { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.grid-lk > .card { margin-bottom: 0; }
@media (max-width: 900px) { .grid-lk { grid-template-columns: 1fr; } }
.grid-lk + .card { margin-top: 14px; }
label.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; cursor: pointer; color: var(--text); }
label.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-weak); }
label.opt input { margin-top: 3px; }
label.opt span { display: flex; flex-direction: column; } label.opt b { font-weight: 600; font-size: 13.5px; } label.opt small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
#lk-cfg label.chk { display: flex; gap: 8px; margin: 8px 0; font-size: 13px; font-weight: 400; }
.copyfield { display: flex; gap: 4px; align-items: center; }
.copyfield input { min-width: 260px !important; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f7f9fc; }
.lk-table td.actions { white-space: nowrap; }
.lk-table details { margin-top: 4px; } .lk-table details ul { margin: 4px 0; padding-left: 16px; }
.qr-modal { text-align: center; } .qr-modal img { width: 220px; height: 220px; }

/* Trang đăng nhập */
body.auth-page { background: #f6f7fb; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.auth-brand { position: relative; overflow: hidden; color: #fff; background: radial-gradient(130% 120% at 0% 0%, #2b55a8 0%, var(--navy2) 38%, var(--navy) 100%); }
.auth-brand::before { content: ""; position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(120% 90% at 100% 100%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(120% 90% at 100% 100%, #000 0%, transparent 70%); }
.auth-brand::after { content: ""; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(201,162,39,.32), transparent 62%); }
.auth-brand-in { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: 40px 48px; }
.auth-school { display: flex; align-items: center; gap: 12px; }
.auth-school img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; }
.auth-school span { display: flex; flex-direction: column; line-height: 1.3; }
.auth-school b { font-size: 16px; font-weight: 600; } .auth-school small { opacity: .7; font-size: 13px; }
.auth-hero { margin: auto 0; max-width: 460px; }
.auth-hero .eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 600; color: #e9d48b; }
.auth-hero h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.18; letter-spacing: -.02em; margin: 12px 0 22px; font-weight: 700; }
.auth-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-hero li { display: flex; gap: 10px; align-items: center; color: #d5def2; font-size: 14.5px; }
.auth-hero li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; background: rgba(201,162,39,.2) center/10px no-repeat;
  box-shadow: inset 0 0 0 1px rgba(233,212,139,.6); background-image: radial-gradient(circle, #e9d48b 0 3px, transparent 3.5px); }
.auth-foot { font-size: 12px; opacity: .55; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px 32px 28px; box-shadow: 0 24px 60px -28px rgba(15,31,68,.35); }
.auth-card h2 { font-size: 26px; margin: 0 0 4px; }
.auth-card > p.muted { margin: 0 0 22px; font-size: 13.5px; }
.auth-card form { display: grid; gap: 14px; }
label.fld { display: block; color: #334155; font-size: 13px; font-weight: 600; }
label.fld input { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font-size: 15px; border-radius: 10px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 46px !important; }
.pw .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 3px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; cursor: pointer; font-size: 16px; opacity: .5; user-select: none; }
.pw .eye:hover, .pw .eye.on { opacity: 1; background: #f1f4f9; }
.caps { font-size: 12.5px; color: var(--warn); background: var(--warn-weak); border-radius: 8px; padding: 6px 10px; margin-top: -4px; }
.auth-note { margin: 18px 0 0; text-align: center; }
.auth-links { margin-top: 18px; display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.auth-links a { color: var(--muted); text-decoration: none; } .auth-links a:hover { color: var(--primary); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand-in { padding: 22px 20px 26px; }
  .auth-hero { margin: 22px 0 0; } .auth-hero h1 { font-size: 24px; margin-bottom: 0; } .auth-hero ul, .auth-foot { display: none; }
  .auth-main { justify-content: flex-start; padding: 0 16px 28px; margin-top: -14px; position: relative; z-index: 2; }
  .auth-card { padding: 26px 20px 22px; }
}

@media (max-width: 900px) {
  .app main { padding: 14px 14px 32px; }
  .menubar { min-height: 46px; }
  .card { padding: 14px; }
}
@media print {
  .card { box-shadow: none; }
  table.tkb { border-radius: 0; border-color: #888; } table.tkb th, table.tkb td { border-color: #999; }
}
.ed-left .tabs button { white-space: nowrap; padding: 8px 4px; font-size: 12.5px; }
@media (max-width: 860px) { .auth-brand::after { opacity: .45; right: -200px; bottom: -260px; } }
.toolbar input { flex: 1 1 160px; max-width: 320px; min-width: 140px; }
#lk-cfg label.opt { display: flex; }
.menubar .ban-ind a { color: #a9c1ff; }
.menubar .ban-ind a:hover { color: #fff; }
.menu .mbtn, .toolbar button, .menubar .brand { white-space: nowrap; }
table.list td > select { min-width: 130px; }
table.list td > select[data-f="homeroom_teacher_id"], table.list td > select[data-f="department_id"], table.list td > select[data-f="teacher_id"] { min-width: 190px; }
@media (max-width: 900px) { .menubar { gap: 0; } .menu .mbtn { padding: 8px 9px; } .toolbar { padding: 6px 8px; } }

/* =====================================================================
   v5.8: khung phần mềm mới. Thanh khu bên trái (8 khu), thanh trên (đường dẫn, năm học, bản đang sửa, tìm),
   thanh tab theo nhóm trong từng khu, thanh công cụ chỉ ở khu Xếp TKB.
   Rộng ≥1180px: thanh bên đủ chữ; 760–1180px hoặc khi thu gọn: chỉ biểu tượng; <760px: thanh bên trượt ra từ trái.
   ===================================================================== */
:root { --sb-w: 244px; --sb-rail: 68px; --head-h: 104px; }
.shell { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.ic { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40; color: #c9d3ea;
  background: linear-gradient(180deg, var(--navy) 0%, #12285a 100%); border-right: 1px solid #0b1734; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px 18px; color: #fff; }
.sb-brand > div { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.sb-brand b { font-size: 16px; font-weight: 700; letter-spacing: .01em; } .sb-brand small { font-size: 11px; opacity: .55; }
.sb-brand .mark { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; position: relative;
  background: linear-gradient(135deg, #e7c75a, var(--gold)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.sb-brand .mark::before { content: ""; position: absolute; inset: 8px 7px 7px; border: 2px solid var(--navy); border-top-width: 4px; border-radius: 3px; }
.sb button.ghost { background: transparent; border: 0; box-shadow: none; color: inherit; padding: 6px; border-radius: 8px; opacity: .7; display: grid; place-items: center; }
.sb button.ghost:hover:not(:disabled) { background: rgba(255,255,255,.1); opacity: 1; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #c9d3ea; text-decoration: none;
  font-size: 14px; font-weight: 500; white-space: nowrap; position: relative; }
.sb-nav a span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-nav a.on { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
.sb-nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.sb-nav a.on .ic { color: #e9d48b; }
.sb-nav .sb-all { margin-top: 10px; border: 1px dashed rgba(255,255,255,.18); color: #aebbd8; font-size: 13px; }
.sb-nav kbd { background: rgba(255,255,255,.08); border: 0; color: #aebbd8; font-size: 10px; padding: 1px 5px; }
.sb-nav .cnt-badge { margin-left: auto; }
.sb-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 10px 12px 12px; display: grid; gap: 8px; font-size: 12.5px; }
.sb-school .school { display: block; color: #aebbd8; line-height: 1.35; padding: 0 4px; }
.sb-links { display: flex; gap: 12px; padding: 0 4px; } .sb-links a { color: #aebbd8; text-decoration: none; } .sb-links a:hover { color: #fff; }
.sb-user { display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 6px 6px 6px 8px; }
.sb-user .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #2c4a8f; color: #fff; font-weight: 600; flex-shrink: 0; }
.sb-user .un { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e4eaf7; font-weight: 500; }
.sb-scrim { display: none; }

/* Thu gọn: chỉ biểu tượng */
body:is(.rail, .rail-auto) .shell { grid-template-columns: var(--sb-rail) minmax(0, 1fr); }
body:is(.rail, .rail-auto) .sb-brand { padding: 16px 0 10px; flex-direction: column; gap: 8px; }
body:is(.rail, .rail-auto) .sb-brand > div, body:is(.rail, .rail-auto) .sb-nav a span, body:is(.rail, .rail-auto) .sb-nav kbd, body:is(.rail, .rail-auto) .sb-school, body:is(.rail, .rail-auto) .sb-links, body:is(.rail, .rail-auto) .sb-user .un { display: none; }
body:is(.rail, .rail-auto) .sb-nav { padding: 6px 8px; } body:is(.rail, .rail-auto) .sb-nav a { justify-content: center; padding: 11px 0; }
body:is(.rail, .rail-auto) .sb-nav a.on::before { left: -8px; }
body:is(.rail, .rail-auto) .sb-nav .cnt-badge { position: absolute; top: 3px; right: 5px; font-size: 10px; padding: 0 5px; }
body:is(.rail, .rail-auto) .sb-user { flex-direction: column; background: none; padding: 0; }
body:is(.rail, .rail-auto) .sb-foot { padding: 10px 8px; }

/* Vùng làm việc */
.work { min-width: 0; display: flex; flex-direction: column; }
.whead { position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: var(--sh-1); }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 20px; }
.topbar .ghost { background: transparent; border: 0; box-shadow: none; padding: 6px; color: var(--navy); display: grid; place-items: center; }
.sb-toggle { display: none !important; }
.crumb { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; }
.crumb b { font-size: 17px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; }
.crumb i { font-style: normal; color: #9aa5b6; } .crumb span { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.topbar .nam-ind, .topbar .ban-ind { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.topbar .nam-ind:empty, .topbar .ban-ind:empty { display: none; }
.topbar .nam-ind select { padding: 4px 26px 4px 8px; font-size: 12.5px; }
.topbar .ban-ind a { color: var(--primary-ink); background: var(--primary-weak); padding: 3px 10px; border-radius: 999px; text-decoration: none; font-weight: 500; }
.topbar .find { margin-left: auto; display: flex; align-items: center; gap: 8px; background: #f3f5f9; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px;
  flex: 0 1 340px; min-width: 180px; color: var(--muted); }
.topbar .find:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(35,80,200,.14); }
.topbar .find .ic { width: 17px; height: 17px; }
.topbar .find input { border: 0; background: transparent; box-shadow: none; padding: 8px 0; width: 100%; min-width: 0; }
.today-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--navy); flex-shrink: 0; }
.today-btn:hover { background: #f1f4f9; }
.today-btn .cnt-badge { position: absolute; top: 2px; right: 0; font-size: 10px; padding: 0 5px; min-width: 16px; text-align: center; }

/* Thanh tab hai tầng: tầng 1 = nhóm (gạch chân), tầng 2 = tab trong nhóm (viên thuốc) */
.tabbar { padding: 0 20px; border-top: 1px solid #eef1f6; }
.tabbar[hidden] { display: none; }
.tabrow { display: flex; align-items: center; gap: 12px; }
.tabbar .tabs { display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabbar .tabs::-webkit-scrollbar { display: none; }
.tabbar .t1 { flex: 1; gap: 4px; align-self: stretch; }
.tabbar .t1 a { display: flex; align-items: center; gap: 7px; padding: 12px 12px 11px; color: #3f4a5e; text-decoration: none; font-size: 14px; font-weight: 500;
  white-space: nowrap; border-bottom: 2px solid transparent; align-self: stretch; }
.tabbar .t1 a small { font-size: 11px; font-weight: 600; color: #8a95a8; background: #eef1f6; border-radius: 999px; padding: 0 6px; }
.tabbar .t1 a:hover { color: var(--primary-ink); }
.tabbar .t1 a.on { color: var(--primary-ink); border-bottom-color: var(--primary); font-weight: 600; }
.tabbar .t1 a.on small { background: var(--primary-weak); color: var(--primary-ink); }
.tabbar .t2 { gap: 4px; padding: 8px 0 9px; border-top: 1px solid #eef1f6; }
.tabbar .t2 a { white-space: nowrap; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: #3f4a5e; text-decoration: none; }
.tabbar .t2 a:hover { background: #f1f4f9; color: var(--primary-ink); }
.tabbar .t2 a.on { background: var(--primary-weak); color: var(--primary-ink); font-weight: 600; box-shadow: inset 0 0 0 1px #cfdcff; }
.tabbar .cnt-badge { font-size: 10px; padding: 0 5px; }
.qacts { position: relative; flex-shrink: 0; }
.qacts > button { white-space: nowrap; }
.qdrop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3);
  padding: 6px; min-width: 300px; display: flex; flex-direction: column; }
.qdrop[hidden] { display: none; }
.qdrop a { padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.qdrop a:hover { background: var(--primary-weak); color: var(--primary-ink); }
.whead .toolbar { border-top: 1px solid #eef1f6; padding: 6px 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; background: #fafbfd; }
.whead .toolbar[hidden] { display: none; }
.whead .toolbar a button.primary { padding: 5px 14px; }

main#main { padding: 22px 28px 48px; min-width: 0; }
body.wide main#main { padding: 10px 12px; }
.ed-left, .ed-right { top: calc(var(--head-h) + 10px); max-height: calc(100vh - var(--head-h) - 20px); }
main#main > h2:first-child { margin-top: 0; }

/* "Tất cả chức năng" */
.modal.wide { max-width: 1100px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.allmenu { display: flex; flex-direction: column; min-height: 0; max-height: 86vh; }
.am-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.am-head h3 { margin: 0; font-size: 17px; white-space: nowrap; } .am-head input { flex: 1; min-width: 0; padding: 9px 12px; }
.am-body { overflow: auto; padding: 16px 20px 20px; columns: 4 220px; column-gap: 24px; }
.am-body section { break-inside: avoid; margin-bottom: 18px; }
.am-body h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; color: var(--navy); }
.am-body h4 .ic { color: var(--primary); width: 18px; height: 18px; }
.am-body h5 { margin: 8px 0 2px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8a95a8; font-weight: 600; }
.am-body a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; margin: 0 -8px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.am-body a:hover { background: var(--primary-weak); color: var(--primary-ink); }
.am-body a[hidden], .am-body section[hidden] { display: none; }

@media (max-width: 1180px) { main#main { padding: 18px 20px 40px; } .topbar .find { flex-basis: 240px; } }
@media (max-width: 760px) {
  .shell, body:is(.rail, .rail-auto) .shell { grid-template-columns: minmax(0, 1fr); }
  .sb { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 84vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--sh-3); }
  body.sb-open .sb { transform: none; }
  body.sb-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  body:is(.rail, .rail-auto) .sb-brand { flex-direction: row; padding: 16px 14px 14px 18px; }
  body.rail .sb-brand > div, body.rail .sb-links { display: flex; } body.rail .sb-nav a span, body.rail .sb-school, body.rail .sb-user .un { display: block; }
  body:is(.rail, .rail-auto) .sb-nav a { justify-content: flex-start; padding: 9px 12px; } body:is(.rail, .rail-auto) .sb-user { flex-direction: row; background: rgba(255,255,255,.06); padding: 6px 6px 6px 8px; }
  .sb-rail { display: none !important; }
  .sb-toggle { display: grid !important; }
  .topbar { padding: 6px 10px; gap: 6px; flex-wrap: wrap; min-height: 50px; }
  .crumb { flex: 1; } .crumb span, .crumb i { display: none; } .crumb b { font-size: 16px; }
  .topbar .find { order: 5; flex: 1 1 100%; margin: 0 0 4px; }
  .topbar .nam-ind, .topbar .ban-ind { order: 4; }
  .tabbar { padding: 0 10px; }
  .tabbar .t1 a { padding: 10px 8px 9px; font-size: 13.5px; } .tabbar .t1 a small { display: none; }
  .qacts > button { padding: 4px 8px; } .qdrop { min-width: 260px; }
  .whead .toolbar { padding: 6px 10px; flex-wrap: nowrap; overflow-x: auto; }
  main#main { padding: 14px 12px 32px; }
  .am-body { columns: 1; } .am-head { flex-wrap: wrap; } .am-head input { order: 3; flex-basis: 100%; }
}
@media print { .shell { display: block; } .whead, .sb { display: none !important; } main#main { padding: 0; } }
.tabbar .r2 { border-top: 1px solid #eef1f6; flex-wrap: wrap; row-gap: 0; }
.tabbar .r2 .t2 { border-top: 0; flex: 0 1 auto; }
.tabbar .r2 .toolbar { border: 0; background: transparent; padding: 5px 0; margin-left: auto; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabbar .r2 .toolbar button { padding: 5px 10px; }
@media (max-width: 760px) { .tabbar .r2 .toolbar { margin-left: 0; width: 100%; border-top: 1px solid #eef1f6; } }
body.rail-auto .sb-rail { display: none; }
.modal-bg { z-index: 100; } .ctx { z-index: 110; } .toast { z-index: 120; }
/* Danh sách gọn + ngăn sửa bên phải */
h2 .count { font-size: 13px; font-weight: 600; color: var(--muted); background: #eef1f6; border-radius: 999px; padding: 2px 9px; vertical-align: 4px; margin-left: 4px; }
.find-in { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line2); border-radius: 999px; padding: 0 12px; background: #fff; color: var(--muted); }
.find-in:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(35,80,200,.14); }
.find-in .ic { width: 16px; height: 16px; } .find-in input { border: 0; box-shadow: none !important; padding: 7px 0; width: 200px; background: transparent; }
details.intro { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 14px; margin-bottom: 12px; font-size: 13px; }
details.intro summary { cursor: pointer; color: var(--primary-ink); font-weight: 500; }
details.intro p { margin: 8px 0 4px; }
.card.flush { padding: 0; overflow-x: auto; }
table.dlist { width: 100%; }
table.dlist th:first-child, table.dlist td:first-child { padding-left: 18px; }
table.dlist tr.rowlink { cursor: pointer; }
table.dlist tr.rowlink:hover td { background: #f5f8ff; }
table.dlist a.rname { font-weight: 600; color: var(--text); text-decoration: none; }
table.dlist tr.rowlink:hover a.rname { color: var(--primary-ink); }
table.dlist td.acts { text-align: right; white-space: nowrap; padding-right: 14px; }
table.dlist td.acts button { margin-left: 2px; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line2); vertical-align: -3px; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.drawer-bg { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,0); transition: background .18s; }
.drawer-bg.on { background: rgba(15,23,42,.32); }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); box-shadow: var(--sh-3);
  display: flex; flex-direction: column; transform: translateX(30px); opacity: 0; transition: transform .18s ease, opacity .18s; }
.drawer-bg.on .drawer { transform: none; opacity: 1; }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer header h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer header .ghost { border: 0; box-shadow: none; background: transparent; font-size: 16px; padding: 6px 10px; }
.drawer .dbody { flex: 1; overflow-y: auto; padding: 8px 20px 20px; }
.drawer fieldset { border: 0; border-bottom: 1px solid #eef1f6; padding: 14px 0 16px; margin: 0; }
.drawer fieldset:last-of-type { border-bottom: 0; }
.drawer legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #8a95a8; padding: 0; margin-bottom: 10px; float: left; width: 100%; }
.drawer .dgrid { clear: both; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.drawer .dgrid label { display: flex; flex-direction: column; gap: 5px; }
.drawer .dgrid label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.drawer .dgrid input:not([type=checkbox]):not([type=color]), .drawer .dgrid select { width: 100%; }
.drawer .dacts { clear: both; display: flex; flex-wrap: wrap; gap: 6px; }
.drawer footer { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; }
@media (max-width: 560px) { .drawer .dgrid { grid-template-columns: 1fr; } .find-in input { width: 130px; } }
table.dlist td, table.dlist th { white-space: nowrap; }
table.dlist td { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .topbar .today-btn { order: 3; } .topbar .nam-ind, .topbar .ban-ind { order: 5; max-width: 100%; overflow: hidden; } .topbar .find { order: 6; }
  .crumb { flex: 1 1 0; min-width: 90px; }
  /* danh sách thành thẻ */
  table.dlist thead { display: none; }
  table.dlist, table.dlist tbody { display: block; }
  table.dlist tr.rowlink { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid #edf0f5; }
  table.dlist tr.rowlink[hidden] { display: none; }
  table.dlist tr.rowlink td { border: 0; padding: 0; max-width: 100%; font-size: 13px; color: var(--muted); }
  table.dlist tr.rowlink td:first-child { flex-basis: 100%; padding: 0; font-size: 15px; }
  table.dlist tr.rowlink td:not(:first-child):not(.acts):has(.muted:only-child) { display: none; }
  table.dlist td.acts { flex-basis: 100%; text-align: left; white-space: normal; padding: 6px 0 0 !important; }
  table.dlist td.acts button { margin: 2px 2px 0 0; }
  .page-head { align-items: stretch; } .page-head > .row { width: 100%; } .page-head .find-in { flex: 1; } .find-in input { width: 100%; }
}
@media (max-width: 760px) { table.dlist td.acts { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; } table.dlist td.acts button { margin: 0; } }
table.list.calendar-fix { min-width: 0; }
.card:has(> table.list), .card:has(> div > table.list) { overflow-x: auto; }
main#main .card:has(table.list) { overflow-x: auto; }
main#main > table.list { display: block; overflow-x: auto; max-width: 100%; }
@media (max-width: 760px) { .cal-g { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; } .cal-d { min-width: 0; overflow: hidden; } .card.cal .row { flex-wrap: wrap; } }
table.dlist td.acts { max-width: none; overflow: visible; }
/* v5.8b: Tổ của năm học */
.warns { display: grid; gap: 6px; margin-bottom: 12px; } .warns .msg { margin: 0; padding: 7px 12px; font-size: 13px; }
.to-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.to-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.to-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); display: flex; flex-direction: column; overflow: hidden; }
.to-card.khoi { border-top: 3px solid #36a9f0; } .to-card.chuyen_mon { border-top: 3px solid var(--primary); } .to-card.khac { border-top: 3px solid var(--gold); }
.to-h { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px 10px; border-bottom: 1px solid #eef1f6; }
.to-h > div { flex: 1; min-width: 0; } .to-h b { font-size: 15px; color: var(--navy); }
.to-h .cnt { font-size: 12px; font-weight: 600; background: #eef1f6; border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.to-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; } .to-tags span { font-size: 11.5px; background: #f2f5fa; border-radius: 6px; padding: 1px 7px; color: #475569; }
.to-m { padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 64px; transition: background .15s; }
.to-m.over { background: var(--primary-weak); outline: 2px dashed var(--primary); outline-offset: -6px; }
.gchip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: grab; font-size: 13.5px; }
.gchip:hover { border-color: #b9c6dc; } .gchip.drag { opacity: .5; }
.gchip .gn { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gchip small { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gchip .role { font-size: 10px; background: var(--gold); color: #3b2a00; border-radius: 5px; padding: 1px 5px; } .gchip .role.pho { background: #e7ecf5; color: #334155; }
.gchip .gx { border: 0; box-shadow: none; background: transparent; padding: 2px 6px; color: var(--muted); }
.to-free { position: sticky; top: calc(var(--head-h) + 12px); max-height: calc(100vh - var(--head-h) - 24px); overflow: auto; padding: 12px; }
.to-free h3 { margin: 2px 4px 8px; }
.to-free .to-m { padding: 0; }
.modal.wide-sm { max-width: 880px; }
@media (max-width: 980px) { .to-wrap { grid-template-columns: 1fr; } .to-free { position: static; max-height: none; } }
details.warnbox { background: var(--warn-weak); border: 1px solid #f5dcae; border-radius: 10px; padding: 8px 14px; margin-bottom: 14px; color: var(--warn); font-size: 13.5px; }
details.warnbox.do { background: var(--danger-weak); border-color: #f5c6c8; color: var(--danger); }
details.warnbox summary { cursor: pointer; font-weight: 600; }
details.warnbox ul { margin: 6px 0 2px; padding-left: 20px; } details.warnbox li.do { color: var(--danger); font-weight: 500; } details.warnbox li.vang { color: var(--warn); }

/* ---------- v5.8c: Bắt đầu năm học, nhập dữ liệu năm học ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: #eef2f8; border-radius: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.seg a { padding: 6px 14px; border-radius: 8px; color: #334155; text-decoration: none; font-weight: 500; font-size: 14px; }
.seg a.on { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.bd-prog { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.bd-bar { flex: 1 1 100%; height: 8px; background: #e5eaf2; border-radius: 99px; overflow: hidden; }
.bd-bar span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #22c55e); border-radius: 99px; }
ol.bd-steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
ol.bd-steps li { display: flex; align-items: flex-start; gap: 14px; margin: 0; }
ol.bd-steps li.cur { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.bd-n { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #eef2f8; color: #475569; font-weight: 700; }
li.done .bd-n { background: #dcfce7; color: #15803d; }
li.cur .bd-n { background: var(--primary); color: #fff; }
.bd-b { flex: 1; min-width: 0; }
.bd-t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bd-t a { color: inherit; text-decoration: none; }
.bd-c { margin-top: 2px; color: #b45309; font-size: 14px; }
.bd-c.ok { color: #15803d; }
.bd-b p { margin: 4px 0 0; }
ol.bd-steps .btn { flex: 0 0 auto; align-self: center; }
.nn-top .card h3, #nn-pv h3 { margin-top: 0; }
.nn-r { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0; }
.nn-r input[type=radio], .nn-r input[type=checkbox] { margin: 0; }
.nn-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.nn-sum > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.nn-sum b { font-size: 22px; line-height: 1.1; }
.nn-sum span { font-weight: 600; font-size: 13px; }
.nn-sum small { color: #64748b; font-size: 12px; }
table.nn-gv select { min-width: 220px; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #92400e; }
.nn-go { margin-top: 12px; align-items: center; }
.nn-f { margin-bottom: 10px; align-items: center; }
.nn-f input[type=search], .nn-f #ls-q { min-width: 240px; }
table.nn-ls td { vertical-align: top; min-width: 140px; }
table.nn-ls td.moved { background: #fffbeb; }
@media (max-width: 760px) {
  ol.bd-steps li { flex-wrap: wrap; }
  ol.bd-steps .btn { margin-left: 46px; }
  table.nn-gv select { min-width: 160px; }
  .nn-f #ls-q { min-width: 0; flex: 1; }
}
.grid2.nn-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; max-width: none; }
.nn-top .card { margin: 0; }
.nn-sum { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.nn-r .nn-d { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #475569; }
.grid2.nn-top { margin-bottom: 14px; }
.nn-r.small { flex-wrap: nowrap; align-items: flex-start; }
.nn-r.small input { margin-top: 3px; }

/* ===================== v5.8d: nhận diện Ngôi Sao Hà Nội (xanh lá #0F974D, cam #EF7921 theo logo) ===================== */
:root {
  --brand: #0f974d; --brand-d: #0b7a3d; --brand-dd: #0a4a2a; --brand-weak: #e8f6ee; --orange: #ef7921; --orange-d: #d7650f; --orange-weak: #fff1e5;
  --primary: var(--brand); --primary-weak: var(--brand-weak); --primary-ink: #0b6b37;
  --navy: #14271d; --navy2: #1d4a32; --gold: var(--orange); --gold-weak: var(--orange-weak);
  --bg: #f4f6f5; --line: #e3e8e5; --line2: #d3dbd6;
}
::selection { background: #c5ecd6; }
:focus-visible { outline-color: var(--brand); }
button.primary, a.btn.primary { background: var(--brand); border-color: var(--brand-d); box-shadow: 0 1px 2px rgba(15,151,77,.3); }
button.primary:hover:not(:disabled), a.btn.primary:hover { background: var(--brand-d); }
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(15,151,77,.15) !important; }

/* Thanh bên xanh lá đậm như mẫu */
.sb { background: linear-gradient(180deg, #0c5a31 0%, #0a4a2a 55%, #083d23 100%); border-right: 0; color: #d5ecdf; }
.sb-brand { flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 14px 12px; position: relative; }
.sb-brand .sb-logo { width: 74px; height: 74px; object-fit: contain; border-radius: 50%; background: rgba(255,255,255,.06); padding: 3px; }
.sb-brand > div { align-items: center; }
.sb-brand b { font-size: 15.5px; font-weight: 800; letter-spacing: .04em; }
.sb-brand small { opacity: .65; }
.sb-brand .sb-rail { position: absolute; top: 10px; right: 8px; }
.sb-me { display: flex; align-items: center; gap: 10px; margin: 4px 12px 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.07); }
.sb-me .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--brand-d); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sb-me div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-me small { font-size: 11px; color: #a9d4bb; } .sb-me b { color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-nav a { color: #d5ecdf; font-weight: 500; }
.sb-nav a:hover { background: rgba(255,255,255,.08); }
.sb-nav a.on { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(0,0,0,.5); }
.sb-nav a.on::before { display: none; }
.sb-nav a.on .ic { color: #fff; }
.sb-nav .sb-all { border-color: rgba(255,255,255,.2); color: #b9dcc7; }
.sb-foot { border-top: 0; gap: 8px; }
.sb-year { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, #f08a2e, var(--orange-d)); box-shadow: 0 10px 22px -12px rgba(239,121,33,.9); }
.sb-year .yr-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); font-size: 15px; flex-shrink: 0; }
.sb-year div { display: flex; flex-direction: column; line-height: 1.2; } .sb-year small { font-size: 10.5px; opacity: .9; } .sb-year b { font-size: 19px; font-weight: 800; letter-spacing: .01em; }
.sb-sync { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: rgba(0,0,0,.18); }
.sb-sync div { flex: 1; display: flex; flex-direction: column; line-height: 1.25; } .sb-sync small { font-size: 10.5px; color: #a9d4bb; } .sb-sync b { font-size: 12.5px; color: #fff; }
.sb-sync .ghost { opacity: .9; }
.sb-school { display: none; }
.sb-links a, .sb-school .school { color: #a9d4bb; }
.sb-user { background: transparent; padding: 0 4px; }
.sb-user .un { display: none; }
.sb-user .ghost { display: flex !important; gap: 6px; align-items: center; font-size: 12.5px; color: #cfe6d8; opacity: .85; }
body:is(.rail, .rail-auto) .sb-brand .sb-logo { width: 42px; height: 42px; }
body:is(.rail, .rail-auto) .sb-brand .sb-rail { position: static; }
body:is(.rail, .rail-auto) .sb-me { justify-content: center; margin: 4px 8px 8px; padding: 6px 0; background: transparent; }
body:is(.rail, .rail-auto) .sb-me div, body:is(.rail, .rail-auto) .sb-year div, body:is(.rail, .rail-auto) .sb-sync div, body:is(.rail, .rail-auto) .sb-user .ghost span { display: none; }
body:is(.rail, .rail-auto) .sb-year { justify-content: center; padding: 8px 0; }
body:is(.rail, .rail-auto) .sb-sync { justify-content: center; padding: 4px 0; background: transparent; }
body:is(.rail, .rail-auto) .sb-user { justify-content: center; }

/* Đầu vùng làm việc, tab */
.whead { box-shadow: none; }
.tabbar .t1 a.on { color: var(--primary-ink); border-bottom-color: var(--brand); }
.tabbar .t2 a.on { box-shadow: inset 0 0 0 1px #bfe5cf; }
.crumb b, .crumb strong { color: var(--navy); }
.topbar .nam-ind .tag.other { background: var(--orange-weak); color: var(--orange-d); border-color: #f7c79e; }
.cnt-badge { background: var(--orange); }
h2 { color: var(--navy); }
.card { border-radius: 12px; }

/* Bảng điều hành (Tổng quan) */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-head h2 { margin: 0; font-size: 22px; } .dash-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; display: block; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.kpi.o::after { background: var(--orange); } .kpi.r::after { background: var(--danger); }
.kpi small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7a71; }
.kpi b { display: block; font-size: 24px; font-weight: 800; color: #14271d; margin-top: 4px; letter-spacing: -.01em; }
.kpi span { font-size: 11.5px; color: var(--muted); }
.kpi:hover { border-color: #b9dcc7; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.dcard.wide { grid-column: 1 / -1; }
.dcard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.dcard-h small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }
.dcard-h b { font-size: 14.5px; color: #14271d; }
.dcard-h a { font-size: 12px; white-space: nowrap; border: 1px solid var(--line2); border-radius: 8px; padding: 3px 9px; text-decoration: none; color: #2f3d35; }
.dcard-h a:hover { border-color: var(--brand); color: var(--brand-d); }
.vbars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding: 4px 2px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.vb { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 34px; }
.vb i { display: block; width: 60%; max-width: 30px; border-radius: 5px 5px 0 0; background: var(--brand); min-height: 2px; }
.vb.o i { background: var(--orange); } .vb.r i { background: #d64545; } .vb.p i { background: #7c5cd6; } .vb.s i { background: #4f7b9a; }
.vb em { font-style: normal; font-size: 11px; font-weight: 700; color: #2f3d35; margin-bottom: 3px; }
.vb-l { display: flex; gap: 8px; padding: 4px 2px 0; overflow: hidden; }
.vb-l span { flex: 1 0 34px; min-width: 34px; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--brand); margin-right: 4px; vertical-align: -1px; }
.legend i.o { background: var(--orange); }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 48px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.hbar:last-child { border-bottom: 0; }
.hbar .tr { height: 8px; background: #eef2ef; border-radius: 99px; overflow: hidden; } .hbar .tr i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hbar.o .tr i { background: var(--orange); } .hbar.r .tr i { background: #d64545; }
.hbar b { text-align: right; font-size: 12.5px; }
.ring { --p: 50; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e6ece8 0); }
.ring span { width: 74px; height: 74px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #14271d; }
.ring-row { display: flex; gap: 16px; align-items: center; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; font-size: 13px; }
.todo li b { color: var(--orange-d); } .todo li a { text-decoration: none; color: inherit; flex: 1; }
.todo li.ok b { color: var(--brand-d); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: #22312a; font-size: 13px; font-weight: 500; }
.quick a:hover { border-color: var(--brand); background: var(--brand-weak); }
.quick a .ic { color: var(--brand); width: 18px; height: 18px; }
.empty-d { color: var(--muted); font-size: 13px; padding: 18px; text-align: center; border: 1px dashed var(--line2); border-radius: 10px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi b { font-size: 20px; } .quick { grid-template-columns: 1fr; } }
.vbars.dense .vb, .vb-l.dense span { flex: 1 0 18px; min-width: 18px; } .vb-l.dense span { font-size: 9.5px; }
.vbars { overflow: hidden; }
/* đăng nhập theo màu trường */
.auth-brand { background: radial-gradient(130% 120% at 0% 0%, #1fb56a 0%, #0f974d 35%, #0a4a2a 100%); }
.auth-hero .eyebrow { color: #ffc999; }
.auth-hero li { color: #e2f4ea; }
.auth-hero li::before { background-image: radial-gradient(circle, #ef7921 0 3px, transparent 3.5px); box-shadow: inset 0 0 0 1px rgba(255,201,153,.7); background-color: rgba(239,121,33,.18); }
.auth-card { box-shadow: 0 24px 60px -28px rgba(10,74,42,.35); }

/* ---------- v5.9: Học sinh, phụ huynh ---------- */
.hs-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: start; }
.hs-side { padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow: auto; }
.hs-side-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.hs-side a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14px; }
.hs-side a span { color: var(--muted); font-size: 12px; }
.hs-side a:hover { background: #f1f7f3; }
.hs-side a.on { background: #e5f4ea; color: #0b7a3d; font-weight: 600; }
.hs-main { display: grid; gap: 10px; min-width: 0; }
.hs-tbl td { vertical-align: top; }
code.ma { font-family: ui-monospace, Menlo, Consolas, monospace; background: #eef7f1; color: #0b7a3d; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; letter-spacing: .02em; }
code.ma.small { font-size: 11px; padding: 1px 4px; }
.hs-empty { border-left: 4px solid #ef7921; }
.hs-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hs-ph { display: grid; grid-template-columns: 110px 1.4fr 1fr 1.2fr 1fr auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.hs-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0; }
td.nowrap { white-space: nowrap; }
@media (max-width: 900px) {
  .hs-wrap { grid-template-columns: 1fr; }
  .hs-side { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .hs-side-h { width: 100%; }
  .hs-form { grid-template-columns: 1fr 1fr; }
  .hs-ph { grid-template-columns: 1fr 1fr; }
  .hs-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v6.0: Kiểm tra dữ liệu */
.err-t { color: #b91c1c; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #fef3c7; color: #92400e; }
.kt-list { display: grid; gap: 8px; }
.kt-it { padding: 10px 14px; }
.kt-it summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.kt-it summary::-webkit-details-marker { display: none; }
.kt-dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; flex: none; }
.kt-it.loi .kt-dot { background: #dc2626; }
.kt-it.canh_bao .kt-dot { background: #f59e0b; }
.kt-it ul { margin: 8px 0; padding-left: 20px; font-size: 14px; }
.hs-stat { margin: -4px 0 10px; }
/* v6.0: Xếp lớp đầu cấp, lên lớp */
.xl-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; align-items: start; }
.xl-col { padding: 10px; min-height: 120px; }
.xl-col[data-cid=""] { border: 2px dashed var(--line, #cfe3d6); }
.xl-h { font-weight: 700; margin-bottom: 8px; display: flex; gap: 6px; align-items: baseline; }
.xl-list { display: grid; gap: 6px; }
.xl-hs { border: 1px solid var(--line, #e2ece6); border-radius: 8px; padding: 6px 8px; background: var(--card, #fff); cursor: grab; display: grid; gap: 2px; }
.xl-hs select { font-size: 13px; padding: 2px 4px; }
.hs-len { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
/* v6.0 (G1): hai cấp học */
.cap-ind { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: color-mix(in srgb, var(--capc, #0F974D) 14%, white); color: var(--capc, #0F974D); text-decoration: none; white-space: nowrap; }
.cap-ind.none { background: #fff7ed; color: #c2410c; }
.cap-land { max-width: 1040px; margin: 0 auto; }
.cap-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin: 18px 0; }
.cap-tile { text-align: left; border: 0; border-radius: 20px; padding: 26px 26px 22px; min-height: 230px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--capc), color-mix(in srgb, var(--capc) 65%, #062b17)); display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--capc) 70%, transparent); transition: transform .15s; font: inherit; }
.cap-tile:hover:not(:disabled) { transform: translateY(-3px); }
.cap-tile:disabled { opacity: .5; cursor: not-allowed; }
.cap-tile.on { outline: 4px solid color-mix(in srgb, var(--capc) 35%, white); }
.cap-tile small { letter-spacing: .14em; opacity: .85; font-weight: 600; }
.cap-tile > b { font-size: 34px; line-height: 1.1; letter-spacing: .02em; }
.cap-st { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.cap-st span { font-size: 14px; opacity: .92; } .cap-st i { font-style: normal; font-weight: 800; font-size: 20px; margin-right: 3px; }
.cap-b { font-size: 13px; opacity: .92; } .cap-tile .muted { color: #fff; opacity: .8; }
@media (max-width: 640px) { .cap-tile { min-height: 180px; padding: 20px; } .cap-tile > b { font-size: 26px; } }

/* v6.1 (G2): Chủ nhiệm lớp */
.cn-tab td { vertical-align: top; }
.cn-tab tr.cn-thieu td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.cn-tab .cn-act { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.warn-card { border-left: 4px solid #f59e0b; }
.warn-card ul { margin: 6px 0 0; }
#nl-t input.nl-mon { width: 100%; min-width: 160px; }

/* v6.4.1: trường hai cấp, chưa vào cấp: chỉ hai ô Tiểu học, THCS và phần dùng chung */
.lobby-nav { display: none; }
body.lobby .lobby-nav { display: flex; flex-direction: column; gap: 2px; }
body.lobby .sb-nav > a[data-area], body.lobby .sb-nav > .sb-all, body.lobby #tabbar, body.lobby #toolbar,
body.lobby #ban-ind, body.lobby .today-btn, body.lobby .sb-sync { display: none !important; }
.lobby-nav .lobby-cap { background: color-mix(in srgb, var(--capc) 35%, transparent); color: #fff; font-weight: 700; margin-bottom: 4px; }
.lobby-nav .lobby-cap:hover { background: var(--capc); }
.lobby-h { color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; padding: 10px 12px 4px; }
body.lobby .cap-land { max-width: 1100px; margin: 24px auto; }
body.lobby .cap-tiles { gap: 24px; }
body.lobby .cap-tile { min-height: 260px; }
.sb-cap { display: flex; flex-direction: column; margin: 0 14px 10px; padding: 10px 14px; border-radius: 12px; background: var(--capc); color: #fff; text-decoration: none; }
.sb-cap small { font-size: 11px; opacity: .8; } .sb-cap b { font-size: 18px; letter-spacing: .02em; } .sb-cap span { font-size: 12px; opacity: .85; }
body.rail .sb-cap { display: none; }

/* ===================== v6.5: Trợ lý xếp TKB ===================== */
.tl-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.tl-head p { max-width: 760px; margin: 4px 0 0; }
.tl-ring { flex: 0 0 84px; height: 84px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(var(--brand) calc(var(--p) * 1%), #e3e8e5 0); }
.tl-ring b { font-size: 20px; line-height: 1; } .tl-ring small { font-size: 11px; color: var(--muted); }
.tl-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 16px; position: sticky; top: var(--head-h, 0); z-index: 3; background: var(--bg); padding: 6px 0; }
.tl-steps.mini { position: static; margin: 8px 0; padding: 0; background: none; }
.tl-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px; border-radius: 99px; border: 1px solid var(--line2);
  background: #fff; color: var(--text); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.tl-chip i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #eef2f0; color: #475569; }
.tl-chip b { background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 18px; }
.tl-chip.s-ok i { background: var(--ok-weak); color: var(--ok); }
.tl-chip.s-err i { background: var(--danger-weak); color: var(--danger); }
.tl-chip.s-warn i { background: var(--warn-weak); color: var(--warn); }
.tl-chip.s-cho { opacity: .65; }
.tl-chip.next { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,151,77,.16); }
.tl-list { display: grid; gap: 12px; }
.tl-card { position: relative; margin: 0; scroll-margin-top: calc(var(--head-h, 0px) + 64px); border-left: 4px solid var(--line2); }
.tl-card.s-ok { border-left-color: var(--ok); } .tl-card.s-err { border-left-color: var(--danger); } .tl-card.s-warn { border-left-color: #e0a100; }
.tl-card.s-todo { border-left-color: var(--brand); } .tl-card.s-cho { opacity: .72; }
.tl-card.next { box-shadow: 0 0 0 3px rgba(15,151,77,.14), var(--sh-2); }
.tl-next { position: absolute; top: -10px; right: 14px; background: var(--orange); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 99px; letter-spacing: .02em; }
.tl-top { display: flex; gap: 14px; align-items: flex-start; }
.tl-n { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #eef2f0; color: #475569; }
.s-ok .tl-n { background: var(--ok-weak); color: var(--ok); } .s-err .tl-n { background: var(--danger-weak); color: var(--danger); }
.s-warn .tl-n { background: var(--warn-weak); color: var(--warn); } .s-todo .tl-n, .next .tl-n { background: var(--brand); color: #fff; }
.tl-b { flex: 1; min-width: 0; } .tl-b h3 { margin: 2px 0 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-b p { margin: 2px 0 4px; }
.tl-st { font-size: 12px; font-weight: 600; color: var(--muted); }
.s-err .tl-st { color: var(--danger); } .s-ok .tl-st { color: var(--ok); } .s-warn .tl-st { color: var(--warn); }
.tl-so { font-size: 13.5px; color: #334155; } .tl-r { color: var(--danger); }
ul.tl-items { list-style: none; margin: 10px 0 0 48px; padding: 0; display: grid; gap: 4px; }
ul.tl-items li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 8px; border-radius: 8px; background: #f8faf9; }
ul.tl-items li .dot { flex: 0 0 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: #e0a100; }
ul.tl-items li.lv-red .dot { background: var(--danger); } ul.tl-items li.lv-red { background: #fff6f6; }
.tl-msg { flex: 1; min-width: 0; }
.tl-acts { display: flex; gap: 8px; align-items: center; flex-shrink: 0; } .tl-acts a { font-size: 12.5px; }
.tl-more { margin: 6px 0 0 48px; }
.tl-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 0 48px; }
.tl-links { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tl-sec { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tl-sec input { width: 70px; display: inline-block; margin: 0; }
.tl-prog { margin: 10px 0 0 48px; display: grid; gap: 4px; }
.tl-desk-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; } .tl-desk h3 { margin: 0; }
.sb-nav a .tl-badge { margin-left: auto; background: var(--orange); }
.rail .sb-nav a .tl-badge { position: absolute; top: 4px; right: 6px; margin: 0; font-size: 10px; }
@media (max-width: 720px) {
  .tl-head { flex-direction: column; } .tl-ring { align-self: flex-start; }
  ul.tl-items, .tl-foot, .tl-more, .tl-prog { margin-left: 0; }
  ul.tl-items li { flex-wrap: wrap; } .tl-links { margin-left: 0; }
}
table.tkb td.doi { outline: 3px solid #e8890c; outline-offset: -3px; }   /* v6.7: ô thay đổi trong màn duyệt */
