:root { --brand:#2563eb; --bg:#0f172a; --side:#111827; --line:#e5e7eb; --muted:#6b7280; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; font:14px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color:#111827; background:#f3f4f6; }
h1,h2,h3 { margin:0; }
a { color:var(--brand); }

/* Login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#1e293b,#0f172a); }
.login-box { background:#fff; padding:34px; border-radius:14px; width:340px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.login-box h1 { font-size:20px; }
.login-box .muted { color:var(--muted); margin:4px 0 18px; font-size:13px; }
.login-box label { display:block; font-weight:600; margin:12px 0 5px; font-size:13px; }
.login-box input { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:8px; font-size:14px; }
.login-box button { width:100%; margin-top:20px; padding:12px; background:var(--brand); color:#fff; border:0; border-radius:8px; font-size:15px; font-weight:600; cursor:pointer; }
.login-box .hint { color:var(--muted); font-size:12px; text-align:center; margin:14px 0 0; }
.err { color:#dc2626; font-size:13px; margin-top:10px; min-height:18px; }

/* Layout */
.app { display:flex; min-height:100vh; }
.sidebar { width:230px; background:var(--side); color:#cbd5e1; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
.brand { padding:20px; font-size:18px; color:#fff; border-bottom:1px solid #1f2937; }
.brand b { color:#60a5fa; }
.site-pick { padding:16px 16px 6px; }
.site-pick label { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:#94a3b8; }
.site-pick select { width:100%; margin-top:6px; padding:9px; border-radius:8px; border:0; background:#1f2937; color:#fff; }
nav { padding:10px; flex:1; overflow:auto; }
nav a { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; color:#cbd5e1; text-decoration:none; border-radius:8px; margin-bottom:3px; cursor:pointer; }
nav a:hover { background:#1f2937; color:#fff; }
nav a.active { background:var(--brand); color:#fff; }
nav a .badge { background:#ef4444; color:#fff; border-radius:20px; font-size:11px; padding:1px 8px; }
.side-foot { padding:16px; border-top:1px solid #1f2937; display:flex; justify-content:space-between; align-items:center; }
.side-foot a { color:#94a3b8; text-decoration:none; font-size:13px; }
.link { background:none; border:0; color:#f87171; cursor:pointer; font-size:13px; }

.main { flex:1; min-width:0; }
.topbar { background:#fff; padding:16px 26px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; z-index:5; }
.topbar h2 { font-size:19px; }
.view { padding:26px; }

/* Cards / stats */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:16px; margin-bottom:24px; }
.stat { background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; min-width:0; box-shadow:0 1px 3px rgba(15,23,42,.04); }
.stat .n { font-size:26px; font-weight:800; color:#0f172a; overflow-wrap:anywhere; }
.stat .l { color:var(--muted); font-size:13px; margin-top:4px; }

.panel { background:#fff; border:1px solid var(--line); border-radius:12px; padding:0; overflow:hidden; margin-bottom:22px; }
.panel-head { padding:14px 18px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; }
.panel-head h3 { font-size:15px; }

table { width:100%; border-collapse:collapse; }
th,td { text-align:left; padding:11px 14px; border-bottom:1px solid #f1f5f9; font-size:13.5px; vertical-align:middle; }
th { background:#f9fafb; color:#374151; font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.3px; }
tr:hover td { background:#fafafa; }
td img { width:52px; height:40px; object-fit:cover; border-radius:6px; background:#eee; }

.btn { background:var(--brand); color:#fff; border:0; padding:9px 16px; border-radius:8px; cursor:pointer; font-size:13.5px; font-weight:600; }
.btn.ghost { background:#fff; color:#374151; border:1px solid var(--line); }
.btn.sm { padding:6px 11px; font-size:12.5px; }
.btn.danger { background:#dc2626; }
.tag { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; }
.st-MOI,.st-HIEN { background:#dbeafe; color:#1d4ed8; }
.st-XACNHAN { background:#dcfce7; color:#15803d; }
.st-CHOT { background:#fef9c3; color:#a16207; }
.st-HUY,.st-AN { background:#fee2e2; color:#b91c1c; }
.st-HOANTAT { background:#e0e7ff; color:#4338ca; }
.actions { display:flex; gap:6px; }

/* Forms */
.field { margin-bottom:14px; }
.field label { display:block; font-weight:600; margin-bottom:5px; font-size:13px; }
.field input,.field textarea,.field select { width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px; font:inherit; }
.field textarea { min-height:80px; resize:vertical; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.muted { color:var(--muted); }
.thumb-row { display:flex; gap:8px; align-items:center; }
.thumb-row img { width:60px; height:46px; object-fit:cover; border-radius:6px; }

/* Modal */
.modal { position:fixed; inset:0; background:rgba(15,23,42,.55); display:flex; align-items:center; justify-content:center; z-index:50; padding:20px; }
.modal-box { background:#fff; border-radius:14px; width:560px; max-width:100%; max-height:90vh; display:flex; flex-direction:column; }
.modal-head { padding:16px 20px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; }
.modal-body { padding:20px; overflow:auto; }
.modal-foot { padding:14px 20px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; }
.x { border:0; background:none; font-size:26px; line-height:1; cursor:pointer; color:#9ca3af; }

.toast { position:fixed; left:50%; bottom:28px; transform:translateX(-50%); background:#16a34a; color:#fff; padding:13px 24px; border-radius:9px; z-index:99; box-shadow:0 10px 30px rgba(0,0,0,.25); font-weight:500; }
.toast.bad { background:#dc2626; }
.empty { text-align:center; color:var(--muted); padding:40px; }
