/* ==========================================================================
   July CONTROL — Linear "midnight precision instrument" theme
   Dark canvas #08090a · hairline borders · Inter 400-510-590 · acid-lime CTA
   Quy ước Linear: radius buttons/inputs 6px · cards 12px · pills 9999px ·
   badges 4px · elevation bằng border hairline, không đổ bóng trang trí.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300..700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Ink-navy dark — mềm hơn đen tuyền, sang hơn */
  --color-void: #0a0e1a;
  --color-carbon: #101828;
  --color-obsidian: #1a2333;
  --color-graphite: #26314a;
  --color-smoke: #3b4763;
  --color-ash: #8b96b0;
  --color-fog: #a7b1c8;
  --color-mist: #cbd5e1;
  --color-bone: #e8edf5;
  --color-paper: #f4f7fb;
  --color-acid-lime: #5ea8ff;
  --color-acid-lime-hover: #7dbbff;
  --color-pulse-green: #34d399;
  --color-coral-red: #f87171;
  --color-signal-teal: #22d3ee;
  --color-iris-violet: #818cf8;
  --color-lavender: #a78bfa;
  --color-amber: #fbbf24;

  /* App tokens (map sang Linear) */
  --bg: #0a0e1a;
  --surface: #101828;
  --surface-hover: #1a2333;
  --sidebar-bg: #0d1322;
  --border: rgba(148, 163, 184, 0.14);
  --border-light: rgba(148, 163, 184, 0.08);
  --text: #f4f7fb;
  --text-secondary: #cbd5e1;
  --text-muted: #8b96b0;
  --text-light: #8b96b0;
  --primary: #5ea8ff;
  --primary-bg: rgba(94, 168, 255, 0.12);
  --primary-hover: #7dbbff;
  --on-primary: #06121f;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --skeleton: #1a2333;
  --elev: #1a2333;
  --elev-border: #3b4763;
  --elev-text: #ffffff;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px 0px;
  --shadow-lg: rgba(8, 9, 10, 0.6) 0px 4px 32px 0px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --lavender: #a78bfa;
  --text-primary: var(--text);
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0a0e1a;
  --surface: #101828;
  --surface-hover: #1a2333;
  --sidebar-bg: #0d1322;
  --border: rgba(148, 163, 184, 0.14);
  --border-light: rgba(148, 163, 184, 0.08);
  --text: #f4f7fb;
  --text-secondary: #cbd5e1;
  --text-muted: #8b96b0;
  --text-light: #8b96b0;
  --primary: #5ea8ff;
  --primary-bg: rgba(94, 168, 255, 0.12);
  --primary-hover: #7dbbff;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --skeleton: #1a2333;
  --elev: #1a2333;
  --elev-border: #3b4763;
  --elev-text: #ffffff;
  --shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px 0px;
  --shadow-lg: rgba(8, 9, 10, 0.6) 0px 4px 32px 0px;
}

[data-theme="light"] {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --sidebar-bg: #ffffff;
  --border: #e2e4e8;
  --border-light: #eef0f2;
  --text: #0f172a;
  --text-secondary: #3f444b;
  --text-muted: #8a8f98;
  --text-light: #8a8f98;
  --primary: #2563eb;
  --primary-bg: rgba(37, 99, 235, 0.08);
  --primary-hover: #1d4ed8;
  --on-primary: #ffffff;
  --success: #15803d;
  --success-bg: rgba(22, 163, 74, 0.1);
  --warning: #b45309;
  --warning-bg: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --skeleton: #e7e9ec;
  --elev: #ffffff;
  --elev-border: #dfe2e7;
  --elev-text: #0f172a;
  --shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px;
  --shadow-lg: rgba(0, 0, 0, 0.1) 0px 4px 32px 0px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: inherit;
}

/* Checkbox/radio giữ giao diện native (reset appearance:none ở trên làm chúng vô hình) */
input[type="checkbox"], input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  accent-color: #5ea8ff;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

body {
  font-family: var(--font);
  font-feature-settings: "cv01" on, "ss03" on, "zero" on;
  background-color: var(--bg);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 180ms ease, color 180ms ease;
}

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 510;
  letter-spacing: -0.012em;
  line-height: 1.2;
}

