:root {
  --ink: #14345d;
  --muted: #5a7484;
  --blue: #0a7ec9;
  --navy: #14345d;
  --teal: #0f9295;
  --cyan: #12b8c4;
  --jade: #0d9b7a;
  --gold: #d6930b;
  --red: #c51f2d;
  --line: rgba(20, 52, 93, .12);
  --glass: linear-gradient(155deg, rgba(255,255,255,.9), rgba(224,246,248,.62));
  --shadow: 0 20px 48px rgba(8,59,102,.13), inset 0 1px 0 rgba(255,255,255,.92);
  --shadow-lift: 0 26px 56px rgba(8,59,102,.18), inset 0 1px 0 #fff;
  /* Khung chrome đồng nhất header ↔ footer */
  --chrome: linear-gradient(165deg, #102a4a 0%, #14345d 28%, #0a5f8f 62%, #0c7a7e 100%);
  --chrome-deep: rgba(8, 28, 52, .35);
  --chrome-line: rgba(255, 255, 255, .16);
  --chrome-text: #f2f7fc;
  --chrome-muted: rgba(232, 241, 250, .78);
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --display: "Lexend", "Be Vietnam Pro", system-ui, sans-serif;
  --radius: 20px;
  --ease: cubic-bezier(.22,1,.36,1);
  --side-w: 268px;
  --field-h: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  position: relative; min-height: 100vh; color: var(--ink); font: 15px/1.5 var(--font);
  background:
    radial-gradient(920px 480px at 0% -10%, rgba(10,126,201,.16), transparent 58%),
    radial-gradient(780px 420px at 100% 0%, rgba(15,146,149,.16), transparent 55%),
    radial-gradient(640px 360px at 70% 100%, rgba(214,147,11,.08), transparent 50%),
    linear-gradient(180deg, #dce8f4 0%, #e8eef6 42%, #e4edf4 100%);
}
.ambient {
  pointer-events: none; position: fixed; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(5,44,74,.06) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
}
a { color: var(--blue); text-decoration: none; }
h1 { margin: 0 0 .35rem; font: 800 1.45rem/1.2 var(--display); letter-spacing: -.02em; }
h2 { margin: 0 0 .55rem; font-size: 1.05rem; }
.muted, .lede { color: var(--muted); }
.lede { margin: 0 0 1rem; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--chrome-line);
  background: var(--chrome);
  box-shadow: 0 14px 36px rgba(8, 28, 52, .28), inset 0 -1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.topbar-inner {
  width: min(1480px, 100%); min-height: 76px; margin: auto;
  padding: .55rem clamp(1rem, 2.5vw, 2rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .75rem; min-width: 0;
  text-decoration: none; color: var(--chrome-text);
}
.brand-logo {
  width: 52px; height: 52px; object-fit: contain; flex: 0 0 auto;
  border-radius: 16px; background: #fff; padding: .25rem;
  box-shadow: 0 10px 22px rgba(0,0,0,.22), inset 0 0 0 1.5px rgba(214,147,11,.45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; max-width: min(720px, 58vw); }
.brand-text strong {
  font-family: var(--display); font-size: clamp(.72rem, 1.15vw, .92rem); font-weight: 800;
  text-transform: uppercase; letter-spacing: .015em; color: #fff;
  display: block; line-height: 1.25;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.brand-text small {
  color: var(--chrome-muted); font-size: .72rem; font-weight: 600; margin-top: .18rem;
}
.nav-pill i { font-size: .95rem; }
.user-chip i { margin-right: .25rem; opacity: .85; }
.top-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.user-chip {
  padding: .45rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  color: var(--chrome-text);
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 0 0 1px var(--chrome-line);
}
.nav-pill {
  min-height: 42px; display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem;
  border: 0; border-radius: 999px; color: #fff; font: 800 .86rem var(--font); cursor: pointer;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
  box-shadow: inset 0 0 0 1px var(--chrome-line), 0 8px 18px rgba(0,0,0,.12);
  transition: transform .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.nav-pill:hover {
  transform: translateY(-2px); color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.26), rgba(255,255,255,.12));
}
.nav-pill.active {
  color: #14345d;
  background: linear-gradient(180deg, #fff, #e8f6fa);
  box-shadow: 0 10px 22px rgba(0,0,0,.18), inset 0 1px 0 #fff;
}
.nav-pill.login-button {
  color: #14345d;
  background: linear-gradient(180deg, #ffe7a0, #d6930b);
  box-shadow: 0 10px 22px rgba(214,147,11,.28), inset 0 1px 0 rgba(255,255,255,.45);
}
.nav-pill.login-button:hover { color: #14345d; filter: brightness(1.04); }
.nav-pill.logout {
  color: #fff; background: linear-gradient(180deg, #ef6a74, var(--red));
  box-shadow: 0 12px 24px rgba(197,31,45,.28), inset 0 1px 0 rgba(255,255,255,.28);
}
.nav-pill svg { width: 17px; height: 17px; fill: currentColor; }

.shell {
  width: min(1480px, 100%); margin: 0 auto; padding: 1.1rem clamp(1rem, 2.5vw, 2rem) 2.5rem;
  display: grid; grid-template-columns: var(--side-w) 1fr; gap: 1.1rem; align-items: start;
}
.side-nav {
  position: sticky; top: 92px;
  border: 1px solid rgba(255,255,255,.72); border-radius: 24px;
  background: linear-gradient(165deg, rgba(255,255,255,.9), rgba(224,243,248,.72));
  box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 1rem .85rem 1.15rem;
}
.side-brand {
  margin: 0 .35rem 1rem; padding: .95rem 1rem; border-radius: 18px; color: #fff;
  background: linear-gradient(145deg, #0a7ec9, #0d9b7a 70%, #087a86);
  box-shadow: 0 14px 28px rgba(5,44,74,.22), inset 0 1px 0 rgba(255,255,255,.25);
}
.side-brand strong { display: block; font-size: .95rem; }
.side-brand span { display: block; margin-top: .25rem; color: rgba(255,255,255,.78); font-size: .72rem; font-weight: 600; }
.nav-label {
  margin: .85rem .55rem .35rem; color: var(--muted); font-size: .7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
.nav-item {
  display: flex; align-items: center; gap: .55rem; padding: .72rem .8rem; margin: .18rem 0;
  border-radius: 14px; color: var(--ink); font-weight: 700; font-size: .9rem;
  transition: background .15s var(--ease), transform .15s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.9); color: var(--blue); transform: translateX(2px); }
.nav-item.active {
  color: #fff; background: linear-gradient(135deg, #4eb8ef, var(--blue) 55%, #0a5f9a);
  box-shadow: 0 12px 24px rgba(8,118,201,.28);
}
.nav-ico {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px;
  background: rgba(8,118,201,.1); color: var(--blue); flex: 0 0 auto;
}
.nav-item.active .nav-ico { color: #fff; background: rgba(255,255,255,.18); }
.nav-ico svg { width: 16px; height: 16px; fill: currentColor; }

.content { min-width: 0; }
.glass, .panel, .card {
  border: 1px solid rgba(255,255,255,.72); background: var(--glass);
  box-shadow: var(--shadow); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border-radius: var(--radius);
}
.panel { padding: 1.15rem 1.25rem; margin-bottom: 1rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1rem;
}
.stat {
  padding: 1rem 1.05rem; border-radius: 18px; position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,.75);
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(230,246,250,.7));
  box-shadow: var(--shadow);
}
.stat::after {
  content: ""; position: absolute; inset: auto -20% -40% auto; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(18,184,196,.22), transparent 70%);
}
.stat .lbl { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat .num { margin-top: .25rem; font: 800 1.65rem/1.1 var(--display); color: var(--navy); }
.stat.a .num { color: #9a3412; }
.stat.b .num { color: #075985; }
.stat.c .num { color: #0f766e; }
.stat.d .num { color: #6d28d9; }

.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin-bottom: .9rem; }
.input, .select {
  min-height: 44px; padding: .55rem .9rem; border-radius: 14px; border: 0;
  color: var(--ink); background: rgba(255,255,255,.82); font: inherit; outline: none;
  box-shadow: inset 0 0 0 1px rgba(8,59,102,.12);
}
.input:focus, .select:focus { box-shadow: inset 0 0 0 1.5px rgba(10,126,201,.45), 0 0 0 4px rgba(10,126,201,.12); }
.btn {
  min-height: 44px; padding: .55rem 1.1rem; border: 0; border-radius: 14px; cursor: pointer;
  font: 800 .88rem var(--font); color: #fff;
  background: linear-gradient(180deg, #4eb8ef, var(--blue) 55%, #0a4f8f);
  box-shadow: 0 10px 22px rgba(10,126,201,.24), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .15s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost {
  color: var(--navy); background: linear-gradient(180deg, #fff, #eef7fd);
  box-shadow: 0 8px 18px rgba(8,59,102,.1), inset 0 0 0 1px rgba(8,118,201,.16);
}
.btn.jade { background: linear-gradient(180deg, #28c9b8, #0f9a8f 45%, #0a6f78); }

.table-wrap { overflow: auto; border-radius: 16px; }
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem;
}
table.data th, table.data td {
  padding: .72rem .8rem; text-align: left; border-bottom: 1px solid rgba(8,59,102,.08);
}
table.data th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: rgba(255,255,255,.55); position: sticky; top: 0;
}
table.data tr:hover td { background: rgba(255,255,255,.45); }
.badge {
  display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 800; letter-spacing: .02em;
  background: rgba(8,118,201,.1); color: var(--blue);
}
.badge.a { background: rgba(154,52,18,.12); color: #9a3412; }
.badge.b { background: rgba(7,89,133,.12); color: #075985; }
.badge.c { background: rgba(15,118,110,.12); color: #0f766e; }
.badge.d { background: rgba(109,40,217,.12); color: #6d28d9; }
.badge.warn { background: rgba(232,178,58,.2); color: #92400e; }
.badge.ok { background: rgba(13,155,122,.15); color: #0d9b7a; }

.login-wrap {
  min-height: calc(100vh - 90px); display: grid; place-items: center; padding: 1.5rem;
}
.login-card {
  width: min(440px, 100%); padding: 1.55rem 1.45rem 1.35rem; border-radius: 28px;
  border: 1px solid rgba(255,255,255,.78); background: var(--glass);
  box-shadow: var(--shadow-lift); backdrop-filter: blur(18px);
}
.login-hero { display: flex; gap: .9rem; align-items: center; margin-bottom: .45rem; }
.login-hero-icon {
  width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 18px; color: #fff; font-size: 1.35rem; line-height: 1;
  background: linear-gradient(145deg, #4eb8ef, var(--blue) 48%, var(--teal));
  box-shadow: 0 12px 24px rgba(8,118,201,.28), inset 0 1px 0 rgba(255,255,255,.4);
}
.login-hero h1 { margin: 0 0 .2rem; }
.login-hero .lede { margin: 0; font-size: .88rem; line-height: 1.4; }
.login-label {
  display: block; margin: .9rem 0 .38rem;
  font-size: .82rem; font-weight: 700; color: var(--muted); line-height: 1.2;
}
.login-field {
  position: relative; display: flex; align-items: center; min-height: var(--field-h);
}
.login-field-icon {
  position: absolute; left: 0; top: 0; bottom: 0; width: 2.6rem;
  display: grid; place-items: center;
  color: var(--blue); opacity: .85; pointer-events: none; z-index: 1;
  font-size: .95rem; line-height: 1;
}
.login-input {
  width: 100%; min-height: var(--field-h) !important; height: var(--field-h);
  padding: 0 2.75rem 0 2.6rem !important; line-height: 1.25;
  display: flex; align-items: center;
}
.login-pass-toggle {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  display: grid; place-items: center;
  background: transparent; color: var(--muted); cursor: pointer; font-size: .95rem; line-height: 1;
}
.login-pass-toggle:hover { color: var(--blue); background: rgba(10,126,201,.08); }
.login-captcha {
  display: grid; grid-template-columns: minmax(0,1fr) var(--field-h) 108px;
  gap: .45rem; align-items: center;
}
.login-captcha__q {
  height: var(--field-h); display: flex; align-items: center; justify-content: center;
  padding: 0 .7rem; border-radius: 14px;
  font: 800 1.05rem/1 var(--display); color: var(--navy); letter-spacing: .02em;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(224,246,248,.8));
  box-shadow: inset 0 0 0 1px rgba(8,118,201,.16);
}
.login-captcha__refresh {
  width: var(--field-h); height: var(--field-h); border: 0; border-radius: 14px;
  display: grid; place-items: center; cursor: pointer; color: var(--blue); font-size: 1rem; line-height: 1;
  background: linear-gradient(180deg, #fff, #eef7fd);
  box-shadow: 0 8px 16px rgba(8,59,102,.1), inset 0 0 0 1px rgba(8,118,201,.16);
  transition: transform .15s var(--ease);
}
.login-captcha__refresh:hover { transform: rotate(-20deg); }
.login-captcha__input {
  width: 100%; height: var(--field-h); min-height: var(--field-h) !important;
  text-align: center; font-weight: 800; padding: 0 .5rem !important;
}
.login-submit {
  width: 100%; margin-top: 1.15rem; min-height: var(--field-h);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.login-submit i { line-height: 1; }
.login-secure-note {
  margin-top: 1rem; padding: .85rem .9rem; border-radius: 16px; font-size: .8rem; color: var(--muted);
  background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px rgba(8,59,102,.08);
  display: grid; gap: .45rem;
}
.login-secure-note > div {
  display: flex; align-items: flex-start; gap: .55rem; line-height: 1.4;
}
.login-secure-note i {
  color: var(--teal); width: 1.1rem; flex: 0 0 auto; text-align: center;
  margin-top: .12rem; line-height: 1;
}
.pwd-rules {
  margin: .95rem 0 0; padding: .75rem .9rem .75rem 1.35rem; border-radius: 14px;
  background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px rgba(8,59,102,.08);
  color: var(--muted); font-size: .8rem; line-height: 1.45;
}
.pwd-rules li { margin: .2rem 0; }
.link-btn {
  border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: underline;
}
.alert {
  padding: .75rem .9rem; border-radius: 12px; margin-bottom: .9rem;
  background: rgba(197,31,45,.08); color: #9f1239; box-shadow: inset 0 0 0 1px rgba(197,31,45,.15);
  display: flex; gap: .55rem; align-items: flex-start; line-height: 1.4;
}
.alert i { margin-top: .15rem; flex: 0 0 auto; width: 1.1rem; text-align: center; }
.alert-ok {
  background: rgba(13,155,122,.1); color: #0b6b55; box-shadow: inset 0 0 0 1px rgba(13,155,122,.2);
}
.alert-warn {
  background: rgba(214,147,11,.12); color: #7a4e08; box-shadow: inset 0 0 0 1px rgba(214,147,11,.28);
}
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.pager {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; margin-top: 1rem; padding: .75rem .5rem .15rem;
}
.pager-info {
  font-size: .82rem; font-weight: 650; color: var(--muted); letter-spacing: .01em;
}
.pager-nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem;
}
.pager-num, .pager-nav-btn {
  min-width: 36px; height: 36px; padding: 0 .7rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border-radius: 10px; font-weight: 750; font-size: .86rem; color: var(--ink);
  text-decoration: none; background: rgba(255,255,255,.78);
  box-shadow: inset 0 0 0 1px rgba(8,59,102,.12);
}
.pager-num.active {
  color: #fff; background: linear-gradient(135deg, var(--blue), #0f9295);
  box-shadow: 0 6px 14px rgba(10,126,201,.28);
}
.pager-nav-btn.is-disabled, .pager-ellipsis {
  opacity: .42; cursor: default; pointer-events: none;
}

.note-soft {
  margin-top: .8rem; padding: .75rem .9rem; border-radius: 14px; font-size: .85rem; color: var(--muted);
  background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1px rgba(8,59,102,.08);
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side-nav { position: static; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-inner {
    flex-wrap: wrap;
    min-height: 0;
    gap: .65rem;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .brand-text { max-width: none; flex: 1; }
}
@media (max-width: 720px) {
  .brand-logo { width: 44px; height: 44px; border-radius: 12px; }
  .brand-text strong { font-size: .68rem; }
  .brand-text small { font-size: .65rem; }
  .user-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Trang chủ mobile: ẩn «Trang chủ» (đang đứng sẵn); hiện icon Quản trị trên header */
  .is-home .nav-pill-home {
    display: none !important;
  }
  .nav-pill span { display: none; }
  .nav-pill {
    min-width: 42px;
    padding: .5rem .7rem;
    justify-content: center;
  }
  .is-home .nav-pill-admin {
    display: inline-flex !important;
    background: linear-gradient(180deg, #4eb8ef, #0a7ec9 55%, #0a4f8f);
    color: #fff;
    border: 0;
    box-shadow: 0 8px 16px rgba(8, 118, 201, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
  }
  .is-home .nav-pill-admin:hover { color: #fff; }
  .login-wrap { padding: 1rem .75rem 1.5rem; min-height: calc(100vh - 120px); }
  .login-card { padding: 1.2rem 1rem 1.1rem; border-radius: 22px; }
  .login-captcha {
    grid-template-columns: minmax(0, 1fr) var(--field-h);
    grid-template-areas:
      "q refresh"
      "input input";
  }
  .login-captcha__q { grid-area: q; }
  .login-captcha__refresh { grid-area: refresh; }
  .login-captcha__input { grid-area: input; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data { min-width: 520px; font-size: .84rem; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .brand-copy small,
  .brand-text small { display: none; }
  .topbar-inner { padding: .5rem .75rem; }
  .input, .select, .login-input, .login-captcha__input {
    font-size: 16px; /* tránh iOS zoom khi focus */
  }
}
