:root {
  --navy: #0b2357;
  --blue: #1676ea;
  --blue-2: #33b5ff;
  --teal: #13b8a6;
  --green: #0aa66f;
  --orange: #ff9b21;
  --red: #e6495f;
  --ink: #16223b;
  --muted: #66758f;
  --line: #dce7f5;
  --surface: #ffffff;
  --surface-2: #f5f9ff;
  --shadow: 0 20px 60px rgba(26, 68, 131, 0.12);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 3%, rgba(51,181,255,.18), transparent 32%),
    radial-gradient(circle at 93% 12%, rgba(19,184,166,.13), transparent 30%),
    #f3f8ff;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.splash { min-height: 100vh; display: grid; place-content: center; text-align: center; }
.splash h1 { margin: 14px 0 5px; color: var(--navy); }
.splash h1 span { color: var(--teal); }
.splash p { color: var(--muted); }
.brand-mark {
  width: 74px; height: 74px; border-radius: 24px; margin: auto;
  display: grid; place-items: center; color: #fff; font-size: 35px; font-weight: 800;
  background: linear-gradient(135deg, var(--navy), var(--blue-2));
  box-shadow: 0 18px 40px rgba(22,118,234,.3);
}
.loader { width: 42px; height: 42px; margin: 22px auto; border-radius: 50%; border: 4px solid #dce9f8; border-top-color: var(--blue); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-shell { min-height: 100vh; padding: 28px; display: grid; place-items: center; }
.auth-grid { width: min(1180px, 100%); display: grid; grid-template-columns: 1.08fr .92fr; gap: 26px; }
.auth-visual, .auth-card { background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); border-radius: 30px; overflow: hidden; }
.auth-visual { padding: 42px; position: relative; background: linear-gradient(145deg, #fff, #eaf5ff); }
.auth-visual::after { content:""; position:absolute; inset:auto -80px -120px auto; width:300px; height:300px; border-radius:50%; background:rgba(22,118,234,.1); }
.auth-logo { display:flex; align-items:center; gap:12px; color:var(--navy); font-size:24px; font-weight:800; }
.auth-logo .brand-mark { width:46px; height:46px; border-radius:15px; margin:0; font-size:22px; }
.auth-visual h1 { font-size: clamp(37px, 4vw, 62px); line-height: 1.04; color: var(--navy); max-width: 700px; margin: 48px 0 20px; letter-spacing:-.04em; }
.gradient-text { background: linear-gradient(90deg, var(--blue), var(--teal)); -webkit-background-clip:text; color:transparent; }
.auth-visual > p { font-size:18px; line-height:1.7; color:var(--muted); max-width:650px; }
.feature-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; margin-top:30px; }
.feature { background:rgba(255,255,255,.75); border:1px solid var(--line); border-radius:18px; padding:17px; display:flex; gap:12px; align-items:flex-start; }
.feature-icon { width:40px; height:40px; border-radius:13px; background:#e8f4ff; display:grid; place-items:center; font-size:20px; flex:0 0 auto; }
.feature strong { display:block; color:var(--navy); margin-bottom:4px; }
.feature small { color:var(--muted); line-height:1.4; }
.demo-frame { margin-top:28px; border-radius:22px; overflow:hidden; border:1px solid var(--line); box-shadow:0 12px 35px rgba(21,67,126,.12); }
.demo-frame img { width:100%; display:block; }
.auth-card { padding:34px; align-self:center; }
.auth-card h2 { color:var(--navy); font-size:28px; margin:10px 0 6px; }
.auth-card > p { color:var(--muted); margin:0 0 22px; }
.auth-tabs { display:flex; background:#eef5fd; padding:5px; border-radius:14px; margin-bottom:22px; }
.auth-tab { border:0; background:transparent; padding:10px 16px; border-radius:10px; color:var(--muted); font-weight:700; flex:1; }
.auth-tab.active { background:#fff; color:var(--blue); box-shadow:0 5px 18px rgba(28,92,162,.1); }
.form-grid { display:grid; gap:14px; }
.form-row { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.field label { display:block; font-size:13px; color:#40506d; margin:0 0 7px; font-weight:700; }
.field input, .field select, .field textarea {
  width:100%; border:1px solid #cfdced; background:#fbfdff; color:var(--ink); border-radius:13px; padding:13px 14px; outline:none; transition:.2s;
}
.field textarea { min-height:92px; resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--blue); box-shadow:0 0 0 4px rgba(22,118,234,.1); background:#fff; }
.btn { border:0; border-radius:13px; padding:12px 17px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; gap:8px; transition:.18s; text-decoration:none; }
.btn:hover { transform:translateY(-1px); }
.btn:disabled { opacity:.55; cursor:not-allowed; transform:none; }
.btn-primary { color:#fff; background:linear-gradient(135deg,var(--blue),#0d5ec9); box-shadow:0 10px 24px rgba(22,118,234,.22); }
.btn-teal { color:#fff; background:linear-gradient(135deg,var(--teal),#078c7e); }
.btn-light { color:var(--blue); background:#eaf4ff; }
.btn-soft { color:var(--navy); background:#f0f5fb; border:1px solid var(--line); }
.btn-danger { color:#fff; background:var(--red); }
.btn-block { width:100%; }
.btn-sm { padding:8px 11px; font-size:13px; border-radius:10px; }
.help { color:var(--muted); font-size:12px; line-height:1.5; }

.app-shell { min-height:100vh; display:grid; grid-template-columns:260px 1fr; }
.sidebar { position:sticky; top:0; height:100vh; background:linear-gradient(180deg,#082152,#0b397a); color:#fff; padding:22px 16px; display:flex; flex-direction:column; z-index:20; }
.sidebar-brand { display:flex; align-items:center; gap:11px; padding:8px 10px 23px; font-size:20px; font-weight:800; }
.sidebar-brand .brand-mark { width:42px; height:42px; border-radius:14px; margin:0; font-size:19px; background:linear-gradient(135deg,#22c6b5,#34aaff); }
.side-nav { display:grid; gap:7px; }
.nav-btn { border:0; background:transparent; color:rgba(255,255,255,.72); padding:12px 13px; border-radius:13px; text-align:left; display:flex; align-items:center; gap:11px; font-weight:600; }
.nav-btn:hover, .nav-btn.active { color:#fff; background:rgba(255,255,255,.12); }
.nav-icon { width:26px; text-align:center; font-size:18px; }
.sidebar-footer { margin-top:auto; border-top:1px solid rgba(255,255,255,.14); padding:17px 10px 4px; }
.user-mini { display:flex; align-items:center; gap:10px; }
.avatar { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; background:linear-gradient(135deg,#e8f6ff,#d9fff8); color:var(--navy); font-weight:800; border:1px solid rgba(255,255,255,.5); }
.user-mini strong { display:block; font-size:13px; }
.user-mini small { color:rgba(255,255,255,.6); font-size:11px; }
.main { min-width:0; }
.topbar { height:76px; background:rgba(255,255,255,.84); backdrop-filter:blur(14px); border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; padding:0 28px; position:sticky; top:0; z-index:15; }
.topbar h1 { margin:0; font-size:22px; color:var(--navy); }
.topbar-actions { display:flex; align-items:center; gap:10px; }
.mobile-menu { display:none; }
.content { padding:28px; max-width:1500px; margin:auto; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:23px; }
.page-head h2 { margin:0 0 6px; color:var(--navy); font-size:28px; letter-spacing:-.03em; }
.page-head p { margin:0; color:var(--muted); }

.banner { border-radius:var(--radius); padding:22px; display:flex; justify-content:space-between; gap:20px; align-items:center; margin-bottom:22px; }
.banner-active { background:linear-gradient(135deg,#dff9f4,#e8f5ff); border:1px solid #bcece2; }
.banner-locked { background:linear-gradient(135deg,#fff5df,#fffaf0); border:1px solid #f7db9d; }
.banner h3 { margin:0 0 6px; color:var(--navy); }
.banner p { margin:0; color:var(--muted); }
.grid { display:grid; gap:18px; }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px; box-shadow:0 9px 30px rgba(30,74,131,.06); }
.card-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.card-title h3 { margin:0; color:var(--navy); font-size:17px; }
.card-title a, .link-btn { border:0; background:transparent; color:var(--blue); font-weight:700; padding:0; text-decoration:none; }
.stat { position:relative; overflow:hidden; }
.stat::after { content:""; position:absolute; width:90px; height:90px; border-radius:50%; right:-25px; bottom:-35px; background:rgba(22,118,234,.07); }
.stat-icon { width:42px; height:42px; border-radius:14px; display:grid; place-items:center; background:#ebf5ff; font-size:21px; margin-bottom:16px; }
.stat-value { font-size:30px; font-weight:800; color:var(--navy); }
.stat-label { color:var(--muted); font-size:13px; margin-top:5px; }
.child-card { display:flex; flex-direction:column; gap:15px; }
.child-head { display:flex; align-items:center; gap:12px; }
.child-head .avatar { width:52px; height:52px; font-size:24px; }
.child-head h3 { margin:0 0 4px; color:var(--navy); }
.child-head p { margin:0; color:var(--muted); font-size:13px; }
.progress { height:9px; border-radius:999px; overflow:hidden; background:#e8eff8; }
.progress > span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,var(--teal),var(--blue)); }
.metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.metric { background:#f5f9ff; border-radius:12px; padding:10px; text-align:center; }
.metric strong { display:block; color:var(--navy); }
.metric small { color:var(--muted); font-size:11px; }
.actions { display:flex; flex-wrap:wrap; gap:8px; }
.badge { display:inline-flex; align-items:center; gap:5px; padding:6px 9px; border-radius:999px; background:#edf5ff; color:#2666ac; font-size:12px; font-weight:700; }
.badge-green { background:#e7f9f1; color:#087d57; }
.badge-orange { background:#fff2dd; color:#a55a00; }
.badge-red { background:#ffe8ec; color:#b72c43; }
.badge-gray { background:#eef2f6; color:#526176; }
.empty { padding:35px 18px; text-align:center; color:var(--muted); }
.empty-icon { font-size:38px; margin-bottom:10px; }

.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:15px; }
table { width:100%; border-collapse:collapse; min-width:760px; background:#fff; }
th, td { text-align:left; padding:13px 14px; border-bottom:1px solid #edf2f8; font-size:13px; vertical-align:top; }
th { background:#f7faff; color:#53637e; font-size:12px; text-transform:uppercase; letter-spacing:.04em; position:sticky; top:0; }
td strong { color:var(--navy); }

.package-card { position:relative; display:flex; flex-direction:column; }
.package-card.featured { border:2px solid var(--blue); box-shadow:0 18px 48px rgba(22,118,234,.14); }
.featured-label { position:absolute; right:16px; top:16px; background:linear-gradient(135deg,var(--blue),var(--teal)); color:#fff; padding:6px 10px; border-radius:999px; font-size:11px; font-weight:800; }
.package-name { color:var(--navy); font-size:20px; font-weight:800; }
.package-price { font-size:31px; color:var(--blue); font-weight:800; margin:14px 0 5px; }
.package-price small { font-size:13px; color:var(--muted); font-weight:500; }
.package-desc { color:var(--muted); line-height:1.6; min-height:52px; }
.package-list { padding:0; margin:16px 0 22px; list-style:none; display:grid; gap:9px; color:#44536d; font-size:13px; }
.package-list li::before { content:'✓'; color:var(--green); font-weight:800; margin-right:8px; }
.package-card .btn { margin-top:auto; }

.test-shell { max-width:920px; margin:auto; }
.test-question { margin-bottom:18px; }
.question-number { color:var(--blue); font-weight:800; font-size:12px; text-transform:uppercase; margin-bottom:8px; }
.question-text { font-size:17px; font-weight:700; color:var(--navy); line-height:1.5; }
.options { display:grid; gap:9px; margin-top:13px; }
.option { border:1px solid var(--line); border-radius:13px; padding:12px 13px; display:flex; gap:10px; align-items:flex-start; background:#fbfdff; transition:.15s; }
.option:hover { border-color:#8fc3ff; background:#f5faff; }
.option input { margin-top:3px; }
.result-score { width:140px; height:140px; margin:10px auto 20px; border-radius:50%; display:grid; place-items:center; background:conic-gradient(var(--teal) var(--pct), #e8eff8 0); position:relative; }
.result-score::after { content:""; position:absolute; width:104px; height:104px; border-radius:50%; background:#fff; }
.result-score strong { position:relative; z-index:2; font-size:28px; color:var(--navy); }
.skill-list { display:grid; gap:11px; }
.skill-row { display:grid; grid-template-columns:minmax(160px,1fr) 2fr 55px; align-items:center; gap:12px; font-size:13px; }

.chat-layout { display:grid; grid-template-columns:290px 1fr; gap:18px; min-height:650px; }
.chat-side { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:18px; }
.chat-main { background:#fff; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; display:flex; flex-direction:column; min-height:650px; }
.chat-header { padding:17px 19px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; background:#fbfdff; }
.chat-header h3 { margin:0; color:var(--navy); }
.chat-messages { padding:20px; flex:1; overflow:auto; background:linear-gradient(rgba(245,249,255,.82),rgba(255,255,255,.92)), radial-gradient(circle at 50% 30%,#dff3ff,transparent 50%); }
.msg { max-width:min(78%,680px); margin-bottom:12px; padding:12px 14px; border-radius:16px; line-height:1.58; white-space:pre-wrap; }
.msg.user { margin-left:auto; background:#dff6e9; border-bottom-right-radius:5px; }
.msg.ai { background:#fff; border:1px solid var(--line); border-bottom-left-radius:5px; box-shadow:0 6px 20px rgba(25,65,120,.06); }
.msg-meta { font-size:11px; color:var(--muted); margin-top:6px; }
.chat-input { border-top:1px solid var(--line); padding:13px; display:flex; gap:10px; background:#fff; }
.chat-input textarea { flex:1; resize:none; min-height:46px; max-height:130px; border:1px solid var(--line); border-radius:14px; padding:12px; outline:none; }
.chat-input textarea:focus { border-color:var(--blue); }
.subject-chip { width:100%; border:1px solid var(--line); padding:10px 12px; border-radius:12px; background:#fff; text-align:left; margin-bottom:8px; }
.subject-chip.active { border-color:var(--blue); background:#ebf5ff; color:var(--blue); font-weight:700; }

.mastery-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.mastery-item { border:1px solid var(--line); border-radius:15px; padding:14px; }
.mastery-item h4 { margin:0 0 10px; color:var(--navy); font-size:14px; }
.plan-item { display:flex; gap:13px; border-bottom:1px solid #edf2f8; padding:14px 0; }
.plan-item:last-child { border-bottom:0; }
.plan-order { width:34px; height:34px; border-radius:11px; background:#eaf4ff; color:var(--blue); display:grid; place-items:center; font-weight:800; flex:0 0 auto; }
.plan-item h4 { margin:0 0 5px; color:var(--navy); }
.plan-item p { margin:0; color:var(--muted); font-size:13px; line-height:1.5; }
.plan-item .actions { margin-left:auto; align-self:center; }

.modal-backdrop { position:fixed; inset:0; background:rgba(8,24,55,.55); backdrop-filter:blur(5px); z-index:100; display:grid; place-items:center; padding:18px; }
.modal { width:min(620px,100%); max-height:92vh; overflow:auto; background:#fff; border-radius:24px; box-shadow:0 30px 90px rgba(0,0,0,.28); }
.modal-head { padding:20px 22px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; }
.modal-head h3 { margin:0; color:var(--navy); }
.modal-body { padding:22px; }
.modal-close { border:0; background:#eef3f8; width:34px; height:34px; border-radius:10px; }
.payment-box { text-align:center; }
.qr { width:min(300px,90%); border-radius:16px; border:1px solid var(--line); margin:12px auto; display:block; }
.bank-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; text-align:left; margin:17px 0; }
.bank-item { background:#f5f9ff; border-radius:12px; padding:11px; }
.bank-item small { display:block; color:var(--muted); margin-bottom:3px; }
.bank-item strong { color:var(--navy); word-break:break-word; }
.code-box { background:#0c285c; color:#fff; border-radius:16px; padding:18px; text-align:center; font-size:30px; font-weight:800; letter-spacing:.15em; margin:15px 0; }

.toast { position:fixed; right:22px; top:22px; z-index:200; max-width:380px; padding:13px 16px; border-radius:13px; background:#132b57; color:#fff; box-shadow:0 14px 45px rgba(0,0,0,.22); transform:translateY(-20px); opacity:0; pointer-events:none; transition:.22s; }
.toast.show { opacity:1; transform:translateY(0); }
.toast.error { background:#b83248; }
.toast.success { background:#087d57; }
.loading-inline { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .8s linear infinite; }

.mobile-bottom { display:none; }
@media (max-width:1080px) {
  .auth-grid { grid-template-columns:1fr; max-width:760px; }
  .auth-visual { display:none; }
  .grid-4 { grid-template-columns:repeat(2,1fr); }
  .grid-3 { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:860px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:-280px; width:260px; transition:.22s; box-shadow:20px 0 60px rgba(0,0,0,.22); }
  .sidebar.open { left:0; }
  .mobile-menu { display:inline-flex; }
  .topbar { padding:0 16px; }
  .content { padding:18px 14px 90px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns:1fr; }
  .chat-layout { grid-template-columns:1fr; }
  .chat-side { display:flex; overflow:auto; gap:8px; }
  .subject-chip { width:auto; min-width:max-content; margin:0; }
  .mobile-bottom { position:fixed; display:flex; bottom:0; left:0; right:0; height:72px; background:rgba(255,255,255,.96); border-top:1px solid var(--line); z-index:50; justify-content:space-around; padding-bottom:env(safe-area-inset-bottom); }
  .mobile-bottom button { border:0; background:transparent; color:var(--muted); font-size:11px; display:grid; place-items:center; gap:2px; min-width:56px; }
  .mobile-bottom button span { font-size:20px; }
  .mobile-bottom button.active { color:var(--blue); font-weight:700; }
  .mastery-grid { grid-template-columns:1fr; }
}
@media (max-width:560px) {
  .auth-shell { padding:0; }
  .auth-card { border-radius:0; min-height:100vh; padding:25px 18px; }
  .form-row { grid-template-columns:1fr; }
  .page-head { flex-direction:column; }
  .banner { flex-direction:column; align-items:flex-start; }
  .metrics { grid-template-columns:1fr 1fr 1fr; }
  .skill-row { grid-template-columns:1fr 55px; }
  .skill-row .progress { grid-column:1/-1; grid-row:2; }
  .chat-main { min-height:72vh; }
  .msg { max-width:90%; }
  .bank-grid { grid-template-columns:1fr; }
  .topbar h1 { font-size:18px; }
}

/* V1.1.0: cổng truy cập độc lập */
.portal-home{max-width:1120px;margin:auto;padding:56px 22px;text-align:center}.portal-home>p{max-width:760px;margin:12px auto 34px;color:var(--muted);line-height:1.7}.portal-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.portal-card{display:block;text-align:left;background:#fff;border:1px solid var(--border);border-radius:22px;padding:26px;text-decoration:none;color:var(--text);box-shadow:var(--shadow);transition:.2s}.portal-card:hover{transform:translateY(-4px);border-color:#8db9ff}.portal-card>span{font-size:38px}.portal-card h2{margin:14px 0 8px}.portal-card p{color:var(--muted);min-height:52px}.portal-card b{color:var(--primary)}.student-shell{min-height:100vh;background:var(--bg)}.student-top{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;background:#fff;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:10}.list-row{display:flex;justify-content:space-between;gap:18px;padding:13px 0;border-bottom:1px solid var(--border)}
@media(max-width:820px){.portal-grid{grid-template-columns:1fr}.portal-home{padding-top:28px}.student-top{padding:12px;gap:10px}.student-top .auth-logo{font-size:16px}}

/* V1.2.0 - Cổng khách hàng thống nhất */
.customer-auth-shell{padding:32px 20px;background:radial-gradient(circle at 15% 20%,#dff2ff 0,transparent 34%),radial-gradient(circle at 88% 12%,#ddf8f5 0,transparent 30%),#f4f8ff}
.customer-auth-wrap{width:min(980px,100%);display:grid;gap:22px}
.customer-brand{text-align:center;display:grid;gap:10px;justify-items:center}
.customer-brand h1{margin:0;color:var(--navy);font-size:clamp(30px,4vw,48px);letter-spacing:-.04em}
.customer-brand p{margin:0;color:var(--muted);font-size:16px}
.customer-auth-card{width:min(760px,100%);margin:auto;padding:28px}
.role-tabs{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:26px}
.role-tab{border:1px solid var(--line);background:#f7faff;border-radius:18px;padding:16px;text-align:left;display:grid;grid-template-columns:auto 1fr;column-gap:10px;align-items:center;cursor:pointer}
.role-tab>span{grid-row:1/3;font-size:30px}.role-tab b{color:var(--navy);font-size:17px}.role-tab small{color:var(--muted)}
.role-tab.active{border-color:var(--blue);background:#eaf4ff;box-shadow:0 8px 24px rgba(22,118,234,.12)}
.login-head,.register-head{text-align:center;margin-bottom:20px}.login-head h2,.register-head h2{margin:0 0 7px;color:var(--navy)}.login-head p,.register-head p{margin:0;color:var(--muted)}
.back-link{display:inline-block;border:0;background:transparent;color:var(--blue);font-weight:700;margin-bottom:12px;cursor:pointer}.required{color:#d62d4b}.field small{display:block;color:var(--muted);margin-top:6px}.center{text-align:center}.auth-bottom{text-align:center;margin-top:4px}.customer-note{text-align:center;color:var(--muted);font-size:12px}
@media(max-width:640px){.customer-auth-shell{padding:14px}.customer-auth-card{padding:20px 16px;border-radius:22px;min-height:auto}.role-tabs{grid-template-columns:1fr}.customer-brand h1{font-size:30px}.customer-brand p{font-size:14px}}