a { color: var(--primary); text-decoration: none; }

/* Monospace — issue IDs, UID, mã đơn */
.mono {
  font-family: var(--mono);
  letter-spacing: -0.013em;
  font-size: 0.92em;
}

/* Helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }
.danger-text { color: var(--danger) !important; }
.warning-text { color: var(--warning) !important; }
.success-text { color: var(--success) !important; }
.font-bold { font-weight: 590; }
.flex-1 { flex: 1; }
.sub-text { font-size: 12px; color: var(--text-muted); }
.desktop-only { display: block; }
.mobile-only { display: none; }

/* Status dot */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 200ms ease forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Buttons (Linear) ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
  user-select: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
[data-theme="light"] .btn:hover { background: var(--surface-hover); }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid transparent;
  font-weight: 510;
  padding: 10px 16px;
  font-size: 14px;
}
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-full { width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 9999px; }
.btn-fb, .btn-zalo {
  height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 510;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
}
.btn-fb:hover, .btn-zalo:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }

/* ============ Forms (Linear text input) ============ */
.form-group { margin-bottom: 12px; }
.form-label, .form-label-bold {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border-color 130ms ease, background 130ms ease;
}
[data-theme="light"] .form-control {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}
textarea.form-control { height: auto; }
.form-control:focus { border-color: var(--text-secondary); background: var(--surface-hover); }
.form-control::placeholder { color: var(--text-muted); }
.form-val { font-size: 14px; font-weight: 400; color: var(--text); }
.form-val.mono { font-size: 13px; }
.form-val.primary { color: var(--primary); font-weight: 510; }

/* Backdrop */
.sheet-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

/* Skeleton */
.skeleton {
  background: var(--skeleton);
  border-radius: 6px;
  animation: skeletonPulse 1.5s infinite ease-in-out;
}
.skeleton-card { height: 160px; width: 100%; }
.skeleton-line { height: 20px; width: 100%; }
.skeleton-line.medium { height: 40px; }
@keyframes skeletonPulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}

/* ============ User dropdown ============ */
.user-dropdown-container { position: relative; }
.user-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease;
  min-height: 38px;
}
.user-badge-wrap:hover { background: rgba(255, 255, 255, 0.05); }
.user-badge-wrap .user-name { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #202329; background: var(--elev, #202329);
  border: 1px solid #3f444b; border: 1px solid var(--elev-border, #3f444b);
  border-radius: 12px;
  box-shadow: rgba(8, 9, 10, 0.6) 0px 4px 32px 0px;
  z-index: 1000;
  display: none;
  padding: 6px 0;
}
.user-dropdown-menu.open { display: block; }
.user-dropdown-header { padding: 10px 14px; }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 400;
  color: #ffffff; color: var(--elev-text, #ffffff);
  cursor: pointer;
  text-decoration: none;
}
.user-dropdown-item:hover { background: rgba(128, 128, 128, 0.18); }
.user-dropdown-item.danger { color: var(--danger); }

/* Views */
.portal-view { display: none; }
.portal-view.active { display: block; }

/* Header nav tabs */
/* ==========================================================================
   SIDEBAR — component dùng chung (admin + portal user), chuyển từ admin.css
   ========================================================================== */
