/* =========================================================
   SIM JAPAN — Neo-Tokyo futuristic dark theme
   Tông màu: deep-space navy + neon cyan/violet + glassmorphism
   (Giữ nguyên toàn bộ tên class & biến CSS — chỉ đổi giá trị)
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

@property --borderAngle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ---------------------------------------------------------
   DESIGN TOKENS — nguồn chân lý duy nhất (teal · cool-gray)
   Premium SaaS + Japanese telecom operations dashboard.
   Mọi lớp phía dưới chỉ dùng token này, không định nghĩa lại.
   --------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Surfaces — trắng / xám lạnh */
  --bg-page:     #f6f8fb;
  --bg-card:     #ffffff;
  --bg-subtle:   #eef2f7;
  --bg-sidebar:  #ffffff;
  --bg-hover:    #f1f5f9;
  --bg-elevated: #ffffff;

  /* Borders — rõ, mảnh */
  --border:        #e3e8ef;
  --border-soft:   #eef2f7;
  --border-strong: rgba(15, 118, 110, 0.40);

  /* Text — slate */
  --text-1: #0f172a;   /* slate-900 */
  --text-2: #475569;   /* slate-600 */
  --text-3: #64748b;   /* slate-500 */
  --text-4: #94a3b8;   /* slate-400 */

  /* Accent — teal Nhật */
  --accent:        #0f766e;   /* teal-700 */
  --accent-dark:   #115e59;   /* teal-800 — màu chữ link */
  --accent-light:  #14b8a6;   /* teal-500 */
  --accent-soft:   rgba(15, 118, 110, 0.08);
  --accent-glow:   rgba(15, 118, 110, 0.16);
  --accent-grad:   linear-gradient(135deg, #0f766e 0%, #0d9488 100%);

  /* Primary aliases (lớp polish dùng) — trỏ về teal */
  --primary:        #0f766e;
  --primary-2:      #0d9488;
  --primary-strong: #115e59;
  --primary-grad:   linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  --primary-soft:   rgba(15, 118, 110, 0.08);
  --ring:           rgba(15, 118, 110, 0.22);
  --shadow-primary: 0 10px 24px -12px rgba(15, 118, 110, 0.45);

  /* Đỏ Nhật — dùng RẤT tiết chế (cảnh báo, điểm nhấn thương hiệu) */
  --jp-red:      #e0232e;
  --jp-red-soft: rgba(224, 35, 46, 0.08);

  /* Semantic */
  --success:      #0f9d6b;  --success-soft: rgba(15, 157, 107, 0.10);
  --danger:       #dc2626;  --danger-soft:  rgba(220, 38, 38, 0.08);
  --info:         #2563eb;  --info-soft:    rgba(37, 99, 235, 0.08);
  --warning:      #d97706;  --warning-soft: rgba(217, 119, 6, 0.10);
  --purple:       #7c3aed;  --purple-soft:  rgba(124, 58, 237, 0.08);

  /* Shadows — mềm, nhiều lớp (Stripe/Linear) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 16px -6px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 50px -16px rgba(15, 23, 42, 0.18), 0 8px 18px -8px rgba(15, 23, 42, 0.08);
  --glow-cyan:   none;
  --glow-violet: none;

  /* Radius — gọn 8–12 (card lớn dùng 16) */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Easing chuẩn (Emil) */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Fonts */
  --font-display: 'Plus Jakarta Sans', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:    'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Sidebar width */
  --sidebar-w: 264px;
}

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Nền trang sạch — không quầng neon, không lưới cyber.
   Quầng sáng teal rất nhẹ chỉ áp riêng cho .landing-wrap / .login-wrap. */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.4px;
  line-height: 1.25;
}

code {
  font-family: 'JetBrains Mono', Consolas, monospace;
  background: var(--bg-subtle);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent-dark);
  border: 1px solid var(--border-soft);
}

a { color: var(--accent-dark); text-decoration: none; transition: color 0.15s, text-shadow 0.15s; }
a:hover { color: #b3f1ff; text-shadow: 0 0 12px rgba(15, 118, 110, 0.55); }

::selection { background: rgba(15, 118, 110, 0.30); color: #eafdff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 170, 255, 0.18);
  border-radius: 10px;
  border: 2px solid var(--bg-page);
}
::-webkit-scrollbar-thumb:hover { background: rgba(15, 118, 110, 0.45); }

/* Focus rõ ràng khi điều hướng bằng bàn phím */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =========================================================
   LOGIN
   ========================================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.login-card {
  background: linear-gradient(160deg, rgba(20, 30, 58, 0.72), rgba(9, 14, 28, 0.78));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 46px 42px 38px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 80px rgba(15, 118, 110, 0.07);
  animation: loginIn 0.6s cubic-bezier(.16,1,.3,1);
  position: relative;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Viền holographic xoay quanh card đăng nhập */
.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--borderAngle),
    transparent 0%,
    rgba(15, 118, 110, 0.9) 8%,
    transparent 22%,
    transparent 48%,
    rgba(124, 58, 237, 0.9) 58%,
    transparent 74%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.85;
  pointer-events: none;
  animation: spinBorder 7s linear infinite;
}

@keyframes spinBorder { to { --borderAngle: 360deg; } }

.login-card.shake { animation: shake 0.42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}

.logo-block { text-align: center; margin-bottom: 28px; }

.logo-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  background: var(--accent-grad);
  border-radius: var(--r-md);
  font-size: 34px;
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  position: relative;
  box-shadow:
    0 0 28px rgba(15, 118, 110, 0.45),
    0 8px 30px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
  animation: logoFloat 5s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.brand-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  margin-top: 16px;
  letter-spacing: 1px;
  background: linear-gradient(115deg, #f1f7ff 30%, #7ee7fb 70%, #b7a8ff 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

.brand-subtitle {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 5px;
  letter-spacing: 0.3px;
}

.hint-text {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  margin-top: 20px;
}
.hint-text b { color: var(--accent-dark); font-weight: 600; }

.error-msg {
  background: var(--danger-soft);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #fda4af;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
  box-shadow: 0 0 18px rgba(251, 113, 133, 0.10);
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(4, 8, 18, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

input::placeholder, textarea::placeholder { color: var(--text-4); }

input:hover, select:hover, textarea:hover { border-color: rgba(120, 170, 255, 0.32); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(6, 12, 26, 0.75);
  box-shadow:
    0 0 0 3px var(--accent-glow),
    0 0 22px rgba(15, 118, 110, 0.14);
}

input[readonly] { background: var(--bg-subtle); color: var(--text-2); }

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%237ee7fb' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select option {
  background: #0b1224;
  color: var(--text-1);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Quản lý danh sách lựa chọn (Loại SIM, ...) */
.option-list {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 14px;
  background: rgba(4, 8, 18, 0.45);
}
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s;
}
.option-item:last-child { border-bottom: none; }
.option-item:hover { background: var(--bg-hover); }
.option-num {
  font-size: 11px;
  color: var(--text-3);
  min-width: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.option-text {
  flex: 1;
  color: var(--text-1);
  font-size: 13.5px;
  word-break: break-word;
}
.add-option-row {
  display: flex;
  gap: 8px;
}
.add-option-row input { flex: 1; }

/* Preview yen live cho ô nhập tiền */
.input-preview {
  margin-top: 8px;
  padding: 5px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0.8px;
  display: inline-block;
  transition: all 0.2s;
  box-shadow: 0 0 16px rgba(15, 118, 110, 0.12);
  text-shadow: 0 0 12px rgba(15, 118, 110, 0.45);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm), 0 0 14px rgba(15, 118, 110, 0.10);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }

.btn-primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow:
    0 4px 18px rgba(59, 130, 246, 0.38),
    0 0 26px rgba(15, 118, 110, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 4px rgba(0, 30, 60, 0.35);
}
/* Vệt sáng quét qua nút khi hover */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.40), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.btn-primary:hover {
  filter: brightness(1.10);
  box-shadow:
    0 6px 24px rgba(59, 130, 246, 0.50),
    0 0 38px rgba(15, 118, 110, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover::after { animation: shineSweep 0.65s ease forwards; }
@keyframes shineSweep { to { left: 140%; } }

.btn:disabled, .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
  transform: none !important;
}

.btn-danger {
  background: rgba(251, 113, 133, 0.07);
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  box-shadow: 0 0 18px rgba(251, 113, 133, 0.20);
}

.btn-soft {
  background: var(--bg-subtle);
  border-color: var(--border-soft);
  color: var(--text-2);
  box-shadow: none;
}
.btn-soft:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  transition: all 0.18s;
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--border-strong);
  box-shadow: 0 0 14px rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
}
.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.45);
  box-shadow: 0 0 14px rgba(251, 113, 133, 0.18);
}

/* =========================================================
   APP SHELL (sidebar + main)
   ========================================================= */
.app {
  display: none;
  min-height: 100vh;
}
.app.active {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  animation: fadeIn 0.4s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--bg-sidebar);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}
/* Đường sáng neon dưới brand */
.sidebar-brand::after {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 118, 110, 0.55), transparent);
}
.sidebar-brand .logo-square {
  width: 44px;
  height: 44px;
  font-size: 22px;
  border-radius: 11px;
  animation: none;
}
.sidebar-brand .brand-info { flex: 1; min-width: 0; }
.sidebar-brand .brand-title {
  font-size: 19px;
  margin: 0;
  letter-spacing: 0.6px;
}
.sidebar-brand .brand-subtitle {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

/* Tab buttons in sidebar */
.tab {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--r-sm);
  transition: all 0.18s cubic-bezier(.16,1,.3,1);
  text-align: left;
  position: relative;
}
.tab .tab-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.18s;
  flex-shrink: 0;
}
.tab .tab-label { flex: 1; }
.tab:hover {
  background: var(--bg-hover);
  color: var(--text-1);
  transform: translateX(3px);
}
.tab:hover .tab-icon {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}
.tab.active {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.14), rgba(124, 58, 237, 0.10));
  color: var(--accent-dark);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.22);
}
/* Thanh neon đánh dấu tab đang chọn */
.tab.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), #7c3aed);
  box-shadow: 0 0 12px rgba(15, 118, 110, 0.65);
}
.tab.active .tab-icon {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 16px rgba(15, 118, 110, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Badge đỏ trên tab (số tài khoản chờ duyệt) */
.tab-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.55);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(15, 118, 110, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}
.user-meta .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta .role {
  font-size: 11px;
  color: var(--text-3);
}

/* ---------- MAIN AREA ---------- */
.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 8, 16, 0.62);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  letter-spacing: 0.6px;
}

.topbar-spacer { flex: 1; }

.menu-toggle { display: none; }

.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  background: var(--success-soft);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 999px;
  font-size: 12px;
  color: #6ee7b7;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.12);
}
.realtime-badge.offline {
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.4);
  color: #fda4af;
  box-shadow: 0 0 16px rgba(251, 113, 133, 0.12);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.9);
  animation: pulseDot 1.8s infinite;
}
.realtime-badge.offline .live-dot { background: var(--danger); animation: none; box-shadow: 0 0 8px rgba(251, 113, 133, 0.8); }

@keyframes pulseDot {
  0%   { box-shadow: 0 0 8px rgba(52, 211, 153, 0.9), 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70%  { box-shadow: 0 0 8px rgba(52, 211, 153, 0.9), 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 8px rgba(52, 211, 153, 0.9), 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ---------- PAGE ---------- */
.page-wrap { flex: 1; }
.page {
  padding: 28px;
  max-width: 1500px;
  margin: 0 auto;
  display: none;
  animation: fadeIn 0.3s;
}
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 14px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.8px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sidebar overlay (mobile drawer) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.60);
  backdrop-filter: blur(3px);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* =========================================================
   STAT CARDS
   ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  --card-accent: var(--accent);
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(.16,1,.3,1), box-shadow 0.25s, border-color 0.2s;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
/* Thanh neon bên trái */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--card-accent);
  border-radius: 0 3px 3px 0;
  transition: width 0.2s;
  box-shadow: 0 0 14px var(--card-accent);
}
/* Quầng sáng góc phải trên khi hover */
.stat-card::after {
  content: '';
  position: absolute;
  top: -34px; right: -34px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, var(--card-accent) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 26px rgba(15, 118, 110, 0.10);
  border-color: var(--border);
}
.stat-card:hover::before { width: 4px; }
.stat-card:hover::after { opacity: 0.14; }

.stat-card.green  { --card-accent: var(--success); }
.stat-card.blue   { --card-accent: var(--info); }
.stat-card.purple { --card-accent: var(--purple); }
.stat-card.red    { --card-accent: var(--danger); }
.stat-card.yellow { --card-accent: var(--warning); }

.stat-label {
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(15, 118, 110, 0.18);
}

/* =========================================================
   EMPLOYEE FILTER — chip multi-select nhân viên (admin)
   ========================================================= */
.emp-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}
.filter-label {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}
.emp-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.chip-emp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.chip-emp:hover {
  background: var(--bg-hover);
  color: var(--text-1);
  border-color: var(--border);
}
.chip-emp.active {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--accent-dark);
  font-weight: 600;
  box-shadow: 0 0 14px rgba(15, 118, 110, 0.18);
}
.chip-emp.clear-emp {
  background: transparent;
  border-style: dashed;
  padding: 4px 12px;
  color: var(--text-3);
}
.chip-emp.clear-emp:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  border-style: solid;
  color: var(--danger);
}
.avatar-tiny {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chip-emp.active .avatar-tiny {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.45);
}

/* =========================================================
   PERIOD CHIPS — quick filter Hôm nay / Tuần / Tháng / Năm
   ========================================================= */
.period-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chip {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.chip:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chip.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(15, 118, 110, 0.35), 0 3px 12px rgba(59, 130, 246, 0.35);
  text-shadow: 0 1px 3px rgba(0, 30, 60, 0.35);
}
.chip.active:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

/* =========================================================
   FILTERS + TABLES
   ========================================================= */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  align-items: center;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.filters .field { flex: 1; min-width: 150px; }
.filters input,
.filters select {
  padding: 9px 12px;
  font-size: 13px;
}

