/* ==========================================================================
   CTSS Console – lớp tương thích để app. & ops. dùng đúng design system
   schoolx.io.vn (style.css) nhưng tối ưu Typography (Be Vietnam Pro + Inter),
   phân cấp thị giác và mật độ thông tin khoa học, thoáng mắt.
   ========================================================================== */
:root { --zl:#7c3aed; --zl-soft:#f1ebff; --info:#0891b2; --info-soft:#e0f5fa; }
[data-theme=dark] { --zl:#b39dff; --zl-soft:#b39dff1f; --info:#5ad1e6; --info-soft:#5ad1e61f; }
/* Bí danh biến cũ (ctss.css / ops.css) để style inline trong template vẫn theo theme */
:root, [data-theme=dark] {
  --mute: var(--muted); --ink: var(--text); --ink-2: var(--text); --card: var(--surface); --r: var(--radius);
  --ph: var(--accent); --ph-bg: var(--accent-soft); --nt: var(--accent); --nt-bg: var(--accent-soft);
  --ok-bg: var(--ok-soft); --bad-bg: var(--bad-soft); --test: var(--warn); --test-bg: var(--warn-soft);
  --sys: var(--muted); --sys-bg: var(--surface2); --zl-bg: var(--zl-soft); --bk: var(--ok); --bk-bg: var(--ok-soft);
}

/* ---------- 1. Typography & Phân cấp thị giác chuẩn macOS (SF Pro) ---------- */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif !important;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}
button, input, select, textarea {
  font-family: inherit !important;
}
/* Chuẩn Apple HIG: chữ nhấn mạnh dùng Medium (500) hoặc Semibold (590/600), không dùng Bold (700) dày đặc */
b, strong {
  font-weight: 550;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[data-theme=dark] a:not(.btn):not(.nav a):not(.kpi) { color: #93c5fd; }
h1, h2, h3, h4 {
  margin: 0 0 .45em;
  line-height: 1.3;
  letter-spacing: -0.016em;
  font-weight: 600;
}
h3 { font-size: 16px; font-weight: 590; }
h4 { font-size: 14.5px; font-weight: 590; }
code, .mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 450;
}
code {
  background: var(--surface2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--text);
}
pre, .ops-pre {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  overflow: auto;
  max-height: 320px;
  margin: 8px 0 0;
  color: var(--text);
}
[x-cloak] { display: none !important; }
.tabular, .mono, .kpi b, .ops-kpi-val, .stat-val { font-variant-numeric: tabular-nums; }
.ops-muted { color: var(--muted); }
.ops-err { color: var(--bad); font-size: 13px; margin-top: 4px; }
.hint { font-size: 13px; }

/* ---------- Shell & Điều hướng ---------- */
.logo.txt { display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13.5px; letter-spacing: .02em; }
[data-theme=dark] .logo.txt { background: #fafafa; color: #0a0a0a; }
.logo.img { background: #fff; object-fit: contain; padding: 3px; }
.brand b { font-size: 15.5px; }
.brand span { font-size: 12px; }
.nav h6 { font-size: 11px; letter-spacing: .07em; font-weight: 600; opacity: .5; margin: 16px 10px 6px; }
.nav h6:first-child { margin-top: 6px; }
.nav a { position: relative; font-size: 14px; font-weight: 500; line-height: 20px; padding: 9.5px 12px; text-decoration: none !important; }
.nav a svg.i { width: 20px; height: 20px; display: block; flex: none; }
.nav a .lbl { display: inline-flex; align-items: center; line-height: 20px; }
.nav a:hover, .nav a:focus { text-decoration: none !important; }
.nav a.on { font-weight: 600; }
.nav a .cnt { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; line-height: 1.2; padding: 1.5px 8px; border-radius: 99px; background: rgba(255,255,255,.10); color: var(--side-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nav a .cnt.warn { background: rgba(245,158,11,.18); color: #fbbf24; }
.nav a .cnt.bad { background: rgba(239,68,68,.2); color: #fca5a5; }
.nav a.on .cnt { background: rgba(255,255,255,.22); color: #fff; }
@media (min-width: 901px) {
  .app.collapsed .nav a .cnt { display: none; }
  .app.collapsed .nav a.alert::after { content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
}
.sidefoot form { margin: 0; }
.sidefoot .acts { display: flex; gap: 4px; align-items: center; }
[data-theme-toggle] .i-sun { display: none; }
[data-theme=dark] [data-theme-toggle] .i-sun { display: block; }
[data-theme=dark] [data-theme-toggle] .i-moon { display: none; }
[data-theme-toggle]:hover svg { transform: rotate(25deg); }
[data-theme-toggle] svg { transition: transform .3s; }

/* Topbar tinh gọn – dùng breadcrumb ngữ cảnh thay vì lặp tiêu đề lớn */
.top { height: 58px; padding: 0 28px; }
.top h1 { font-size: 16px; font-weight: 600; color: var(--text); }
.top .crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .crumb-school { font-weight: 500; color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.top .crumb-sep { opacity: .45; }
.top .crumb-cur { color: var(--text); font-weight: 600; }
.top .user b { font-size: 13.5px; font-weight: 600; }
.top .user small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.15; }
.top .user span { line-height: 1.2; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 5px 11px; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; background: var(--surface2); }
@media (max-width: 1100px) { .status-pill { display: none; } .top .crumb-school, .top .crumb-sep { display: none; } }
.top-acts { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top .top-theme-btn {
  width: 38px; height: 38px; padding: 0;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.top .top-theme-btn:hover { background: var(--surface2); color: var(--text); }
.top .top-theme-btn svg.i { width: 18px; height: 18px; }
.user-menu { position: relative; }
.user.user-btn {
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 4px 12px 4px 4px;
  text-align: left;
  transition: background-color .15s, border-color .15s;
}
.user.user-btn:hover, .user.user-btn[aria-expanded=true] { background: var(--surface2); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.user.user-btn .user-meta { display: block; }
.user.user-btn .user-chev { width: 15px; height: 15px; color: var(--muted); transition: transform .2s var(--ease); }
.user.user-btn[aria-expanded=true] .user-chev { transform: rotate(180deg); }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.05);
  z-index: 30;
  animation: drop-in .16s var(--ease);
  transform-origin: top right;
}
[data-theme=dark] .user-dropdown { box-shadow: 0 14px 36px rgba(0,0,0,.45); }
.user-dropdown-hd { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.user-dropdown-hd b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-dropdown-hd small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.user-dropdown form { margin: 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text) !important;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.user-menu-item svg.i { width: 17px; height: 17px; color: var(--muted); }
.user-menu-item:hover { background: var(--surface2); }
.user-menu-item.danger { color: var(--bad) !important; }
.user-menu-item.danger svg.i { color: var(--bad); }
.user-menu-item.danger:hover { background: var(--bad-soft); }
@media (max-width: 900px) {
  .user .avatar { display: grid; }
  .user.user-btn { padding: 4px 8px 4px 4px; }
  .user.user-btn .user-meta { display: none; }
}
@media (max-width: 560px) { .top .combo { order: 3; flex: 1 1 100%; width: 100%; } }

/* Combobox chọn trường tinh tế hơn */
.combo .inp { height: 40px; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--surface2); border-radius: 9px; }
.combo .inp:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.combo-ic, .combo-chev { top: 11px; }
.combo-list a { display: flex; gap: 8px; align-items: center; width: 100%; padding: 10px 10px; border-radius: 8px; color: var(--text) !important; text-decoration: none !important; font-size: 14px; }
.combo-list a small { margin-left: auto; }
.combo-list a:hover, .combo-list a.cur { background: var(--accent-soft); color: var(--accent) !important; }
.combo-list a.on, .combo-list button.on { font-weight: 600; }
.combo-list .grp { padding: 8px 10px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.combo-list a small, .combo-list button small { color: var(--muted); font-size: 12px; }
.combo-list .combo-foot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.combo-list form { margin: 0; }

/* Sub-navigation cho Báo cáo */
.report-subnav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.report-subnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7.5px 15px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none !important;
  transition: background .15s, color .15s;
}
.report-subnav a svg.i { width: 16px; height: 16px; display: block; flex: none; }
.report-subnav a > span { display: inline-block; line-height: 20px; }
.report-subnav a:hover { color: var(--text); background: var(--surface2); }
.report-subnav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
[data-theme=dark] .report-subnav a.on { background: var(--side-active); color: var(--text); }

/* Toast cho Django messages */
.toast.success { border-left-color: var(--ok); }
.toast.info { border-left-color: var(--accent); }
.toast.warning { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }

/* ---------- Tiêu đề trang (pagehead) & Không gian chính ---------- */
.view { padding: 28px 32px 90px; transition: max-width .28s cubic-bezier(.77, 0, .175, 1), padding .28s cubic-bezier(.77, 0, .175, 1); }
.view.wide { max-width: 1520px; }
@media (min-width: 901px) { .app.collapsed .view.wide { max-width: 1840px; } }
@media (min-width: 901px) and (max-width: 1100px) { .view { padding: 22px 24px 90px; } }
@media (max-width: 900px) { .view { padding: 18px 16px 90px; } .top { padding: 10px 16px; height: auto; } }
@media (max-width: 700px) { .view { padding: 14px 12px calc(90px + env(safe-area-inset-bottom, 0px)); } }

.pagehead, .ws-top, .ops-page-hd {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.pagehead h2, .ws-top h1, .ops-page-hd h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.02em;
  font-weight: 600;
  line-height: 1.3;
}
.ws-top h1 code, .ops-page-hd h1 code { font-size: 14.5px; vertical-align: 1px; }
.pagehead p, .ws-top > div:first-child > div, .ops-page-sub {
  color: var(--muted) !important;
  font-size: 14px !important;
  margin: 4px 0 0;
  line-height: 1.5;
}
@media (max-width: 900px) { .ws-top .btn, .ops-page-hd .btn { flex: 1; } }

/* ---------- Thẻ, lưới ---------- */
.card { border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.03); }
.card:not(.tile):not(.svc):not(:has(> .bd)) { padding: 20px 22px; }
.card > .hd { padding: 18px 22px 0; }
.card > .bd { padding: 18px 22px 20px; }
.card + .card { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid2 > .card + .card, .grid3 > .card + .card { margin-top: 0; }
.ops-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.ops-panel + .ops-panel { margin-top: 16px; }
.ops-panel-hd { padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ops-panel-hd strong, .ops-panel-hd h3 { font-size: 15.5px; font-weight: 600; margin: 0; }
.ops-panel-hd form { margin: 0; }
.ops-panel-bd { padding: 16px 20px 20px; }
.ops-panel > .ops-table-wrap { padding: 8px 12px 12px; }
.ops-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ops-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ops-grid-main { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
.ops-grid-2 > .ops-panel + .ops-panel, .ops-grid-3 > .ops-panel + .ops-panel, .ops-grid-main > .ops-panel + .ops-panel { margin-top: 0; }
.ops-grid-2, .ops-grid-3, .ops-grid-main { margin-bottom: 16px; }
@media (min-width: 901px) and (max-width: 1050px) {
  .app:not(.collapsed) .grid2, .app:not(.collapsed) .grid3, .app:not(.collapsed) .ops-grid-2, .app:not(.collapsed) .ops-grid-3, .app:not(.collapsed) .ops-grid-main { grid-template-columns: 1fr; }
  .app.collapsed .grid3, .app.collapsed .ops-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) { .grid2, .grid3, .ops-grid-2, .ops-grid-3, .ops-grid-main { grid-template-columns: 1fr; } }

/* ---------- KPI → tile (tương tác lọc trực tiếp & giảm chói thị giác) ---------- */
.kpis, .ops-kpis, .ops-kpis-4, .ops-kpis-5 { display: grid; gap: 14px; margin-bottom: 18px; }
.kpis, .ops-kpis { grid-template-columns: repeat(6, 1fr); }
.ops-kpis-5 { grid-template-columns: repeat(5, 1fr); }
.ops-kpis-4 { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 901px) and (max-width: 1280px) { .app:not(.collapsed) .kpis, .app:not(.collapsed) .ops-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 901px) and (max-width: 1200px) { .app:not(.collapsed) .ops-kpis-5 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 901px) and (max-width: 1100px) { .app.collapsed .kpis, .app.collapsed .ops-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 901px) and (max-width: 1050px) { .app.collapsed .ops-kpis-5 { grid-template-columns: repeat(3, 1fr); } .app:not(.collapsed) .ops-kpis-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .kpis, .ops-kpis, .ops-kpis-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .ops-kpis-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .kpis, .ops-kpis, .ops-kpis-4, .ops-kpis-5 { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.kpi, .ops-kpi {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--text) !important;
  text-decoration: none !important;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s, background-color .18s;
}
a.kpi:hover, .ops-kpi:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--kc, var(--accent)) 45%, var(--line)) !important;
  box-shadow: 0 4px 12px rgba(15,23,42,.06);
}
a.kpi.active {
  background: color-mix(in srgb, var(--kc, var(--accent)) 7%, var(--surface));
  border-color: var(--kc, var(--accent)) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--kc, var(--accent)) 18%, transparent);
}
.kpi::before, .ops-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kc, transparent); opacity: .85; }
.kpi { flex-direction: column-reverse; justify-content: flex-end; }
.kpi span, .ops-kpi-lbl {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi b, .ops-kpi-val {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-kpi-val .pill { font-size: 12.5px; }
.ops-kpi-sub { color: var(--muted); font-size: 13px; }
.ops-kpi.warn { --kc: var(--warn); background: linear-gradient(0deg, var(--warn-soft), var(--warn-soft)), var(--surface); }
.ops-kpi.alert { --kc: var(--bad); background: linear-gradient(0deg, var(--bad-soft), var(--bad-soft)), var(--surface); }
.kpi.k-info { --kc: var(--accent); } .kpi.k-ok { --kc: var(--ok); } .kpi.k-warn { --kc: var(--warn); } .kpi.k-bad { --kc: var(--bad); } .kpi.k-zl { --kc: var(--zl); }

/* ---------- Pill → badge (dịu mắt, dễ quét) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface2);
  color: var(--muted);
  line-height: 1.35;
}
.p-ph { background: var(--accent-soft); color: var(--accent); }
[data-theme=dark] .p-ph { color: #93c5fd; background: #93c5fd1f; }
.p-ok, .p-bk { background: var(--ok-soft); color: var(--ok); }
.p-test, .p-wait, .p-warn, .p-nt { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-sys { background: var(--surface2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.p-zl { background: var(--zl-soft); color: var(--zl); }
.p-ok::before, .p-bad::before, .p-test::before, .p-warn::before, .p-wait::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Nút ---------- */
.btn { text-decoration: none !important; font-weight: 500; font-size: 14px; padding: 8px 15px; }
.btn.primary, .btn.pri, .btn.nt, .btn.school, .btn-pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 550; }
.btn.pri:hover, .btn.nt:hover, .btn.school:hover, .btn-pri:hover { background: var(--accent); filter: brightness(1.08); }
.btn.ok, .btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 550; }
.btn.test, .btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 550; }
.btn.bad, .btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 550; }
.btn.zl, .btn-zl { background: var(--zl); border-color: var(--zl); color: #fff; font-weight: 550; }
[data-theme=dark] .btn.ok, [data-theme=dark] .btn-ok, [data-theme=dark] .btn.test, [data-theme=dark] .btn-warn, [data-theme=dark] .btn.zl, [data-theme=dark] .btn-zl { color: #0a0a0a; }
.btn.ok:hover, .btn-ok:hover, .btn.test:hover, .btn-warn:hover, .btn.bad:hover, .btn-bad:hover, .btn.zl:hover, .btn-zl:hover { filter: brightness(1.08); }
.btn.ok:hover, .btn-ok:hover { background: var(--ok); } .btn.test:hover, .btn-warn:hover { background: var(--warn); }
.btn.bad:hover, .btn-bad:hover { background: var(--bad); } .btn.zl:hover, .btn-zl:hover { background: var(--zl); }
.btn-ghost { background: transparent; }
.btn-sm, .btn.sm { padding: 6.5px 13px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn svg.i { width: 16px; height: 16px; }

/* ---------- Form & Bộ lọc ---------- */
.fld { margin-bottom: 14px; }
.fgrid .fld { margin-bottom: 0; }
.fld label, .ops-field > label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.ops-field { margin-bottom: 14px; }
.ops-field input[type=text], .ops-field input[type=password], .ops-field input[type=email], .ops-field input[type=number],
.ops-field input[type=date], .ops-field input[type=url], .ops-field input[type=tel], .ops-field select, .ops-field textarea, .ops-input, .ops-input-sm {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; outline: none; transition: .15s;
}
.ops-input-sm { width: auto; height: 40px; }
.ops-field select, select.ops-input-sm { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' 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 10px center; background-size: 16px; }
.ops-field input:focus, .ops-field select:focus, .ops-field textarea:focus, .ops-input:focus, .ops-input-sm:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ops-field textarea { min-height: 90px; resize: vertical; }
.ops-field input[type=color] { width: 60px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.ops-field label:has(> input[type=checkbox]), label:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; cursor: pointer; }
.ops-filter-bar, .filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  margin-bottom: 16px;
}
.filter-bar .search-wrap { position: relative; flex: 1 1 280px; min-width: 220px; }
.filter-bar .search-wrap svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; pointer-events: none; }
.filter-bar .search-wrap .inp { padding-left: 36px; height: 40px; width: 100%; max-width: none; font-size: 14px; }
.filter-bar select.inp, .filter-bar input.inp { height: 40px; width: auto; min-width: 175px; font-size: 14px; }
.filter-bar .btn { height: 40px; padding: 0 15px; }
@media (max-width: 760px) {
  .filter-bar select.inp, .filter-bar input.inp, .filter-bar .btn,
  .ops-filter-bar .ops-input-sm, .ops-filter-bar .ops-input, .ops-filter-bar .btn { flex: 1 1 100%; width: 100%; min-width: 0 !important; max-width: none; }
}
.ops-filter-bar .btn { height: 40px; }
.ws-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ws-filter .inp { height: 40px; }
.ws-filter .btn { height: 40px; }
textarea.inp { font-family: inherit; font-size: 14.5px; }
textarea.inp.code, textarea[name=raw_json] { font-family: ui-monospace, Menlo, monospace !important; font-size: 13px !important; }
input[type=file].inp { padding: 7px 10px; }

/* ---------- Ghi chú / cảnh báo → banner ---------- */
.note, .ops-alert { display: block; padding: 13px 16px; border-radius: 12px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--text); font-size: 14px; line-height: 1.5; }
.note.blue, .ops-alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.note.ok, .ops-alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.note.bad, .ops-alert-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.ops-alert-warn { background: var(--warn-soft); }
.flash-list, .ops-messages { display: none; }

/* ---------- Bảng dữ liệu thoáng & phân cấp rõ ---------- */
.tbl, .ops-table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
.tbl { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.03), 0 4px 12px rgba(15,23,42,.025); padding: 6px 10px; }
.card .tbl { border: 0; box-shadow: none; padding: 0; background: transparent; }
.tbl table, .ops-table, .card table, .ops-panel table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th, .ops-table th, .card table th, .ops-panel table th {
  text-align: left;
  background: var(--surface2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.tbl th:first-child, .ops-table th:first-child, .card table thead th:first-child { border-radius: 9px 0 0 9px; }
.tbl th:last-child, .ops-table th:last-child, .card table thead th:last-child { border-radius: 0 9px 9px 0; }
.tbl td, .ops-table td, .card table td, .ops-panel table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.5;
}
.tbl tbody tr:last-child td, .ops-table tbody tr:last-child td, .card table tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td, .ops-table tbody tr:hover td, .card table tbody tr:hover td { background: var(--surface2); }
.tbl td b, .ops-table td b, .card table td b { font-weight: 550; color: var(--text); font-size: 15px; }
.who2 .av { width: 38px; height: 38px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.who2 .sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
table.mini th, table.mini td { padding: 10px 12px; font-size: 13.5px; }
.ops-row-alert td { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }
tr.changed td { background: var(--warn-soft) !important; }
.empty-row { text-align: center !important; color: var(--muted); padding: 28px !important; }
@media (max-width: 700px) {
  .ops-field input[type=text], .ops-field input[type=password], .ops-field input[type=email], .ops-field input[type=number],
  .ops-field input[type=date], .ops-field input[type=url], .ops-field input[type=tel], .ops-field select, .ops-field textarea,
  .ops-input, .ops-input-sm { font-size: 16px; min-height: 44px; }
  .ops-field textarea { min-height: 90px; }
  table.people.cardify thead { display: none !important; }
  table.people.cardify, table.people.cardify tbody, table.people.cardify tr, table.people.cardify td { display: block !important; width: 100% !important; }
  table.people.cardify tr { padding: 12px 14px !important; margin-bottom: 10px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: var(--surface) !important; }
  table.people.cardify td { border: 0 !important; padding: 4px 0 !important; text-align: left !important; min-height: 0 !important; }
  table.people.cardify td > div { min-width: 0 !important; max-width: 100%; }
  table.people.cardify td[data-label] > * { text-align: left !important; }
  table.people.cardify td:first-child, table.people.cardify td:first-child:empty + td { padding-bottom: 8px !important; margin-bottom: 4px !important; border-bottom: 1px solid var(--line) !important; }
  table.people.cardify td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-bottom: 1px; }
  table.people.cardify td[data-label]:first-child::before, table.people.cardify td:first-child:empty + td[data-label]::before { display: none !important; content: none !important; }
  table.people.cardify td:empty { display: none !important; }
  table.people.cardify tr:hover td { background: transparent !important; }
  table.people.mini:not(.cardify) { display: table !important; width: 100% !important; }
  table.people.mini:not(.cardify) thead { display: table-header-group !important; }
  table.people.mini:not(.cardify) tbody { display: table-row-group !important; }
  table.people.mini:not(.cardify) tr { display: table-row !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; }
  table.people.mini:not(.cardify) th, table.people.mini:not(.cardify) td { display: table-cell !important; width: auto !important; padding: 8px 10px !important; text-align: left !important; border-bottom: 1px solid var(--line) !important; }
  table.people.mini:not(.cardify) td[data-label]::before { display: none !important; content: none !important; }
  table.people.mini:not(.cardify) td[data-label] > * { text-align: left !important; }
  .tbl { padding: 0; border: 0; box-shadow: none; background: transparent; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ops-panel:not(:has(> .ops-panel-hd)):has(> .ops-table-wrap > table.cardify) { border: 0; box-shadow: none; background: transparent; }
  .ops-panel:not(:has(> .ops-panel-hd)):has(> .ops-table-wrap > table.cardify) > .ops-table-wrap { padding: 0; }
}

/* ---------- Tabs ---------- */
.ops-tabs, .tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.ops-tabs::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.ops-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 14px; line-height: 20px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.ops-tabs a:hover, .tabs button:hover { color: var(--text); }
.ops-tabs a.on, .tabs button.on { color: var(--accent) !important; border-color: var(--accent); font-weight: 600; }
.tabs button, .seg-tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer; }
.tabs button { padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.seg-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.seg-tabs button { padding: 7.5px 15px; border-radius: 7px; }
.seg-tabs button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.ops-tabs a svg.i, .tabs button svg.i, .seg-tabs button svg.i { width: 17px; height: 17px; display: block; flex: none; }
.ops-tabs a > span, .tabs button > span, .seg-tabs button > span { display: inline-block; line-height: 20px; }

/* ---------- Bố cục Tab 2 cột (Cột 1: Tab dọc, Cột 2: Nội dung) ---------- */
.ops-vtabs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.ops-vtabs-side {
  position: sticky;
  top: 76px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
}
.ops-vtabs-hd {
  padding: 6px 10px 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.ops-vtabs {
  display: grid;
  gap: 4px;
}
.ops-vtabs a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none !important;
  transition: background-color .15s, color .15s;
}
.ops-vtabs a svg.i { width: 17px; height: 17px; display: block; flex: none; }
.ops-vtabs a > span:not(.cnt) { flex: 1; min-width: 0; }
.ops-vtabs a .cnt {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--muted);
}
.ops-vtabs a:hover { color: var(--text); background: var(--surface2); }
.ops-vtabs a.on { background: var(--accent-soft); color: var(--accent) !important; font-weight: 600; }
.ops-vtabs a.on .cnt { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
[data-theme="dark"] .ops-vtabs a.on { background: var(--side-active); color: var(--text) !important; }
.ops-vtabs-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.ops-vtabs-main { min-width: 0; }
@media (max-width: 1280px) {
  .ops-vtabs-main .ops-kpis-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .ops-vtabs-layout { grid-template-columns: 1fr; gap: 14px; }
  .ops-vtabs-side { position: static; }
}

/* ---------- KV, tiến trình, bước ---------- */
.ops-kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.ops-kv dt, .kv dt { color: var(--muted); font-size: 14px; font-weight: 400; }
.ops-kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.kv { grid-template-columns: 135px 1fr; gap: 10px 14px; margin: 0; font-size: 14.5px; }
.kv dd { font-weight: 500; color: var(--text); word-break: break-word; }
.ops-prog { width: 100%; height: 7px; background: var(--surface2); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.ops-prog > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ops-prog > i.ok { background: var(--ok); } .ops-prog > i.warn { background: var(--warn); } .ops-prog > i.bad { background: var(--bad); }
.ops-school-chip { width: 38px; height: 38px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 11px; display: grid; place-items: center; flex: none; }
.ops-steps-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.ops-step-box { background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.ops-step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; margin-right: 6px; }
@media (max-width: 900px) { .ops-steps-3 { grid-template-columns: 1fr; } }

/* ---------- Collapsible details / Nhật ký thu gọn ---------- */
details.fold-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  margin-top: 16px;
  overflow: hidden;
}
details.fold-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  transition: background .15s;
}
details.fold-card > summary::-webkit-details-marker { display: none; }
details.fold-card > summary:hover { background: var(--surface2); }
details.fold-card > summary .fold-meta { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
details.fold-card > summary svg.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s var(--ease); }
details.fold-card[open] > summary { border-bottom: 1px solid var(--line); background: var(--surface2); }
details.fold-card[open] > summary svg.chev { transform: rotate(180deg); }
details.fold-card > .fold-bd { padding: 14px 20px 18px; }

/* ---------- Workspace: rà soát hồ sơ ---------- */
.split-review { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
@media (min-width: 1440px) { .app.collapsed .split-review { grid-template-columns: 400px 1fr; } }
@media (max-width: 1150px) { .app:not(.collapsed) .split-review { grid-template-columns: 1fr; } }
@media (min-width: 1025px) and (max-width: 1150px) { .app.collapsed .split-review { grid-template-columns: 320px 1fr; } }
@media (max-width: 1024px) { .split-review { grid-template-columns: 1fr; } }
.page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.page-tile { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface2); cursor: pointer; text-align: center; font-size: 13px; transition: border-color .15s, transform .15s; }
.page-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.page-tile img { width: 100%; height: 130px; object-fit: cover; border-radius: 7px; display: block; margin-bottom: 6px; }
.page-tile b { font-weight: 600; display: block; color: var(--text); }
.chkl { list-style: none; padding: 0; margin: 6px 0; }
.chkl li { padding: 7px 0; font-size: 14.5px; display: flex; gap: 8px; align-items: flex-start; border-bottom: 1px dashed var(--line); line-height: 1.5; }
.chkl li:last-child { border-bottom: 0; }
.ai-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fail-box { margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--bad-soft); }
.ws-lightbox { position: fixed; inset: 0; background: rgba(2,6,23,.86); backdrop-filter: blur(4px); z-index: 80; display: flex; flex-direction: column; padding: 16px; }
.ws-lightbox-bar { display: flex; justify-content: space-between; align-items: center; color: #fff; margin-bottom: 10px; gap: 10px; }
.ws-lightbox-stage { flex: 1; overflow: auto; display: grid; place-items: center; }
.ws-lightbox-stage img { max-width: 92vw; max-height: 82vh; border-radius: 8px; transition: transform .2s; }
.big-stat { font-size: 32px; font-weight: 700; letter-spacing: -.03em; color: var(--ok); margin: 6px 0; }
.sec-title { font-size: 16px; font-weight: 600; margin: 24px 0 12px; color: var(--text); }

/* ---------- Đăng nhập (login.css của schoolx) ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 14px; }
.login form { display: grid; gap: 14px; }
.login .brand { padding: 0 0 6px; color: var(--text); }
.login .brand b { color: var(--text); }
.login .brand span { color: var(--muted); opacity: 1; max-width: 280px; white-space: normal; }
.login h1 { margin: 0; font-size: 21px; font-weight: 600; }
.login label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
.login .err { color: var(--bad); font-size: 14px; }
.login .demo { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }
.login .demo ul { margin: 6px 0 0; padding-left: 18px; }
.login .theme-fab { position: fixed; top: 14px; right: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
@media (max-width: 700px) { .login { padding: 16px; align-items: start; padding-top: 10vh; } .login .login-card { padding: 22px; } }

@media print { .side, .top, .scrim, .toasts, .noprint { display: none !important; } .view { padding: 0; } }

/* ---------- Dashboard ops (tối giản, thoáng) ---------- */
.dash { max-width: 100%; }
.dash .ops-page-hd { margin-bottom: 32px; }
.dash-sec { margin-bottom: 36px; }
.dash-h { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 14px; }
.dash-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dash-link { font-size: 14px; font-weight: 600; }
.todo { display: grid; gap: 10px; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.todo-item form { margin: 0; }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dc, var(--muted)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dc, var(--muted)) 18%, transparent); }
.todo-item.bad { --dc: var(--bad); } .todo-item.warn { --dc: var(--warn); } .todo-item.info { --dc: var(--accent); }
.todo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-txt b { font-size: 15px; font-weight: 600; }
.todo-txt small { color: var(--muted); font-size: 13.5px; }
.allgood { display: flex; align-items: center; gap: 16px; padding: 22px 24px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); border-radius: var(--radius); }
.allgood-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-weight: 700; flex: none; }
.allgood b { display: block; font-size: 15px; font-weight: 600; } .allgood small { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text) !important; text-decoration: none !important; transition: border-color .2s, transform .2s var(--ease); }
a.stat:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-val small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.school-list { padding: 6px; }
.school-row { display: grid; grid-template-columns: auto 1fr 200px 100px; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 10px; color: var(--text) !important; text-decoration: none !important; }
.school-row + .school-row { border-top: 1px solid var(--line); }
.school-row:hover { background: var(--surface2); }
.school-row .pill { justify-self: end; }
.school-name { min-width: 0; display: flex; flex-direction: column; }
.school-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-name small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-quota { font-size: 12.5px; color: var(--muted); }
.school-quota b { color: var(--text); font-weight: 600; }
.school-empty { padding: 24px; text-align: center; }
@media (min-width: 1280px) { .app.collapsed .school-row { grid-template-columns: auto 1fr 260px 110px; } }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .school-row { grid-template-columns: auto 1fr auto; }
  .school-quota { display: none; }
  .todo-item { padding: 14px 16px; }
}