.sidebar-backdrop { display: none; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 248px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 510;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sidebar .brand-mark { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.s-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.s-nav-item svg, .s-nav-item i { width: 16px; height: 16px; flex-shrink: 0; }
.s-nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.s-nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 510;
  border-left-color: var(--primary);
  border-radius: 0 6px 6px 0;
}
.nav-section {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}
.s-nav-sub {
  display: block;
  padding: 8px 12px 8px 36px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}
.s-nav-sub:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.s-nav-sub.active { color: var(--primary); font-weight: 510; }
.nav-bottom-group { margin-top: auto; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 4px; }

.main-layout {
  margin-left: 248px;
  min-height: 100vh;
  background: var(--bg);
}

/* Header portal user: chừa rộng cho sidebar ở PC */
.has-sidebar .app-header {
  margin-left: 248px;
  padding: 0 max(16px, calc((100% - 1416px) / 2));
}

/* Có sidebar thì logo header dư thừa trên desktop (sidebar đã có logo) — tránh 2 logo */
@media (min-width: 900px) {
  .has-sidebar .app-header .header-brand { display: none !important; }
  body.public-page .sidebar:not(.drawer-open) { display: none !important; }
}

@media (max-width: 899px) {
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(280px, 85vw) !important;
    max-width: 320px !important;
    background: var(--sidebar-bg, #0d1322) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(-105%) !important;
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5) !important;
    z-index: 10001 !important;
    pointer-events: none !important;
  }
  .sidebar.drawer-open {
    display: flex !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }
  .main-layout { margin-left: 0; }
  .has-sidebar .app-header { margin-left: 0; padding: 0 14px; }
  .sidebar-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(10, 14, 26, 0.72) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }
  .sidebar-backdrop.show {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* ============ History filter system ============ */
.history-filter-system {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  overflow: visible !important;
}
.filter-top-row { display: flex; gap: 8px; width: 100%; overflow: visible !important; }
.search-box-wrap { position: relative; flex: 2; display: flex; align-items: center; }
.search-box-wrap .search-icon {
  position: absolute;
  left: 14px;
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.filter-search-input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  outline: none;
}
.filter-search-input::placeholder { color: var(--text-muted); }
.filter-search-input:focus { border-color: var(--text-secondary); }

/* Custom dropdown (user page) */
.custom-dropdown-container { position: relative; width: 260px; flex-shrink: 0; }
.custom-dropdown-trigger {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  font-family: inherit;
  user-select: none;
}
.custom-dropdown-trigger:hover { background: var(--surface-hover); }
.custom-dropdown-trigger.open { border-color: var(--text-secondary); }
.trigger-label {
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trigger-arrow { width: 16px; height: 16px; color: var(--text-muted); transition: transform 150ms ease; flex-shrink: 0; }
.custom-dropdown-trigger.open .trigger-arrow { transform: rotate(180deg); }
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 130ms ease, transform 130ms ease, visibility 130ms ease;
  padding: 4px 0;
}
.custom-dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.custom-dropdown-option {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.custom-dropdown-option:hover { background: rgba(255, 255, 255, 0.05); }
.custom-dropdown-option.selected { background: var(--primary-bg); color: var(--primary); font-weight: 510; }
.option-check { color: var(--primary); font-size: 14px; }

/* Filter chips → Linear pills */
.filter-chips-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-chips-scroll::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active { background: var(--primary-bg); color: var(--primary); font-weight: 510; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.chip-dot.success { background: var(--success); }
.chip-dot.primary { background: var(--primary); }
.chip-dot.danger { background: var(--danger); }

/* Timeline */
.timeline-month-group { margin-bottom: 24px; }
.timeline-month-header {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.timeline-month-header::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* Desktop visibility helpers */
.desktop-only-flex { display: none; }
.desktop-only-inline { display: none; }
@media (min-width: 900px) {
  .desktop-only-flex { display: flex !important; }
  .desktop-only-inline { display: inline !important; }
}

/* ============ App header — COMPONENT DÙNG CHUNG MỌI TRANG ============
   Đồng bộ 100% giữa Control (Admin, Box, User) và Public (Home, Mua Mon, Checktt, Support).
   Chiều cao cố định 58px, padding 0 20px (mobile 0 14px), 3 gạch bên trái, logo kế bên, không thụt thò khi chuyển trang. */
.app-header {
  position: sticky;
  top: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

/* Nút menu 3 gạch 36px — góc trái */
.header-menu-btn {
  display: none; /* Desktop ẩn, mobile hiện inline-flex */
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  transition: background 130ms ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.header-menu-btn:hover { background: rgba(255, 255, 255, 0.08); }
.header-menu-btn:active { background: var(--border); }
.header-menu-btn svg, .header-menu-btn i { width: 18px; height: 18px; pointer-events: none; }

.sidebar-close-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text-secondary);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close-btn:hover, .sidebar-close-btn:active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}
.sidebar-close-btn svg, .sidebar-close-btn i { width: 16px; height: 16px; pointer-events: none; }

/* Brand logo + chữ July CONTROL */
.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}
.header-brand:hover { opacity: 0.92; }

.app-header .brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}

/* Desktop Navigation — nằm ngay cạnh brand */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}
.header-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.header-nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.header-nav-link.active {
  color: var(--primary);
  background: var(--primary-bg);
  font-weight: 600;
}
/* Icon global flex alignment */
[class^="ri-"], [class*=" ri-"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  font-style: normal !important;
  vertical-align: middle !important;
}

.header-nav-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.header-nav-link svg, .header-nav-link i {
  width: 15px;
  height: 15px;
  font-size: 15px;
  line-height: 1;
}

.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}
.btn svg, .btn i {
  width: 15px;
  height: 15px;
  font-size: 15px;
  line-height: 1;
  margin: 0 !important;
}

