/* ===== THEME (cùng hệ thiết kế với app Thi đua Đoàn – Đội) ===== */
:root[data-theme="dark"] {
  --bg:#0f0f1a; --bg-elev:#13131f; --surface:rgba(255,255,255,.04); --surface-2:rgba(255,255,255,.025);
  --surface-hover:rgba(255,255,255,.07); --border:rgba(255,255,255,.08); --border-soft:rgba(255,255,255,.04);
  --border-strong:rgba(255,255,255,.12); --input-bg:rgba(255,255,255,.06);
  --text:#e0e0e0; --text-strong:#fff; --text-soft:#aaa; --text-muted:#888; --text-faint:#5c5c6e;
  --bar-bg:rgba(15,15,26,.92); --popup-bg:rgba(26,26,46,.98); --option-bg:#1a1a2e;
  --shadow:none; --shadow-pop:0 8px 32px rgba(0,0,0,.5);
  --green:#86efac; --red:#fca5a5; --amber:#fbbf24; --indigo:#a5b4fc;
  --accent-text:var(--accent-300); --login-bg:var(--bg); color-scheme:dark;
}
:root:not([data-theme="dark"]), [data-theme="light"] {
  --bg:#f3f5fa; --bg-elev:#fff; --surface:#fff; --surface-2:#f8fafc; --surface-hover:#eef2f7;
  --border:#e3e7ee; --border-soft:#eef1f5; --border-strong:#d3d9e2; --input-bg:#fff;
  --text:#1f2937; --text-strong:#0f172a; --text-soft:#4b5563; --text-muted:#6b7280; --text-faint:#9ca3af;
  --bar-bg:rgba(255,255,255,.9); --popup-bg:#fff; --option-bg:#fff;
  --shadow:0 1px 3px rgba(15,23,42,.06); --shadow-pop:0 10px 30px rgba(15,23,42,.15);
  --green:#15803d; --red:#dc2626; --amber:#b45309; --indigo:#4f46e5;
  --accent-text:var(--accent-700); --login-bg:#f7f6f3; color-scheme:light;
}
:root { --accent:#3b82f6; --accent-rgb:59,130,246; --accent-600:#2563eb; --accent-700:#1d4ed8; --accent-900:#1e3a8a; --accent-300:#93c5fd; --accent-alt-rgb:45,212,191; }
[data-accent="green"]  { --accent:#22c55e; --accent-rgb:34,197,94;  --accent-600:#16a34a; --accent-700:#15803d; --accent-900:#14532d; --accent-300:#86efac; --accent-alt-rgb:56,189,248; }
[data-accent="teal"]   { --accent:#14b8a6; --accent-rgb:20,184,166; --accent-600:#0d9488; --accent-700:#0f766e; --accent-900:#134e4a; --accent-300:#5eead4; --accent-alt-rgb:244,114,182; }
[data-accent="sky"]    { --accent:#0ea5e9; --accent-rgb:14,165,233; --accent-600:#0284c7; --accent-700:#0369a1; --accent-900:#0c4a6e; --accent-300:#7dd3fc; --accent-alt-rgb:167,139,250; }
[data-accent="violet"] { --accent:#8b5cf6; --accent-rgb:139,92,246; --accent-600:#7c3aed; --accent-700:#6d28d9; --accent-900:#4c1d95; --accent-300:#c4b5fd; --accent-alt-rgb:244,114,182; }
[data-accent="pink"]   { --accent:#ec4899; --accent-rgb:236,72,153; --accent-600:#db2777; --accent-700:#be185d; --accent-900:#831843; --accent-300:#f9a8d4; --accent-alt-rgb:129,140,248; }
[data-accent="rose"]   { --accent:#e11d48; --accent-rgb:225,29,72;  --accent-600:#be123c; --accent-700:#9f1239; --accent-900:#4c0519; --accent-300:#fda4af; --accent-alt-rgb:52,211,153; }
[data-accent="orange"] { --accent:#f97316; --accent-rgb:249,115,22; --accent-600:#ea580c; --accent-700:#c2410c; --accent-900:#7c2d12; --accent-300:#fdba74; --accent-alt-rgb:56,189,248; }

*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
[hidden] { display:none !important; }
body { font-family:'Inter',system-ui,sans-serif; background:var(--bg); color:var(--text); min-height:100vh; min-height:100dvh; transition:background .2s,color .2s; -webkit-font-smoothing:antialiased; }
button, input, select, textarea { font-family:inherit; font-size:inherit; color:inherit; }
a { color:inherit; }

/* ===== LOGIN ===== */
.login-page { min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; background:
  radial-gradient(70% 80% at 0% 0%, rgba(var(--accent-rgb),.16), transparent 70%),
  radial-gradient(65% 75% at 100% 100%, rgba(var(--accent-alt-rgb),.14), transparent 70%), var(--login-bg); background-attachment:fixed; }
.auth-theme { position:fixed; top:20px; right:20px; z-index:5; box-shadow:var(--shadow); }
.login { flex:1; width:100%; max-width:1100px; margin:0 auto; padding:72px 40px 32px; display:grid; grid-template-columns:minmax(0,1fr) 420px; gap:72px; align-items:center; }
.login-logo { width:76px; height:76px; margin-bottom:30px; border-radius:22px; display:flex; align-items:center; justify-content:center; color:#fff;
  background:linear-gradient(150deg,var(--accent-600),var(--accent-700) 50%,var(--accent-900));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 14px 30px -8px rgba(var(--accent-rgb),.45); }
.login-logo svg { width:42px; height:42px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.login-kicker { margin-bottom:14px; font-size:13px; font-weight:700; letter-spacing:1.4px; text-transform:uppercase; color:var(--accent-text); }
.login-title { font-family:'Fraunces',Georgia,serif; font-size:clamp(36px,4.6vw,56px); line-height:1.12; font-weight:700; letter-spacing:-.6px; color:var(--text-strong); margin-bottom:20px; }
.login-title .nowrap { white-space:nowrap; }
.login-lead { max-width:470px; font-size:16px; line-height:1.65; color:var(--text-muted); }
.login-points { list-style:none; margin-top:26px; display:grid; gap:10px; }
.login-points li { display:flex; align-items:center; gap:10px; font-size:14px; color:var(--text-soft); }
.login-points li::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px rgba(var(--accent-rgb),.18); flex-shrink:0; }
.login-card { width:100%; padding:38px 34px 30px; background:#fff; border:1px solid rgba(15,23,42,.05); border-radius:22px; box-shadow:0 30px 70px -28px rgba(15,23,42,.25), 0 2px 6px rgba(15,23,42,.04); }
[data-theme="dark"] .login-card { background:rgba(24,24,40,.82); border-color:var(--border); box-shadow:0 30px 70px -28px rgba(0,0,0,.7); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.login-card h2 { font-family:'Fraunces',Georgia,serif; font-size:30px; font-weight:700; letter-spacing:-.3px; color:var(--text-strong); margin-bottom:26px; }
.login-foot { padding:0 20px 24px; text-align:center; font-size:12px; color:var(--text-faint); }
.field { margin-bottom:18px; }
.field label { display:block; font-size:14px; font-weight:600; color:var(--text-strong); margin-bottom:8px; }
.input-wrap { position:relative; display:flex; align-items:center; }
.input-wrap input { width:100%; height:50px; padding:0 16px; background:#f3f4f6; border:1px solid transparent; border-radius:12px; font-size:15px; color:var(--text-strong); outline:none; transition:border-color .15s,box-shadow .15s,background .15s; }
.input-wrap.has-toggle input { padding-right:48px; }
[data-theme="dark"] .input-wrap input { background:rgba(255,255,255,.06); border-color:var(--border); }
.input-wrap input::placeholder { color:var(--text-faint); }
.input-wrap input:focus { background:var(--input-bg); border-color:var(--accent); box-shadow:0 0 0 4px rgba(var(--accent-rgb),.14); }
.input-wrap.invalid input { border-color:var(--red); box-shadow:0 0 0 4px rgba(239,68,68,.12); }
.pw-toggle { position:absolute; right:7px; width:36px; height:36px; display:flex; align-items:center; justify-content:center; background:none; border:none; border-radius:8px; color:var(--text-faint); cursor:pointer; }
.pw-toggle:hover { color:var(--text-soft); background:var(--surface-hover); }
.pw-toggle svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.pw-toggle .eye-off, .pw-toggle.on .eye-open { display:none; }
.pw-toggle.on .eye-off { display:block; }
.caps-hint { display:none; margin-top:6px; font-size:12px; font-weight:500; color:var(--amber); }
.caps-hint.show { display:block; }
.btn-submit { position:relative; width:100%; height:52px; margin-top:10px; display:flex; align-items:center; justify-content:center; gap:10px; background:var(--accent-700); color:#fff; border:none; border-radius:12px; font-size:16px; font-weight:700; cursor:pointer; transition:background .15s,box-shadow .15s,transform .15s; }
.btn-submit:hover { background:var(--accent-900); box-shadow:0 10px 24px -8px rgba(var(--accent-rgb),.55); }
.btn-submit:active { transform:translateY(1px); }
.btn-submit:focus-visible { outline:none; box-shadow:0 0 0 4px rgba(var(--accent-rgb),.35); }
[data-theme="dark"] .btn-submit { background:var(--accent-600); }
[data-theme="dark"] .btn-submit:hover { background:var(--accent-700); }
.btn-submit:disabled { cursor:default; opacity:.85; box-shadow:none; }
.spinner { display:none; width:16px; height:16px; border:2px solid rgba(255,255,255,.35); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
.busy > .spinner { display:block; }
@keyframes spin { to { transform:rotate(360deg); } }
.error-msg { display:none; margin-bottom:18px; padding:11px 14px; background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.25); border-left:3px solid var(--red); border-radius:8px; color:var(--red); font-size:13px; font-weight:500; }
.error-msg.show { display:block; animation:shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.auth-help { margin-top:22px; font-size:13px; color:var(--text-muted); text-align:center; }

/* ===== SHELL ===== */
:root { --sb-w:240px; }
.sidebar { position:fixed; inset:0 auto 0 0; width:var(--sb-w); background:var(--bg-elev); border-right:1px solid var(--border); display:flex; flex-direction:column; z-index:120; transition:transform .25s ease; overflow:hidden; }
.sb-brand { display:flex; align-items:center; gap:12px; padding:0 16px; height:64px; border-bottom:1px solid var(--border-soft); flex-shrink:0; }
.logo-icon { width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center; flex-shrink:0; color:#fff; background:linear-gradient(150deg,var(--accent-600),var(--accent-700) 50%,var(--accent-900)); box-shadow:inset 0 1px 0 rgba(255,255,255,.22), 0 0 0 1px rgba(var(--accent-rgb),.25), 0 4px 10px -2px rgba(var(--accent-rgb),.4); }
.logo-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.sb-brand-text { min-width:0; display:flex; flex-direction:column; gap:3px; }
.sb-brand-title { font-size:14.5px; font-weight:700; line-height:1.15; letter-spacing:-.01em; color:var(--text-strong); }
.sb-brand-sub { font-size:10.5px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--text-faint); white-space:nowrap; }
.sb-nav { flex:1; overflow-y:auto; padding:10px; }
.sb-section { font-size:11px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:.6px; padding:14px 10px 6px; }
.sb-item { display:flex; align-items:center; gap:12px; width:100%; padding:10px 14px; margin-bottom:2px; border-radius:10px; font-size:14px; font-weight:600; color:var(--text-muted); text-decoration:none; background:none; border:1px solid transparent; cursor:pointer; text-align:left; transition:background .15s,color .15s; }
.sb-item svg { width:18px; height:18px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sb-item:hover { background:var(--surface-hover); color:var(--text-strong); }
.sb-item.active { background:rgba(var(--accent-rgb),.12); color:var(--accent-text); border-color:rgba(var(--accent-rgb),.3); }
.sb-foot { display:flex; align-items:center; gap:10px; margin:8px 12px 12px; padding:10px 12px; border:1px solid var(--border-soft); border-radius:12px; background:var(--surface-2); flex-shrink:0; }
.sb-foot-icon { display:grid; place-items:center; width:30px; height:30px; border-radius:8px; background:rgba(var(--accent-rgb),.12); color:var(--accent-text); flex-shrink:0; }
.sb-foot-icon svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sb-foot-label { font-size:10.5px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--text-faint); }
.sb-foot-val { font-size:13px; font-weight:700; color:var(--text-strong); }
.sb-backdrop { display:none; }
.content { margin-left:var(--sb-w); min-height:100vh; transition:margin-left .25s ease; }
html.sb-collapsed .sidebar { transform:translateX(-100%); }
html.sb-collapsed .content { margin-left:0; }
.topbar { position:sticky; top:0; z-index:100; height:64px; display:flex; align-items:center; gap:12px; padding:0 20px; background:var(--bar-bg); backdrop-filter:blur(16px); border-bottom:1px solid var(--border); }
.icon-btn { width:38px; height:38px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; background:var(--surface); border:1px solid var(--border); border-radius:10px; color:var(--text-soft); font-size:16px; cursor:pointer; transition:.15s; }
.icon-btn:hover { background:var(--surface-hover); color:var(--text-strong); }
.icon-btn svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.topbar-titles { flex:1; min-width:0; }
.topbar-title { font-size:16px; font-weight:800; color:var(--text-strong); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar-sub { font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar-right { display:flex; align-items:center; gap:8px; }
.menu { position:relative; }
.pop { position:absolute; top:calc(100% + 8px); right:0; min-width:230px; padding:14px; background:var(--popup-bg); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--shadow-pop); opacity:0; visibility:hidden; transform:translateY(-4px); transition:opacity .15s,transform .15s,visibility .15s; z-index:200; }
.menu.open .pop { opacity:1; visibility:visible; transform:none; }
.tm-label { font-size:11px; font-weight:700; letter-spacing:.6px; text-transform:uppercase; color:var(--text-muted); margin-bottom:8px; }
.tm-mode { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:3px; margin-bottom:14px; background:var(--surface-2); border:1px solid var(--border); border-radius:9px; }
.tm-mode button { height:32px; background:none; border:none; border-radius:7px; color:var(--text-soft); font-size:13px; font-weight:600; cursor:pointer; }
.tm-mode button.on { background:var(--surface); color:var(--text-strong); box-shadow:0 1px 3px rgba(0,0,0,.12); }
[data-theme="dark"] .tm-mode button.on { background:rgba(255,255,255,.1); }
.tm-swatches { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:14px; }
.tm-swatch { position:relative; aspect-ratio:1; width:100%; border-radius:50%; border:none; background:var(--sw); cursor:pointer; box-shadow:inset 0 0 0 1px rgba(0,0,0,.1); transition:transform .12s; }
.tm-swatch:hover { transform:scale(1.08); }
.tm-swatch.on { box-shadow:0 0 0 2px var(--popup-bg), 0 0 0 4px var(--sw); }
.tm-swatch.on::after { content:''; position:absolute; left:50%; top:46%; width:7px; height:12px; border:solid #fff; border-width:0 2.5px 2.5px 0; transform:translate(-50%,-50%) rotate(45deg); }
.tm-auto { display:flex; align-items:center; gap:8px; padding-top:12px; border-top:1px solid var(--border); font-size:13px; cursor:pointer; }
.tm-auto input { width:16px; height:16px; accent-color:var(--accent); }
.avatar { width:36px; height:36px; border-radius:50%; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; background:rgba(var(--accent-rgb),.18); color:var(--accent-text); font-weight:700; font-size:13px; border:none; cursor:pointer; text-transform:uppercase; }
.um-name { font-weight:700; color:var(--text-strong); font-size:14px; }
.um-role { font-size:12px; color:var(--text-muted); margin-bottom:12px; }
.um-item { display:block; width:100%; padding:9px 10px; border-radius:8px; border:none; background:none; text-align:left; font-size:13px; font-weight:600; color:var(--red); cursor:pointer; }
.um-item:hover { background:var(--surface-hover); }

/* ===== PAGE / CARD / FORM ===== */
.page { padding:24px; max-width:1180px; margin:0 auto; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; margin-bottom:20px; box-shadow:var(--shadow); }
.card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.card-title { font-size:16px; font-weight:700; color:var(--text-strong); display:flex; align-items:center; gap:10px; }
.step-no { width:26px; height:26px; border-radius:50%; display:inline-grid; place-items:center; font-size:13px; font-weight:800; background:rgba(var(--accent-rgb),.14); color:var(--accent-text); border:1px solid rgba(var(--accent-rgb),.3); }
.card-sub { font-size:13px; color:var(--text-muted); margin:-8px 0 16px; }
.empty-state { text-align:center; padding:40px 20px; color:var(--text-faint); font-size:14px; }
.form-row { display:grid; grid-template-columns:3fr 1.2fr .8fr 1fr; gap:14px; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--text-soft); margin-bottom:5px; }
.form-group input, .form-group select, .form-group textarea, .cell-input { width:100%; padding:10px 14px; background:var(--input-bg); border:1px solid var(--border-strong); border-radius:10px; font-size:14px; color:var(--text-strong); outline:none; transition:border-color .15s, box-shadow .15s; }
.cell-input { padding:8px 10px; border-radius:8px; font-size:13px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .cell-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(var(--accent-rgb),.14); }
select option { background:var(--option-bg); color:var(--text-strong); }
textarea { resize:vertical; }
::placeholder { color:var(--text-faint); }
.form-hint { font-size:12px; color:var(--text-faint); margin-top:6px; line-height:1.5; }
.btn-primary { padding:10px 22px; background:linear-gradient(135deg,var(--accent),var(--accent-600)); color:#fff; border:none; border-radius:10px; font-size:14px; font-weight:700; cursor:pointer; transition:.2s; display:inline-flex; align-items:center; gap:8px; }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 4px 15px rgba(var(--accent-rgb),.3); }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-ghost { padding:10px 18px; background:transparent; color:var(--text-soft); border:1px solid var(--border-strong); border-radius:10px; font-size:14px; font-weight:600; cursor:pointer; transition:.15s; }
.btn-ghost:hover { background:var(--surface-hover); color:var(--text-strong); }
.btn-sm { padding:5px 12px; border-radius:6px; font-size:12px; font-weight:600; cursor:pointer; border:1px solid transparent; }
.btn-edit { background:rgba(99,102,241,.12); color:var(--indigo); border-color:rgba(99,102,241,.25); }
.btn-del { background:rgba(239,68,68,.1); color:var(--red); border-color:rgba(239,68,68,.25); }
.btn-ok { background:rgba(34,197,94,.14); color:var(--green); border-color:rgba(34,197,94,.35); }
.btn-plain { background:var(--surface-hover); color:var(--text-soft); border-color:var(--border-strong); }
.btn-sm:hover { filter:brightness(1.15); }
.btn-danger { padding:10px 18px; background:#dc2626; color:#fff; border:none; border-radius:10px; font-size:14px; font-weight:700; cursor:pointer; }
.actions-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.grow { flex:1; }

/* ===== TABLE ===== */
.table-wrap { overflow-x:auto; }
.data-table { width:100%; border-collapse:separate; border-spacing:0; }
.data-table th { text-align:left; font-size:12px; font-weight:600; color:var(--text-muted); padding:10px 8px; border-bottom:1px solid var(--border); text-transform:uppercase; letter-spacing:.3px; white-space:nowrap; }
.data-table td { padding:8px; font-size:13px; border-bottom:1px solid var(--border-soft); vertical-align:middle; }
.data-table tbody tr:hover td { background:var(--surface-2); }
.data-table td.actions { text-align:right; white-space:nowrap; }
.matrix { min-width:880px; }
.matrix td { vertical-align:top; }
.matrix textarea.cell-input { min-height:38px; }

/* ===== STATS / CHIPS ===== */
.stat-row { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.stat { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px; min-width:0; box-shadow:var(--shadow); }
.stat .k { font-size:12px; color:var(--text-muted); font-weight:600; margin-bottom:6px; }
.stat .v { font-size:22px; font-weight:800; color:var(--text-strong); }
.stat .s { font-size:11px; color:var(--text-faint); margin-top:4px; }
.stat.warn .v { color:var(--amber); }
.badge { font-size:12px; background:var(--surface-hover); padding:2px 10px; border-radius:20px; color:var(--text-muted); font-weight:600; border:1px solid var(--border); white-space:nowrap; }
.lv { background:rgba(var(--c),.14); color:rgb(var(--c)); border-color:rgba(var(--c),.3); }
.lv-NB { --c:34,197,94; } .lv-TH { --c:14,165,233; } .lv-VD { --c:245,158,11; } .lv-VDC { --c:239,68,68; }
[data-theme="light"] .lv-NB { --c:21,128,61; } [data-theme="light"] .lv-TH { --c:3,105,161; } [data-theme="light"] .lv-VD { --c:180,83,9; } [data-theme="light"] .lv-VDC { --c:185,28,28; }
.section-label { font-size:12px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:.5px; margin:22px 0 10px 2px; display:flex; justify-content:space-between; align-items:center; }
.notice { display:flex; gap:12px; align-items:flex-start; padding:14px 16px; margin-bottom:20px; background:rgba(245,158,11,.1); border:1px solid rgba(245,158,11,.3); border-radius:12px; color:var(--amber); font-size:13px; }
.notice ul { margin:4px 0 0 18px; }
.notice button { margin-left:auto; background:none; border:none; color:inherit; cursor:pointer; font-size:18px; line-height:1; }

/* ===== QUESTIONS ===== */
.q { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px 18px; margin-bottom:12px; box-shadow:var(--shadow); }
.q.flag { border-color:rgba(245,158,11,.55); }
.qh { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
.qno { font-weight:800; color:var(--text-strong); margin-right:4px; }
.warn-box { background:rgba(245,158,11,.1); color:var(--amber); border:1px solid rgba(245,158,11,.3); padding:8px 12px; border-radius:8px; font-size:13px; margin-bottom:10px; }
.stem, .opt { white-space:pre-wrap; color:var(--text-strong); line-height:1.7; }
.opt { margin:2px 0 2px 18px; color:var(--text); }
.opt.ok { color:var(--green); font-weight:600; }
.answer-line { margin:8px 0 0 18px; color:var(--green); font-weight:600; white-space:pre-wrap; }
.q details { margin-top:10px; }
.q summary { cursor:pointer; font-size:13px; color:var(--text-muted); font-weight:600; }
.q details .stem { margin-top:6px; font-size:14px; color:var(--text); }
.q-actions { display:flex; gap:6px; margin-top:12px; flex-wrap:wrap; padding-top:12px; border-top:1px solid var(--border-soft); }
.q .form-group { margin-bottom:10px; }
.q .grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* ===== PROGRESS / TOAST / MODAL ===== */
.progress { margin-top:18px; }
.bar { height:8px; background:var(--surface-hover); border-radius:99px; overflow:hidden; }
.bar > i { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--accent),var(--accent-300)); border-radius:99px; transition:width .5s; }
.progress-txt { display:flex; justify-content:space-between; margin-top:8px; font-size:13px; color:var(--text-muted); }
#toasts { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:300; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; width:max-content; max-width:92vw; }
.toast { background:var(--popup-bg); border:1px solid var(--border-strong); border-radius:12px; padding:12px 18px; font-size:13px; font-weight:500; color:var(--text-strong); box-shadow:var(--shadow-pop); backdrop-filter:blur(20px); animation:rise .25s cubic-bezier(.22,1,.36,1); pointer-events:auto; }
.toast.err { border-color:rgba(239,68,68,.5); color:var(--red); }
.toast.ok { border-color:rgba(34,197,94,.5); }
@keyframes rise { from { transform:translateY(20px); opacity:0; } }
.modal-back { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:250; display:grid; place-items:center; padding:20px; animation:fade .15s; }
@keyframes fade { from { opacity:0; } }
.modal { width:100%; max-width:400px; background:var(--popup-bg); border:1px solid var(--border-strong); border-radius:16px; padding:24px; box-shadow:var(--shadow-pop); }
.modal h3 { font-size:17px; color:var(--text-strong); margin-bottom:8px; }
.modal p { font-size:14px; color:var(--text-muted); margin-bottom:20px; line-height:1.55; }
.modal .actions-row { justify-content:flex-end; }


/* ===== TABS CÁCH TẠO ĐỀ ===== */
.tabs { display:flex; gap:4px; padding:4px; margin-bottom:20px; background:var(--surface-hover); border:1px solid var(--border); border-radius:14px; overflow-x:auto; scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
.tab { flex:1 1 auto; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; border:1px solid transparent; border-radius:10px; background:none; color:var(--text-muted); font-size:13.5px; font-weight:600; white-space:nowrap; cursor:pointer; transition:background .15s,color .15s,box-shadow .15s; }
.tab svg { width:17px; height:17px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.tab:hover { color:var(--text-strong); }
.tab.on { background:var(--bg-elev); color:var(--accent-text); border-color:rgba(var(--accent-rgb),.3); box-shadow:0 1px 3px rgba(0,0,0,.12); }
[data-theme="light"] .tab.on { background:#fff; }
.tab:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(var(--accent-rgb),.35); }
.mode-card { border-color:rgba(var(--accent-rgb),.28); background:linear-gradient(180deg, rgba(var(--accent-rgb),.05), transparent 60%), var(--surface); }
.mode-head { display:flex; gap:14px; align-items:flex-start; margin-bottom:18px; }
.mode-ico { width:42px; height:42px; flex-shrink:0; border-radius:12px; display:grid; place-items:center; background:rgba(var(--accent-rgb),.14); color:var(--accent-text); border:1px solid rgba(var(--accent-rgb),.28); }
.mode-ico svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.mode-desc { margin-top:3px; font-size:13px; line-height:1.55; color:var(--text-muted); max-width:760px; }
.drop { display:flex; flex-direction:column; align-items:center; gap:4px; padding:28px 20px; text-align:center; border:1.5px dashed var(--border-strong); border-radius:14px; background:var(--surface-2); color:var(--text-muted); font-size:13px; cursor:pointer; transition:border-color .15s,background .15s; }
.drop svg { width:30px; height:30px; margin-bottom:6px; fill:none; stroke:var(--accent-text); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.drop b { color:var(--text-strong); font-size:14px; }
.drop:hover, .drop.over { border-color:var(--accent); background:rgba(var(--accent-rgb),.07); }
.drop-name { margin-top:8px; font-style:normal; font-weight:700; font-size:13px; color:var(--accent-text); }
.drop-name:empty { display:none; }
.or { display:flex; align-items:center; gap:12px; margin:16px 0; font-size:12px; font-weight:600; color:var(--text-faint); text-transform:uppercase; letter-spacing:.4px; }
.or::before, .or::after { content:''; flex:1; height:1px; background:var(--border); }
.mode-actions { margin-top:16px; }
.eg-label { margin:14px 0 8px; font-size:12px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:.5px; }
.eg-chips { display:flex; flex-wrap:wrap; gap:8px; }
.eg { padding:7px 14px; border-radius:20px; border:1px solid var(--border-strong); background:var(--surface); color:var(--text-soft); font-size:12.5px; font-weight:600; cursor:pointer; transition:.15s; text-align:left; }
.eg:hover { border-color:var(--accent); color:var(--accent-text); background:rgba(var(--accent-rgb),.07); }
.count-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-top:6px; }
.count-grid .span2 { grid-column:span 2; }
.src-banner { display:flex; align-items:center; gap:12px; padding:12px 14px; margin-bottom:16px; background:rgba(var(--accent-rgb),.09); border:1px solid rgba(var(--accent-rgb),.3); border-radius:12px; font-size:13px; color:var(--text); }
.src-banner svg { width:20px; height:20px; flex-shrink:0; fill:none; stroke:var(--accent-text); stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.src-banner b { color:var(--text-strong); }
.src-banner span { color:var(--text-muted); }
.src-banner .btn-sm { margin-left:auto; }
@media (max-width:700px) { .count-grid { grid-template-columns:1fr 1fr; } .tab { padding:10px 12px; } .mode-head { flex-direction:column; } }


/* ===== CẤU HÌNH AI ===== */
.card > .form-group { margin-bottom:16px; }
.secret { position:relative; display:flex; align-items:center; }
.secret input { padding-right:48px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:13.5px; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:700; border:1px solid var(--border); background:var(--surface-hover); color:var(--text-muted); }
.pill::before { content:''; width:7px; height:7px; border-radius:50%; background:currentColor; }
.pill.ok { color:var(--green); background:rgba(34,197,94,.1); border-color:rgba(34,197,94,.3); }
.pill.warn { color:var(--amber); background:rgba(245,158,11,.1); border-color:rgba(245,158,11,.3); }
.ai-status { display:grid; gap:6px; margin-bottom:18px; padding:14px 16px; border:1px solid var(--border-soft); border-radius:12px; background:var(--surface-2); font-size:13px; color:var(--text-muted); }
.ai-status .row { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.ai-status b { color:var(--text-strong); font-weight:600; }
.mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
.test-result { margin-top:14px; padding:12px 14px; border-radius:10px; font-size:13px; line-height:1.55; border:1px solid; }
.test-result.ok { color:var(--green); background:rgba(34,197,94,.08); border-color:rgba(34,197,94,.3); }
.test-result.bad { color:var(--red); background:rgba(239,68,68,.08); border-color:rgba(239,68,68,.3); }
.model-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.switch-row { display:flex; gap:14px; align-items:flex-start; margin-top:6px; padding-top:16px; border-top:1px solid var(--border-soft); cursor:pointer; }
.switch-row b { display:block; color:var(--text-strong); font-size:14px; }
.switch-row small { display:block; margin-top:2px; color:var(--text-muted); font-size:12.5px; line-height:1.5; }
.switch { position:relative; width:42px; height:24px; flex-shrink:0; margin-top:1px; }
.switch input { position:absolute; inset:0; opacity:0; cursor:pointer; z-index:1; }
.switch i { position:absolute; inset:0; border-radius:99px; background:var(--border-strong); transition:background .2s; }
.switch i::after { content:''; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .2s; }
.switch input:checked + i { background:var(--accent); }
.switch input:checked + i::after { transform:translateX(18px); }
.switch input:focus-visible + i { box-shadow:0 0 0 3px rgba(var(--accent-rgb),.35); }
.spinner.dark { border-color:var(--border-strong); border-top-color:var(--accent); }
.custom-models { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:2px 0 16px; padding:12px 14px; border:1px dashed var(--border-strong); border-radius:12px; background:var(--surface-2); }
.chips-label { font-size:12px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:.4px; margin-right:4px; }
.mchip { display:inline-flex; align-items:center; gap:6px; padding:4px 6px 4px 12px; border-radius:20px; border:1px solid var(--border-strong); background:var(--surface); font-size:12.5px; color:var(--text); }
.mchip button { width:20px; height:20px; border:none; border-radius:50%; background:none; color:var(--text-muted); font-size:15px; line-height:1; cursor:pointer; }
.mchip button:hover { background:rgba(239,68,68,.15); color:var(--red); }
@media (max-width:760px) { .model-grid { grid-template-columns:1fr; } }

/* ===== RESPONSIVE ===== */
@media (max-width:1000px) { .stat-row { grid-template-columns:repeat(2,1fr); } .form-row { grid-template-columns:1fr 1fr; } }
@media (max-width:900px) {
  .login { grid-template-columns:1fr; gap:28px; max-width:480px; padding:72px 20px 24px; align-items:start; }
  .login > .login-hero { text-align:center; }
  .login-logo { width:60px; height:60px; border-radius:18px; margin:0 auto 18px; }
  .login-logo svg { width:34px; height:34px; }
  .login-kicker { font-size:12px; margin-bottom:8px; }
  .login-title { font-size:30px; margin-bottom:0; }
  .login-lead, .login-points { display:none; }
  .login-card { padding:28px 22px 22px; border-radius:18px; }
  .login-card h2 { font-size:24px; margin-bottom:20px; }
  .sidebar { width:260px; transform:translateX(-100%); box-shadow:var(--shadow-pop); }
  html.sb-collapsed .sidebar { transform:translateX(-100%); }
  html.sb-open .sidebar { transform:none; }
  html.sb-open .sb-backdrop { display:block; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:110; }
  .content, html.sb-collapsed .content { margin-left:0; }
  .page { padding:16px 14px 80px; }
  .card { padding:18px; }
}
@media (max-width:600px) { .form-row, .q .grid2 { grid-template-columns:1fr; } .topbar { padding:0 12px; } }