/* ---------- Phân hệ Tổ chức thi (4 bước Hội đồng thi) ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid4 > .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .grid4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid4 { grid-template-columns: 1fr; } }

.exam-ctx-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.exam-ctx-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exam-ctx-pick label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.exam-ctx-pick select.inp { width: auto; min-width: 240px; max-width: 420px; height: 38px; padding: 6px 32px 6px 12px; font-weight: 600; }
.exam-ctx-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

.exam-flow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 980px) { .exam-flow-grid { grid-template-columns: 1fr; } }
.exam-stage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.exam-stage-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow);
}
.exam-stage-card.is-done {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}
.exam-stage-hd { display: flex; align-items: flex-start; gap: 12px; }
.exam-stage-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex: none;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.exam-stage-card.is-active .exam-stage-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.exam-stage-card.is-done .exam-stage-num { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.exam-stage-meta { flex: 1; min-width: 0; }
.exam-stage-meta h3 { margin: 0; font-size: 16px; font-weight: 600; }
.exam-stage-role { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.exam-stage-summary {
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--surface2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.exam-stage-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); }
.exam-stage-tasks li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; }
.exam-stage-tasks li::before { content: "•"; color: var(--accent); font-weight: 700; }
.exam-stage-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portrait-box {
  width: 72px;
  height: 96px;
  border-radius: 9px;
  overflow: hidden;
  flex: none;
}
.portrait-box.is-photo { border: 1px solid var(--line); cursor: zoom-in; }
.portrait-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-box.is-empty {
  border: 1.5px dashed var(--line);
  background: var(--surface2);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
}
.mini-portrait {
  width: 34px;
  height: 45px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: none;
  display: block;
}
.mini-portrait-empty {
  width: 34px;
  height: 45px;
  border-radius: 6px;
  border: 1px dashed var(--line);
  background: var(--surface2);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  flex: none;
  line-height: 1.1;
}

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 12px; }
.room-chip {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.room-chip.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.room-chip-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-chip-acts { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }

.score-inp {
  width: 82px !important;
  text-align: center;
  padding: 7px 6px !important;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
}
.score-inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.score-inp.is-err { border-color: var(--bad) !important; background: var(--bad-soft) !important; color: var(--bad); }
.score-inp:disabled { opacity: .45; background: var(--surface2); cursor: not-allowed; }

.cand-picker {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 12px;
  background: var(--surface2);
}
.cand-picker label {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 400 !important;
  margin: 0;
}
.cand-picker label:last-child { border-bottom: 0; }

.dist-row { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.dist-bar { height: 10px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.dist-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.dist-bar > i.ok { background: var(--ok); }
.dist-bar > i.bad { background: var(--bad); }