.s-nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}
.s-nav-item svg, .s-nav-item i {
  width: 18px;
  height: 18px;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
  text-align: center;
}

/* Cụm actions bên phải: theme toggle, login, user dropdown */
.header-right,
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.desktop-only-flex {
  display: flex !important;
}
/* Cụm Admin gọn: chấm xanh + tên + mũi tên, không khung viền */
.app-header .user-badge-wrap {
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
}
.app-header .user-badge-wrap:hover { background: var(--surface-hover); }
.app-header .user-badge-wrap .status-dot {
  width: 7px;
  height: 7px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 16%, transparent);
}
.app-header .user-badge { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
/* Logo chữ J nền xanh đậm — dùng chung mọi header (admin + portal) */
.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
/* Logo J dạng SVG — tự co theo khung, nhận màu từ tile */
.brand-mark svg {
  width: 62%;
  height: 62%;
  display: block;
  fill: currentColor;
}
.brand-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  border: none;
  background: var(--surface-hover);
  color: var(--text-secondary);
  white-space: nowrap;
}
.header-contact-btn:hover { background: var(--border); color: var(--text); }
.header-contact-btn.fb, .header-contact-btn.zalo { color: var(--text-secondary); }
.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.header-icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.user-avatar-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Main container */
.dashboard-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* Welcome */
.dashboard-welcome-section { margin-bottom: 24px; }
.welcome-title {
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 2px;
  letter-spacing: -0.012em;
  line-height: 1.33;
}
.user-greeting-name { color: var(--text); }
.welcome-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }

/* Overview grid */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.stat-card-head { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.stat-icon-wrap {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}
.stat-icon-wrap.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon-wrap.success { background: var(--success-bg); color: var(--success); }
.stat-icon-wrap.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon-wrap.danger { background: var(--danger-bg); color: var(--danger); }
.stat-value {
  font-size: 32px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.13;
  letter-spacing: -0.022em;
  margin: 8px 0 2px;
}
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* Content grid */
.dashboard-content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
.section-card-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  overflow: visible !important;
}
.section-header { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 15px; font-weight: 510; letter-spacing: -0.011em; color: var(--text); }
.section-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Boxes grid */
.boxes-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

/* User box card */
.user-box-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.user-box-card.expired { border-color: var(--danger); }
.user-box-card.expiring { border-color: var(--warning); }
.ub-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.status-badge.active { background: var(--success-bg); color: var(--success); }
.status-badge.expiring { background: var(--warning-bg); color: var(--warning); }
.status-badge.expired { background: var(--danger-bg); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ub-tid {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 14px;
  word-break: break-all;
}
.ub-dates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.date-lbl { font-size: 10px; font-weight: 510; color: var(--text-muted); }
.date-val { font-size: 12px; font-weight: 400; color: var(--text-secondary); margin-top: 2px; }
.ub-progress-section { margin-bottom: 16px; }
.ub-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}
.progress-lbl { color: var(--text-muted); }
.progress-wrap { height: 6px; background: var(--border); border-radius: 9999px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 9999px; transition: width 300ms ease; background: var(--primary); }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }
.ub-actions-row { display: flex; gap: 8px; margin-top: auto; }
.ub-actions-row .btn { flex: 1; padding: 10px 16px; font-size: 14px; }

