@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-0.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-1.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-2.woff2) format('woff2');unicode-range:U+1F00-1FFF;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-3.woff2) format('woff2');unicode-range:U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-4.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-5.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Roboto Condensed";font-style:italic;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-6.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-7.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-8.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-9.woff2) format('woff2');unicode-range:U+1F00-1FFF;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-10.woff2) format('woff2');unicode-range:U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-11.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-12.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Roboto Condensed";font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/roboto-condensed-13.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}

:root {
  /* Font dùng chung cho toàn bộ giao diện web (đăng nhập + quản trị + app). */
  --font-ui: "Roboto Condensed", Verdana, Geneva, Tahoma, sans-serif;
  --navy: #0d2b48;
  --navy-soft: #17426c;
  --navy-line: #1f4f7d;
  --red: #c0263a;
  --red-soft: #d94b5d;
  --bg: #eef3f9;
  --line: #d7e2ee;
  --line-strong: #c2d3e4;
  --text: #0d2b48;
  --muted: #6b8298;
  --ok: #1c7c4a;
  --warn: #a86400;
  --shadow-sm: 0 1px 2px rgba(13, 43, 72, 0.06);
  --shadow-md: 0 8px 24px rgba(13, 43, 72, 0.08);
  --shadow-lg: 0 24px 60px rgba(13, 43, 72, 0.16);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy-soft);
}

h1,
h2 {
  letter-spacing: -0.015em;
}

/* =========================================================
   ĐĂNG NHẬP — bố cục hai cột
   ========================================================= */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* ---------- Cột thương hiệu ---------- */

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 48px 52px;
  color: #fff;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(192, 38, 58, 0.28), transparent 62%),
    radial-gradient(760px 520px at 105% 108%, rgba(31, 79, 125, 0.72), transparent 62%),
    linear-gradient(158deg, #0a2138 0%, #0d2b48 42%, #123a61 100%);
}

/* Lưới mờ tạo chiều sâu, không dùng ảnh ngoài. */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 78%);
  pointer-events: none;
}

/* Vệt đỏ nhấn ở mép phải, nối hai cột. */
.auth-brand::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--red) 0%, rgba(192, 38, 58, 0.25) 55%, transparent 100%);
  pointer-events: none;
}

.auth-brand > * {
  position: relative;
  z-index: 1;
}

.brand-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.logo-badge img {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 8px;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.1;
}

.brand-tag {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.brand-body {
  margin: auto 0;
  padding: 40px 0;
  max-width: 460px;
}

.brand-headline {
  margin: 0;
  font-size: clamp(25px, 2.5vw, 33px);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-headline em {
  font-style: normal;
  color: var(--red-soft);
}

.brand-desc {
  margin: 16px 0 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
}

.feature-list {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  gap: 13px;
}

.feature {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
}

.feature svg {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  padding: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  stroke: #7ee2a8;
  stroke-width: 2.6;
  fill: none;
}

.auth-brand-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.46);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 18px;
}

.auth-brand-foot .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ec98a;
  box-shadow: 0 0 0 3px rgba(78, 201, 138, 0.18);
}

/* ---------- Cột biểu mẫu ---------- */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background:
    radial-gradient(720px 420px at 100% 0%, rgba(211, 226, 240, 0.85), transparent 68%),
    var(--bg);
}

.auth-form-wrap {
  width: 100%;
  max-width: 394px;
  animation: auth-in 0.45s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-mobile-brand .logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.auth-mobile-brand .logo-badge img {
  width: 33px;
  height: 33px;
}

.auth-mobile-brand .brand-name {
  color: var(--navy);
  font-size: 15px;
}

.auth-mobile-brand .brand-tag {
  color: var(--muted);
  font-size: 10px;
}

.auth-head h1 {
  margin: 0 0 8px;
  font-size: 27px;
  font-weight: 700;
}

.auth-head p {
  margin: 0 0 26px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- Ô nhập ---------- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--navy);
}

input,
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder {
  color: #9db0c2;
}

input:hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: #a9c0d6;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3.5px rgba(23, 66, 108, 0.16);
}

input[aria-invalid='true'] {
  border-color: var(--red);
  box-shadow: 0 0 0 3.5px rgba(192, 38, 58, 0.12);
}

/* Ô mật khẩu có nút hiện/ẩn */

.pw-wrap {
  position: relative;
}

.pw-wrap input {
  padding-right: 46px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.pw-toggle:hover {
  background: #eef3f9;
  color: var(--navy);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--navy-soft);
  outline-offset: 1px;
}

.pw-toggle svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
}

/* Hiện/ẩn icon mắt theo aria-pressed.
   Không dùng thuộc tính `hidden` cho <svg>: quy tắc CSS của tác giả
   (ví dụ display:inline-block) sẽ đè lên [hidden] của trình duyệt. */
.pw-toggle svg {
  display: none;
}