.table-wrap {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead {
  background: rgba(255, 255, 255, 0.03);
}
th {
  text-align: left;
  padding: 13px 16px;
  font-weight: 600;
  color: var(--text-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-1);
  vertical-align: top;
}
tbody tr { transition: background 0.15s; }
/* Kẻ sọc xen kẽ — dễ dò theo hàng trên bảng rộng (hover/flash vẫn đè lên nhờ
   đặt trước :hover và do rule theo theme có độ ưu tiên cao hơn) */
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.022); }
tbody tr:hover { background: rgba(15, 118, 110, 0.045); }
tbody tr:last-child td { border-bottom: none; }

tr.flash { animation: flashRow 2s ease-out; }
@keyframes flashRow {
  0%   { background: rgba(15, 118, 110, 0.18); }
  100% { background: transparent; }
}

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-3);
}
.empty-state h3 {
  color: var(--text-2);
  font-size: 18px;
  margin-bottom: 6px;
  font-weight: 500;
}
.dim { color: var(--text-4); }

/* =========================================================
   TAGS — neon translucent
   ========================================================= */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid;
  line-height: 1.5;
}
.tag-green  { background: rgba(52, 211, 153, 0.12);  border-color: rgba(52, 211, 153, 0.38);  color: #6ee7b7; }
.tag-blue   { background: rgba(96, 165, 250, 0.12);  border-color: rgba(96, 165, 250, 0.38);  color: #93c5fd; }
.tag-gold   { background: rgba(251, 191, 36, 0.10);  border-color: rgba(251, 191, 36, 0.40);  color: #fcd34d; }
.tag-red    { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.38); color: #fda4af; }
.tag-orange { background: rgba(251, 146, 60, 0.12);  border-color: rgba(251, 146, 60, 0.40);  color: #fdba74; }
.tag-yellow { background: rgba(250, 204, 21, 0.10);  border-color: rgba(250, 204, 21, 0.40);  color: #fde047; }
.tag-purple { background: rgba(167, 139, 250, 0.13); border-color: rgba(167, 139, 250, 0.38); color: #c4b5fd; }
.tag-gray   { background: rgba(148, 163, 184, 0.10); border-color: rgba(148, 163, 184, 0.30); color: #cbd5e1; }

.row-actions { display: flex; gap: 5px; white-space: nowrap; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s;
}

.modal {
  background: linear-gradient(165deg, rgba(20, 30, 58, 0.92), rgba(8, 13, 27, 0.94));
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    var(--shadow-lg),
    0 0 60px rgba(15, 118, 110, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: slideUp 0.28s cubic-bezier(.16,1,.3,1);
  position: relative;
}
@keyframes slideUp {
  from { transform: translateY(24px) scale(0.985); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal.modal-sm { max-width: 460px; }

.modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}
/* Đường neon dưới tiêu đề modal */
.modal-head::after {
  content: '';
  position: absolute;
  left: 24px;
  bottom: -1px;
  width: 90px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  box-shadow: 0 0 10px rgba(15, 118, 110, 0.5);
}
.modal-head h3 {
  font-size: 21px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modal-body { padding: 22px 24px; }

.modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-grid-2 .full { grid-column: 1 / -1; }

/* =========================================================
   TOAST
   ========================================================= */
.toast-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: linear-gradient(160deg, rgba(20, 30, 58, 0.92), rgba(8, 13, 27, 0.94));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--r-md);
  padding: 13px 16px;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.32s cubic-bezier(.16,1,.3,1);
  pointer-events: auto;
  font-size: 13px;
  position: relative;
}
.toast.success  { border-left-color: var(--success); box-shadow: var(--shadow-md), -6px 0 22px -8px rgba(52, 211, 153, 0.45); }
.toast.error    { border-left-color: var(--danger);  box-shadow: var(--shadow-md), -6px 0 22px -8px rgba(251, 113, 133, 0.45); }
.toast.warning  { border-left-color: var(--warning); box-shadow: var(--shadow-md), -6px 0 22px -8px rgba(251, 191, 36, 0.45); }
.toast.info     { border-left-color: var(--info);    box-shadow: var(--shadow-md), -6px 0 22px -8px rgba(96, 165, 250, 0.45); }
.toast.activity {
  border-left-color: var(--accent);
  box-shadow: var(--shadow-md), -6px 0 22px -8px rgba(15, 118, 110, 0.5);
  animation: slideInRight 0.32s cubic-bezier(.16,1,.3,1), pulseRing 1.6s ease-out;
}
.toast .title { font-weight: 600; margin-bottom: 2px; color: var(--text-1); font-size: 13.5px; }
.toast .body  { color: var(--text-2); font-size: 12.5px; }

@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes pulseRing {
  0%   { box-shadow: var(--shadow-md), 0 0 0 0 rgba(15, 118, 110, 0.5); }
  100% { box-shadow: var(--shadow-md), 0 0 0 14px rgba(15, 118, 110, 0); }
}

/* =========================================================
   WELCOME BANNER
   ========================================================= */
.welcome-banner {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-grad);
  color: #fff;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  box-shadow:
    0 10px 36px rgba(59, 130, 246, 0.45),
    0 0 40px rgba(15, 118, 110, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  text-shadow: 0 1px 4px rgba(0, 30, 60, 0.35);
  z-index: 400;
  animation: slideDown 0.4s cubic-bezier(.16,1,.3,1), fadeOutUp 0.4s 3.6s forwards;
}
@keyframes slideDown {
  from { transform: translate(-50%, -30px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes fadeOutUp { to { transform: translate(-50%, -30px); opacity: 0; } }

/* =========================================================
   TIMELINE (stock history)
   ========================================================= */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.5), rgba(124, 58, 237, 0.35));
}
.timeline-item {
  position: relative;
  margin-bottom: 16px;
  padding-bottom: 10px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0a1124;
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(15, 118, 110, 0.6);
}
.timeline-item .head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.timeline-item .when {
  font-size: 11.5px;
  color: var(--text-3);
}
.timeline-item .who {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
}

/* =========================================================
   MESSENGER INBOX (FB Page)
   ========================================================= */
.msg-shell {
  display: grid;
  grid-template-columns: 300px 1fr 300px; /* danh sách | hội thoại | panel khách */
  gap: 0;
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  height: calc(100vh - 220px);
  min-height: 500px;
  box-shadow: var(--shadow-sm);
}
/* Cột trái: thanh lọc cố định + danh sách cuộn */
.msg-col-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.16);
}
.msg-list {
  flex: 1;
  overflow-y: auto;
}
/* Thanh lọc + tìm kiếm */
.msg-filterbar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.10);
}
.msg-search {
  width: 100%;
  font-size: 13px;
  padding: 8px 11px;
  margin-bottom: 8px;
}
.msg-filter-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mfchip {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.mfchip:hover { border-color: var(--c, var(--accent)); color: var(--text-1); }
.mfchip.on {
  background: var(--c, var(--accent));
  border-color: var(--c, var(--accent));
  color: #fff;
}
.mfchip-clear { color: var(--danger); border-color: transparent; }
.mfchip-clear:hover { border-color: var(--danger); }

.msg-conv {
  display: grid;
  grid-template-columns: 9px 40px 1fr auto; /* chấm trạng thái | avatar | info | giờ */
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.15s;
  align-items: center;
}
.msg-conv:hover { background: var(--bg-hover); }
.msg-conv.active {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.conv-status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}
.conv-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.conv-tag {
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 5px;
  color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 40%, transparent);
}
.conv-has-order { font-size: 12px; line-height: 1; }
.conv-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(15, 118, 110, 0.25);
}
.conv-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
/* Badge nhỏ hiện tên Page khi đang xem "Tất cả Page" */
.conv-page-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid rgba(15, 118, 110, 0.30);
}
/* Subtitle nhỏ trong head hội thoại — báo page nào */
.thread-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: normal;
}
.conv-info { min-width: 0; }
.conv-name {
  font-size: 13.5px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.conv-snippet {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.unread-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.55);
}

/* ===== Panel thông tin khách (cột phải, kiểu Manychat) ===== */
.msg-side {
  border-left: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.10);
  overflow-y: auto;
  padding: 0;
}
.msg-side .side-empty { padding: 40px 20px; text-align: center; font-size: 13px; line-height: 1.6; }
.side-head {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.side-head .conv-avatar { width: 44px; height: 44px; font-size: 17px; }
.side-head-info { min-width: 0; }
.side-name { font-size: 15px; font-weight: 700; color: var(--text-1); word-break: break-word; }
.side-section { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
.side-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); margin-bottom: 8px;
}
.side-status, .side-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.side-status-btn, .side-tag-btn {
  font-size: 12px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.side-status-btn:hover, .side-tag-btn:hover { border-color: var(--c, var(--accent)); color: var(--text-1); }
.side-status-btn.on, .side-tag-btn.on {
  background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff;
}
.side-order.linked {
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.30);
  border-radius: 8px; padding: 10px 12px;
}
.side-note {
  width: 100%; font-size: 13px; resize: vertical; min-height: 70px; line-height: 1.5;
}

.msg-thread {
  display: flex; flex-direction: column;
  background: transparent;
  position: relative; /* để bảng chọn mẫu (tpl-picker) neo theo */
}
.thread-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  font-size: 15px;
}
.thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 70%;
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.bubble-them {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-1);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 5px;
}
.bubble-me {
  align-self: flex-end;
  background: var(--accent-grad);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 3px 14px rgba(59, 130, 246, 0.30);
}
.bubble-text { white-space: pre-wrap; }

/* Hover dịch: bóng chat của khách → con trỏ "help" + gạch chân chấm khi rê chuột */
.bubble-them .bubble-text { cursor: help; }
.bubble-them:hover .bubble-text {
  text-decoration: underline dotted rgba(15, 118, 110, 0.55);
  text-underline-offset: 3px;
}

/* Gợi ý nhỏ dưới tên hội thoại */
.thread-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 400;
}

/* Tooltip bản dịch tiếng Việt */
.trans-tip {
  position: fixed;
  z-index: 9999;
  max-width: 340px;
  background: #0f172a;
  color: #f1f5f9;
  border: 1px solid rgba(43, 217, 191, 0.40);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* không chặn chuột → tránh nhấp nháy tooltip */
  animation: transTipIn 0.12s ease-out;
}
.trans-tip-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2bd9bf;
  margin-bottom: 3px;
}
.trans-tip-body { white-space: pre-wrap; word-break: break-word; }
.trans-tip.loading .trans-tip-body { opacity: 0.7; font-style: italic; }
@keyframes transTipIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.bubble-time {
  font-size: 10.5px;
  opacity: 0.65;
  margin-top: 4px;
  text-align: right;
}

.thread-input {
  display: flex;
  gap: 8px;
  align-items: flex-end; /* nút canh đáy khi textarea cao lên */
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.16);
}
.thread-input textarea {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  resize: none;
  line-height: 1.45;
  padding: 9px 12px;
  overflow-y: auto;
}
.thread-input .btn { white-space: nowrap; }
.tpl-btn { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--border); }
.thread-input .trans-sel {
  flex: 0 0 auto;
  width: auto;
  max-width: 120px;
  font-size: 12.5px;
  padding: 8px 8px;
  align-self: flex-end;
}

/* ===== Bảng chọn mẫu nhanh (popover trên ô soạn tin) ===== */
.tpl-picker {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 50;
  max-height: 52%;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: transTipIn 0.14s ease-out;
}
.tpl-picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.tpl-picker-title { font-weight: 700; font-size: 13.5px; color: var(--text-1); }
.tpl-picker-body { overflow-y: auto; padding: 6px 12px 12px; }
.tpl-group { margin-top: 10px; }
.tpl-group-name {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-3); margin-bottom: 6px;
}
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-chip {
  border: 1px solid var(--border);
  background: var(--bg-subtle, rgba(15,118,110,0.05));
  color: var(--text-1);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
  max-width: 100%;
}
.tpl-chip:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-1px); }
.tpl-chip:active { transform: scale(0.96); } /* phản hồi khi bấm */

/* Tôn trọng người tắt hiệu ứng chuyển động (chống say chuyển động) */
@media (prefers-reduced-motion: reduce) {
  .trans-tip, .tpl-picker { animation: none; }
  .tpl-chip { transition: background .12s, border-color .12s; }
  .tpl-chip:hover, .tpl-chip:active { transform: none; }
}

/* ===== Trang "Mẫu tin" (tab riêng) — lưới các nhóm ===== */
.tpl-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  align-items: start;
}