/* History timeline */
.history-timeline-container { height: auto; min-height: unset; }
.section-card-container.history-panel { height: auto; min-height: unset; }
.dashboard-timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 12px; }
.dashboard-timeline::before {
  content: '';
  position: absolute;
  left: 4px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; padding-left: 14px; }
.timeline-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  left: -12px; top: 5px;
}
.timeline-dot.success { background: var(--success); }
.timeline-dot.danger { background: var(--danger); }
.timeline-dot.primary { background: var(--primary); }
.timeline-body {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}
.tl-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.tl-date { font-size: 12px; color: var(--text-muted); }
.tl-status-badge { font-size: 12px; }
.tl-title { font-size: 13px; font-weight: 510; color: var(--text); }
.tl-details-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.tl-box-code { color: var(--text-muted); }
.tl-amount { font-weight: 510; color: var(--text); }

/* Empty states */
.empty-state-box, .empty-state-history, .empty-state {
  text-align: center;
  padding: 28px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.empty-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.empty-title { font-size: 14px; font-weight: 510; color: var(--text); }
.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

/* ============ Renewal modal ============ */
.renewal-modal-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  background: #202329; background: var(--elev, #202329);
  border: 1px solid #3f444b; border: 1px solid var(--elev-border, #3f444b);
  border-radius: 12px;
  box-shadow: rgba(8, 9, 10, 0.6) 0px 4px 32px 0px;
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  padding: 24px;
  overflow-y: auto;
}
.renewal-modal-dialog.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.modal-close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal-close-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.modal-header-section { margin-bottom: 18px; padding-right: 20px; }
.modal-title { font-size: 20px; font-weight: 510; color: var(--text); letter-spacing: -0.012em; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.modal-info-bar {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
}
.highlight-val { color: var(--text); }
.packages-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.package-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.package-card:hover { border-color: var(--text-secondary); }
.package-card.active { border-color: var(--primary); background: var(--primary-bg); }
.pkg-months { font-size: 12px; font-weight: 510; color: var(--text); }
.pkg-price { font-size: 14px; font-weight: 510; color: var(--primary); margin-top: 2px; }
.pkg-badge {
  position: absolute;
  top: -8px; right: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 510;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.pkg-badge.best { background: var(--success-bg); color: var(--success); }
.package-card { position: relative; }
.modal-summary-box {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.summary-lbl { font-size: 12px; color: var(--text-muted); }
.summary-amount { font-size: 20px; font-weight: 510; color: var(--primary); letter-spacing: -0.012em; }
.modal-actions-row { display: flex; gap: 8px; }
.qr-code-frame {
  display: inline-block;
  padding: 12px;
  background: #ffffff;
  border-radius: 12px;
  margin-bottom: 14px;
}
.qr-code-img { width: 190px; height: 190px; display: block; margin: 0 auto; border-radius: 6px; object-fit: contain; }
.payment-details-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  margin-bottom: 14px;
}
.pay-row { display: flex; justify-content: space-between; align-items: center; }
.pay-lbl { font-size: 12px; color: var(--text-muted); }
.pay-val-price { font-size: 16px; font-weight: 510; color: var(--primary); }
.pay-row-divider { height: 1px; background: var(--border); margin: 8px 0; }
.pay-val-code { font-size: 14px; font-weight: 400; color: var(--text); margin-top: 2px; }
.payment-waiting-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--warning);
  margin-bottom: 10px;
}
.timer-countdown { font-size: 13px; font-weight: 510; color: var(--text); }
.success-icon-badge {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

/* Mobile bottom nav (user page) */
.mobile-bottom-nav { display: none; }

/* ============ Login (Linear) ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  position: relative;
}
.login-theme-toggle {
  position: absolute;
  top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.login-theme-toggle:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.login-wrapper { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; }
.login-header-logo { text-align: center; margin-bottom: 24px; }
.login-logo-mark {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.login-brand-title {
  font-size: 24px;
  font-weight: 510;
  color: var(--text);
  margin: 0 0 4px 0;
  letter-spacing: -0.012em;
}
.login-brand-sub { font-size: 13px; color: var(--text-muted); margin: 0; }
.login-card-v2 {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.login-role-tab {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.login-role-tab.active { background: rgba(255, 255, 255, 0.05); color: var(--text); font-weight: 510; }
.input-password-wrap { position: relative; display: flex; align-items: center; }
.input-password-wrap input { padding-right: 42px; }
.btn-toggle-pwd {
  position: absolute;
  right: 8px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.btn-toggle-pwd:hover { color: var(--text); }

/* ============ Responsive ============ */
@media (max-width: 899px) {
  body { padding-bottom: 76px; }
  /* Mobile & Tablet: 3 gạch bên trái, logo kế bên, actions bên phải, padding 0 14px */
  .app-header {
    padding: 0 14px;
    gap: 10px;
  }
  .header-menu-btn { display: inline-flex !important; }
  .header-nav, .desktop-only-flex { display: none !important; }
  .social-links, .header-contact-btn { display: none !important; }

@media (max-width: 480px) {
  .app-header {
    padding: 0 10px;
    gap: 8px;
  }
  .app-header .header-brand {
    gap: 6px;
  }
  .app-header .brand {
    font-size: 14px;
  }
  .header-right {
    gap: 6px;
  }
  #headerAuthWrap .btn-sm {
    padding: 0 10px;
    font-size: 12.5px;
  }
}
  .dashboard-main-container { padding: 16px 16px 80px; width: 100%; max-width: 100%; }
  .welcome-title { font-size: 24px; }
  .welcome-subtitle { font-size: 13px; margin-bottom: 14px; }
  .stats-overview-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 24px; }
  .stat-value { font-size: 32px; }
  .dashboard-content-grid { grid-template-columns: 1fr; gap: 20px; }
  .section-card-container { padding: 24px; border-radius: 12px; }
  .history-filter-system { gap: 10px; margin-bottom: 18px; }
  .filter-top-row { flex-direction: column; gap: 8px; }
  .custom-dropdown-container { width: 100%; }
  .boxes-cards-grid { grid-template-columns: 1fr; gap: 8px; }
  .user-box-card { padding: 24px; }
  .ub-actions-row .btn { padding: 10px 16px; font-size: 14px; width: 100%; }
  .renewal-modal-dialog {
    width: 100vw;
    max-width: 100vw;
    border-radius: 12px 12px 0 0;
    top: auto; bottom: 0; left: 0;
    transform: translateY(100%);
    max-height: 85vh;
    padding: 20px 16px 28px;
  }
  .renewal-modal-dialog.open { transform: translateY(0); }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    flex: 1;
    height: 100%;
  }
  .mobile-nav-item.active { color: var(--primary); font-weight: 510; }
  .mobile-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
}

