:root {
  --cobalt: #1d5fe0; --cobalt-dark: #1748b0; --cobalt-soft: #e3edff;
  --bg: #f4f7fc; --surface: #fff; --border: #dde5f3;
  --text: #14213d; --muted: #64708a;
  --ok: #22a559; --warn: #e8a317; --danger: #d64545;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* đăng nhập */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand .mark { width: 38px; height: 38px; border-radius: 10px; background: var(--cobalt); display: grid; place-items: center; }
.brand .mark svg { width: 22px; height: 22px; }
.brand b { font-size: 18px; color: var(--cobalt); letter-spacing: .3px; }
.brand span { display: block; font-size: 12px; color: var(--muted); margin-top: -2px; }

/* khung chính */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { background: #f1f5fd; border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 6px; }
.nav-h { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; color: var(--muted); padding: 12px 10px 4px; }
.nav { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: 10px;
  cursor: pointer; color: var(--text); font-weight: 500; }
.nav:hover { background: #e7eefb; }
.nav.on { background: var(--cobalt-soft); color: var(--cobalt); font-weight: 700; }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.main { padding: 24px 28px 40px; min-width: 0; }
.head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 220px; }

/* thành phần */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .f { flex: 1; min-width: 130px; }
label.l { display: block; font-weight: 700; margin-bottom: 5px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cobalt); outline-offset: -1px; border-color: var(--cobalt); }
.btn { border: 0; background: var(--cobalt); color: #fff; padding: 9px 16px; border-radius: 9px; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--cobalt-dark); }
.btn:disabled { background: var(--border); cursor: default; }
.btn.ghost { background: #fff; color: var(--cobalt); border: 1px solid var(--cobalt); }
.btn.ghost:hover { background: var(--cobalt-soft); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #fafcff; }
tr:last-child td { border-bottom: 0; }
tr.sel td { background: var(--cobalt-soft); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6f9ff; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.b-ok { background: #dff5e8; color: #17803f; }
.b-warn { background: #fdf0d2; color: #8a6200; }
.b-bad { background: #fbe1e1; color: #a52a2a; }
.b-mute { background: #e9edf5; color: #55617a; }
code.k { font-family: Consolas, monospace; font-weight: 700; letter-spacing: .5px; }
.empty { padding: 22px; text-align: center; color: var(--muted); }
.err { color: var(--danger); margin-top: 10px; }
.two { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; align-items: start; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.chk input { width: auto; }

/* hộp thoại + thông báo */
.ov { position: fixed; inset: 0; background: rgba(15, 29, 38, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; padding: 22px; }
.modal h2 { margin-bottom: 12px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; right: 18px; bottom: 18px; background: #14213d; color: #fff; padding: 11px 16px; border-radius: 10px; z-index: 60; max-width: 360px; }
.toast.bad { background: var(--danger); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav-h, .side .foot { display: none; }
  .two { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .card.flush { overflow-x: auto; }
}

/* tiện ích bố cục (thay cho style nội dòng, vì CSP chặn style nội dòng) */
.sp { height: 10px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt14 { margin-top: 14px; }
.mb10 { margin-bottom: 10px; }
.btn.block { width: 100%; margin-top: 16px; }
.card.narrow { max-width: 460px; }
input.w240 { max-width: 240px; }
