:root {
  --navy: #1a365d;
  --navy-2: #2a4365;
  --blue: #2b6cb0;
  --blue-50: #ebf4ff;
  --green: #2f855a;
  --green-50: #f0fff4;
  --orange: #dd6b20;
  --orange-50: #fffaf0;
  --red: #c53030;
  --red-50: #fff5f5;
  --ink: #1a202c;
  --ink-2: #4a5568;
  --ink-3: #718096;
  --line: #e2e8f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --R: #2f7d4f; --I: #2b6cb0; --A: #b83280; --S: #c05621; --E: #c53030; --C: #6b46c1;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .7em; }
small, .small { font-size: .85rem; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h3 { margin-bottom: 10px; }
.card.tight { padding: 12px 14px; }

.btn { appearance: none; border: 1px solid transparent; background: var(--navy); color: #fff; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; min-height: 40px; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--navy); border-color: #cbd5e0; }
.btn.secondary:hover { background: #f7fafc; filter: none; }
.btn.ghost { background: transparent; color: var(--navy); border-color: transparent; }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .88rem; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; color: var(--ink); }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: .82rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cbd5e0; border-radius: 9px; padding: 9px 11px; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .opt:focus-within { outline: 3px solid rgba(43, 108, 176, .28); outline-offset: 1px; border-color: var(--blue); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 4px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 17px; height: 17px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid #cbd5e0; background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .9rem; user-select: none; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: .78rem; font-weight: 600; background: #edf2f7; color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.orange { background: var(--orange-50); color: var(--orange); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.blue { background: var(--blue-50); color: var(--blue); }
.tcode { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: #fff; font-weight: 700; font-size: .82rem; }
.tcode.R { background: var(--R); } .tcode.I { background: var(--I); } .tcode.A { background: var(--A); } .tcode.S { background: var(--S); } .tcode.E { background: var(--E); } .tcode.C { background: var(--C); }
.codebig { font-size: 2.4rem; font-weight: 800; letter-spacing: .35em; color: var(--navy); }

.alert { border-radius: 10px; padding: 10px 14px; border: 1px solid; margin: 8px 0; }
.alert.info { background: var(--blue-50); border-color: #bee3f8; color: #2c5282; }
.alert.warn { background: var(--orange-50); border-color: #fbd38d; color: #7b341e; }
.alert.danger { background: var(--red-50); border-color: #feb2b2; color: #742a2a; }
.alert.ok { background: var(--green-50); border-color: #9ae6b4; color: #22543d; }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-2); background: #f7fafc; border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; position: sticky; top: 0; }
table.data td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #f7fafc; }
td.num, th.num { text-align: right; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--navy)); transition: width .3s; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi .l { color: var(--ink-2); font-size: .88rem; }
.kpi.red .v { color: var(--red); } .kpi.green .v { color: var(--green); } .kpi.orange .v { color: var(--orange); }

.modal-back { position: fixed; inset: 0; background: rgba(26, 32, 44, .55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 900px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.err { background: var(--red); }
.empty { text-align: center; color: var(--ink-3); padding: 28px 10px; }
.spinner { width: 22px; height: 22px; border: 3px solid #cbd5e0; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Trang học sinh ===== */
.s-top { background: linear-gradient(135deg, var(--navy), #2c5282); color: #fff; padding: 14px 16px; }
.s-top .in { max-width: 860px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.s-top .org { font-size: .8rem; opacity: .85; text-transform: uppercase; letter-spacing: .03em; }
.s-top .app { font-weight: 700; font-size: 1.05rem; }
.s-top .btn.ghost { color: #fff; }
.s-main { max-width: 860px; margin: 0 auto; padding: 16px; }
.login-box { max-width: 420px; margin: 6vh auto; }
.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 14px; align-items: center; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.step .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--blue-50); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex: none; }
.step .t { font-weight: 700; }
.step .d { color: var(--ink-2); font-size: .9rem; }
.step.done .ic { background: var(--green-50); color: var(--green); }
.step .arrow { margin-left: auto; color: var(--ink-3); font-size: 1.3rem; }

.q { padding: 14px 0; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: 0; }
.q .qt { font-weight: 600; margin-bottom: 8px; }
.q .qt .n { color: var(--ink-3); font-weight: 500; margin-right: 6px; }
.opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opts.seven { grid-template-columns: repeat(7, 1fr); }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 4px; border: 1px solid #cbd5e0; border-radius: 9px; font-size: .78rem; line-height: 1.2; background: #fff; transition: all .12s; }
.opt input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.q.missing .qt { color: var(--red); }
@media (max-width: 560px) {
  .opts { gap: 4px; }
  .opt span { min-height: 52px; font-size: .72rem; padding: 3px 2px; border-radius: 8px; }
  .opts.seven { grid-template-columns: 1fr; }
  .opts.seven .opt span { justify-content: flex-start; padding: 6px 12px; min-height: 36px; font-size: .88rem; }
  .s-main { padding: 12px; }
  .card { padding: 14px; }
  .sticky-bar { margin: 14px -14px -14px; }
}
.sticky-bar { position: sticky; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 10px 16px; margin: 16px -18px -18px; border-radius: 0 0 var(--radius) var(--radius); backdrop-filter: blur(4px); }

.typecard { border-left: 5px solid; }
.career { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.career .h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.career .fit { font-weight: 800; color: var(--navy); }
.career .meta { font-size: .82rem; color: var(--ink-2); margin-top: 4px; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 120px); height: calc(100dvh - 120px); min-height: 420px; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 6px 2px 10px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: normal; word-wrap: break-word; }
.bubble.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 .45em; } .bubble p:last-child { margin: 0; }
.bubble ul { margin: .2em 0 .5em; padding-left: 1.2em; }
.chat .composer { display: flex; gap: 8px; padding-top: 8px; }
.chat .composer textarea { min-height: 46px; max-height: 140px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }

/* ===== Trang quản trị ===== */
.a-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.a-side { background: var(--navy); color: #cbd5e0; padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.a-side .brand { color: #fff; font-weight: 700; padding: 4px 10px 14px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 10px; }
.a-side .brand small { display: block; font-weight: 400; opacity: .7; text-transform: uppercase; letter-spacing: .03em; font-size: .7rem; }
.a-side a { display: flex; align-items: center; gap: 10px; color: #e2e8f0; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: .93rem; }
.a-side a:hover { background: rgba(255,255,255,.08); }
.a-side a.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.a-side .sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .55; padding: 14px 12px 4px; }
.a-side .cnt { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 7px; font-weight: 700; }
.a-main { padding: 20px 24px 40px; min-width: 0; }
.a-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.a-head h1 { margin: 0; font-size: 1.35rem; }
.a-user { font-size: .85rem; color: var(--ink-2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; }
.filters select, .filters input { min-height: 38px; padding: 6px 10px; }
.a-burger { display: none; }
@media (max-width: 900px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-side { position: fixed; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .a-side.open { transform: none; }
  .a-burger { display: inline-flex; }
  .a-main { padding: 14px 16px 40px; }
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--navy); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.chart-box svg { display: block; margin: 0 auto; }
.transcript { max-height: 60vh; overflow-y: auto; background: var(--bg); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pill-filter { display: flex; gap: 6px; flex-wrap: wrap; }

/* Zalo: thẻ chuyển trang & kịch bản */
.ztabs{display:flex;gap:6px;flex-wrap:wrap;margin:12px 0 4px}
.ztabs button{border:1px solid var(--line,#e2e8f0);background:#fff;border-radius:999px;padding:8px 14px;font-weight:600;cursor:pointer;color:#334155}
.ztabs button.on{background:#0068ff;border-color:#0068ff;color:#fff}
.grid.g4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
@media (max-width:900px){.grid.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}
.kpi.orange .v{color:#d97706}.kpi.red .v{color:#dc2626}
.zscript.off{opacity:.55}
.zscript details{margin-top:8px}
.zprev{white-space:pre-wrap;background:#f1f5f9;border-radius:12px;padding:12px;font-family:inherit;font-size:.86rem;line-height:1.5;margin:8px 0 0;max-width:560px}
.switch{position:relative;display:inline-block;width:42px;height:24px}
.switch input{opacity:0;width:0;height:0}
.switch span{position:absolute;inset:0;background:#cbd5e1;border-radius:999px;transition:.2s;cursor:pointer}
.switch span::before{content:"";position:absolute;width:18px;height:18px;left:3px;top:3px;background:#fff;border-radius:50%;transition:.2s}
.switch input:checked+span{background:#0068ff}.switch input:checked+span::before{transform:translateX(18px)}