/* Bottom nav 6 mục: chữ nhỏ lại trên màn hình rất hẹp */
@media (max-width: 360px) {
  .mobile-nav-item { font-size: 10.5px; gap: 2px; }
}

/* ==========================================================================
   UI POLISH LAYER — Linear precision details (không đổi layout/logic)
   ========================================================================== */
::selection { background: var(--primary); color: var(--on-primary, #08090a); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbar mảnh theo theme */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* Số liệu tabular — cảm giác "precision instrument" */
.stat-value, .summary-amount, .timer-countdown, .pay-val-price {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv01" on, "ss03" on, "zero" on, "tnum" on;
}

/* Nút: nhấn có phản hồi */
.btn { transition: background 130ms ease, border-color 130ms ease, color 130ms ease, transform 80ms ease; }
.btn:active { transform: scale(0.98); }

/* Toast có màu theo loại + trượt vào */
.toast { border-left: 2px solid var(--border); animation: toastIn 200ms ease forwards; }
.toast.success { border-left-color: var(--success); }
.toast.success svg, .toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error svg, .toast.error i { color: var(--danger); }

/* Skeleton shimmer thay pulse */
.skeleton {
  background: linear-gradient(100deg, var(--skeleton) 30%, var(--surface-hover) 50%, var(--skeleton) 70%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite linear;
}
@keyframes skeletonShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* Trang login: sàn gradient + card nổi */
.login-page {
  background:
    radial-gradient(640px 320px at 50% -80px, rgba(94, 168, 255, 0.12), transparent 70%),
    radial-gradient(480px 260px at 85% 110%, rgba(129, 140, 248, 0.08), transparent 70%),
    var(--bg);
}
.login-card-v2 { animation: cardIn 240ms ease both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-logo-mark { box-shadow: 0 0 28px rgba(94, 168, 255, 0.35); }

.mobile-nav-item { position: relative; }
.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 20px; height: 2px;
  border-radius: 9999px;
  background: var(--primary);
}

/* Card + input chuyển trạng thái mượt */
.user-box-card, .stat-card, .section-card-container, .package-card {
  transition: border-color 150ms ease, background 150ms ease;
}
.form-control, .search-input, .filter-search-input { transition: border-color 130ms ease, background 130ms ease; }

/* Tôn trọng reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   LIGHT THEME — component fixes (viền/input/bảng trên nền sáng)
   ========================================================================== */
[data-theme="light"] .search-input,
[data-theme="light"] .filter-search-input,
[data-theme="light"] .custom-select,
[data-theme="light"] .custom-dropdown-trigger {
  background: #ffffff;
  border-color: #e2e4e8;
  color: #0f172a;
}
[data-theme="light"] .btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}
[data-theme="light"] .filter-chip { background: #ffffff; border-color: var(--border); }
[data-theme="light"] .filter-chip:hover { background: var(--surface-hover); }
[data-theme="light"] .preset-btn { background: #ffffff; border-color: var(--border); }
[data-theme="light"] .login-role-tab.active { background: #ffffff; box-shadow: var(--shadow); }
[data-theme="light"] .stat-icon-wrap,
[data-theme="light"] .brand-icon-wrap,
[data-theme="light"] .empty-icon-wrap,
[data-theme="light"] .user-avatar-icon { background: var(--surface-hover); }
[data-theme="light"] .s-nav-item.active,
[data-theme="light"] .s-nav-sub.active { background: var(--surface-hover); }
[data-theme="light"] .login-page {
  background:
    radial-gradient(640px 320px at 50% -80px, rgba(37, 99, 235, 0.08), transparent 70%),
    var(--bg);
}
[data-theme="light"] .login-logo-mark { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25); }
[data-theme="light"] .select-option:hover,
[data-theme="light"] .custom-dropdown-option:hover,
[data-theme="light"] .action-menu-item:hover,
[data-theme="light"] .sheet-item:hover,
[data-theme="light"] .user-dropdown-item:hover { background: var(--surface-hover); }
[data-theme="light"] .s-nav-item:hover,
[data-theme="light"] .s-nav-sub:hover,
[data-theme="light"] .data-table tbody tr:hover,
[data-theme="light"] .table tbody tr:hover,
[data-theme="light"] .user-badge-wrap:hover,
[data-theme="light"] .header-icon-btn:hover,
[data-theme="light"] .btn-more:hover,
[data-theme="light"] .page-btn:hover,
[data-theme="light"] .header-contact-btn:hover { background: var(--surface-hover); }

/* ==========================================================================
   PUBLIC PAGES SHARED UI — Footer & Layout Helpers
   Áp dụng đồng bộ cho: Trang chủ (/), Mua Mon (/muamon), Checktt (/checktt), Hỗ trợ (/support)
   ========================================================================== */

/* Public Footer Đồng Bộ */
.public-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
  padding: 48px 20px 32px;
}

.public-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1.2fr;
  gap: 36px;
}

@media (max-width: 900px) {
  .public-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 30px 24px;
  }
  .footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .public-footer {
    padding: 36px 16px 24px;
  }
  .public-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 26px 16px;
  }
  .footer-brand-col {
    grid-column: 1 / -1;
  }
  .footer-col-support {
    grid-column: 1 / -1;
  }
}

.footer-brand-col p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 10px;
  max-width: 340px;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 13.5px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.public-footer-bottom {
  max-width: 1200px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