/* Mỗi nhóm = 1 card có thanh tiêu đề màu riêng (xoay vòng để dễ phân biệt) */
.tpl-page-grid .tpl-mgr-group {
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, 0.55);
  --grp: var(--accent); /* màu mặc định, ghi đè bằng nth-child bên dưới */
}
.tpl-page-grid .tpl-mgr-group:nth-child(6n+1) { --grp: #0f766e; } /* teal */
.tpl-page-grid .tpl-mgr-group:nth-child(6n+2) { --grp: #2563eb; } /* xanh dương */
.tpl-page-grid .tpl-mgr-group:nth-child(6n+3) { --grp: #d97706; } /* cam */
.tpl-page-grid .tpl-mgr-group:nth-child(6n+4) { --grp: #7c3aed; } /* tím */
.tpl-page-grid .tpl-mgr-group:nth-child(6n+5) { --grp: #db2777; } /* hồng */
.tpl-page-grid .tpl-mgr-group:nth-child(6n)   { --grp: #0891b2; } /* xanh ngọc */

/* Thanh tiêu đề nhóm: nền màu nhạt + viền trái màu đậm + chữ màu */
.tpl-page-grid .tpl-mgr-group-head {
  margin-bottom: 0;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--grp) 15%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--grp) 35%, transparent);
  border-left: 4px solid var(--grp);
}
.tpl-page-grid .tpl-mgr-group-name {
  font-size: 15px;
  color: var(--grp);
  filter: brightness(1.25); /* sáng hơn chút cho dễ đọc trên nền tối */
}

/* Danh sách mẫu trong card */
.tpl-page-grid .tpl-mgr-item {
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}
.tpl-page-grid .tpl-mgr-group-head + .tpl-mgr-item { border-top: none; }
.tpl-page-grid .tpl-mgr-group > .dim { padding: 10px 14px; }
.tpl-page-grid .tpl-mgr-item-title { font-size: 14px; }

/* ===== Modal quản lý mẫu ===== */
.tpl-mgr { max-height: 64vh; overflow-y: auto; }
.tpl-mgr-group {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.tpl-mgr-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.tpl-mgr-group-name { font-weight: 700; font-size: 14.5px; color: var(--text-1); }
.tpl-mgr-actions { display: flex; gap: 4px; flex-shrink: 0; }
.tpl-mgr-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border-soft);
}
.tpl-mgr-item-main { min-width: 0; flex: 1; }
.tpl-mgr-item-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.tpl-mgr-item-text {
  font-size: 12.5px; color: var(--text-2);
  white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Màn hình vừa: ẩn panel khách để ưu tiên list + chat */
@media (max-width: 1180px) {
  .msg-shell { grid-template-columns: 280px 1fr; }
  .msg-side { display: none; }
}
@media (max-width: 768px) {
  .msg-shell { grid-template-columns: 1fr; height: calc(100vh - 180px); }
  .msg-col-left { display: none; } /* sẽ làm toggle sau */
}
/* Tối ưu mobile chung: bớt padding, cho header & nút xuống dòng gọn gàng */
@media (max-width: 768px) {
  .page.active { padding: 16px 14px; }
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-actions { flex-wrap: wrap; }
}
/* Chế độ cài app (PWA standalone): chừa lề an toàn cho tai thỏ */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}

/* =========================================================
   RESPONSIVE — Mobile drawer
   ========================================================= */
@media (max-width: 900px) {
  .app.active {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(6, 10, 20, 0.94);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.16,1,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle {
    display: inline-flex;
    font-size: 22px;
  }
  .topbar { padding: 12px 18px; }
  .page { padding: 18px; }
  .page-title { font-size: 23px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .toast-stack { right: 14px; left: 14px; max-width: none; top: 76px; }
  th, td { padding: 11px 12px; font-size: 12.5px; }
  .stat-value { font-size: 24px; }
  .stat-card { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .topbar-title { font-size: 17px; }
  .realtime-badge span:not(.live-dot) { display: none; }
  .realtime-badge { padding: 6px 9px; }
  .modal-head h3 { font-size: 18px; }
  .modal-body, .modal-footer, .modal-head { padding-left: 18px; padding-right: 18px; }
}

/* =========================================================
   ĐĂNG KÝ + DUYỆT TÀI KHOẢN
   ========================================================= */
/* Banner báo có tài khoản chờ duyệt (tab Nhân viên) */
.pending-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--warning-soft);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-left: 4px solid var(--warning);
  border-radius: var(--r-md);
  color: #92400e;
  font-size: 13.5px;
  box-shadow: var(--shadow-xs);
  animation: fadeIn 0.3s;
}
.pending-banner b { color: #b45309; }

/* Dòng tài khoản đang chờ duyệt — nhuộm vàng nhẹ */
tr.pending-row { background: rgba(251, 191, 36, 0.045); }
tr.pending-row:hover { background: rgba(251, 191, 36, 0.09); }

/* Nút duyệt ✓ — xanh lá neon */
.icon-btn.approve {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.40);
}
.icon-btn.approve:hover {
  background: var(--success-soft);
  color: #6ee7b7;
  border-color: var(--success);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
}

/* Khối "Đã gửi đăng ký" thành công */
.register-success {
  text-align: center;
  padding: 8px 0 4px;
  animation: fadeIn 0.35s;
}
.reg-success-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
}
.register-success h3 { font-size: 22px; margin-bottom: 8px; letter-spacing: 0.2px; }
.register-success p {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 18px;
}
.register-success b { color: var(--accent-dark); }

/* Cụm nút Đăng ký / Đăng nhập trên landing nav */
.landing-nav-actions { display: flex; gap: 8px; }

/* Nút quay lại landing trong card đăng nhập */
.login-back {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  transition: color 0.15s;
}
.login-back:hover { color: var(--accent-dark); }

@media (max-width: 720px) {
  .landing-nav { padding: 12px 18px; }
  .hero { padding: 56px 18px 44px; }
  .hero-title { font-size: 34px; }
  .hero-desc { font-size: 14.5px; }
  .features { padding: 14px 18px 56px; }
  .features-title { font-size: 24px; }
}

/* Nav landing trên màn rất hẹp — gọn lại để không tràn nút */
@media (max-width: 480px) {
  .landing-nav { padding: 10px 12px; gap: 8px; }
  .landing-brand { gap: 8px; }
  .landing-brand .logo-square { width: 34px; height: 34px; font-size: 17px; }
  .landing-brand-name { font-size: 15px; }
  .landing-brand-sub { display: none; }
  .landing-nav-actions { gap: 6px; }
  .landing-nav-actions .btn { padding: 8px 12px; font-size: 12.5px; white-space: nowrap; }
}

/* =========================================================
   ENTERPRISE INTERIOR — tinh chỉnh giao diện SAU ĐĂNG NHẬP cho
   cảm giác doanh nghiệp: trầm, sạch, hài hoà; ít chuyển động,
   viền rõ ràng, ánh sáng dịu. Scope trong .app, không đụng landing/login.
   ========================================================= */

/* ---- Sidebar: gọn gàng, bỏ hiệu ứng quét/nhấp nháy ---- */
.app .sidebar-brand .logo-square {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.app .sidebar-brand::after { opacity: 0.5; }   /* đường brand dịu lại */

/* Tab đang chọn: nền phẳng, viền mảnh, bỏ glow mạnh */
.app .tab.active {
  background: rgba(15, 118, 110, 0.09);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}
.app .tab.active::before {
  background: var(--accent);
  box-shadow: none;
}
.app .tab.active .tab-icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ---- Topbar: tiêu đề phẳng, sạch (không gạch/glow/nhấp nháy) ---- */
.app .topbar-title {
  text-shadow: none;
}

/* ---- Tiêu đề trang: gạch nhấn gọn, không quầng sáng ---- */
.app .page-title {
  position: relative;
  padding-left: 15px;
}
.app .page-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 0.72em;
  border-radius: 2px;
  background: var(--accent);
}

/* ---- Stat card: phẳng & rõ ràng, hover điềm đạm (bỏ lưới/ngoặc/vệt) ---- */
.app .stat-card::before {
  width: 3px;
  box-shadow: none;            /* dải màu phẳng, không quầng neon */
}
.app .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.app .stat-card:hover::before { width: 3px; }
.app .stat-card:hover::after  { opacity: 0; }   /* tắt quầng góc khi hover */
.app .stat-value { text-shadow: none; }          /* số liệu sắc nét */

/* ---- Bảng dữ liệu: header điềm đạm, hover tinh tế ---- */
.app .table-wrap thead {
  background: rgba(255, 255, 255, 0.025);
}
.app .table-wrap thead th {
  color: var(--text-2);
  border-bottom-color: var(--border);
}
.app .table-wrap tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 2px 0 0 rgba(15, 118, 110, 0.5);
}

/* =========================================================
   ☀ LIGHT THEME — giao diện SAU ĐĂNG NHẬP (body.app-light)
   Nền sáng, sạch, thoáng — phong cách phần mềm quản trị doanh nghiệp.
   Bật khi vào app (app.js thêm class app-light vào <body>), nên phủ
   cả modal/toast (nằm ngoài .app). Landing/login lúc này đang ẩn.
   ========================================================= */
body.app-light {
  /* App sau đăng nhập kế thừa hệ token teal ở :root.
     Chỉ tinh chỉnh nền/viền cho cảm giác "phần mềm quản trị". */
  --bg-page:     #eef2f7;
  --bg-subtle:   rgba(15, 23, 42, 0.035);
  --bg-hover:    rgba(15, 23, 42, 0.05);
  --border:      rgba(15, 23, 42, 0.11);
  --border-soft: rgba(15, 23, 42, 0.07);

  background: var(--bg-page);
  color: var(--text-1);
}

/* ----- App shell ----- */
body.app-light .app.active { background: var(--bg-page); }
/* Nền sáng cho sidebar — đủ mạnh để thắng cả rule mobile drawer (nền tối cứng) */
body.app-light .sidebar {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 1px 0 0 var(--border-soft);
}
body.app-light .sidebar-overlay { background: rgba(15, 23, 42, 0.32); }
body.app-light .topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: var(--border-soft);
}
body.app-light .tab { color: var(--text-2); }
body.app-light .tab .tab-icon {
  background: rgba(15, 23, 42, 0.045);
  border-color: var(--border-soft);
}
body.app-light .tab.active {
  background: rgba(15, 118, 110, 0.10);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18);
}
body.app-light .sidebar-brand .logo-square {
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
body.app-light .sidebar-brand::after { opacity: 0.35; }
/* Chữ "SIM Japan" trên sidebar: gradient đậm để đọc rõ trên nền trắng */
body.app-light .sidebar-brand .brand-title {
  background: linear-gradient(115deg, #0f172a 18%, #0f766e 78%);
  -webkit-background-clip: text;
          background-clip: text;
}

/* ----- Form controls ----- */
body.app-light input,
body.app-light select,
body.app-light textarea {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-1);
}
body.app-light input:hover,
body.app-light select:hover,
body.app-light textarea:hover { border-color: rgba(15, 118, 110, 0.4); }
body.app-light input:focus,
body.app-light select:focus,
body.app-light textarea:focus {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
body.app-light input[readonly] { background: #f1f5f9; }
body.app-light select {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%230f766e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
body.app-light select option { background: #ffffff; color: var(--text-1); }
body.app-light .option-list { background: #ffffff; }
body.app-light .input-preview { text-shadow: none; box-shadow: none; }

/* ----- Buttons ----- */
body.app-light .btn {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
body.app-light .btn:hover {
  background: #f1f5f9;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
body.app-light .btn-primary {
  background: var(--accent-grad);   /* giữ gradient — không để .btn ghi đè thành trắng */
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
body.app-light .btn-primary:hover {
  background: var(--accent-grad);
  box-shadow: 0 6px 22px rgba(15, 118, 110, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
body.app-light .btn-danger {
  background: var(--danger-soft);
  border-color: rgba(244, 63, 94, 0.35);
  color: #be123c;
}
body.app-light .btn-danger:hover { background: rgba(244, 63, 94, 0.16); border-color: var(--danger); }
body.app-light .icon-btn {
  background: #ffffff;
  border-color: var(--border);
}

/* ----- Stat cards / bảng (ghi đè bản refinement tối ở trên) ----- */
body.app-light .page { padding: 32px; }
body.app-light .stat-grid { gap: 18px; }
body.app-light .stat-card { padding: 22px 24px; }
body.app-light .stat-card:hover { box-shadow: var(--shadow-md); }
body.app-light .table-wrap thead { background: #f8fafc; }
body.app-light .table-wrap thead th { color: var(--text-2); border-bottom-color: var(--border); }
/* Sọc xen kẽ cho theme sáng (tint tối nhạt; đặt trước :hover để hover vẫn thắng) */
body.app-light .table-wrap tbody tr:nth-child(even) { background: rgba(15, 23, 42, 0.025); }
body.app-light .table-wrap tbody tr:hover {
  background: rgba(15, 118, 110, 0.05);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* ----- Modal & toast ----- */
body.app-light .modal-backdrop { background: rgba(15, 23, 42, 0.34); }
body.app-light .modal { background: #ffffff; }
body.app-light .modal-footer { background: rgba(15, 23, 42, 0.025); }
body.app-light .modal-head::after { box-shadow: none; }
body.app-light .toast { background: #ffffff; }

/* ----- Realtime badge ----- */
body.app-light .realtime-badge {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.32);
  color: #047857;
}
body.app-light .realtime-badge.offline { color: #be123c; border-color: rgba(244, 63, 94, 0.35); }

/* ----- Tag/pill trạng thái: chữ đậm cho nền sáng ----- */
body.app-light .tag-green  { background: rgba(16,185,129,.12);  border-color: rgba(16,185,129,.35);  color: #047857; }
body.app-light .tag-blue   { background: rgba(59,130,246,.12);  border-color: rgba(59,130,246,.35);  color: #1d4ed8; }
body.app-light .tag-gold,
body.app-light .tag-yellow { background: rgba(245,158,11,.13);  border-color: rgba(245,158,11,.40);  color: #b45309; }
body.app-light .tag-red    { background: rgba(244,63,94,.12);   border-color: rgba(244,63,94,.35);   color: #be123c; }
body.app-light .tag-orange { background: rgba(249,115,22,.12);  border-color: rgba(249,115,22,.40);  color: #c2410c; }
body.app-light .tag-purple { background: rgba(139,92,246,.13);  border-color: rgba(139,92,246,.35);  color: #6d28d9; }
body.app-light .tag-gray   { background: rgba(100,116,139,.12); border-color: rgba(100,116,139,.30); color: #475569; }

/* ----- Scrollbar ----- */
body.app-light ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-color: var(--bg-page);
}
body.app-light ::-webkit-scrollbar-thumb:hover { background: rgba(15, 118, 110, 0.5); }

/* =========================================================
   GIẢM CHUYỂN ĐỘNG — tôn trọng cài đặt hệ điều hành
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  body::before,
  .login-card::before,
  .logo-square,
  .live-dot {
    animation: none !important;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* =========================================================
   BUSINESS UI REFRESH
   Chuyển toàn bộ bề mặt sản phẩm sang nền sáng (component rules).
   Token đã gom về :root đầu file — lớp này KHÔNG định nghĩa lại token.
   ========================================================= */
body,
body.app-light {
  background: var(--bg-page);
  color: var(--text-1);
}


h1,
h2,
h3,
h4,
.brand-title,
.landing-brand-name,
.topbar-title,
.page-title,
.stat-value,
.mock-stat b,
.mock-his-row b {
  font-family: var(--font-display);
  letter-spacing: 0;
  text-shadow: none !important;
}

a,
a:hover {
  color: var(--accent-dark);
  text-shadow: none;
}

::selection {
  background: rgba(15, 118, 110, 0.16);
  color: var(--text-1);
}

/* Identity */
.logo-square,
.landing-brand .logo-square,
.sidebar-brand .logo-square,
body.app-light .sidebar-brand .logo-square {
  background: #0f766e;
  color: #ffffff;
  border-radius: 8px;
  box-shadow: none;
  text-shadow: none;
  animation: none;
}

.brand-title,
.sidebar-brand .brand-title,
body.app-light .sidebar-brand .brand-title {
  background: none;
  -webkit-text-fill-color: currentColor;
          color: var(--text-1);
  font-weight: 700;
}

.brand-subtitle,
.landing-brand-sub,
.sidebar-brand .brand-subtitle {
  color: var(--text-3);
  letter-spacing: 0.08em;
}

/* Buttons and press feedback */
.btn,
body.app-light .btn,
.icon-btn,
body.app-light .icon-btn,
.chip,
.chip-emp,
.tab {
  transition:
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}

.btn,
body.app-light .btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.btn:hover,
body.app-light .btn:hover {
  background: #f8fafc;
  border-color: rgba(17, 24, 39, 0.18);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active,
.icon-btn:active,
.chip:active,
.chip-emp:active,
.tab:active {
  transform: scale(0.98);
}

.btn-primary,
body.app-light .btn-primary,
.mock-btn-primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.18);
  text-shadow: none;
}

.btn-primary:hover,
body.app-light .btn-primary:hover {
  background: #115e59;
  border-color: #115e59;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.20);
  filter: none;
}

.btn-primary::after,
.landing-wrap .btn-primary::after {
  display: none;
}

.btn-soft {
  background: #f8fafc;
  color: var(--text-2);
}

.btn-danger,
body.app-light .btn-danger {
  background: #fff5f5;
  border-color: rgba(220, 38, 38, 0.22);
  color: #b91c1c;
}

.icon-btn,
body.app-light .icon-btn {
  width: 34px;
  height: 34px;
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-2);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
}

.icon-btn:hover {
  background: #f8fafc;
  border-color: var(--border-strong);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.icon-btn.danger:hover {
  background: #fff5f5;
  border-color: rgba(220, 38, 38, 0.26);
  color: #b91c1c;
  box-shadow: var(--shadow-sm);
}


.pill,
.tag {
  border-radius: 999px;
  font-weight: 650;
  letter-spacing: 0;
}

.pill-green,
.tag-green,
body.app-light .tag-green {
  color: #047857;
  background: rgba(5, 150, 105, 0.10);
  border-color: rgba(5, 150, 105, 0.22);
}

.pill-blue,
.tag-blue,
body.app-light .tag-blue {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.09);
  border-color: rgba(37, 99, 235, 0.22);
}

.pill-amber,
.tag-gold,
.tag-yellow,
body.app-light .tag-gold,
body.app-light .tag-yellow {
  color: #b45309;
  background: rgba(217, 119, 6, 0.11);
  border-color: rgba(217, 119, 6, 0.24);
}

.tag-red,
body.app-light .tag-red {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.22);
}

.tag-purple,
body.app-light .tag-purple {
  color: #6d28d9;
  background: rgba(124, 58, 237, 0.09);
  border-color: rgba(124, 58, 237, 0.22);
}

.tag-gray,
body.app-light .tag-gray {
  color: #4b5563;
  background: #f3f4f6;
  border-color: rgba(75, 85, 99, 0.18);
}

.landing-footer2 {
  background: #ffffff;
  border-top: 1px solid var(--border-soft);
}

.footer-bottom {
  color: var(--text-3);
}

/* Login/register */
.login-wrap {
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: loginIn 240ms cubic-bezier(0.23, 1, 0.32, 1);
}

.login-card::before {
  display: none;
}

.login-back {
  color: var(--text-2);
}

.error-msg {
  background: #fff5f5;
  border-color: rgba(220, 38, 38, 0.22);
  color: #b91c1c;
  box-shadow: none;
}

.register-success {
  background: #f0fdf4;
  border-color: rgba(5, 150, 105, 0.20);
}

.reg-success-icon {
  background: #dcfce7;
  color: #047857;
  box-shadow: none;
}

/* App shell */
body.app-light {
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-hover: #eef6f5;
  --bg-elevated: #ffffff;
  --border: rgba(17, 24, 39, 0.14);
  --border-soft: rgba(17, 24, 39, 0.08);
  --border-strong: rgba(15, 118, 110, 0.45);
  --text-1: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-4: #9ca3af;
  --accent: #0f766e;
  --accent-dark: #0f766e;
  --accent-light: #14b8a6;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --accent-glow: rgba(15, 118, 110, 0.16);
  --accent-grad: linear-gradient(135deg, #0f766e 0%, #0b7285 100%);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.09);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.09);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.11);
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.09);
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 12px 28px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, 0.14);
  --r-sm: 8px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;
}

.app.active,
body.app-light .app.active {
  background: var(--bg-page);
}

.sidebar,
body.app-light .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border-soft);
  box-shadow: 1px 0 0 rgba(17, 24, 39, 0.02);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-brand::after {
  display: none;
}

.sidebar-nav {
  padding: 14px 10px;
  gap: 4px;
}

.tab {
  border-radius: 8px;
  color: var(--text-2);
  padding: 9px 10px;
}

.tab .tab-icon {
  width: 30px;
  height: 30px;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  color: var(--text-3);
  border-radius: 8px;
  box-shadow: none;
}

.tab .tab-icon svg {
  width: 17px;
  height: 17px;
  display: block;
}

.tab:hover {
  background: #f8fafc;
  color: var(--text-1);
  transform: none;
}

.tab.active,
body.app-light .tab.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.tab.active::before {
  left: -10px;
  width: 3px;
  background: var(--accent);
  box-shadow: none;
}

.tab.active .tab-icon,
body.app-light .tab.active .tab-icon {
  background: #ffffff;
  border-color: rgba(15, 118, 110, 0.20);
  color: var(--accent-dark);
  box-shadow: none;
}

.tab-badge {
  background: #dc2626;
  box-shadow: none;
}

.user-info {
  background: #f8fafc;
  border-color: var(--border-soft);
  border-radius: 8px;
}

.user-avatar {
  background: #0f766e;
  border-radius: 8px;
  box-shadow: none;
}

.topbar,
body.app-light .topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
}

.realtime-badge,
body.app-light .realtime-badge {
  background: #ecfdf5;
  border-color: rgba(5, 150, 105, 0.22);
  color: #047857;
  box-shadow: none;
  letter-spacing: 0;
}

.live-dot,
.realtime-badge.offline .live-dot {
  box-shadow: none;
  animation: none;
}

.page,
body.app-light .page {
  padding: 30px;
  animation: fadeIn 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 26px;
  font-weight: 750;
}

.app .page-title {
  padding-left: 0;
}

.app .page-title::before {
  display: none;
}

.stat-grid {
  gap: 16px;
}

.stat-card,
body.app-light .stat-card {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 18px 18px 17px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.stat-card::before {
  width: 3px;
  background: var(--card-accent);
  box-shadow: none;
}

.stat-card::after {
  display: none;
}

.stat-card:hover,
body.app-light .stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 24, 39, 0.16);
  box-shadow: var(--shadow-md);
}

.stat-label {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 25px;
  color: var(--text-1);
}

.period-chips {
  margin-bottom: 14px;
}

.chip {
  background: #ffffff;
  border-color: var(--border);
  border-radius: 8px;
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
}

.chip:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.chip.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.16);
  text-shadow: none;
}

.filters,
.emp-filter {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

input,
select,
textarea,
body.app-light input,
body.app-light select,
body.app-light textarea {
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  box-shadow: none;
}

input:hover,
select:hover,
textarea:hover,
body.app-light input:hover,
body.app-light select:hover,
body.app-light textarea:hover {
  border-color: rgba(17, 24, 39, 0.22);
}

input:focus,
select:focus,
textarea:focus,
body.app-light input:focus,
body.app-light select:focus,
body.app-light textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #ffffff;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-4);
}

.table-wrap,
body.app-light .table-wrap {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

thead,
body.app-light .table-wrap thead {
  background: #f8fafc;
}

th,
body.app-light .table-wrap thead th {
  color: var(--text-2);
  border-bottom-color: var(--border-soft);
  letter-spacing: 0.06em;
}

td {
  color: var(--text-1);
  border-bottom-color: var(--border-soft);
}

tbody tr:hover,
body.app-light .table-wrap tbody tr:hover {
  background: #f8fafc;
  box-shadow: inset 2px 0 0 var(--accent);
}

.empty-state {
  color: var(--text-3);
}

.empty-state h3 {
  color: var(--text-1);
}

.modal-backdrop,
body.app-light .modal-backdrop {
  background: rgba(17, 24, 39, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal,
body.app-light .modal {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: slideUp 220ms cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-head::after {
  display: none;
}

.modal-footer,
body.app-light .modal-footer {
  background: #f8fafc;
}

.toast,
body.app-light .toast {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: slideInRight 220ms cubic-bezier(0.23, 1, 0.32, 1);
}

.toast.success,
.toast.error,
.toast.warning,
.toast.info,
.toast.activity {
  box-shadow: var(--shadow-md);
}

.welcome-banner {
  background: #0f766e;
  box-shadow: var(--shadow-md);
  text-shadow: none;
}

@media (max-width: 940px) {
  .hero,
  .hero-cine {
    padding-top: 54px;
  }

  .hero-copy {
    text-align: left;
  }

  .hero-copy .hero-actions {
    justify-content: flex-start;
  }

  .sidebar {
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 680px) {
  .landing-nav,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .page,
  body.app-light .page {
    padding: 20px 16px;
  }

  .page-header,
  .page-actions,
  .filters {
    align-items: stretch;
  }

  .page-actions,
  .filters .field,
  .filters .btn {
    width: 100%;
  }

  .btn,
  .btn-lg {
    min-height: 42px;
  }
}

/* =========================================================
   ✦ DESIGN SYSTEM POLISH — teal · cool-gray
   Lớp polish thị giác toàn sản phẩm (KHÔNG định nghĩa lại token).
   Shadow nhiều lớp, hover lift, focus ring teal, micro-animation.
   Đặt SAU mọi lớp cũ nên thắng về thứ tự nguồn.
   ========================================================= */

/* ---------- Nền mesh gradient teal rất nhẹ ---------- */
.landing-wrap {
  background:
    radial-gradient(1100px circle at 8% -8%,  rgba(15, 118, 110, 0.07), transparent 46%),
    radial-gradient(900px  circle at 98% 4%,  rgba(13, 148, 136, 0.06), transparent 42%),
    radial-gradient(800px  circle at 50% 120%, rgba(20, 184, 166, 0.05), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f5f8fa 55%, var(--bg-page) 100%);
}
.login-wrap {
  background:
    radial-gradient(900px circle at 15% 0%,  rgba(15, 118, 110, 0.08), transparent 45%),
    radial-gradient(900px circle at 85% 100%, rgba(13, 148, 136, 0.07), transparent 45%),
    linear-gradient(180deg, #ffffff 0%, var(--bg-page) 100%);
}
.app.active,
body.app-light .app.active {
  background:
    radial-gradient(1000px circle at 100% -5%, rgba(15, 118, 110, 0.04), transparent 42%),
    radial-gradient(800px  circle at 0% 6%,    rgba(13, 148, 136, 0.03), transparent 40%),
    var(--bg-page);
  background-attachment: fixed;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4,
.brand-title, .landing-brand-name, .topbar-title, .page-title,
.hero-title, .features-title, .sec-head h2, .showcase-text h2, .cta-card h2 {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}
.hero-title, .hero-cine .hero-title { font-weight: 800; }
.page-title, .topbar-title { font-weight: 800; }

/* Gradient text cho cụm nhấn mạnh */
.hero-grad {
  background: var(--primary-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Identity: logo + avatar gradient ---------- */
.logo-square,
.landing-brand .logo-square,
.sidebar-brand .logo-square,
body.app-light .sidebar-brand .logo-square,
.user-avatar,
.reg-success-icon {
  background: var(--primary-grad);
  color: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-primary);
}

/* ---------- Buttons ---------- */
.btn, body.app-light .btn {
  border-radius: var(--r-sm);
  font-weight: 600;
}
.btn-primary, body.app-light .btn-primary, .mock-btn-primary, .chip.active {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover, body.app-light .btn-primary:hover {
  background: var(--primary-grad);
  border-color: transparent;
  filter: brightness(1.06) saturate(1.05);
  box-shadow: 0 14px 30px -8px rgba(15, 118, 110, 0.62);
  transform: translateY(-2px);
}
.btn-primary:active, body.app-light .btn-primary:active { transform: translateY(0) scale(0.985); }
.chip.active {
  border-color: transparent;
  box-shadow: 0 6px 16px -4px rgba(15, 118, 110, 0.45);
}

/* ---------- Sidebar + tabs ---------- */
.sidebar-brand .brand-title,
body.app-light .sidebar-brand .brand-title { font-weight: 800; }

.tab.active, body.app-light .tab.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}
.tab.active::before { background: var(--primary-grad); border-radius: 0 3px 3px 0; }
.tab.active .tab-icon, body.app-light .tab.active .tab-icon {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
}
.tab .tab-icon { border-radius: 9px; }

/* ---------- Topbar ---------- */
.topbar, body.app-light .topbar {
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

/* ---------- Stat cards — modern + hover glow ---------- */
.stat-card, body.app-light .stat-card {
  border-radius: var(--r-md);
  padding: 18px 18px 16px;
  overflow: hidden;
  position: relative;
  animation: vrRise 0.5s cubic-bezier(.16,1,.3,1) both;
}
.stat-card::before { width: 4px; border-radius: 4px; }
.stat-card:nth-child(1){ animation-delay:.02s } .stat-card:nth-child(2){ animation-delay:.07s }
.stat-card:nth-child(3){ animation-delay:.12s } .stat-card:nth-child(4){ animation-delay:.17s }
.stat-card:hover, body.app-light .stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 118, 110, 0.30);
  box-shadow: 0 18px 36px -14px rgba(15, 118, 110, 0.30), var(--shadow-md);
}
.stat-value { font-family: var(--font-display); font-weight: 800; }

/* ---------- Inputs: focus ring indigo ---------- */
input:focus, select:focus, textarea:focus,
body.app-light input:focus, body.app-light select:focus, body.app-light textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
input, select, textarea,
body.app-light input, body.app-light select, body.app-light textarea { border-radius: var(--r-sm); }

/* ---------- Cards / surfaces ---------- */
.feature-card, .flow-step, .cta-card, .mock-window, .filters, .emp-filter,
.table-wrap, body.app-light .table-wrap, .sim-visual, .dash-card,
.mock-stat, .mock-chart, .mock-history {
  border-radius: var(--r-md);
}
.feature-card:hover, .flow-step:hover {
  transform: translateY(-4px);
  border-color: rgba(15, 118, 110, 0.26);
  box-shadow: 0 18px 36px -14px rgba(15, 118, 110, 0.26), var(--shadow-md);
}
.feature-card::before { background: var(--primary-grad); }
.feature-icon, .fi-1, .fi-2, .fi-3, .fi-4, .fi-5, .fi-6 {
  background: var(--primary-soft);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--primary-strong);
  border-radius: 12px;
}

/* ---------- Tables ---------- */
tbody tr:hover, body.app-light .table-wrap tbody tr:hover {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

/* ---------- Pills ---------- */
.pill, .tag { border-radius: 999px; font-weight: 600; }

/* ---------- Modals / toasts ---------- */
.modal, body.app-light .modal { border-radius: var(--r-lg); }
.welcome-banner { background: var(--primary-grad); box-shadow: var(--shadow-md); }
.mock-bubble.out, .mock-unread { background: var(--primary-grad); color: #fff; }

/* ---------- Micro-animations ---------- */
@keyframes vrRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.btn, .icon-btn, .chip, .tab, .stat-card, .feature-card, .flow-step,
.tab .tab-icon, input, select, textarea {
  transition:
    background-color 170ms cubic-bezier(.23,1,.32,1),
    border-color 170ms cubic-bezier(.23,1,.32,1),
    color 170ms cubic-bezier(.23,1,.32,1),
    box-shadow 220ms cubic-bezier(.23,1,.32,1),
    transform 200ms cubic-bezier(.23,1,.32,1),
    filter 170ms cubic-bezier(.23,1,.32,1);
}

@media (prefers-reduced-motion: reduce) {
  .stat-card, body.app-light .stat-card { animation: none; }
}

/* =========================================================
   ✦ TOKYO MIDNIGHT — premium dark operations command center
   Landing + auth screens. Class lp-* + scope .landing-wrap/.login-wrap.
   Mực nhiều tầng · accent ngọc aqua-teal + hổ phách · IBM Plex.
   App sau đăng nhập (body.app-light) GIỮ SÁNG — không đụng tới.
   ========================================================= */
.landing-wrap, .login-wrap {
  /* Ink — nhiều tầng, không đen kịt */
  --mn-void:    #070b12;
  --mn-bg:      #0a0f1a;
  --mn-raised:  #0e1524;
  --mn-surface: #121b2d;
  --mn-surf-2:  #17223a;
  --mn-line:    rgba(150, 174, 214, 0.12);
  --mn-line-2:  rgba(150, 174, 214, 0.22);
  /* Chữ */
  --mn-text:   #e9eef8;
  --mn-text-2: #a2b2cd;
  --mn-text-3: #64748f;
  /* Accent ngọc */
  --mn-aqua:   #2bd9bf;
  --mn-aqua-hi:#5af2d8;
  --mn-amber:  #f2b04b;
  --mn-red:    #ff5d62;
  --mn-grad:   linear-gradient(135deg, #2bd9bf 0%, #14b8a6 55%, #0ea5a0 100%);
  --mn-glow:   rgba(43, 217, 191, 0.45);
  /* Fonts */
  --mn-sans: 'IBM Plex Sans', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --mn-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

.landing-wrap {
  position: relative;
  background:
    radial-gradient(1200px circle at 78% -6%, rgba(43, 217, 191, 0.10), transparent 46%),
    radial-gradient(900px circle at 4% 8%, rgba(46, 110, 255, 0.08), transparent 44%),
    linear-gradient(180deg, #0b1120 0%, var(--mn-bg) 40%, var(--mn-void) 100%);
  color: var(--mn-text);
  font-family: var(--mn-sans);
  -webkit-font-smoothing: antialiased;
}
.landing-wrap ::selection { background: rgba(43, 217, 191, 0.30); color: #eafff9; }

/* ---------- Header ---------- */
.landing-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  max-width: 1240px; margin: 0 auto;
  padding: 15px 28px;
  background: rgba(10, 15, 26, 0.62);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--mn-line);
}
.landing-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--mn-text); }
.landing-wrap .logo-square, .login-wrap .logo-square {
  background: var(--mn-grad); color: #03130f; border-radius: 9px;
  font-family: 'Noto Sans JP', sans-serif; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(43,217,191,0.25), 0 8px 22px -8px var(--mn-glow);
}
.landing-brand .logo-square { width: 38px; height: 38px; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; }
.landing-brand-name { font-family: var(--mn-sans); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--mn-text); }
.landing-brand-sub { font-family: var(--mn-mono); font-size: 10px; color: var(--mn-text-3); letter-spacing: 0.22em; text-transform: uppercase; }
.landing-nav-links { display: flex; gap: 2px; margin-left: 6px; }
.landing-nav-links a {
  padding: 8px 13px; border-radius: 8px;
  color: var(--mn-text-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: color 180ms ease, background-color 180ms ease;
}
.landing-nav-links a:hover, .landing-nav-links a.active { color: var(--mn-aqua-hi); background: rgba(43, 217, 191, 0.10); }
.landing-nav-actions { display: flex; gap: 9px; margin-left: auto; }

/* Buttons — scope landing + login */
.landing-wrap .btn, .login-wrap .btn { border-radius: 9px; font-weight: 600; font-family: var(--mn-sans); }
.landing-wrap .btn-primary, .login-wrap .btn-primary,
.landing-wrap .btn-primary:hover, .login-wrap .btn-primary:hover {
  background: var(--mn-grad); border: 1px solid rgba(43, 217, 191, 0.5); color: #04140f;
  box-shadow: 0 0 0 1px rgba(43,217,191,0.18), 0 10px 26px -10px var(--mn-glow);
  filter: none; text-shadow: none;
}
.landing-wrap .btn-primary:hover, .login-wrap .btn-primary:hover { box-shadow: 0 0 0 1px rgba(43,217,191,0.35), 0 14px 32px -10px var(--mn-glow); transform: translateY(-1px); }
.lp-btn-ghost, .landing-wrap .lp-btn-ghost {
  background: rgba(150, 174, 214, 0.05); border: 1px solid var(--mn-line-2); color: var(--mn-text);
}
.lp-btn-ghost:hover, .landing-wrap .lp-btn-ghost:hover { background: rgba(150, 174, 214, 0.10); border-color: var(--mn-aqua); color: var(--mn-aqua-hi); }

/* ---------- HERO ---------- */
.lp-hero {
  position: relative; max-width: 1240px; margin: 0 auto;
  padding: 78px 28px 64px;
  display: grid; grid-template-columns: 1.02fr 1.12fr; gap: 54px; align-items: center;
}
.lp-hero-fx { position: absolute; inset: -40px 0 0; pointer-events: none; z-index: 0; overflow: hidden; }
.lp-glow { position: absolute; border-radius: 50%; filter: blur(80px); }
.lp-glow-1 { width: 560px; height: 560px; top: -180px; right: -60px; background: radial-gradient(circle, rgba(43,217,191,0.34), transparent 70%); }
.lp-glow-2 { width: 480px; height: 480px; bottom: -160px; left: -120px; background: radial-gradient(circle, rgba(46,110,255,0.16), transparent 70%); }
.lp-grid-floor {
  position: absolute; left: -10%; right: -10%; bottom: 0; height: 62%;
  background-image:
    linear-gradient(rgba(43, 217, 191, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 217, 191, 0.09) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(440px) rotateX(62deg); transform-origin: bottom center;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 78%);
          mask-image: linear-gradient(to top, #000 0%, transparent 78%);
  opacity: 0.6;
}
.lp-vrail {
  position: absolute; right: 6px; top: 70px; z-index: 1;
  writing-mode: vertical-rl; font-family: var(--mn-mono);
  font-size: 11px; letter-spacing: 0.4em; color: var(--mn-text-3);
}
.lp-hero-copy, .lp-hero-visual { position: relative; z-index: 2; }

.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 13px 6px 11px; border-radius: 999px;
  background: rgba(43, 217, 191, 0.07); border: 1px solid rgba(43, 217, 191, 0.22);
  color: var(--mn-aqua-hi); font-family: var(--mn-mono); font-size: 12px; letter-spacing: 0.02em;
  margin-bottom: 24px;
}
.lp-eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mn-aqua); box-shadow: 0 0 10px var(--mn-aqua); animation: mnPulse 2.4s ease-in-out infinite; }
.lp-hero-title {
  font-family: var(--mn-sans); font-weight: 700;
  font-size: clamp(34px, 4.6vw, 58px); line-height: 1.06; letter-spacing: -0.03em;
  color: var(--mn-text); margin: 0 0 20px;
}
.lp-hero-title span { display: block; }
.lp-grad {
  display: inline !important;
  background: linear-gradient(100deg, #5af2d8 0%, #2bd9bf 45%, #46c8ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lp-hero-desc { font-size: clamp(15px, 1.3vw, 17px); line-height: 1.66; color: var(--mn-text-2); max-width: 30em; margin: 0 0 30px; }
.lp-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.landing-wrap .btn.btn-lg, .login-wrap .btn.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 10px; }
.lp-trust { list-style: none; display: flex; flex-wrap: wrap; gap: 26px; margin: 34px 0 0; padding: 24px 0 0; border-top: 1px solid var(--mn-line); }
.lp-trust li { display: flex; flex-direction: column; gap: 3px; }
.lp-trust b { font-family: var(--mn-mono); font-size: 20px; font-weight: 600; color: var(--mn-aqua-hi); letter-spacing: -0.01em; }
.lp-trust span { font-size: 12.5px; color: var(--mn-text-3); }

/* ---------- HERO VISUAL — console ---------- */
.lp-hero-visual { perspective: 1600px; }
.lp-app {
  display: grid; grid-template-columns: 176px minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(23, 34, 58, 0.92), rgba(14, 21, 36, 0.96));
  border: 1px solid var(--mn-line-2); border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(43,217,191,0.06), 0 40px 90px -30px rgba(0,0,0,0.8), 0 0 80px -30px var(--mn-glow);
  transform: rotateY(-7deg) rotateX(3deg); transform-origin: center right;
}
.lp-app-main, .lp-app-side, .lp-app-top, .lp-kpi { min-width: 0; }
.lp-app-side { padding: 16px 13px; background: rgba(8, 13, 23, 0.5); border-right: 1px solid var(--mn-line); display: flex; flex-direction: column; gap: 14px; }
.lp-app-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--mn-text); }
.lp-app-logo { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--mn-grad); color: #04140f; font-size: 13px; font-family: 'Noto Sans JP', sans-serif; font-weight: 700; }
.lp-app-nav { display: flex; flex-direction: column; gap: 3px; }
.lp-app-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; color: var(--mn-text-2); font-weight: 500; }
.lp-app-link svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--mn-text-3); }
.lp-app-link.active { background: rgba(43, 217, 191, 0.12); color: var(--mn-aqua-hi); box-shadow: inset 2px 0 0 var(--mn-aqua); }
.lp-app-link.active svg { color: var(--mn-aqua); }
.lp-app-badge { margin-left: auto; background: var(--mn-red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.lp-app-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding-top: 12px; border-top: 1px solid var(--mn-line); }
.lp-app-ava { width: 28px; height: 28px; border-radius: 50%; background: var(--mn-grad); color: #04140f; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.lp-app-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.lp-app-user-meta b { font-size: 12px; color: var(--mn-text); }
.lp-app-user-meta i { font-size: 10.5px; color: var(--mn-aqua); font-style: normal; }
.lp-app-main { padding: 15px 17px; display: flex; flex-direction: column; gap: 13px; }
.lp-app-top { display: flex; align-items: center; justify-content: space-between; }
.lp-app-top b { font-size: 13px; color: var(--mn-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-app-live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mn-mono); font-size: 10.5px; color: var(--mn-aqua); flex-shrink: 0; }
.lp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mn-aqua); box-shadow: 0 0 8px var(--mn-aqua); animation: mnPulse 2.4s ease-in-out infinite; }
.lp-app-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.lp-kpi { padding: 11px 12px; border: 1px solid var(--mn-line); border-radius: 11px; background: rgba(150, 174, 214, 0.04); }
.lp-kpi i { display: block; font-size: 10px; color: var(--mn-text-3); font-style: normal; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.lp-kpi b { display: block; font-family: var(--mn-mono); font-size: 16px; font-weight: 600; color: var(--mn-text); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; }
.lp-kpi u { display: block; margin-top: 3px; font-family: var(--mn-mono); font-size: 10px; color: var(--mn-text-3); text-decoration: none; }
.lp-kpi u.up { color: var(--mn-aqua); }
.lp-kpi u.warn { color: var(--mn-amber); }
.lp-app-panel { display: grid; grid-template-columns: 1.05fr 1fr; gap: 13px; }
.lp-bars { display: flex; align-items: flex-end; gap: 7px; height: 92px; padding: 10px 12px; border: 1px solid var(--mn-line); border-radius: 11px; background: rgba(150, 174, 214, 0.03); }
.lp-bars.wide { height: 118px; gap: 11px; }
.lp-bars span { flex: 1; height: var(--h); border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, rgba(43,217,191,0.55), rgba(43,217,191,0.12)); }
.lp-bars span.hot { background: linear-gradient(180deg, #5af2d8, #2bd9bf); box-shadow: 0 0 16px -2px var(--mn-glow); }
.lp-rows { display: flex; flex-direction: column; gap: 6px; }
.lp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--mn-text-2); padding: 6px 0; border-bottom: 1px solid var(--mn-line); }
.lp-row:last-child { border-bottom: none; }
.lp-pill { font-family: var(--mn-mono); font-size: 10px; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.lp-pill.ok { background: rgba(43,217,191,0.14); color: var(--mn-aqua-hi); }
.lp-pill.go { background: rgba(70,160,255,0.14); color: #7db9ff; }
.lp-pill.wait { background: rgba(242,176,75,0.16); color: #f7c873; }
.lp-app-status { display: flex; align-items: center; gap: 14px; padding-top: 11px; margin-top: 1px; border-top: 1px solid var(--mn-line); font-family: var(--mn-mono); font-size: 10.5px; color: var(--mn-text-3); }
.lp-app-stat { display: inline-flex; align-items: center; gap: 6px; }
.lp-app-stat.ok { color: var(--mn-aqua); }
.lp-app-stat.end { margin-left: auto; color: var(--mn-text-2); }

/* ---------- SECTION HEADS ---------- */
.lp-features, .lp-showcases, .lp-cta { max-width: 1240px; margin: 0 auto; padding: 56px 28px; }
.lp-sec-head { max-width: 680px; margin: 0 auto 44px; text-align: center; }
.lp-kicker { display: inline-block; font-family: var(--mn-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mn-aqua); margin-bottom: 14px; }
.lp-sec-head h2, .features-title { font-family: var(--mn-sans); font-weight: 700; font-size: clamp(26px, 3vw, 37px); line-height: 1.14; letter-spacing: -0.025em; color: var(--mn-text); margin: 0 0 13px; }
.lp-sec-sub { font-size: 15.5px; line-height: 1.6; color: var(--mn-text-2); margin: 0; }

/* ---------- FEATURES — bento bất đối xứng ---------- */
.lp-feature-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.lp-feature:nth-child(1) { grid-column: span 7; }
.lp-feature:nth-child(2) { grid-column: span 5; }
.lp-feature:nth-child(3) { grid-column: span 5; }
.lp-feature:nth-child(4) { grid-column: span 7; }
.lp-feature {
  position: relative; overflow: hidden;
  padding: 26px 24px; border-radius: 16px;
  background: linear-gradient(180deg, var(--mn-surface), var(--mn-raised));
  border: 1px solid var(--mn-line);
  transition: transform 260ms cubic-bezier(0.22,1,0.36,1), border-color 260ms ease, box-shadow 260ms ease;
}
.lp-feature::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(43,217,191,0.4), transparent); opacity: 0; transition: opacity 260ms ease; }
.lp-feature-ic { width: 46px; height: 46px; border-radius: 12px; margin-bottom: 18px; display: flex; align-items: center; justify-content: center; background: rgba(43, 217, 191, 0.10); color: var(--mn-aqua); border: 1px solid rgba(43, 217, 191, 0.2); }
.lp-feature-ic svg { width: 24px; height: 24px; }
.lp-feature h3 { font-family: var(--mn-sans); font-size: 18px; font-weight: 600; color: var(--mn-text); margin: 0 0 9px; letter-spacing: -0.01em; }
.lp-feature p { font-size: 13.5px; line-height: 1.62; color: var(--mn-text-2); margin: 0; max-width: 42ch; }
@media (hover: hover) and (pointer: fine) {
  .lp-feature:hover { transform: translateY(-4px); border-color: rgba(43, 217, 191, 0.32); box-shadow: 0 24px 48px -22px rgba(0,0,0,0.7), 0 0 40px -20px var(--mn-glow); }
  .lp-feature:hover::before { opacity: 1; }
}
/* Card thứ 5 — REALTIME, trải full hàng (theo mockup landing) */
.lp-feature:nth-child(5) { grid-column: span 12; }
.lp-feature-rt { background: linear-gradient(150deg, rgba(43,217,191,0.16), var(--mn-raised)); border-color: rgba(43,217,191,0.30); }
.lp-feature-rt-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--mn-aqua); letter-spacing: 0.06em; margin-bottom: 11px; }
.lp-feature-rt-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--mn-aqua); box-shadow: 0 0 8px var(--mn-aqua); }

/* ---------- STATS BAND (sau hero) ---------- */
.lp-statsband { max-width: 1180px; margin: 8px auto 0; padding: 0 24px; }
.lp-statsband-grid { display: grid; grid-template-columns: repeat(4, 1fr); background: linear-gradient(180deg, var(--mn-surface), var(--mn-raised)); border: 1px solid var(--mn-line); border-radius: 16px; overflow: hidden; }
.lp-stat { padding: 26px 20px; text-align: center; border-right: 1px solid var(--mn-line); }
.lp-stat:last-child { border-right: none; }
.lp-stat b { display: block; font-family: var(--mn-mono); font-size: 30px; font-weight: 600; color: var(--mn-aqua-hi); letter-spacing: -0.02em; }
.lp-stat span { display: block; margin-top: 7px; font-size: 12.5px; color: var(--mn-text-3); }
@media (max-width: 720px) { .lp-statsband-grid { grid-template-columns: repeat(2, 1fr); } .lp-stat:nth-child(2) { border-right: none; } .lp-stat:nth-child(1), .lp-stat:nth-child(2) { border-bottom: 1px solid var(--mn-line); } }

/* ---------- TESTIMONIALS ---------- */
.lp-tms { max-width: 1180px; margin: 0 auto; padding: 64px 24px 8px; }
.lp-tm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 34px; }
.lp-tm { background: linear-gradient(180deg, var(--mn-surface), var(--mn-raised)); border: 1px solid var(--mn-line); border-radius: 16px; padding: 24px 22px; }
.lp-tm-quote { font-size: 14.5px; line-height: 1.7; color: var(--mn-text-2); margin: 0 0 18px; }
.lp-tm-author { display: flex; align-items: center; gap: 12px; }
.lp-tm-ava { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 16px; color: var(--c, var(--mn-aqua)); background: color-mix(in srgb, var(--c, var(--mn-aqua)) 18%, transparent); }
.lp-tm-author b { display: block; font-size: 14px; color: var(--mn-text); }
.lp-tm-author i { display: block; font-style: normal; font-size: 12px; color: var(--mn-text-3); margin-top: 2px; }
@media (max-width: 720px) { .lp-tm-grid { grid-template-columns: 1fr; } }

/* ---------- SHOWCASES ---------- */
.lp-showcases { padding-top: 28px; padding-bottom: 28px; }
.lp-show { display: grid; grid-template-columns: 1fr 1.12fr; gap: 56px; align-items: center; padding: 50px 0; border-top: 1px solid var(--mn-line); }
.lp-show.reverse .lp-show-text { order: 2; }
.lp-show.reverse .lp-show-visual { order: 1; }
.lp-show-num { font-family: var(--mn-mono); font-size: 12px; font-weight: 500; color: var(--mn-aqua); letter-spacing: 0.1em; }
.lp-show-text .lp-kicker { display: block; margin: 9px 0 14px; }
.lp-show-text h3 { font-family: var(--mn-sans); font-size: clamp(22px, 2.4vw, 29px); font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; color: var(--mn-text); margin: 0 0 14px; }
.lp-show-text > p { font-size: 15px; line-height: 1.66; color: var(--mn-text-2); margin: 0 0 20px; }
.lp-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.lp-list li { position: relative; padding-left: 28px; font-size: 14px; line-height: 1.5; color: var(--mn-text-2); }
.lp-list li::before {
  content: ''; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 6px;
  background: rgba(43, 217, 191, 0.12);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232bd9bf' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>");
  background-size: 11px; background-position: center; background-repeat: no-repeat;
}

/* ---------- MOCKUP — dark glass console ---------- */
.lp-mock { background: linear-gradient(180deg, var(--mn-surface), var(--mn-raised)); border: 1px solid var(--mn-line-2); border-radius: 14px; overflow: hidden; box-shadow: 0 34px 70px -30px rgba(0,0,0,0.8); }
.lp-mock-bar { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-bottom: 1px solid var(--mn-line); background: rgba(8, 13, 23, 0.4); }
.lp-mock-bar::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--mn-aqua); box-shadow: 0 0 8px var(--mn-aqua); }
.lp-mock-tag { font-family: var(--mn-mono); font-size: 12px; font-weight: 500; color: var(--mn-text); }
.lp-mock-path { font-family: var(--mn-mono); font-size: 11px; color: var(--mn-text-3); }
.lp-mock-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.lp-mock-tools { display: flex; align-items: center; gap: 7px; }
.lp-chip { font-family: var(--mn-mono); font-size: 11px; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--mn-line); color: var(--mn-text-2); background: rgba(150,174,214,0.04); }
.lp-chip.active { background: rgba(43, 217, 191, 0.12); border-color: rgba(43,217,191,0.3); color: var(--mn-aqua-hi); }
.lp-mock-spacer { flex: 1; }
.lp-mock-add { font-family: var(--mn-mono); font-size: 11px; font-weight: 500; padding: 6px 12px; border-radius: 7px; background: var(--mn-grad); color: #04140f; }
.lp-table { display: flex; flex-direction: column; }
.lp-tr { display: grid; grid-template-columns: 1.4fr 1fr 0.7fr 0.9fr; gap: 8px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--mn-line); font-size: 12.5px; color: var(--mn-text); }
.lp-tr:last-child { border-bottom: none; }
.lp-th { font-family: var(--mn-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mn-text-3); }
.lp-tr span:nth-child(3) { font-family: var(--mn-mono); color: var(--mn-text-2); }
.lp-tr .lp-pill { justify-self: start; }

/* Inbox */
.lp-inbox { display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 0; padding: 0; }
.lp-convos { border-right: 1px solid var(--mn-line); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.lp-convo { display: flex; align-items: center; gap: 9px; padding: 9px 8px; border-radius: 8px; }
.lp-convo.active { background: rgba(43, 217, 191, 0.08); }
.lp-ava { width: 30px; height: 30px; border-radius: 50%; color: #04140f; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lp-ava.a { background: linear-gradient(135deg, #2bd9bf, #5af2d8); }
.lp-ava.b { background: linear-gradient(135deg, #4a90ff, #7db9ff); color:#021026; }
.lp-ava.c { background: linear-gradient(135deg, #f2b04b, #ffd27a); }
.lp-convo-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.lp-convo-meta b { font-size: 12.5px; color: var(--mn-text); }
.lp-convo-meta i { font-size: 11px; color: var(--mn-text-3); font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-unread { margin-left: auto; background: var(--mn-red); color: #fff; font-family: var(--mn-mono); font-size: 10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.lp-chat { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.lp-bubble { max-width: 82%; font-size: 12.5px; line-height: 1.45; padding: 8px 12px; border-radius: 13px; }
.lp-bubble.in { align-self: flex-start; background: rgba(150,174,214,0.08); color: var(--mn-text); border-bottom-left-radius: 4px; }
.lp-bubble.out { align-self: flex-end; background: var(--mn-grad); color: #04140f; border-bottom-right-radius: 4px; }
.lp-chat-input { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px 9px 13px; border: 1px solid var(--mn-line); border-radius: 999px; font-size: 12px; color: var(--mn-text-3); }
.lp-send { background: var(--mn-grad); color: #04140f; font-family: var(--mn-mono); font-size: 11px; padding: 5px 12px; border-radius: 999px; }

/* Stats mock */
.lp-mock-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lp-rank { display: flex; flex-direction: column; gap: 9px; }
.lp-rank-row { display: grid; grid-template-columns: 22px 84px 1fr auto; gap: 10px; align-items: center; font-size: 12px; color: var(--mn-text); }
.lp-rank-row > u { height: 7px; border-radius: 999px; background: rgba(150,174,214,0.10); position: relative; overflow: hidden; text-decoration: none; }
.lp-rank-row > u::after { content: ''; position: absolute; inset: 0; width: var(--w); border-radius: 999px; background: var(--mn-grad); }
.lp-rank-row > span:last-child { font-family: var(--mn-mono); color: var(--mn-text-3); font-size: 11px; white-space: nowrap; }
.lp-rk { width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mn-mono); font-size: 11px; font-weight: 600; color: #04140f; }
.lp-rk.one { background: var(--mn-aqua); }
.lp-rk.two { background: #8a99b3; }
.lp-rk.three { background: var(--mn-amber); }

/* Stock mock */
.lp-stock { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lp-stock-card { padding: 12px; border: 1px solid var(--mn-line); border-radius: 11px; background: rgba(150,174,214,0.03); }
.lp-stock-card b { display: block; font-size: 13px; color: var(--mn-text); }
.lp-stock-card i { display: block; font-family: var(--mn-mono); font-size: 10px; color: var(--mn-text-3); font-style: normal; margin: 3px 0 9px; }
.lp-meter { height: 7px; border-radius: 999px; background: rgba(150,174,214,0.1); overflow: hidden; }
.lp-meter u { display: block; height: 100%; width: var(--w); border-radius: 999px; background: var(--mn-grad); }
.lp-meter.low u { background: linear-gradient(90deg, var(--mn-amber), var(--mn-red)); }
.lp-stock-card em { display: block; font-family: var(--mn-mono); font-size: 10.5px; color: var(--mn-text-2); font-style: normal; margin-top: 7px; }
.lp-stock-card em.low { color: var(--mn-red); }
.lp-history { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.lp-his { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mn-text-2); }
.lp-his b { font-family: var(--mn-mono); color: var(--mn-text); }
.lp-his i { font-family: var(--mn-mono); color: var(--mn-text-3); font-style: normal; font-size: 10.5px; margin-left: auto; }
.lp-his-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lp-his-dot.in { background: var(--mn-aqua); }
.lp-his-dot.out { background: #7db9ff; }

/* ---------- CTA ---------- */
.lp-cta { padding-top: 32px; padding-bottom: 56px; }
.lp-cta-card {
  position: relative; overflow: hidden; padding: 60px 40px; text-align: center; border-radius: 20px;
  background: linear-gradient(150deg, #0f2a2c 0%, #102338 60%, #0c1626 100%);
  border: 1px solid rgba(43, 217, 191, 0.25);
  box-shadow: 0 40px 90px -40px rgba(0,0,0,0.8), inset 0 0 80px -40px var(--mn-glow);
}
.lp-cta-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(660px circle at 78% -20%, rgba(43,217,191,0.22), transparent 60%); }
.lp-cta-card h2 { position: relative; font-family: var(--mn-sans); font-size: clamp(25px, 3vw, 35px); font-weight: 700; letter-spacing: -0.025em; margin: 0 0 13px; color: var(--mn-text); }
.lp-cta-card p { position: relative; font-size: 15.5px; line-height: 1.6; color: var(--mn-text-2); max-width: 34em; margin: 0 auto 28px; }
.lp-cta-card .lp-hero-actions { position: relative; justify-content: center; }

/* ---------- FOOTER ---------- */
.lp-footer { border-top: 1px solid var(--mn-line); background: rgba(7, 11, 18, 0.6); }
.lp-footer-grid { max-width: 1240px; margin: 0 auto; padding: 52px 28px 28px; display: grid; grid-template-columns: 1.8fr 1fr 1fr; gap: 40px; }
.lp-footer-brand .landing-brand-name { color: var(--mn-text); }
.lp-footer-brand p { font-size: 13.5px; line-height: 1.66; color: var(--mn-text-2); max-width: 34em; margin: 16px 0 0; }
.lp-footer-col { display: flex; flex-direction: column; gap: 11px; }
.lp-footer-col b { font-family: var(--mn-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mn-text-3); font-weight: 500; margin-bottom: 3px; }
.lp-footer-col a { font-size: 13.5px; color: var(--mn-text-2); text-decoration: none; transition: color 160ms ease; }
.lp-footer-col a:hover { color: var(--mn-aqua-hi); }
.lp-footer-bottom { max-width: 1240px; margin: 0 auto; padding: 18px 28px; border-top: 1px solid var(--mn-line); font-family: var(--mn-mono); font-size: 11.5px; color: var(--mn-text-3); display: flex; align-items: center; gap: 8px; }
.lp-footer-bottom .logo-square.sm { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }

/* =========================================================
   LOGIN / REGISTER — Tokyo Midnight
   ========================================================= */
.login-wrap {
  background:
    radial-gradient(900px circle at 18% 0%, rgba(43, 217, 191, 0.10), transparent 46%),
    radial-gradient(900px circle at 86% 100%, rgba(46, 110, 255, 0.10), transparent 46%),
    linear-gradient(180deg, #0b1120 0%, var(--mn-bg) 50%, var(--mn-void) 100%);
  color: var(--mn-text); font-family: var(--mn-sans);
}
.login-wrap .login-card {
  background: linear-gradient(180deg, rgba(23, 34, 58, 0.7), rgba(14, 21, 36, 0.85));
  border: 1px solid var(--mn-line-2);
  box-shadow: 0 40px 90px -40px rgba(0,0,0,0.85), 0 0 80px -40px var(--mn-glow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.login-wrap .logo-block .logo-square { width: 56px; height: 56px; font-size: 28px; display: inline-flex; align-items: center; justify-content: center; }
.login-wrap .brand-title { background: none; -webkit-text-fill-color: var(--mn-text); color: var(--mn-text); font-family: var(--mn-sans); font-weight: 700; }
.login-wrap .brand-subtitle { color: var(--mn-text-3); }
.login-wrap .form-group label { color: var(--mn-text-2); }
.login-wrap input {
  background: rgba(8, 13, 23, 0.6) !important; border: 1px solid var(--mn-line-2); color: var(--mn-text);
  border-radius: 9px;
}
.login-wrap input::placeholder { color: var(--mn-text-3); }
.login-wrap input:hover { border-color: var(--mn-line-2); }
.login-wrap input:focus { border-color: var(--mn-aqua); box-shadow: 0 0 0 3px rgba(43, 217, 191, 0.18); background: rgba(8, 13, 23, 0.8) !important; }
.login-wrap .hint-text { color: var(--mn-text-3); }
.login-wrap .hint-text a, .login-wrap .hint-text a b { color: var(--mn-aqua-hi); }
.login-wrap .login-back { color: var(--mn-text-3); }
.login-wrap .login-back:hover { color: var(--mn-aqua-hi); }
.login-wrap .error-msg { background: rgba(255, 93, 98, 0.12); border: 1px solid rgba(255, 93, 98, 0.4); color: #ffb3b5; }
.login-wrap .register-success h3 { color: var(--mn-text); }
.login-wrap .register-success p { color: var(--mn-text-2); }
.login-wrap .register-success b { color: var(--mn-aqua-hi); }
.login-wrap .reg-success-icon { background: var(--mn-grad); color: #04140f; border-radius: 14px; }

/* =========================================================
   ANIMATION — tiết chế, chỉ transform/opacity
   ========================================================= */
.lp-rise { opacity: 0; transform: translateY(12px); animation: lpRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes lpRise { to { opacity: 1; transform: none; } }
@keyframes mnPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.reveal-ready .reveal { opacity: 0; transform: translateY(16px); }
.reveal-ready .reveal.in-view { opacity: 1; transform: none; transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1), transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }

.flash-title { animation: lpFlash 0.8s ease; }
@keyframes lpFlash { 0%, 100% { color: var(--mn-text); } 35% { color: var(--mn-aqua-hi); } }

.landing-wrap .btn:active, .login-wrap .btn:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  .lp-rise { animation: none; opacity: 1; transform: none; }
  .lp-eyebrow-dot, .lp-dot { animation: none; }
  .reveal-ready .reveal { opacity: 1; transform: none; transition: none; }
}

/* =========================================================
   RESPONSIVE — landing
   ========================================================= */
@media (max-width: 1000px) {
  .lp-hero { grid-template-columns: 1fr; gap: 40px; padding-top: 52px; }
  .lp-hero-visual { order: -1; }
  .lp-app { transform: none; }
  .lp-vrail { display: none; }
  .lp-show, .lp-show.reverse .lp-show-text, .lp-show.reverse .lp-show-visual { grid-template-columns: 1fr; order: 0; }
  .lp-show { gap: 28px; }
  .lp-feature:nth-child(n) { grid-column: span 6; }
  .lp-footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .lp-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 860px) { .landing-nav-links { display: none; } }
@media (max-width: 560px) {
  .landing-nav { padding: 11px 16px; }
  .landing-brand-sub { display: none; }
  .lp-hero { padding: 34px 18px 44px; }
  .lp-features, .lp-showcases, .lp-cta { padding-left: 18px; padding-right: 18px; }
  .lp-feature:nth-child(n) { grid-column: span 12; }
  .lp-app { grid-template-columns: 124px minmax(0, 1fr); }
  .lp-app-side { padding: 12px 9px; gap: 12px; }
  .lp-app-link { padding: 7px 8px; font-size: 11.5px; gap: 7px; }
  .lp-app-main { padding: 13px; gap: 11px; }
  .lp-app-panel { grid-template-columns: 1fr; }
  .lp-app-kpis, .lp-mock-kpis { grid-template-columns: 1fr 1fr; }
  .lp-kpi b { font-size: 13.5px; }
  .lp-app-status { gap: 10px; flex-wrap: wrap; }
  .lp-inbox { grid-template-columns: 1fr; }
  .lp-convos { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--mn-line); }
  .lp-stock { grid-template-columns: 1fr; }
  .lp-trust { gap: 18px; }
  .lp-footer-grid { grid-template-columns: 1fr; }
  .lp-cta-card { padding: 40px 22px; }
}

.landing-wrap { overflow-x: hidden; }

/* Nền body mặc định tối cho landing/login */
body { background: #070b12; }

/* =========================================================
   ✦ TOKYO MIDNIGHT — APP (sau đăng nhập)
   Lật toàn bộ workspace sang dark command-center, đồng bộ landing.
   Scope `body.app-light` + đặt CUỐI → thắng mọi lớp sáng phía trên.
   ========================================================= */
body.app-light {
  --bg-page:     #0a0f1a;
  --bg-card:     #111a2b;
  --bg-subtle:   rgba(150, 174, 214, 0.05);
  --bg-sidebar:  #0c1320;
  --bg-hover:    rgba(150, 174, 214, 0.07);
  --bg-elevated: #152134;

  --border:        rgba(150, 174, 214, 0.12);
  --border-soft:   rgba(150, 174, 214, 0.07);
  --border-strong: rgba(43, 217, 191, 0.45);

  --text-1: #e9eef8;
  --text-2: #a2b2cd;
  --text-3: #64748f;
  --text-4: #4a576e;

  --accent:        #2bd9bf;
  --accent-dark:   #5af2d8;
  --accent-light:  #14b8a6;
  --accent-soft:   rgba(43, 217, 191, 0.12);
  --accent-glow:   rgba(43, 217, 191, 0.22);
  --accent-grad:   linear-gradient(135deg, #2bd9bf 0%, #14b8a6 55%, #0ea5a0 100%);

  --primary: #2bd9bf; --primary-2: #14b8a6; --primary-strong: #5af2d8;
  --primary-grad: linear-gradient(135deg, #2bd9bf, #14b8a6);
  --primary-soft: rgba(43, 217, 191, 0.12);
  --ring: rgba(43, 217, 191, 0.28);
  --shadow-primary: 0 10px 24px -12px rgba(43, 217, 191, 0.40);

  --success: #2dd4a0; --success-soft: rgba(45, 212, 160, 0.13);
  --danger:  #ff5d62; --danger-soft:  rgba(255, 93, 98, 0.13);
  --info:    #5aa2ff; --info-soft:    rgba(90, 162, 255, 0.13);
  --warning: #f2b04b; --warning-soft: rgba(242, 176, 75, 0.14);
  --purple:  #b39bff; --purple-soft:  rgba(167, 139, 250, 0.16);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 30px -10px rgba(0, 0, 0, 0.60);
  --shadow-lg: 0 30px 64px -22px rgba(0, 0, 0, 0.75);

  background: var(--bg-page);
  color: var(--text-1);
}

/* App shell */
body.app-light .app.active {
  background:
    radial-gradient(1000px circle at 100% -6%, rgba(43, 217, 191, 0.05), transparent 44%),
    radial-gradient(800px circle at 0% 4%, rgba(46, 110, 255, 0.04), transparent 42%),
    var(--bg-page);
}
body.app-light .sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border); box-shadow: none; }
body.app-light .sidebar-brand { border-bottom-color: var(--border); }
body.app-light .sidebar-brand .logo-square { box-shadow: 0 0 0 1px rgba(43,217,191,0.25), 0 8px 22px -8px rgba(43,217,191,0.40); }
body.app-light .sidebar-brand .brand-title {
  background: linear-gradient(110deg, #e9eef8 22%, #5af2d8 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
body.app-light .brand-subtitle { color: var(--text-3); }
body.app-light .sidebar-overlay { background: rgba(3, 6, 12, 0.55); }

/* Tabs */
body.app-light .tab { color: var(--text-2); }
body.app-light .tab .tab-icon { background: rgba(150, 174, 214, 0.06); border-color: var(--border); color: var(--text-3); }
body.app-light .tab:hover { background: rgba(150, 174, 214, 0.06); color: var(--text-1); }
body.app-light .tab.active { background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px rgba(43, 217, 191, 0.20); }
body.app-light .tab.active .tab-icon { background: rgba(43, 217, 191, 0.16); border-color: rgba(43, 217, 191, 0.30); color: var(--accent-dark); }
body.app-light .tab.active::before { background: var(--accent); box-shadow: 0 0 10px rgba(43,217,191,0.5); }
body.app-light .tab-badge { background: var(--danger); }

/* User block */
body.app-light .user-info { background: rgba(150, 174, 214, 0.05); border-color: var(--border); }
body.app-light .user-avatar { background: var(--accent-grad); color: #04140f; }
body.app-light .user-meta .role { color: var(--text-3); }

/* Topbar */
body.app-light .topbar { background: rgba(12, 19, 32, 0.82); border-bottom-color: var(--border); box-shadow: none; }
body.app-light .realtime-badge { background: rgba(45, 212, 160, 0.12); border-color: rgba(45, 212, 160, 0.30); color: #5af2d8; }
body.app-light .realtime-badge.offline { color: #ff8e91; border-color: rgba(255, 93, 98, 0.35); }
body.app-light .live-dot { box-shadow: 0 0 8px rgba(43,217,191,0.6); }

/* Stat cards */
body.app-light .stat-card { background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
body.app-light .stat-card:hover { border-color: rgba(43, 217, 191, 0.30); box-shadow: var(--shadow-md), 0 0 32px -18px var(--accent-glow); }
body.app-light .stat-value { color: var(--text-1); }
body.app-light .stat-label { color: var(--text-3); }

/* Period chips */
body.app-light .chip { background: rgba(150, 174, 214, 0.05); border-color: var(--border); color: var(--text-2); box-shadow: none; }
body.app-light .chip:hover { background: rgba(150, 174, 214, 0.10); }
body.app-light .chip.active { background: var(--accent-grad); border-color: transparent; color: #04140f; box-shadow: 0 8px 18px -8px var(--accent-glow); }

/* Filters + employee filter */
body.app-light .filters, body.app-light .emp-filter { background: var(--bg-card); border-color: var(--border); }
body.app-light .chip-emp { background: rgba(150, 174, 214, 0.05); border-color: var(--border); color: var(--text-2); }
body.app-light .chip-emp.active { background: var(--accent-soft); border-color: rgba(43,217,191,0.4); color: var(--accent-dark); }

/* Form controls */
body.app-light input, body.app-light select, body.app-light textarea {
  background-color: rgba(8, 13, 23, 0.55); border-color: var(--border); color: var(--text-1);
}
body.app-light input:hover, body.app-light select:hover, body.app-light textarea:hover { border-color: rgba(43, 217, 191, 0.40); }
body.app-light input:focus, body.app-light select:focus, body.app-light textarea:focus {
  background-color: rgba(8, 13, 23, 0.80); border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
body.app-light input[readonly] { background-color: rgba(150, 174, 214, 0.04); }
body.app-light input::placeholder, body.app-light textarea::placeholder { color: var(--text-3); }
body.app-light select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%232bd9bf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
body.app-light select option { background: #111a2b; color: var(--text-1); }
body.app-light .option-list { background: #111a2b; border-color: var(--border); }
body.app-light .option-list .opt:hover, body.app-light .option-list .opt.active { background: var(--accent-soft); color: var(--accent-dark); }

/* Buttons */
body.app-light .btn { background: rgba(150, 174, 214, 0.06); border-color: var(--border); color: var(--text-1); box-shadow: var(--shadow-xs); }
body.app-light .btn:hover { background: rgba(150, 174, 214, 0.12); border-color: var(--border-strong); }
body.app-light .btn-soft { background: rgba(150, 174, 214, 0.06); color: var(--text-2); }
body.app-light .btn-primary { background: var(--accent-grad); border: 1px solid rgba(43, 217, 191, 0.5); color: #04140f; box-shadow: 0 8px 22px -10px var(--accent-glow); }
body.app-light .btn-primary:hover { background: var(--accent-grad); filter: none; box-shadow: 0 12px 28px -10px var(--accent-glow); }
body.app-light .btn-danger { background: rgba(255, 93, 98, 0.12); border-color: rgba(255, 93, 98, 0.35); color: #ff9a9d; }
body.app-light .btn-danger:hover { background: rgba(255, 93, 98, 0.18); border-color: var(--danger); }
body.app-light .icon-btn { background: rgba(150, 174, 214, 0.06); border-color: var(--border); color: var(--text-2); }
body.app-light .icon-btn:hover { background: rgba(150, 174, 214, 0.12); border-color: var(--border-strong); color: var(--accent-dark); }
body.app-light .icon-btn.danger:hover { background: rgba(255, 93, 98, 0.14); border-color: rgba(255, 93, 98, 0.40); color: #ff8e91; }
body.app-light .icon-btn.approve { color: var(--success); border-color: rgba(45, 212, 160, 0.40); }
body.app-light .icon-btn.approve:hover { background: rgba(45, 212, 160, 0.14); color: #6ff0c4; border-color: var(--success); }

/* Tables */
body.app-light .table-wrap { background: var(--bg-card); border-color: var(--border); box-shadow: var(--shadow-xs); }
body.app-light .table-wrap thead, body.app-light thead { background: rgba(150, 174, 214, 0.04); }
body.app-light .table-wrap thead th, body.app-light th { color: var(--text-3); border-bottom-color: var(--border); }
body.app-light td { color: var(--text-1); border-bottom-color: var(--border); }
body.app-light .table-wrap tbody tr:hover, body.app-light tbody tr:hover { background: rgba(43, 217, 191, 0.07); box-shadow: inset 2px 0 0 var(--accent); }
body.app-light .empty-state { color: var(--text-3); }
body.app-light .empty-state h3 { color: var(--text-1); }
body.app-light tr.pending-row { background: rgba(242, 176, 75, 0.06); }
body.app-light tr.pending-row:hover { background: rgba(242, 176, 75, 0.10); }

/* Modal + toast */
body.app-light .modal { background: linear-gradient(180deg, #141d30, #0f1626); border-color: var(--border); box-shadow: var(--shadow-lg); }
body.app-light .modal-backdrop { background: rgba(3, 6, 12, 0.64); }
body.app-light .modal-footer { background: rgba(8, 13, 23, 0.5); }
body.app-light .modal-head, body.app-light .modal-head h3 { color: var(--text-1); }
body.app-light .toast { background: #141d30; border-color: var(--border); }

/* === Phân biệt rõ loại thông báo (sửa lỗi: trước đây mọi toast cùng 1 màu) ===
   - Xác nhận thường (success/info): viền màu 4px, nhẹ nhàng — "bình thường".
   - Cần chú ý (error/warning/activity): viền dày 5px + quầng sáng màu — "thông báo" nổi bật. */
body.app-light .toast.success  { border-left-color: var(--success); }
body.app-light .toast.info     { border-left-color: var(--info); }
body.app-light .toast.error    { border-left-color: var(--danger); }
body.app-light .toast.warning  { border-left-color: var(--warning); }
body.app-light .toast.activity { border-left-color: var(--accent); }
body.app-light .toast.error,
body.app-light .toast.warning,
body.app-light .toast.activity { border-left-width: 5px; }
body.app-light .toast.error    { box-shadow: var(--shadow-md), -7px 0 24px -9px rgba(255, 93, 98, 0.55); }
body.app-light .toast.warning  { box-shadow: var(--shadow-md), -7px 0 24px -9px rgba(242, 176, 75, 0.50); }
body.app-light .toast.activity { box-shadow: var(--shadow-md), -7px 0 24px -9px rgba(43, 217, 191, 0.50); }

/* Banners */
body.app-light .welcome-banner { background: var(--accent-grad); color: #04140f; }
body.app-light .pending-banner { background: var(--warning-soft); border-color: rgba(242, 176, 75, 0.30); border-left-color: var(--warning); color: #f7c873; box-shadow: none; }
body.app-light .pending-banner b { color: #ffd9a0; }

/* Tags / pills — chữ sáng trên nền tối */
body.app-light .pill-green, body.app-light .tag-green { background: rgba(45, 212, 160, 0.14); border-color: rgba(45, 212, 160, 0.30); color: #5af2d8; }
body.app-light .pill-blue, body.app-light .tag-blue { background: rgba(90, 162, 255, 0.14); border-color: rgba(90, 162, 255, 0.30); color: #9cc4ff; }
body.app-light .pill-amber, body.app-light .tag-gold, body.app-light .tag-yellow { background: rgba(242, 176, 75, 0.16); border-color: rgba(242, 176, 75, 0.30); color: #f7c873; }
body.app-light .tag-red, body.app-light .pill-red { background: rgba(255, 93, 98, 0.14); border-color: rgba(255, 93, 98, 0.30); color: #ff9a9d; }
body.app-light .tag-orange { background: rgba(255, 140, 60, 0.14); border-color: rgba(255, 140, 60, 0.30); color: #ffb787; }
body.app-light .tag-purple { background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.30); color: #c4b3ff; }
body.app-light .tag-gray { background: rgba(150, 174, 214, 0.10); border-color: rgba(150, 174, 214, 0.25); color: var(--text-2); }

/* Misc */
body.app-light code { background: rgba(150, 174, 214, 0.08); color: var(--accent-dark); border-color: var(--border); }
body.app-light a { color: var(--accent-dark); }
body.app-light ::-webkit-scrollbar-thumb { background: rgba(150, 174, 214, 0.18); border-color: var(--bg-page); }
body.app-light ::-webkit-scrollbar-thumb:hover { background: rgba(43, 217, 191, 0.50); }

/* =========================================================
   2026 PRODUCTIVITY UPGRADE
   Command palette, bulk operations, save state polish.
   ========================================================= */
.topbar-command {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: min(420px, 38vw);
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(150, 174, 214, 0.06);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.topbar-command:hover {
  background: rgba(150, 174, 214, 0.11);
  border-color: var(--border-strong);
  color: var(--text-1);
}
.topbar-command:active { transform: scale(0.985); }
.command-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  font-weight: 800;
}
.command-label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 13px;
}
kbd {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(150, 174, 214, 0.08);
  color: var(--text-3);
  font: 600 11px/1 var(--font-body);
}

.modal.modal-command {
  max-width: 680px;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
}
.command-shell { padding: 12px; }
.command-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(150, 174, 214, 0.06);
}
.command-search > span {
  color: var(--accent-dark);
  font-weight: 800;
}
.command-search input {
  flex: 1;
  height: 44px;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 15px;
}
.command-list {
  max-height: min(62vh, 540px);
  overflow: auto;
  padding: 10px 2px 2px;
}
.command-item {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.command-item:hover,
.command-item.active {
  background: var(--accent-soft);
  border-color: rgba(43, 217, 191, 0.28);
}
.command-item:active { transform: scale(0.99); }
.command-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(150, 174, 214, 0.08);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}
.command-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.command-item-main b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.command-item-main i {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}
.command-item-type {
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.command-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -2px 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(43, 217, 191, 0.26);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text-2);
}
.bulk-bar > div {
  margin-right: auto;
  color: var(--text-1);
}
.select-col {
  width: 42px;
  text-align: center;
}
.select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  cursor: pointer;
}

.realtime-badge.saving,
.realtime-badge.saved,
.realtime-badge.save-error {
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.realtime-badge.saving {
  background: rgba(90, 162, 255, 0.13) !important;
  border-color: rgba(90, 162, 255, 0.32) !important;
  color: #9cc4ff !important;
}
.realtime-badge.saved {
  background: rgba(45, 212, 160, 0.13) !important;
  border-color: rgba(45, 212, 160, 0.32) !important;
  color: #5af2d8 !important;
}
.realtime-badge.save-error {
  background: rgba(255, 93, 98, 0.13) !important;
  border-color: rgba(255, 93, 98, 0.34) !important;
  color: #ff9a9d !important;
}

@media (max-width: 980px) {
  .topbar-command {
    min-width: 0;
    width: 42px;
    padding: 0;
    justify-content: center;
  }
  .topbar-command .command-label,
  .topbar-command kbd { display: none; }
}

@media (max-width: 680px) {
  .modal.modal-command {
    max-width: calc(100vw - 22px);
  }
  .command-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .command-item-type { display: none; }
  .bulk-bar .btn {
    flex: 1;
  }
}

/* =========================================================
   DASHBOARD — Trang Tổng quan (KPI cards + panels)
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px -12px rgba(0, 0, 0, 0.5);
  transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.6); }
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text-1); margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.kpi-card.accent { border-left-color: var(--accent); }
.kpi-card.ok     { border-left-color: var(--success); }
.kpi-card.warn   { border-left-color: var(--warning); }
.kpi-card.danger { border-left-color: var(--danger); }
.kpi-card.accent .kpi-value { color: var(--accent); filter: brightness(1.15); }
.kpi-card.warn   .kpi-value { color: var(--warning); }
.kpi-card.danger .kpi-value { color: var(--danger); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-panel {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
}
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
  font-weight: 700; font-size: 14px; color: var(--text-1);
}
.dash-panel-body { padding: 6px 8px; }
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 8px;
  transition: background .12s;
}
.dash-row[data-q] { cursor: pointer; }
.dash-row:hover { background: rgba(255, 255, 255, 0.045); }
.dash-row + .dash-row { border-top: 1px solid var(--border-soft); }
.dash-row-main { flex: 1; min-width: 0; }
.dash-row-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dash-empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.6; }

/* Chip "khách chờ X phút" trên danh sách hội thoại */
.conv-wait {
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 5px;
  color: #f2b04b;
  background: rgba(242, 176, 75, 0.14);
  border: 1px solid rgba(242, 176, 75, 0.38);
}

/* ===== Skeleton loading (tham khảo app lớn) ===== */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.11) 37%, rgba(255,255,255,0.05) 63%);
  background-size: 400% 100%;
  animation: skelShimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skelShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel-conv { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 14px; align-items: center; }
.skel-conv .skel-av { width: 40px; height: 40px; border-radius: 50%; }
.skel-line { height: 10px; }
.skel-line.short { width: 55%; margin-top: 7px; }
.skel-bubble { height: 34px; border-radius: 14px; margin: 8px 0; }
.skel-bubble.them { width: 60%; }
.skel-bubble.me { width: 50%; margin-left: auto; }

/* ===== Bảng pro: cuộn trong khung + tiêu đề cột DÍNH khi cuộn ===== */
body.app-light .table-wrap { max-height: calc(100vh - 240px); overflow: auto; }
body.app-light .table-wrap thead th {
  position: sticky; top: 0; z-index: 3;
  background: #111a2b; /* khớp --bg-card (theme tối) để hàng không lộ qua */
}

/* =========================================================
   ANALYTICS — Trang Phân tích (kiểu Google Search Console)
   ========================================================= */
.an-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.an-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.an-card:hover { border-color: var(--c, var(--accent)); transform: translateY(-1px); }
.an-card.active {
  border-color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  box-shadow: inset 0 0 0 1px var(--c, var(--accent));
}
.an-card-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3);
}
.an-card.active .an-card-label { color: var(--c, var(--accent)); filter: brightness(1.2); }
.an-card-value {
  font-size: 25px; font-weight: 800; color: var(--text-1); margin-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}

.an-ranges { display: inline-flex; gap: 4px; background: rgba(255,255,255,0.04); padding: 3px; border-radius: 999px; }
.an-range {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  border: none; background: transparent; color: var(--text-2); cursor: pointer;
}
.an-range.on { background: var(--accent); color: #fff; }

.an-chart-card {
  position: relative;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px 8px;
  margin-bottom: 16px;
}
.an-chart { width: 100%; height: auto; display: block; }
.an-grid { stroke: rgba(148, 163, 184, 0.16); stroke-width: 1; }
.an-ylab, .an-xlab { fill: var(--text-3); font-size: 11px; font-family: inherit; }
.an-guide { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.an-tip {
  position: absolute; top: 10px;
  background: #0f172a; color: #f1f5f9;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; line-height: 1.5;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 22px -8px rgba(0,0,0,0.5); z-index: 5;
}

.an-table-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 12px; overflow: hidden;
}
.an-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.an-tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.an-tab {
  font-size: 12.5px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.an-tab:hover { color: var(--text-1); }
.an-tab.on { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--border); filter: brightness(1.3); }
.an-filter { font-size: 13px; padding: 7px 11px; max-width: 220px; }
.an-table-wrap { overflow-x: auto; max-height: 460px; overflow-y: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-table thead th {
  position: sticky; top: 0; z-index: 1; background: #111a2b;
  text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
  border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none;
}
.an-table thead th.num { text-align: right; }
.an-table thead th:hover { color: var(--text-1); }
.an-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text-1); }
.an-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.an-table tbody tr:hover { background: rgba(255,255,255,0.04); }