.pw-toggle[aria-pressed='false'] #icon-eye,
.pw-toggle[aria-pressed='true'] #icon-eye-off {
  display: block;
}

.caps {
  margin: 7px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warn);
}

/* ---------- Nút ---------- */

button {
  font: inherit;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy);
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
}

button:hover:not(:disabled) {
  border-color: var(--navy-soft);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 6px 16px rgba(13, 43, 72, 0.22);
}

button.primary:hover:not(:disabled) {
  background: var(--navy-soft);
  border-color: var(--navy-soft);
  box-shadow: 0 8px 22px rgba(13, 43, 72, 0.28);
}

button.primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(13, 43, 72, 0.22);
}

button.danger {
  color: var(--red);
  border-color: #eec4ca;
}

button.full {
  width: 100%;
}

button.primary.full {
  padding: 13px 16px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 9px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* .btn-spinner đặt display nên phải tự xử lý [hidden]. */
.btn-spinner[hidden] {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Thông báo ---------- */

.alert {
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
  display: none;
}

.alert.show {
  display: block;
}

.alert.error {
  background: #fdecee;
  border: 1px solid #f0c4ca;
  color: #8e1a28;
}

.alert.ok {
  background: #e9f7ef;
  border: 1px solid #b7e0c7;
  color: var(--ok);
}

.alert.warn {
  background: #fdf4e5;
  border: 1px solid #f0dcb5;
  color: var(--warn);
}

.auth-foot {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

/* =========================================================
   KHUNG QUẢN TRỊ
   ========================================================= */

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar .logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: none;
}

.topbar .logo-badge img {
  width: 30px;
  height: 30px;
}

.topbar .brand-name {
  font-size: 14px;
  letter-spacing: 0.12em;
}

.topbar .brand-tag {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
}

.topbar .spacer {
  flex: 1;
}

.topbar .who {
  font-size: 13px;
  opacity: 0.9;
}

.topbar-link {
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-link:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
}

.topbar button {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  padding: 7px 14px;
}

.topbar button:hover:not(:disabled) {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 16px 20px 0;
  flex-wrap: wrap;
}

.tabs button {
  border-radius: 9px;
}

.tabs button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

main {
  padding: 16px 20px 48px;
  max-width: 1180px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-size: 16px;
  margin: 0 0 4px;
}

.card .hint {
  margin-bottom: 16px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}

.wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  background: #f5f8fc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fbfe;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
}

.pill.on {
  background: #e9f7ef;
  color: var(--ok);
}

.pill.off {
  background: #fdecee;
  color: var(--red);
}

.pill.muted {
  background: #eef1f5;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  padding: 5px 10px;
  font-size: 12.5px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.inline-form .field {
  margin: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  width: min(440px, 92vw);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(13, 43, 72, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-body {
  padding: 22px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   MÀN HÌNH HẸP
   ========================================================= */

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  /* Ẩn cột thương hiệu lớn, chuyển logo lên đầu biểu mẫu. */
  .auth-brand {
    display: none;
  }

  .auth-mobile-brand {
    display: flex;
  }

  .auth-panel {
    padding: 28px 20px 40px;
    align-items: center;
  }

  .auth-form-wrap {
    max-width: 420px;
    margin: 0 auto;
  }

  .auth-head h1 {
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .auth-panel {
    padding: 20px 16px 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* admin-wide: trang quản trị rộng hơn, gọn và dễ đọc */
main {
  max-width: min(1720px, 96vw);
  padding: 18px 24px 56px;
  margin: 0 auto;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
}
/* Bảng: cho nội dung xuống dòng thay vì tràn ngang */
.wrap { overflow-x: auto; }
table { width: 100%; }
th, td { white-space: normal; vertical-align: middle; padding: 11px 12px; }
th { font-size: 11.5px; letter-spacing: 0.5px; }
td { font-size: 13.5px; }
/* Cột thao tác: gom nút thành hàng, không xuống dòng lộn xộn */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.2;
}
/* Bảng tài khoản: email rộng rãi, cột phụ gọn */
#users-body td:nth-child(1) { min-width: 230px; word-break: break-all; }
#users-body td:nth-child(2) { min-width: 150px; }
#users-body td:nth-child(5) { white-space: nowrap; }
#users-body td:nth-child(6) { min-width: 240px; }
/* Bảng nhật ký: chi tiết dài thì xuống dòng */
#logs-body td { word-break: break-word; }
/* Thẻ và nhãn gọn hơn */
.card { padding: 18px 20px; }
.card h2 { font-size: 15.5px; letter-spacing: 0.1px; }
.pill { padding: 3px 10px; font-size: 11.5px; }
/* Nút trong bảng không bị dính sát mép */
.wrap { border-radius: 12px; }
.wrap table { margin: 0; }
@media (max-width: 760px) {
  main { padding: 14px 12px 44px; }
  #users-body td:nth-child(1), #users-body td:nth-child(6) { min-width: 0; }
}
