/* ==========================================================================
   iTN Store · Web UI Demo · Apple Retail & KiotViet Ergonomics
   Nhận diện: Nền tối sang trọng / Nền sáng tinh tế, Gold #b8892b, Apple Blue #0071e3
   ========================================================================== */

:root {
  --color-gold: #b8892b;
  --color-gold-light: #f1c86a;
  --color-gold-bg: rgba(184, 137, 43, 0.12);
  --color-blue: #0284c7;
  --color-blue-hover: #0369a1;
  --color-blue-soft: rgba(2, 132, 199, 0.12);
  --color-sapphire: #0369a1;
  --color-sapphire-light: #38bdf8;
  --color-green: #10b981;
  --color-green-soft: rgba(16, 185, 129, 0.12);
  --color-amber: #f59e0b;
  --color-amber-soft: rgba(245, 158, 11, 0.12);
  --color-purple: #8b5cf6;
  --color-purple-soft: rgba(139, 92, 246, 0.12);
  --color-red: #b91c1c;
  --color-red-soft: rgba(185, 28, 28, 0.12);

  /* Theme Nền tối Sapphire Executive */
  --bg-app: #080c14;
  --bg-card: #131926;
  --bg-card-hover: #182030;
  --bg-input: #0f1523;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(2, 132, 199, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-linear: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-cinematic: cubic-bezier(0.32, 0.72, 0, 1);
  --duration-motion: 380ms;

  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --header-height: 64px;
}

/* Light Theme toggle (nếu người dùng đổi) */
[data-theme="light"] {
  --bg-app: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f9fb;
  --bg-input: #ffffff;
  --border-color: #d2d2d7;
  --border-highlight: #86868b;
  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --text-dim: #86868b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

body {
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  background-image: 
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(2, 132, 199, 0.08), transparent 70%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.03), transparent 50%);
}

/* ==========================================================================
   ROLE CONTROL BAR (Thanh giả lập vai trò & thiết bị thử nghiệm cho anh Nghĩa)
   ========================================================================== */
.role-control-bar {
  background: #080b11;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  z-index: 1000;
  position: relative;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.role-control-bar.collapsed {
  padding: 4px 20px;
  background: #06080d;
}

.role-bar-collapsed-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.role-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.role-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
}
.role-badge-tag.admin { background: rgba(2, 132, 199, 0.15); color: #38bdf8; border: 1px solid rgba(2, 132, 199, 0.3); }
.role-badge-tag.manager { background: rgba(245, 166, 35, 0.15); color: #fbbf24; border: 1px solid rgba(245, 166, 35, 0.3); }
.role-badge-tag.warehouse { background: rgba(52, 199, 89, 0.15); color: #34d399; border: 1px solid rgba(52, 199, 89, 0.3); }
.role-badge-tag.sale { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.3); }
.role-badge-tag.technician { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.role-badge-tag.marketing { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }

.role-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-select-wrapper label {
  color: var(--text-muted);
  font-weight: 500;
}

.role-select-wrapper select {
  background: #111622;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.role-select-wrapper select:focus {
  border-color: #0284c7;
}

.device-simulator-toggle {
  display: flex;
  background: #111622;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.device-btn.active {
  background: #0284c7;
  color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: #0d121d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.header-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 9px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.header-brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #f8fafc;
}

.header-branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  transition: border-color 0.2s ease;
}
.header-branch-pill:hover {
  border-color: rgba(2, 132, 199, 0.4);
}
.branch-label-dim {
  color: #94a3b8;
  font-weight: 500;
}
.header-branch-pill select {
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.branch-chevron {
  color: var(--text-muted);
  font-size: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  color: #cbd5e1;
}
.header-notif-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.notif-bell-icon {
  font-size: 15px;
}
.notif-badge-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d121d;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.user-profile-badge:hover {
  border-color: rgba(2, 132, 199, 0.4);
  background: rgba(255, 255, 255, 0.08);
}
.user-avatar-exec {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: #0284c7;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.user-name-exec {
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
}

/* ==========================================================================
   NAVIGATION BAR (Apple High-End Tech Style With Sliding Indicator)
   ========================================================================== */
.app-nav {
  background: #0d121d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  position: relative;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  padding: 13px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.2s ease;
  position: relative;
  flex-shrink: 0;
}
.nav-tab-btn:hover {
  color: #f8fafc;
}
.nav-tab-btn.active {
  color: #38bdf8;
  font-weight: 600;
}

/* Sliding Indicator chuẩn Apple Linear */
.nav-sliding-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 2px;
  transition: transform var(--duration-motion) var(--ease-apple);
  pointer-events: none;
}

/* ==========================================================================
   MAIN LAYOUT & WORKSPACE CONTAINER
   ========================================================================== */
.main-viewport {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Simulator Container khi bật chế độ iPhone */
body.simulator-mode {
  background: #05070a;
  padding-bottom: 40px;
}
body.simulator-mode .main-viewport {
  max-width: 412px;
  padding: 0;
  margin: 20px auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 12px #22252a;
  border-radius: 48px;
  overflow: hidden;
  background: var(--bg-app);
  border: 4px solid #1a1d22;
  position: relative;
}
body.simulator-mode .iphone-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px 8px;
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 600;
}
body.simulator-mode .iphone-dynamic-island {
  width: 100px;
  height: 24px;
  background: #000;
  border-radius: 12px;
  margin: 0 auto;
}
.iphone-statusbar {
  display: none;
}

/* ==========================================================================
   STAT CARDS (KPI TỒN KHO)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.search-box-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 38px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px var(--color-gold-bg);
}

/* Nút hành động — chuẩn chung (A2, 25/09/2026). MỘT dáng cho cả nút chính lẫn nút phụ: viên thuốc (--itn-nut-bo),
   cao ≥44px (vùng bấm Apple HIG, cả iPad), chữ 13px theo font app. .dash-action-btn-primary/-secondary là cùng chuẩn
   (trước chưa có kiểu gốc nên hiện nút xám mặc định trình duyệt: viền 2px outset, bo 0, thẻ a thành link chữ trần).
   Màu theo theme ở themes.css; token --itn-nut-bo / --itn-nut-vien và trạng thái nguy hiểm ở cuối file này. */
.action-btn-primary, .dash-action-btn-primary,
.action-btn-secondary, .dash-action-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border-radius: var(--itn-nut-bo, 999px);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.action-btn-primary, .dash-action-btn-primary {
  background: var(--color-gold);
  color: #000;
  border: none;
  padding: 10px 18px;
  font-weight: 700;
}
.action-btn-primary:hover, .dash-action-btn-primary:hover {
  background: var(--color-gold-light);
}
.action-btn-primary:disabled, .dash-action-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.action-btn-secondary, .dash-action-btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--itn-nut-vien, var(--border-color));
  padding: 10px 16px;
  font-weight: 600;
}
.action-btn-secondary:hover, .dash-action-btn-secondary:hover {
  background: var(--border-color);
}
.action-btn-secondary:disabled, .dash-action-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.owner-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.owner-badge.shop {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.owner-badge.customer {
  background: rgba(175, 82, 222, 0.2);
  color: #d28fff;
  border: 1px solid #af52de;
}

/* ==========================================================================
   MODAL & SLIDE-OVER DRAWER (Luxury Frosted Glass Sheet Transition)
   ========================================================================== */
.itn-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 13, 0.7);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-apple);
  padding: 16px;
  box-sizing: border-box;
}
.itn-modal-overlay.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  display: flex !important;
  z-index: 1000000 !important;
}

.itn-modal-card {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  width: 100%;
  max-width: min(600px, calc(100vw - 24px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.96) translateY(20px);
  transition: transform 0.38s var(--ease-apple);
  box-sizing: border-box;
}
.itn-modal-overlay.open .itn-modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  padding: 0;
}
.modal-close-btn:hover, .modal-close-btn:focus-visible {
  background: var(--bg-input);
  color: var(--text-main);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(90vh - 120px);
  box-sizing: border-box;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #11151c;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ==========================================================================
   FORM CONTROLS (Kiểu dáng KiotViet nhập kho nhanh)
   ========================================================================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-input, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.form-input:focus, .form-select:focus {
  border-color: var(--color-gold);
}

.permission-warning-box {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid var(--color-red);
  padding: 12px;
  border-radius: var(--radius-sm);
  color: #ff9b96;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   MODULES TAB PANELS (Phiếu kho & Quản trị nhân viên)
   ========================================================================== */
.module-section {
  display: none;
}
.module-section.active {
  display: block;
}

.notice-banner {
  background: rgba(0, 113, 227, 0.1);
  border: 1px solid var(--color-blue);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #92c4ff;
  line-height: 1.5;
}

/* ==========================================================================
   IPHONE BOTTOM NAVIGATION BAR (Hiển thị khi ở chế độ mobile / iPhone frame)
   ========================================================================== */
.iphone-bottom-bar {
  display: none;
  background: #11151c;
  border-top: 1px solid var(--border-color);
  padding: 6px 4px;
  justify-content: space-around;
  position: sticky;
  bottom: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}
.iphone-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  cursor: pointer;
  min-width: 44px;
  min-height: 48px;
  justify-content: center;
  padding: 3px 2px;
  flex: 1 1 0;
  text-align: center;
  box-sizing: border-box;
}
.iphone-nav-item.active {
  color: var(--color-gold);
  font-weight: 600;
}
.iphone-nav-icon {
  font-size: 17px;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Tự động thích ứng khi mở trên iPhone thật)
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }
  .main-viewport {
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .role-control-bar {
    padding: 8px 10px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }
  .role-bar-left {
    gap: 6px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .role-badge-tag {
    align-self: flex-start;
    font-size: 10px;
  }
  .role-select-wrapper {
    flex: 1;
    min-width: 0;
  }
  .role-select-wrapper select {
    width: 100%;
    max-width: none;
    font-size: 12px;
    padding: 6px 8px;
  }
  .role-bar-right {
    width: 100%;
  }
  .device-simulator-toggle {
    display: flex !important;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
  }
  .device-btn {
    flex: 1 1 calc(33.3% - 4px);
    justify-content: center;
    padding: 6px 4px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
  }
  .app-header {
    padding: 0 8px;
    height: 52px;
  }
  .brand-meta h1 {
    font-size: 13px;
  }
  .brand-meta small {
    display: none;
  }
  .user-info-text {
    display: none !important;
  }
  .user-profile-badge {
    padding: 2px;
    border: none;
    background: transparent;
  }
  .branch-pill-select {
    padding: 2px 6px;
  }
  .branch-pill-select select {
    max-width: 110px;
    font-size: 11px;
  }
  .stats-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 8px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .stats-grid::-webkit-scrollbar {
    height: 4px;
  }
  .stats-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
  }

  .iphone-bottom-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 999;
  }
  body:not(.itn-shell) {
    padding-bottom: 70px !important;
  }
  .app-nav {
    display: none !important; /* Dùng thanh điều hướng đáy trên iPhone */
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .action-btn-primary,
  .action-btn-secondary {
    min-height: 44px;
  }
}

/* Áp dụng giao diện di động khi bật chế độ Simulator trên Desktop */
body.simulator-mode .stats-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

body.simulator-mode .iphone-bottom-bar {
  display: flex !important;
}
body.simulator-mode .app-header {
  padding: 0 12px;
  height: 52px;
}
body.simulator-mode .user-info-text {
  display: none !important;
}
body.simulator-mode .user-profile-badge {
  padding: 2px;
  border: none;
  background: transparent;
}
body.simulator-mode .branch-pill-select {
  padding: 2px 6px;
}
body.simulator-mode .branch-pill-select select {
  max-width: 110px;
  font-size: 11px;
}
body.simulator-mode .brand-meta h1 {
  font-size: 13px;
}
body.simulator-mode .brand-meta small {
  display: none;
}
body.simulator-mode .app-nav {
  display: none !important;
}
body.simulator-mode .form-grid-2 {
  grid-template-columns: 1fr;
}

body.simulator-mode .action-btn-primary,
body.simulator-mode .action-btn-secondary {
  min-height: 44px;
}

/* ==========================================================================
   EXECUTIVE OPERATIONS DASHBOARD (Approved Apple Retail & Linear High-End)
   ========================================================================== */
.dash-exec-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1360px;
  margin: 0 auto;
}

.dash-exec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 0 6px 0;
}

.dash-exec-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: #f8fafc;
  margin: 0;
}

.dash-exec-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 3px;
}

.dash-exec-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-exec-dropdown {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}
.dash-exec-dropdown:hover, .dash-exec-dropdown:focus {
  border-color: #0284c7;
}

/* "Cập nhật" (Tổng quan), "Xuất Excel" (Hóa đơn): nút phụ cùng chuẩn A2 — viên thuốc, viền ≥3:1, chữ màu nhấn theo theme
   (trước: màu cứng xanh #0071e3 kể cả theme Hồng, bo 8px, viền 1.3–1.4:1). */
.dash-refresh-btn {
  background: var(--bg-input);
  border: 1px solid var(--itn-nut-vien, var(--border-color));
  color: var(--txt-accent, var(--text-main));
  padding: 8px 16px;
  border-radius: var(--itn-nut-bo, 999px);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  transition: background 0.2s ease, color 0.2s ease;
}
.dash-refresh-btn:hover {
  background: var(--theme-accent-soft, rgba(2, 132, 199, 0.15));
  border-color: var(--txt-accent, var(--text-main));
}

/* 4 Executive KPI Cards */
.dash-exec-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) {
  .dash-exec-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .dash-exec-kpis {
    grid-template-columns: 1fr;
  }
}

.dash-exec-kpi-card {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.dash-exec-kpi-card:hover {
  border-color: rgba(2, 132, 199, 0.35);
  transform: translateY(-2px);
}

.kpi-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-icon-wrap.icon-blue {
  background: rgba(0, 102, 204, 0.15);
  color: #0066cc;
}
.kpi-icon-wrap.icon-green {
  background: rgba(52, 199, 89, 0.15);
  color: #248a3d;
}
.kpi-icon-wrap.icon-orange {
  background: rgba(255, 159, 10, 0.15);
  color: #c97800;
}
.kpi-icon-wrap.icon-purple {
  background: rgba(175, 82, 222, 0.15);
  color: #af52de;
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.exec-kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.1px;
}

.exec-kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin: 6px 0 2px 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.exec-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Split View: 65% / 35% */
.dash-exec-split {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1024px) {
  .dash-exec-split {
    grid-template-columns: 1fr;
  }
}

.dash-split-left, .dash-split-right {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.exec-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.exec-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
  margin: 0;
}

.exec-section-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 3px;
}

.exec-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exec-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.exec-link-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.exec-link-btn:hover {
  background: rgba(2, 132, 199, 0.12);
}

.exec-action-btn-sm {
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.3);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.exec-action-btn-sm:hover {
  background: #0284c7;
  color: #ffffff;
}

/* Executive IMEI Table */
.exec-table-wrapper {
  overflow-x: auto;
}

.exec-imei-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.exec-imei-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.exec-imei-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.exec-table-row:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.model-name {
  font-weight: 600;
  color: #f8fafc;
}

.branch-pill-small {
  font-size: 11px;
  color: #cbd5e1;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-imei-dots {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 30px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.btn-imei-dots:hover {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border-color: rgba(2, 132, 199, 0.4);
}

/* Right Column: Biến động vốn gần nhất */
.exec-audit-feed {
  display: flex;
  flex-direction: column;
}

.exec-audit-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.exec-feed-more-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.exec-feed-more-btn:hover {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.4);
}

/* ==========================================================================
   DASHBOARD MODULE (CHUYÊN BIỆT TỪNG VAI TRÒ)
   ========================================================================== */
.dash-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease;
}

/* Quick Role Switcher Bar - Adaptive & Sleek */
.dash-quickswitch-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-quickswitch-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.dash-active-role-tag {
  background: rgba(184, 137, 43, 0.15);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-light);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.dash-pills-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-role-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dash-role-pill:hover {
  border-color: var(--color-gold);
  color: var(--text-main);
  transform: translateY(-1px);
}

.dash-role-pill.active {
  background: var(--color-gold);
  color: #000;
  border-color: var(--color-gold);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Sale Security Alert Banner */
.dash-sale-security-banner {
  background: rgba(0, 113, 227, 0.1);
  border: 1px solid rgba(0, 113, 227, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* KPI Progress Bar */
.dash-kpi-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0;
}
.dash-kpi-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #34c759, #30d158);
  border-radius: 3px;
}

/* Dashboard KPI Metric Cards */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.dash-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px -2px rgba(0,0,0,0.1);
}

.dash-kpi-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.25);
}

.dash-kpi-card.blue {
  border-color: rgba(0, 113, 227, 0.25);
}
.dash-kpi-card.green {
  border-color: rgba(52, 199, 89, 0.25);
}
.dash-kpi-card.purple {
  border-color: rgba(175, 82, 222, 0.25);
}

.dash-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dash-kpi-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(52, 199, 89, 0.15);
  color: #4cd964;
}

.dash-kpi-badge.warn {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
}

.dash-kpi-badge.info {
  background: rgba(0, 113, 227, 0.15);
  color: #79b7ff;
}

.dash-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.6px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.dash-kpi-val.blur-cost {
  letter-spacing: 3px;
  color: var(--color-gold-light);
  font-family: monospace;
}

.dash-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Two Column Layout */
.dash-two-col {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

.dash-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dash-section-head {
  display: flex;
  flex-wrap: wrap;   /* 13/10/2026: điện thoại không đủ chỗ thì dòng phụ xuống hàng, không cắt / đè tiêu đề (13 khối Tổng quan dùng chung) */
  gap: 4px 12px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.dash-section-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Milestone Progress Bar */
.dash-milestone-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dash-milestone-stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.dash-visitor-count {
  font-size: 32px;
  font-weight: 900;
  color: var(--color-gold-light);
  line-height: 1;
}

.dash-milestone-track-wrapper {
  position: relative;
  padding: 18px 0 28px 0;
}

.dash-milestone-track {
  height: 10px;
  background: #21262d;
  border-radius: var(--radius-full);
  position: relative;
  overflow: visible;
}

.dash-milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, #b8892b, #4cd964);
  border-radius: var(--radius-full);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-milestone-pin {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dash-pin-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #161b22;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}

.dash-pin-dot.achieved {
  background: #34c759;
  border-color: #4cd964;
  color: #000;
}

.dash-pin-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  position: absolute;
  top: 26px;
}

.dash-pin-label.achieved {
  color: #4cd964;
}

/* Leaderboard */
.dash-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-leader-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.dash-leader-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dash-leader-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-leader-rank {
  font-size: 18px;
  font-weight: 800;
  width: 28px;
  text-align: center;
}

.dash-leader-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.dash-leader-info small {
  font-size: 11px;
  color: var(--text-muted);
}

.dash-leader-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-leader-rev {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-gold-light);
}

.dash-leader-bonus {
  font-size: 11px;
  font-weight: 600;
  color: #4cd964;
}

/* Quick Action Buttons */
.dash-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.dash-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dash-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Mobile Responsive for Dashboard */
@media (max-width: 768px), (body.simulator-mode) {
  .dash-two-col {
    grid-template-columns: 1fr;
  }
  .dash-pills-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .dash-role-pill {
    flex-shrink: 0;
  }
  .dash-action-grid {
    grid-template-columns: 1fr;
  }
  .dash-milestone-track-wrapper {
    padding-bottom: 34px;
  }

}

/* ==========================================================================
   THEME SWITCHER STYLES (ĐỔI GIAO DIỆN CHỦ ĐỀ)
   ========================================================================== */

/* Header Theme Button - Frosted Glass Luxury Pill */
.header-theme-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.header-theme-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.header-theme-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   1. APPLE iOS LIGHT MODE (Chuẩn Thiết Kế iPhone iOS 18 · Luxury & Thanh Lịch)
   ========================================================================== */
body.theme-kiotviet,
body.theme-light {
  --bg-main: #f2f2f7; /* iOS systemGroupedBackground */
  --color-apple-blue: #0071e3;
  --color-apple-green: #34c759;
  --color-apple-orange: #ff9f0a;
  --color-apple-red: #ff3b30;
  --color-apple-purple: #af52de;
  background: #f2f2f7 !important;
  color: #1c1c1e !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif !important;
}
/* Token màu theme sáng mặc định: chỉ khi trang CHƯA có theme (theme-manager luôn gắn data-itn-theme).
   Trước đây gán thẳng lên body nên đè token đã chỉnh tương phản của từng theme sáng (chữ phụ #64748b chỉ 4.26:1 trên #f2f2f7). */
body.theme-kiotviet:not([data-itn-theme]),
body.theme-light:not([data-itn-theme]) {
  --bg-card: #ffffff; /* iOS secondarySystemGroupedBackground */
  --bg-card-hover: #f8fafc;
  --bg-input: #f2f2f7; /* iOS tertiarySystemFill */
  --border-color: rgba(60, 60, 67, 0.12); /* iOS separator */
  --color-gold: #0071e3; /* Apple SF Blue */
  --color-gold-light: #0077ed;
  --text-main: #1c1c1e; /* Apple Label */
  --text-muted: #64748b; /* Apple Secondary Label */
  --text-dim: #8e8e93;
}

/* Apple iOS Frosted Glass Header (Tương phản cao, chữ đen & điểm nhấn xanh) */
body.theme-kiotviet .app-header,
body.theme-light .app-header {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: saturate(180%) blur(20px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
  color: #1c1c1e !important;
  border-bottom: 1px solid rgba(60, 60, 67, 0.12) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
}

body.theme-kiotviet .header-brand .header-brand-title,
body.theme-light .header-brand .header-brand-title {
  color: #1c1c1e !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em !important;
}

body.theme-kiotviet .header-logo-img,
body.theme-light .header-logo-img {
  background: #ffffff !important;
  border: 1px solid rgba(0, 113, 227, 0.2) !important;
}

body.theme-kiotviet .header-branch-pill,
body.theme-light .header-branch-pill {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid rgba(60, 60, 67, 0.14) !important;
  color: #1c1c1e !important;
  border-radius: 20px !important;
}

body.theme-kiotviet .header-branch-pill:hover,
body.theme-light .header-branch-pill:hover {
  border-color: #0071e3 !important;
}

body.theme-kiotviet .header-branch-pill .branch-label-dim,
body.theme-light .header-branch-pill .branch-label-dim {
  color: var(--text-muted) !important;
  font-weight: 500 !important;
}

body.theme-kiotviet .header-branch-pill select,
body.theme-light .header-branch-pill select {
  color: #1c1c1e !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .header-branch-pill select option,
body.theme-light .header-branch-pill select option {
  background: #ffffff !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .header-branch-pill .branch-chevron,
body.theme-light .header-branch-pill .branch-chevron {
  color: #0071e3 !important;
}

body.theme-kiotviet .header-theme-btn,
body.theme-light .header-theme-btn {
  background: rgba(0, 113, 227, 0.08) !important;
  border: 1px solid rgba(0, 113, 227, 0.22) !important;
  color: #0071e3 !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

body.theme-kiotviet .header-theme-btn:hover,
body.theme-light .header-theme-btn:hover {
  background: #0071e3 !important;
  color: #ffffff !important;
  border-color: #0071e3 !important;
}

body.theme-kiotviet .header-notif-btn,
body.theme-light .header-notif-btn {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid rgba(60, 60, 67, 0.12) !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .header-notif-btn:hover,
body.theme-light .header-notif-btn:hover {
  background: rgba(120, 120, 128, 0.15) !important;
  border-color: #0071e3 !important;
  color: #0071e3 !important;
}

body.theme-kiotviet .user-profile-badge,
body.theme-light .user-profile-badge {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid rgba(60, 60, 67, 0.14) !important;
  color: #1c1c1e !important;
  border-radius: 20px !important;
}

body.theme-kiotviet .user-profile-badge:hover,
body.theme-light .user-profile-badge:hover {
  border-color: var(--theme-accent-strong, #0071e3) !important;
}

body.theme-kiotviet .user-profile-badge .user-avatar-exec,
body.theme-light .user-profile-badge .user-avatar-exec {
  background: var(--theme-accent-strong, #0071e3) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
}

body.theme-kiotviet .user-profile-badge .user-name-exec,
body.theme-light .user-profile-badge .user-name-exec {
  color: #1c1c1e !important;
  font-weight: 600 !important;
}

/* Apple iOS Top Control Bar */
body.theme-kiotviet .role-control-bar,
body.theme-light .role-control-bar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(60, 60, 67, 0.1) !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .role-bar-left label,
body.theme-light .role-bar-left label {
  color: #8e8e93 !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

body.theme-kiotviet #role-selector,
body.theme-light #role-selector,
body.theme-kiotviet .role-select-wrapper select,
body.theme-light .role-select-wrapper select {
  background: #ffffff !important;
  color: #1c1c1e !important;
  border: 1px solid rgba(60, 60, 67, 0.15) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  font-weight: 500 !important;
}

body.theme-kiotviet .role-badge-tag,
body.theme-light .role-badge-tag {
  background: rgba(0, 113, 227, 0.08) !important;
  border: 1px solid rgba(0, 113, 227, 0.18) !important;
  color: #0071e3 !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}

body.theme-kiotviet .device-simulator-toggle,
body.theme-light .device-simulator-toggle {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid rgba(60, 60, 67, 0.12) !important;
}

body.theme-kiotviet .device-btn,
body.theme-light .device-btn {
  background: transparent !important;
  border: none !important;
  color: #1c1c1e !important;
  font-weight: 500 !important;
}

body.theme-kiotviet .device-btn:hover,
body.theme-light .device-btn:hover {
  background: rgba(120, 120, 128, 0.14) !important;
  color: #0071e3 !important;
}

body.theme-kiotviet .device-btn.active,
body.theme-light .device-btn.active {
  background: #0071e3 !important;
  border-color: #0071e3 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.3) !important;
}

body.theme-kiotviet .device-btn.mode-switch-btn,
body.theme-light .device-btn.mode-switch-btn {
  background: rgba(255, 159, 10, 0.12) !important;
  border: 1px solid rgba(255, 159, 10, 0.25) !important;
  color: #c97800 !important;
  font-weight: 600 !important;
}

/* KiotViet Royal Blue Navigation Bar */
body.theme-kiotviet .app-nav,
body.theme-light .app-nav {
  background: #0066cc !important;
  border-bottom: 1px solid #0052a3 !important;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25) !important;
  padding: 3px 16px !important;
}

body.theme-kiotviet .nav-tab-btn,
body.theme-light .nav-tab-btn {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  margin: 3px 2px !important;
  padding: 7px 16px !important;
  border-bottom: none !important;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease !important;
  font-size: 13px !important;
}

body.theme-kiotviet .nav-tab-btn:hover,
body.theme-light .nav-tab-btn:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.18) !important;
}

body.theme-kiotviet .nav-tab-btn.active,
body.theme-light .nav-tab-btn.active {
  color: #ffffff !important;
  background: #0052a3 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  border-bottom: none !important;
}

body.theme-kiotviet .nav-sliding-indicator,
body.theme-light .nav-sliding-indicator {
  display: none !important;
}

/* Apple iOS Quick Role Switcher Bar */
body.theme-kiotviet .dash-quickswitch-bar,
body.theme-light .dash-quickswitch-bar {
  background: #ffffff !important;
  border: 1px solid rgba(60, 60, 67, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
}

body.theme-kiotviet .dash-quickswitch-title,
body.theme-light .dash-quickswitch-title {
  color: #1c1c1e !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-active-role-tag,
body.theme-light .dash-active-role-tag {
  background: rgba(0, 113, 227, 0.1) !important;
  border: 1px solid rgba(0, 113, 227, 0.2) !important;
  color: #0071e3 !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

body.theme-kiotviet .dash-role-pill,
body.theme-light .dash-role-pill {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid transparent !important;
  color: #1c1c1e !important;
  font-weight: 500 !important;
  border-radius: 20px !important;
  padding: 5px 14px !important;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease !important;
}

body.theme-kiotviet .dash-role-pill:hover,
body.theme-light .dash-role-pill:hover {
  background: rgba(120, 120, 128, 0.14) !important;
  color: #0071e3 !important;
}

body.theme-kiotviet .dash-role-pill.active,
body.theme-light .dash-role-pill.active {
  background: #0071e3 !important;
  color: #ffffff !important;
  border-color: #0071e3 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3) !important;
}

body.theme-kiotviet .kiot-label,
body.theme-light .kiot-label {
  color: #8e8e93 !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
}

body.theme-kiotviet .kiot-live-indicator,
body.theme-light .kiot-live-indicator {
  background: rgba(52, 199, 89, 0.12) !important;
  border: 1px solid rgba(52, 199, 89, 0.25) !important;
  color: #248a3d !important;
  font-weight: 600 !important;
  border-radius: 20px !important;
}

body.theme-kiotviet .kiot-refresh-btn,
body.theme-light .kiot-refresh-btn {
  background: rgba(120, 120, 128, 0.08) !important;
  border: 1px solid rgba(60, 60, 67, 0.1) !important;
  color: #1c1c1e !important;
  border-radius: 8px !important;
}

body.theme-kiotviet .kiot-refresh-btn:hover,
body.theme-light .kiot-refresh-btn:hover {
  color: #0071e3 !important;
  border-color: #0071e3 !important;
}

/* Apple iOS Security Notice */
body.theme-kiotviet .dash-sale-security-banner,
body.theme-light .dash-sale-security-banner {
  background: rgba(0, 113, 227, 0.06) !important;
  border: 1px solid rgba(0, 113, 227, 0.15) !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

body.theme-kiotviet .dash-sale-security-banner strong,
body.theme-light .dash-sale-security-banner strong {
  color: #0071e3 !important;
}

body.theme-kiotviet .dash-sale-security-banner div,
body.theme-light .dash-sale-security-banner div {
  color: #1c1c1e !important;
}

/* Apple iOS Legacy KPI Cards */
body.theme-kiotviet .dash-kpi-card,
body.theme-light .dash-kpi-card {
  background: #ffffff !important;
  border: 1px solid rgba(60, 60, 67, 0.08) !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
  transition: transform 0.25s var(--ease-apple), box-shadow 0.25s var(--ease-apple), border-color 0.25s var(--ease-apple) !important;
}

body.theme-kiotviet .dash-kpi-card:hover,
body.theme-light .dash-kpi-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(0, 113, 227, 0.25) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

body.theme-kiotviet .dash-kpi-label,
body.theme-light .dash-kpi-label {
  color: #8e8e93 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
}

body.theme-kiotviet .dash-kpi-val,
body.theme-light .dash-kpi-val {
  color: #1c1c1e !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

body.theme-kiotviet .dash-kpi-val.blur-cost,
body.theme-light .dash-kpi-val.blur-cost {
  color: #8e8e93 !important;
  letter-spacing: 4px !important;
}

body.theme-kiotviet .dash-kpi-card.gold .dash-kpi-val,
body.theme-light .dash-kpi-card.gold .dash-kpi-val {
  color: #0071e3 !important;
}

body.theme-kiotviet .dash-kpi-badge,
body.theme-light .dash-kpi-badge {
  background: rgba(52, 199, 89, 0.12) !important;
  color: #248a3d !important;
  border: 1px solid rgba(52, 199, 89, 0.25) !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-kpi-badge.warn,
body.theme-light .dash-kpi-badge.warn {
  background: rgba(255, 159, 10, 0.12) !important;
  color: #c97800 !important;
  border: 1px solid rgba(255, 159, 10, 0.25) !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-kpi-badge.info,
body.theme-light .dash-kpi-badge.info {
  background: rgba(0, 113, 227, 0.1) !important;
  color: #0071e3 !important;
  border: 1px solid rgba(0, 113, 227, 0.2) !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-kpi-progress-bar,
body.theme-light .dash-kpi-progress-bar {
  background: #e5e5ea !important;
  border-radius: 999px !important;
  height: 6px !important;
}

body.theme-kiotviet .dash-kpi-progress-fill,
body.theme-light .dash-kpi-progress-fill {
  background: linear-gradient(90deg, #34c759 0%, #30d158 100%) !important;
  border-radius: 999px !important;
}

body.theme-kiotviet .dash-kpi-sub,
body.theme-light .dash-kpi-sub {
  color: #8e8e93 !important;
  font-size: 12px !important;
}

/* ==========================================================================
   EXECUTIVE KPI DASHBOARD TRẮNG - XANH DƯƠNG (Loại bỏ triệt để hộp đen)
   ========================================================================== */
body.theme-kiotviet .dash-exec-title,
body.theme-light .dash-exec-title {
  color: #1c1c1e !important;
  font-weight: 700 !important;
}

body.theme-kiotviet .dash-exec-subtitle,
body.theme-light .dash-exec-subtitle {
  color: var(--text-muted) !important;
}

body.theme-kiotviet .dash-exec-dropdown,
body.theme-light .dash-exec-dropdown {
  background: #ffffff !important;
  border: 1px solid rgba(60, 60, 67, 0.16) !important;
  color: #1c1c1e !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-exec-dropdown:hover,
body.theme-kiotviet .dash-exec-dropdown:focus,
body.theme-light .dash-exec-dropdown:hover,
body.theme-light .dash-exec-dropdown:focus {
  border-color: #0071e3 !important;
}

body.theme-kiotviet .dash-refresh-btn,
body.theme-light .dash-refresh-btn {
  background: var(--bg-card, #ffffff) !important;
  border: 1px solid var(--itn-nut-vien, rgba(0, 113, 227, 0.25)) !important;
  color: var(--txt-accent, #0071e3) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .dash-refresh-btn:hover,
body.theme-light .dash-refresh-btn:hover {
  background: var(--theme-accent-soft, rgba(0, 113, 227, 0.08)) !important;
  border-color: var(--txt-accent, #0071e3) !important;
}

/* 4 Thẻ Executive KPI: KiotViet White Card, Số tiền Đen Slate, Icon Tròn/Vuông bên trái */
body.theme-kiotviet .dash-exec-kpi-card,
body.theme-light .dash-exec-kpi-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
  padding: 16px 20px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 16px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
}

body.theme-kiotviet .dash-exec-kpi-card:hover,
body.theme-light .dash-exec-kpi-card:hover {
  transform: translateY(-2px) !important;
  border-color: #0066cc !important;
  box-shadow: 0 6px 16px rgba(0, 102, 204, 0.08) !important;
}

body.theme-kiotviet .exec-kpi-label,
body.theme-light .exec-kpi-label {
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  font-size: 13px !important;
}

body.theme-kiotviet .exec-kpi-val,
body.theme-light .exec-kpi-val {
  color: #1e293b !important;
  font-weight: 700 !important;
  font-size: 26px !important;
  line-height: 1.2 !important;
  margin: 4px 0 2px 0 !important;
  font-variant-numeric: tabular-nums !important;
}

body.theme-kiotviet .exec-kpi-sub,
body.theme-light .exec-kpi-sub {
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

body.theme-kiotviet .kpi-icon-wrap.icon-blue,
body.theme-light .kpi-icon-wrap.icon-blue {
  background: rgba(0, 102, 204, 0.1) !important;
  color: #0066cc !important;
}

body.theme-kiotviet .kpi-icon-wrap.icon-green,
body.theme-light .kpi-icon-wrap.icon-green {
  background: rgba(52, 199, 89, 0.12) !important;
  color: #248a3d !important;
}

body.theme-kiotviet .kpi-icon-wrap.icon-orange,
body.theme-light .kpi-icon-wrap.icon-orange {
  background: rgba(255, 159, 10, 0.12) !important;
  color: #c97800 !important;
}

body.theme-kiotviet .kpi-icon-wrap.icon-purple,
body.theme-light .kpi-icon-wrap.icon-purple {
  background: rgba(175, 82, 222, 0.12) !important;
  color: #af52de !important;
}

/* Two-Column Split (Live activity split & Biến động vốn gần nhất) */
body.theme-kiotviet .dash-split-left,
body.theme-kiotviet .dash-split-right,
body.theme-light .dash-split-left,
body.theme-light .dash-split-right {
  background: #ffffff !important;
  border: 1px solid rgba(0, 113, 227, 0.14) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04) !important;
}

body.theme-kiotviet .exec-section-title,
body.theme-light .exec-section-title {
  color: #1c1c1e !important;
  font-weight: 700 !important;
}

body.theme-kiotviet .exec-section-sub,
body.theme-light .exec-section-sub {
  color: var(--text-muted) !important;
}

body.theme-kiotviet .exec-badge-live,
body.theme-light .exec-badge-live {
  background: rgba(52, 199, 89, 0.12) !important;
  color: #248a3d !important;
  border: 1px solid rgba(52, 199, 89, 0.25) !important;
}

body.theme-kiotviet .exec-link-btn,
body.theme-light .exec-link-btn {
  color: #0071e3 !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .exec-link-btn:hover,
body.theme-light .exec-link-btn:hover {
  background: rgba(0, 113, 227, 0.08) !important;
}

body.theme-kiotviet .exec-action-btn-sm,
body.theme-light .exec-action-btn-sm {
  background: rgba(0, 113, 227, 0.08) !important;
  border: 1px solid rgba(0, 113, 227, 0.25) !important;
  color: #0071e3 !important;
}

body.theme-kiotviet .exec-action-btn-sm:hover,
body.theme-light .exec-action-btn-sm:hover {
  background: #0071e3 !important;
  color: #ffffff !important;
}

/* Bảng IMEI Executive (Hoạt động kho & Máy sẵn sàng giao dịch) */
body.theme-kiotviet .exec-imei-table th,
body.theme-light .exec-imei-table th {
  color: var(--text-muted) !important;
  background: #f8fafc !important;
  border-bottom: 1px solid rgba(60, 60, 67, 0.12) !important;
}

body.theme-kiotviet .exec-imei-table td,
body.theme-light .exec-imei-table td {
  border-bottom: 1px solid rgba(60, 60, 67, 0.06) !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .exec-table-row:hover td,
body.theme-light .exec-table-row:hover td {
  background: rgba(0, 113, 227, 0.04) !important;
}

body.theme-kiotviet .model-name,
body.theme-light .model-name {
  color: #1c1c1e !important;
  font-weight: 600 !important;
}

body.theme-kiotviet .branch-pill-small,
body.theme-light .branch-pill-small {
  background: #f2f2f7 !important;
  border: 1px solid rgba(60, 60, 67, 0.1) !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .btn-imei-dots,
body.theme-light .btn-imei-dots {
  background: #f2f2f7 !important;
  border: 1px solid rgba(60, 60, 67, 0.15) !important;
  color: var(--text-muted) !important;
}

body.theme-kiotviet .btn-imei-dots:hover,
body.theme-light .btn-imei-dots:hover {
  background: rgba(0, 113, 227, 0.1) !important;
  color: #0071e3 !important;
  border-color: #0071e3 !important;
}

body.theme-kiotviet .exec-audit-footer,
body.theme-light .exec-audit-footer {
  border-top: 1px solid rgba(60, 60, 67, 0.08) !important;
}

body.theme-kiotviet .exec-feed-more-btn,
body.theme-light .exec-feed-more-btn {
  background: rgba(0, 113, 227, 0.04) !important;
  border: 1px dashed rgba(0, 113, 227, 0.3) !important;
  color: #0071e3 !important;
}

body.theme-kiotviet .exec-feed-more-btn:hover,
body.theme-light .exec-feed-more-btn:hover {
  background: rgba(0, 113, 227, 0.08) !important;
  border-color: #0071e3 !important;
}

/* Sections, Cards, Charts */
body.theme-kiotviet .dash-section-card,
body.theme-light .dash-section-card {
  background: #ffffff !important;
  border: 1px solid rgba(60, 60, 67, 0.08) !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

body.theme-kiotviet .dash-section-head,
body.theme-light .dash-section-head {
  border-bottom: 1px solid rgba(60, 60, 67, 0.08) !important;
}

body.theme-kiotviet .dash-section-title,
body.theme-light .dash-section-title {
  color: #1c1c1e !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}

body.theme-kiotviet .kiot-chart-pill,
body.theme-light .kiot-chart-pill {
  background: rgba(0, 113, 227, 0.08) !important;
  color: #0071e3 !important;
  border: 1px solid rgba(0, 113, 227, 0.18) !important;
  border-radius: 8px !important;
}

body.theme-kiotviet .kiot-prod-qty,
body.theme-light .kiot-prod-qty {
  color: #0071e3 !important;
  font-weight: 700 !important;
}

body.theme-kiotviet .kiot-stat-item,
body.theme-light .kiot-stat-item {
  background: #f2f2f7 !important;
  border: 1px solid rgba(60, 60, 67, 0.06) !important;
  border-radius: 12px !important;
}

body.theme-kiotviet .kiot-stat-val,
body.theme-light .kiot-stat-val {
  color: #1c1c1e !important;
  font-weight: 700 !important;
}

body.theme-kiotviet .kiot-stat-sub,
body.theme-light .kiot-stat-sub {
  color: #8e8e93 !important;
}

/* Apple iOS Modal & Sheet Overrides */
body.theme-kiotviet .itn-modal-card,
body.theme-light .itn-modal-card {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(30px) !important;
  border-radius: 22px !important;
  border: 1px solid rgba(60, 60, 67, 0.12) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  color: #1c1c1e !important;
}

body.theme-kiotviet .ui-role-card,
body.theme-light .ui-role-card {
  background: #f2f2f7 !important;
  border-color: rgba(60, 60, 67, 0.1) !important;
  border-radius: 14px !important;
}

body.theme-kiotviet .ui-device-card,
body.theme-light .ui-device-card {
  background: #f2f2f7 !important;
  border-color: rgba(60, 60, 67, 0.1) !important;
  border-radius: 14px !important;
}

body.theme-kiotviet .ui-module-pill,
body.theme-light .ui-module-pill {
  background: #f2f2f7 !important;
  border-color: rgba(60, 60, 67, 0.1) !important;
  color: #1c1c1e !important;
  border-radius: 10px !important;
}

body.theme-kiotviet .modal-footer,
body.theme-light .modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid rgba(60, 60, 67, 0.1) !important;
}

body.theme-kiotviet .kiot-section-card,
body.theme-light .kiot-section-card {
  background: #ffffff !important;
  border: 1px solid rgba(60, 60, 67, 0.08) !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

body.theme-kiotviet .action-btn-primary,
body.theme-light .action-btn-primary {
  background: var(--theme-accent-strong, #0071e3) !important;
  color: #ffffff !important;
}

/* Rê chuột: đậm hơn màu nhấn của theme (trước #0077ed cứng: chữ trắng chỉ 4.32:1 và theme Hồng hiện xanh). */
body.theme-kiotviet .action-btn-primary:hover,
body.theme-light .action-btn-primary:hover {
  background: color-mix(in srgb, var(--theme-accent-strong, #0071e3) 85%, #000) !important;
}

body.theme-kiotviet .floating-ui-switch-btn,
body.theme-light .floating-ui-switch-btn {
  background: #0071e3 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 10px 25px rgba(0, 113, 227, 0.35) !important;
}

body.theme-kiotviet .floating-ui-switch-btn:hover,
body.theme-light .floating-ui-switch-btn:hover {
  background: #0077ed !important;
  box-shadow: 0 14px 30px rgba(0, 113, 227, 0.45) !important;
}

body.theme-kiotviet .iphone-bottom-bar,
body.theme-light .iphone-bottom-bar {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-top: 1px solid rgba(60, 60, 67, 0.12) !important;
}

body.theme-kiotviet .iphone-nav-item,
body.theme-light .iphone-nav-item {
  color: #8e8e93 !important;
}

body.theme-kiotviet .iphone-nav-item.active,
body.theme-light .iphone-nav-item.active {
  color: #0071e3 !important;
}

/* 2. Apple VisionOS Mode (Spatial Glass) */
body.theme-visionos {
  --bg-main: #0c0f17;
  --bg-card: rgba(26, 32, 48, 0.7);
  --bg-card-hover: rgba(35, 43, 64, 0.85);
  --bg-input: rgba(15, 20, 32, 0.7);
  --border-color: rgba(255, 255, 255, 0.15);
  --color-gold: #38bdf8;
  --color-gold-light: #7dd3fc;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  background: radial-gradient(circle at 50% 0%, #1a2238 0%, #0a0d14 70%) !important;
}

body.theme-visionos .dash-kpi-card,
body.theme-visionos .dash-section-card {
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

/* 3. Floating UI Switcher Button (Nút Đổi Giao Diện Obsidian Glass Siêu Sang) */
.floating-ui-switch-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, border-color 0.25s ease;
  letter-spacing: 0.3px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.floating-ui-switch-btn * {
  pointer-events: none !important;
}

.floating-ui-switch-btn:hover {
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.5);
  color: #ffffff;
}

.floating-ui-switch-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  /* Điện thoại cần đường vào Cài đặt ngay trên header; icon 44px không chiếm chỗ nhãn dài. */
  #app-header .header-theme-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }
  #app-header .header-theme-btn strong,
  #app-header .header-theme-btn span { display: none; }
  #app-header .header-left { min-width: 0; gap: 6px; }
  #app-header .header-branch-pill { min-width: 0; max-width: 152px; padding: 0 8px; }
  #app-header .header-branch-pill select { min-width: 84px; width: 100%; font-size: 14px; letter-spacing: 0; }
  #app-header .header-branch-pill strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app-header .header-right { gap: 4px; }
  #app-header .header-brand-title { display: none; }
  .floating-ui-switch-btn {
    bottom: 74px !important;
    right: 14px !important;
    padding: 9px 15px !important;
    font-size: 11px !important;
  }
}

body.simulator-mode .header-theme-btn {
  display: inline-flex !important;
}

body.simulator-mode .floating-ui-switch-btn {
  bottom: 74px !important;
  right: 14px !important;
  padding: 9px 15px !important;
  font-size: 11px !important;
}

.active-gold {
  border-color: var(--color-gold) !important;
  background: rgba(184, 137, 43, 0.15) !important;
  color: #fff !important;
}

/* UI Switcher Modal Styles */
.ui-theme-card, .ui-role-card, .ui-device-card {
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.ui-theme-card:hover, .ui-role-card:hover, .ui-device-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-blue) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.ui-theme-card.selected, .ui-role-card.selected, .ui-device-card.selected {
  border-color: var(--color-blue) !important;
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.3), 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

.ui-module-pill {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.ui-module-pill:hover {
  border-color: var(--color-gold);
  background: var(--bg-card-hover);
  color: var(--color-gold);
}

.ui-module-pill.selected {
  background: var(--color-gold);
  color: #000;
  border-color: var(--color-gold);
  font-weight: 700;
}

/* ==========================================================================
   LUXURY MOTION ENGINE (Apple Quint Curve + Linear Spatial + Stagger)
   ========================================================================== */
@keyframes appleEnter {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes appleExit {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes linearGlideRight {
  0% {
    opacity: 0;
    transform: translate3d(18px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes linearGlideLeft {
  0% {
    opacity: 0;
    transform: translate3d(-18px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes staggerFadeUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.scene-enter {
  animation: appleEnter var(--duration-motion) var(--ease-apple) forwards;
}

.scene-enter-right {
  animation: linearGlideRight 240ms var(--ease-apple) both;
}

.scene-enter-left {
  animation: linearGlideLeft 240ms var(--ease-apple) both;
}

@media (prefers-reduced-motion: reduce) {
  .scene-enter, .scene-enter-right, .scene-enter-left { animation:none; }
}

.scene-exit {
  animation: appleExit 200ms ease-in forwards;
}

.stagger-item {
  opacity: 0;
  animation: staggerFadeUp var(--duration-motion) var(--ease-apple) forwards;
}
.stagger-1 { animation-delay: 30ms; }
.stagger-2 { animation-delay: 60ms; }
.stagger-3 { animation-delay: 90ms; }
.stagger-4 { animation-delay: 130ms; }
.stagger-5 { animation-delay: 180ms; }

/* Số học chuyển đổi hiệu ứng Odometer / Ticker */
.counter-number {
  transition: transform 0.25s var(--ease-apple), opacity 0.25s var(--ease-apple);
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Ánh kim quét viền luxury khi hover thẻ và dòng */
.dash-kpi-card, .kiot-section-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease-apple), border-color 0.25s var(--ease-apple), box-shadow 0.25s var(--ease-apple);
}
.dash-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight) !important;
}

.dash-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.04), transparent);
  transition: transform 0.75s ease;
  pointer-events: none;
}
.dash-kpi-card:hover::before {
  transform: translateX(200%);
}

/* Toast Notification Banner */
.motion-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999999;
  background: #182234;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(50px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-apple), opacity 0.35s var(--ease-apple);
}
.motion-toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   TỔNG QUAN VẬN HÀNH & PHÂN HỆ HÓA ĐƠN CHUẨN KIOTVIET
   ========================================================================== */

/* 1. Doanh thu & Lợi nhuận chi nhánh */
.dash-branch-financials {
  margin-top: 24px;
}
.branch-financials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 992px) {
  .branch-financials-grid {
    grid-template-columns: 1fr;
  }
}

.branch-fin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s var(--ease-apple), border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.branch-fin-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-sm);
}
.branch-fin-card.ct {
  box-shadow: inset 0 2px 0 var(--theme-accent-strong);
}
.branch-fin-card.cm {
  box-shadow: inset 0 2px 0 var(--theme-warning);
}
.branch-fin-card.chain {
  box-shadow: inset 0 2px 0 var(--theme-success);
}

.branch-fin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.branch-fin-title h4 {
  margin: 4px 0 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.badge-ratio {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent-strong);
}
.badge-ratio.success {
  background: color-mix(in srgb, var(--theme-success) 14%, transparent);
  color: var(--theme-success);
}

.branch-fin-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-bottom: 14px;
}
.fin-metric-item {
  display: flex;
  flex-direction: column;
}
.fin-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.fin-val {
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
}
.fin-val.text-blue { color: var(--theme-accent-strong); }
.fin-val.text-green { color: var(--theme-success); }
.fin-val.text-orange { color: var(--theme-warning); }
.fin-val-sub {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 600;
}

.branch-fin-bar-wrap {
  margin-top: 4px;
  margin-bottom: 14px;
}
.branch-fin-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.branch-fin-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}
.branch-fin-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: opacity 0.2s ease;
}
.branch-fin-bar-fill.ct { background: var(--theme-accent-strong); }
.branch-fin-bar-fill.cm { background: var(--theme-warning); }

.branch-fin-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}
.branch-fin-link {
  background: none;
  border: none;
  color: #0071e3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.branch-fin-link:hover {
  text-decoration: underline;
}

.branch-chain-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.chain-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-main);
}
.branch-fin-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--bg-input);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* 2. Máy Tồn Chi Nhánh & Phân Bổ */
.dash-stock-overview {
  margin-top: 24px;
}
.stock-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .stock-overview-grid {
    grid-template-columns: 1fr;
  }
}

.stock-branch-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stock-branch-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stock-branch-item.transit {
  border-color: rgba(255, 159, 10, 0.4);
  background: rgba(255, 159, 10, 0.04);
}
.stock-branch-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.stock-qty-badge {
  font-size: 13px;
  font-weight: 800;
  color: #0071e3;
  background: rgba(0, 113, 227, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
}
.stock-qty-badge.transit {
  color: #ff9f0a;
  background: rgba(255, 159, 10, 0.15);
}
.stock-status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-models-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stock-model-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stock-model-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-main);
}
.stock-model-count {
  font-size: 11px;
  color: var(--text-muted);
}
.stock-model-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}
.stock-model-fill {
  height: 100%;
  border-radius: 3px;
  transition: opacity 0.2s ease;
}

/* 3. Biểu đồ Bán hàng & Tiến độ KPI */
.dash-sales-kpi-charts {
  margin-top: 24px;
}
.sales-kpi-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
@media (max-width: 992px) {
  .sales-kpi-split {
    grid-template-columns: 1fr;
  }
}

.dash-chart-panel,
.dash-kpi-progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chart-legend-box {
  display: flex;
  gap: 14px;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.blue { background: #0071e3; }
.legend-dot.green { background: #34c759; }

.sales-svg-chart-wrap {
  width: 100%;
  height: 220px;
  margin: 12px 0;
}
.sales-dual-chart {
  width: 100%;
  height: 100%;
}
.chart-bar-group {
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.chart-bar-group:hover rect {
  filter: brightness(1.2);
}

.chart-summary-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
}
.chart-summary-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
}
.cs-label {
  color: var(--text-muted);
  font-size: 11px;
}
.cs-val {
  font-weight: 700;
}

/* KPI Toàn hệ thống */
.chain-kpi-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}
.chain-kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.chain-kpi-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chain-kpi-target {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}
.chain-kpi-pct {
  font-size: 22px;
  font-weight: 900;
  color: #34c759;
}
.chain-kpi-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.chain-kpi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0071e3, #34c759);
  border-radius: 4px;
}
.chain-kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Bảng xếp hạng KPI Nhân viên */
.staff-kpi-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.staff-kpi-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.staff-kpi-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.staff-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.staff-rank {
  font-size: 12px;
  font-weight: 800;
}
.staff-rank.gold { color: #f59e0b; }
.staff-rank.silver { color: #94a3b8; }
.staff-rank.bronze { color: #d97706; }
.staff-kpi-val {
  font-size: 12px;
}
.staff-kpi-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.staff-kpi-bar-fill {
  height: 100%;
  border-radius: 3px;
}
.staff-kpi-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}
.badge-achieved {
  color: #34c759;
  font-weight: 700;
  font-size: 11px;
}

/* 4. Phân hệ Quản Lý Hóa Đơn (Chuẩn KiotViet) */
.inv-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.inv-toolbar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inv-time-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.inv-time-tab {
  background: var(--bg-input);
  border: 1px solid var(--itn-nut-vien, var(--border-color));
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.inv-time-tab:hover {
  color: var(--text-main);
  border-color: var(--border-highlight);
}
.inv-time-tab.active {
  background: var(--theme-accent-strong, #0071e3) !important;
  color: #ffffff !important;
  border-color: var(--theme-accent-strong, #0071e3) !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-accent-strong, #0071e3) 35%, transparent);
}

.inv-filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.inv-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.inv-table-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
}
.inv-table-responsive {
  width: 100%;
  overflow-x: auto;
}
.inv-code-link {
  font-family: monospace;
  font-weight: 700;
  color: #0071e3 !important;
  cursor: pointer;
}
.inv-code-link:hover {
  text-decoration: underline;
}
.vip-badge-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(0, 113, 227, 0.1);
  color: #0071e3;
  display: inline-block;
}
.pay-method-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}
.pay-method-badge.cash {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}
.pay-method-badge.transfer {
  background: rgba(0, 113, 227, 0.12);
  color: #0071e3;
}
.pay-method-badge.installment {
  background: rgba(255, 159, 10, 0.12);
  color: #c97800;
}
.btn-print-inv-sm {
  background: var(--bg-card);
  border: 1px solid var(--itn-nut-vien, var(--border-color));
  color: var(--text-main);
  padding: 4px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--itn-nut-bo, 999px);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.btn-print-inv-sm:hover {
  background: var(--theme-accent-strong, #0071e3);
  color: #fff;
  border-color: var(--theme-accent-strong, #0071e3);
}

/* 5. Khung Hóa Đơn In Nhiệt Chuẩn KiotViet / Apple Retail */
.kiot-receipt-container {
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff !important;
  color: #1c1c1e !important;
  padding: 22px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.receipt-header {
  text-align: center;
}
.receipt-store-logo {
  font-size: 22px;
  font-weight: 900;
  color: #0071e3 !important;
  letter-spacing: 1px;
}
.receipt-store-slogan {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted) !important;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.receipt-store-address {
  font-size: 11px;
  color: #475569 !important;
  margin-top: 4px;
  line-height: 1.4;
}
.receipt-store-mst {
  font-size: 10px;
  color: var(--text-muted) !important;
  margin-top: 2px;
}
.receipt-divider {
  text-align: center;
  color: #cbd5e1 !important;
  font-family: monospace;
  margin: 8px 0;
  overflow: hidden;
  letter-spacing: -1px;
}
.receipt-title {
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  color: #0f172a !important;
  letter-spacing: 1px;
  margin: 4px 0 8px 0;
}
.receipt-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
  color: #334155 !important;
  line-height: 1.6;
}
.receipt-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}
.receipt-items-table th {
  border-bottom: 1px dashed #cbd5e1 !important;
  padding: 6px 4px;
  font-size: 11px;
  color: #475569 !important;
}
.receipt-items-table td {
  padding: 8px 4px;
  border-bottom: 1px dotted #e2e8f0 !important;
  color: #1e293b !important;
}
.receipt-totals-box {
  font-size: 12px;
  line-height: 1.7;
  color: #1e293b !important;
}
.receipt-total-row {
  display: flex;
  justify-content: space-between;
}
.receipt-total-row.highlight {
  font-size: 14px;
  font-weight: 800;
  color: #0071e3 !important;
  padding: 6px 0;
  border-top: 1px solid #e2e8f0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  margin: 6px 0;
}
.receipt-total-row.highlight .total-big {
  font-size: 17px;
  font-weight: 900;
  color: #0071e3 !important;
}
.receipt-footer {
  margin-top: 10px;
}
.receipt-warranty-note {
  font-size: 10px;
  color: #475569 !important;
  line-height: 1.5;
  background: #f8fafc !important;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #e2e8f0 !important;
}
.receipt-thankyou {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #0071e3 !important;
  margin-top: 10px;
  font-style: italic;
  line-height: 1.4;
}

@media print {
  body * {
    visibility: hidden;
  }
  #printable-receipt, #printable-receipt * {
    visibility: visible;
  }
  #printable-receipt {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    padding: 0;
  }
}

.view-switcher{display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--border-color,#d2d2d7);border-radius:9px;background:var(--card-bg,#fff)}
.view-switcher-btn{display:inline-flex;align-items:center;gap:5px;min-height:34px;padding:6px 9px;border:0;border-radius:6px;background:transparent;color:var(--text-muted,#6e6e73);font-size:12px;cursor:pointer}
.view-switcher-btn:hover{background:var(--surface-2,rgba(0,0,0,.06));color:var(--text-main,#1d1d1f)}
.view-switcher-btn.active{background:var(--accent,#0071e3);color:#fff}
.view-switcher-btn:focus-visible{outline:2px solid var(--accent,#0071e3);outline-offset:2px}
.list-view-list .inv-main-table th:nth-child(4),.list-view-list .inv-main-table td:nth-child(4),.list-view-list .inv-main-table th:nth-child(6),.list-view-list .inv-main-table td:nth-child(6){display:none}
.list-view-cards .exec-table,.list-view-cards .invoice-table{display:block;min-width:0!important}
.list-view-cards .exec-table thead,.list-view-cards .invoice-table thead{display:none}
.list-view-cards .exec-table tbody,.list-view-cards .invoice-table tbody{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px}
.list-view-cards .exec-table tr,.list-view-cards .invoice-table tr{display:grid;gap:5px;padding:12px;border:1px solid var(--border-color,#d2d2d7);border-radius:10px;background:var(--card-bg,var(--bg-card,#fff))}
@media(max-width:700px){.view-switcher-btn{min-width:44px;justify-content:center;padding:6px}.view-switcher-btn span:last-child{display:none}.list-view-cards .exec-table tbody,.list-view-cards .invoice-table tbody{grid-template-columns:1fr}}

/* ══ App Store 1.0 (25/09/2026) ══════════════════════════════════════════════════════════════
   Tai thỏ / thanh trạng thái: index.html có viewport-fit=cover nên app iOS vẽ web tràn lên dưới thanh trạng thái.
   Chừa đúng env(safe-area-inset-top) (trình duyệt thường = 0 → không đổi gì), header dính ngay dưới vùng đó,
   và một dải nền cố định che nội dung cuộn qua sau thanh trạng thái. */
body { padding-top: env(safe-area-inset-top); }
/* KHÔNG đặt `.app-header { top: env(safe-area-inset-top) }` (sửa 26/09/2026, lỗi "header chừa hàng trống" trên iPhone):
   header sticky nằm trong .main-viewport có overflow-x:hidden nên mốc `top` tính từ mép khung đó — khung đã bị
   padding-top của body đẩy xuống một lần safe area → header bị đẩy thêm lần hai (đo trên iPhone 17: 132px thay vì 70px).
   Safe area chỉ áp MỘT lần ở body; header giữ top:0 như mặc định. */
body::before { content: ""; position: fixed; z-index: 1001; left: 0; right: 0; top: 0; height: env(safe-area-inset-top); background: var(--bg-app, var(--theme-header, #0d121d)); pointer-events: none; }
/* Logo chữ "iTN Store" (App Store 5.2.5): ô cam chữ kem, thay logo hình quả táo ở header. */
.header-brand .itn-mark { min-width: 38px; height: 38px; border-radius: 10px; font-size: 15px; }
/* Dạng Thẻ trên iPhone (App Store 4.2): Hóa đơn, Khách hàng, Sổ quỹ, Nhân viên. Tên cột lấy từ data-label (app.js ganNhanCot). */
.list-view-cards .inv-main-table{display:block;min-width:0!important}
.list-view-cards .inv-main-table thead{display:none}
.list-view-cards .inv-main-table tbody{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px}
.list-view-cards .inv-main-table tr{display:grid;gap:5px;padding:12px;border:1px solid var(--border-color,#d2d2d7);border-radius:10px;background:var(--card-bg,var(--bg-card,#fff))}
.list-view-cards .exec-table td,.list-view-cards .invoice-table td,.list-view-cards .inv-main-table td{display:block;width:auto!important;padding:0!important;border:0!important;text-align:left!important;white-space:normal!important}
.list-view-cards td[data-label]::before{content:attr(data-label);display:block;margin-bottom:1px;font-size:11px;font-weight:600;color:var(--text-muted,#6e6e73)}
.list-view-cards td:empty{display:none}
.list-view-cards td.o-rong{grid-column:1/-1}
.list-view-cards tr > td.o-rong:only-child{padding:4px 0!important}
@media(max-width:700px){.list-view-cards .inv-main-table tbody{grid-template-columns:1fr}.list-surface{max-width:100%}}

/* ══ Hóa đơn gộp (25/09/2026): chip nguồn nhỏ trên từng dòng (Web / Hệ thống cũ), trạng thái hủy, "Có thể trùng" ══ */
.hd-chips{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.hd-nguon{display:inline-block;padding:1px 7px;border-radius:999px;font-size:10.5px;font-weight:600;line-height:1.6;white-space:nowrap;border:1px solid transparent}
.hd-nguon-web{background:rgba(0,113,227,.1);color:#0071e3;border-color:rgba(0,113,227,.25)}
.hd-nguon-cu{background:rgba(110,110,115,.12);color:var(--text-muted,#6e6e73);border-color:rgba(110,110,115,.25)}
.hd-huy{background:rgba(215,0,21,.08);color:#d70015;border-color:rgba(215,0,21,.25)}
.hd-gop{background:color-mix(in srgb,var(--txt-ok,#1d7a3a) 12%,transparent);color:var(--txt-ok,#1d7a3a);border-color:color-mix(in srgb,var(--txt-ok,#1d7a3a) 28%,transparent)}
.hd-trung{background:rgba(255,149,0,.14);color:#b25e00;border-color:rgba(255,149,0,.45)}
.hd-trung-chu{color:#b25e00;font-weight:600}
.hd-ghi-chu{margin:10px 0 0;padding:8px 12px;border-radius:10px;font-size:13px;line-height:1.45;background:rgba(0,113,227,.07);border:1px solid rgba(0,113,227,.2);color:var(--text-main,#1d1d1f);overflow-wrap:anywhere}
body.theme-dark .hd-nguon-web,body.theme-luxury .hd-nguon-web{color:#4da3ff}
body.theme-dark .hd-trung,body.theme-dark .hd-trung-chu,body.theme-luxury .hd-trung,body.theme-luxury .hd-trung-chu{color:#ffb340}

/* Hóa đơn: ô lọc có lựa chọn dài (Trả góp …) không đẩy tràn khung trên iPhone. */
.inv-filter-group { min-width:0; max-width:100%; }
.inv-filter-group select { min-width:0; max-width:100%; text-overflow:ellipsis; }
@media (max-width:700px) { .inv-filter-group select { flex:1 1 auto; width:100%; } }

/* ══ Chuẩn nút giao diện chính (A2, 25/09/2026) — đo getComputedStyle 7 theme × 390/1280 ══
   • --itn-nut-bo: một bán kính cho mọi nút hành động (chính + phụ): viên thuốc. Muốn đổi dáng cả app chỉ sửa 1 dòng này.
   • --itn-nut-vien: viền nút phụ / ô chọn nhanh / công tắc tắt. --border-color chỉ 1.28–1.56:1 so với nền thẻ;
     pha màu chữ phụ vào nền thẻ → ≥3:1 so với nền thẻ, nền app và ô nhập ở cả 7 theme (đo: sáng 3.6–4.6, tối 3.7–4.8). */
:root, html[data-itn-theme] {
  --itn-nut-bo: 999px;
  --itn-nut-vien: color-mix(in srgb, var(--text-muted) 68%, var(--bg-card));
}
html[data-itn-theme="light-pearl"], html[data-itn-theme="ios-light"], html[data-itn-theme="titanium"], html[data-itn-theme="rose-pink"] {
  --itn-nut-vien: color-mix(in srgb, var(--text-muted) 85%, var(--bg-card));
}
/* Rê chuột theo màu nhấn của theme: đậm hơn (chữ trắng) — Graphite/Gold Noir sáng hơn (chữ tối). */
body[data-itn-theme] :is(.action-btn-primary, .dash-action-btn-primary):hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-accent-strong) 85%, #000) !important;
}
html[data-itn-theme="graphite"] body :is(.action-btn-primary, .dash-action-btn-primary):hover:not(:disabled),
html[data-itn-theme="gold-noir"] body :is(.action-btn-primary, .dash-action-btn-primary):hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-accent-strong) 85%, #fff) !important;
}
body[data-itn-theme] :is(.action-btn-secondary, .dash-action-btn-secondary):hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-main) 7%, var(--bg-input)) !important;
}
/* Sapphire (theme tối duy nhất chữ trắng trên màu nhấn): rê chuột chỉ đậm nhẹ nút chính / sáng nhẹ nút đỏ, để nền nút vẫn ≥3:1
   so với thẻ tối (đậm 15% chỉ còn 2.8:1, nút đỏ 2.4:1) mà chữ trắng vẫn ≥4.5:1. */
html[data-itn-theme="sapphire"] body :is(.action-btn-primary, .dash-action-btn-primary):hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-accent-strong) 92%, #000) !important;
}
/* Graphite / Gold Noir: chữ trắng trên màu nhấn sáng chỉ 3.6–3.7:1 → chữ tối của theme (5.3:1). */
html[data-itn-theme="graphite"] body :is(.action-btn-primary, .dash-action-btn-primary, .pilot-subnav .tab-btn.active, .pilot-subnav button[aria-current="page"]),
html[data-itn-theme="gold-noir"] body :is(.action-btn-primary, .dash-action-btn-primary, .pilot-subnav .tab-btn.active, .pilot-subnav button[aria-current="page"]) {
  color: var(--bg-app) !important;
}
/* Viền nút phụ ≥3:1: đặt ở mức ưu tiên (0,3,2) để quy tắc viên thuốc của app-shell.css (viền --border-color, 1.28–1.56:1) không đè lại. */
html[data-itn-theme] body :is(.action-btn-secondary, .dash-action-btn-secondary):not(.is-nguy) { border-color: var(--itn-nut-vien) !important; }
/* Nút phá hủy (.is-nguy — cùng tên lớp với app-shell.css): nút chính tô đỏ theo theme (trước style inline #d70015 bị themes.css đè
   thành màu nhấn → trông như nút Lưu); nút phụ viền + chữ đỏ. Lớp bổ nghĩa nên cụ thể hơn quy tắc nền/viền của nút. */
html[data-itn-theme] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy {
  background: var(--theme-danger, #c0262d) !important; border-color: var(--theme-danger, #c0262d) !important; color: #fff !important;
}
html[data-itn-theme="graphite"] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy,
html[data-itn-theme="gold-noir"] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy { color: var(--bg-app) !important; }
html[data-itn-theme] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-danger, #c0262d) 85%, #000) !important;
}
html[data-itn-theme="graphite"] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy:hover:not(:disabled),
html[data-itn-theme="gold-noir"] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-danger, #c0262d) 85%, #fff) !important;
}
html[data-itn-theme] body :is(.action-btn-secondary, .dash-action-btn-secondary).is-nguy {
  color: var(--txt-bad, #c0262d) !important; border-color: currentColor !important;
}
html[data-itn-theme="sapphire"] body :is(.action-btn-primary, .dash-action-btn-primary).is-nguy:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-danger, #c53030) 90%, #fff) !important;
}
/* Vùng bấm ≥44px trên iPhone: nút ✕ xoá ô tìm (đo 19×25) và chip "Đang lọc" / "Xoá lọc" (cao 22). */
html body .tim-o .tim-xoa { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
html body .tim-o .tim-chung:not(:placeholder-shown) { padding-right: 78px !important; }
/* Gợi ý "F3" trong ô tìm chỉ hiện khi có bàn phím + chuột; màn cảm ứng / hẹp ≤760px ẩn (27/09/2026). */
@media (max-width: 760px), (hover: none), (pointer: coarse) { html body .tim-o .tim-f3, #module-content .tim-o kbd.tim-f3 { display: none; } }
@media (max-width: 1023px) { html body .chip-loc :is([data-chip-bo], [data-chip-het]) { min-height: 44px; } }
/* Chip "Đang lọc": viền/nền xanh cứng (1.4–1.7:1, cả theme Hồng) → token theme, viền ≥3:1. */
html body .chip-loc [data-chip-bo] { border-color: var(--itn-nut-vien) !important; background: var(--theme-accent-soft, rgba(10, 102, 194, .08)) !important; }
/* Hàng nút đầu Tổng quan (Quản lý Hóa đơn · khung thời gian · Cập nhật) và Hóa đơn: chữ trong nút viên thuốc không gãy dòng.
   iPhone: ở Tổng quan nút chính chiếm cả hàng, ô thời gian + Cập nhật ở hàng dưới (trước "Quản lý Hóa / đơn" gãy 2 dòng ở 390px). */
.dash-exec-controls > :is(button, a) { white-space: nowrap; }
/* 26/09/2026 (brief UI mobile): "Quản lý Hóa đơn" không còn là nút to cả hàng — iPhone: MỘT hàng [khung thời gian][Cập nhật][Hóa đơn],
   nút Hóa đơn gọn (chữ ngắn "Hóa đơn", icon), cao chuẩn 44px, không chiếm cả hàng. */
@media (max-width: 480px) {
  .dash-exec-controls { flex-wrap: wrap; }
  .dash-exec-controls:has(.dash-time-dropdown-wrap) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px; width: 100%; align-items: center; }
  .dash-exec-controls > .dash-time-dropdown-wrap { order: 1; min-width: 0; }
  .dash-exec-controls > #btn-dash-refresh { order: 2; }
  .dash-exec-controls > [data-go-mod="invoices"] { order: 3; }
  .dash-exec-controls > [data-sap-xep-tq] { order: 4; padding: 0 8px !important; min-width: 44px; min-height: 44px; justify-content: center; }
  .dash-exec-controls > [data-sap-xep-tq] > span { display: none; }
  .dash-exec-controls > .dash-time-dropdown-wrap > select { width: 100%; padding-inline: 10px 26px !important; }
  html body .dash-exec-controls > :is(#btn-dash-refresh, [data-go-mod="invoices"]) { padding: 0 10px !important; gap: 5px; min-height: 44px; }
  .dash-exec-controls .nhan-dai { display: none; }
}
/* Tab gạch chân dựng bằng style inline (Nhân viên, chi tiết người dùng, chi tiết khách): cao 39–43px → đủ 44px. */
html body :is(button[data-nd-tab], button[data-nd-con], button[data-kh-tab]) { min-height: 44px; }
/* Công tắc (Face ID, Phản hồi…) khi tắt: rãnh nền --border-color chỉ 1.28–1.56:1 → viền ≥3:1 để thấy rõ công tắc. */
html body .tk-switch:not([aria-checked="true"]) { border-color: var(--itn-nut-vien); }

/* Khối chi tiết hóa đơn mở dưới dòng (26/09/2026, lỗi bị cắt bên phải): bảng rộng tối thiểu 1240px nằm trong khung cuộn ngang
   → khối chi tiết dính mép trái và rộng ĐÚNG bằng phần khung đang thấy (100cqi của khung), không trải theo bề rộng bảng. */
.inv-table-responsive { overflow-x: auto; container-type: inline-size; }
.inv-main-table tr.inv-chi-tiet > td { padding: 0 !important; border: 0 !important; background: transparent; }
.inv-ct-khung { position: sticky; left: 0; box-sizing: border-box; width: 100cqi; max-width: 100%; padding: 14px 18px; background: var(--bg-card, #fff);
  border: 2px solid var(--theme-accent-strong, #0071e3); border-top: 0; border-radius: 0 0 8px 8px; }
.inv-ct-khung .hd-nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; font-size: 13px; text-decoration: none; white-space: nowrap; }
.inv-ct-khung .hd-nut-ic { flex: none; }
@supports not (width: 1cqi) { .inv-ct-khung { width: auto; max-width: none; } }
.btn-print-inv-sm { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }

/* Icon nét đứng trước chữ (thay emoji, 26/09/2026): căn giữa dòng chữ, không co. */
.ic-chu { display: inline-block; vertical-align: -0.18em; margin-right: 6px; flex: none; }

/* ── Lấy từ nhánh Gemini 789b406 (26/09/2026), viết lại theo DESIGN.md ── */
/* Giảm chuyển động: khối có hiệu ứng vào luôn hiện đủ, không phụ thuộc animation chạy xong. */
@media (prefers-reduced-motion: reduce) {
  .scene-enter, .scene-enter-right, .scene-enter-left, .stagger-item { animation: none !important; opacity: 1 !important; transform: none !important; }
}
/* Thẻ số (Tổng quan, Hóa đơn, gói bảo hành) — sửa 26/09/2026 (anh Nghĩa gửi ảnh "1,738,800 / ,000"): bản 2 cột trước đó để ô số
   còn 93px và `overflow-wrap:anywhere` cho bẻ giữa con số. Nay: số tiền KHÔNG bao giờ tách dòng (nowrap, chữ số đều);
   điện thoại 1 cột; cỡ số tự nhỏ lại theo BỀ RỘNG THẺ (container query, không theo viewport) khi thẻ hẹp. */
html body .dash-exec-kpis .exec-kpi-val { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; font-variant-numeric: tabular-nums; }
html body .dash-exec-kpis .dash-exec-kpi-card { min-width: 0; }
html body .dash-exec-kpis .dash-exec-kpi-card .kpi-body { container-type: inline-size; min-width: 0; flex: 1; }   /* đo đúng phần chữ (không gồm icon) */
@container (max-width: 165px) { html body .dash-exec-kpis .exec-kpi-val { font-size: 21px !important; } }
@container (max-width: 135px) { html body .dash-exec-kpis .exec-kpi-val { font-size: 18px !important; } }
@media (max-width: 640px) {
  .dash-exec-kpis { grid-template-columns: minmax(0, 1fr) !important; gap: 10px; }
  .dash-exec-kpis .dash-exec-kpi-card { padding: 14px 16px; gap: 12px; border-radius: 8px; min-height: 92px; }
  .dash-exec-kpis .dash-exec-kpi-card .kpi-icon-wrap { width: 40px; height: 40px; border-radius: 8px; flex: none; }
  .dash-exec-kpis .dash-exec-kpi-card .kpi-body { min-width: 0; flex: 1; }
}

/* Điện thoại: thẻ Khách hàng gọn (trước: 10 cặp "nhãn / giá trị" xếp dọc). Dòng 1 tên · tổng bán; dòng 2 SĐT · mã KH;
   các ô còn lại 2 cột "nhãn: giá trị". Bấm thẻ vẫn mở chi tiết như cũ. */
@media (max-width: 700px) {
  [data-list-module="customers"].list-view-cards tr.kh-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; border-radius: 8px; padding: 12px 14px; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:nth-child(7) { grid-column: 2; grid-row: 1; text-align: right !important; font-size: 16px; font-variant-numeric: tabular-nums; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:nth-child(3) { grid-column: 1; grid-row: 2; color: var(--text-muted); font-variant-numeric: tabular-nums; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:nth-child(1) { grid-column: 2; grid-row: 2; text-align: right !important; color: var(--text-muted); }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:is(:nth-child(1), :nth-child(2), :nth-child(3), :nth-child(7))::before { display: none; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:is(:nth-child(4), :nth-child(5), :nth-child(6), :nth-child(8), :nth-child(9), :nth-child(10)) { font-size: 13px; text-align: left !important; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:is(:nth-child(4), :nth-child(5), :nth-child(6), :nth-child(8), :nth-child(9), :nth-child(10))::before { display: inline; margin: 0 4px 0 0; font-size: 12px; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:is(:nth-child(4), :nth-child(6), :nth-child(9))::after { content: ""; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td[data-label]:is(:nth-child(4), :nth-child(5), :nth-child(6), :nth-child(8), :nth-child(9), :nth-child(10))::before { content: attr(data-label) ":"; }
  [data-list-module="customers"].list-view-cards tr.kh-row > td:first-child:not(:empty) { font-size: 13px; }
}
/* Bảo hành: 2 cột (danh mục gói · lịch sử sửa) chỉ trên màn rộng; điện thoại 1 cột — trước bị kẹp 219px, chữ gãy từng từ (ý từ nhánh Gemini). */
.x-grid.bh-luoi { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }
@media (max-width: 760px) { .x-grid.bh-luoi { grid-template-columns: minmax(0, 1fr); } }

/* ── Công tắc & hàng cài đặt (Tài khoản) — 26/09/2026: công tắc bị kéo dài (".tk-phan-hoi .tk-switch{width:100%}") và bị ép cao 44px
   (quy tắc vùng bấm ≥44px chung) nên núm lệch. Nay: công tắc CỐ ĐỊNH 52×32 kiểu hệ thống, không co giãn; vùng bấm 44px bằng ::before
   (không đổi bố cục); mỗi hàng = [tiêu đề + mô tả] | [công tắc] ở cuối hàng; hành động phụ (Quản lý thiết bị) nằm dưới mô tả. */
html body .tk-switch { flex: none; width: 52px !important; min-width: 52px !important; max-width: 52px; height: 32px !important; min-height: 32px !important; padding: 0; box-sizing: border-box; }
html body .tk-switch::before { content: ""; position: absolute; inset: -6px -4px; }
html body .tk-switch .tk-switch-knob { top: 2px; left: 2px; width: 26px; height: 26px; }
.tk-dong { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border-color); }
.tk-dong:first-of-type { border-top: 0; }
.tk-dong-chu { min-width: 0; }
.tk-dong-chu > strong { display: block; font-size: 15px; line-height: 1.35; color: var(--text-main); }
.tk-dong-mo { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.tk-dong-phu { margin-top: 10px; }
.tk-dong-phu .dash-action-btn-secondary { font-size: 13px; min-height: 44px; padding: 0 14px; text-decoration: none; }

/* Khung gọn 2×2 cũ (.tq-gon) đã thay bằng KPI matrix .kmx (van-hanh.css, 26/09/2026). */
/* Nút con mắt: nhỏ về hình, vùng bấm 44px bằng ::before (không đổi chiều cao dòng nhãn). */
.nut-an-so { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; vertical-align: middle; }
.nut-an-so::before { content: ""; position: absolute; inset: -10px; }
.nut-an-so:hover { color: var(--text-main); }
.nut-an-so:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.nut-an-so svg { width: 18px; height: 18px; }

/* Cửa hàng trải nghiệm (28/09/2026): một chi nhánh → một thẻ doanh thu (không kéo giãn cả hàng); dòng "Dữ liệu mẫu" nhỏ dưới tiêu đề. */
.branch-financials-grid.is-mot { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.dash-mau-ghi { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
/* Ghi chú đơn hàng trong danh sách hóa đơn (01/10/2026): một dòng, cắt gọn, đủ nội dung khi rê chuột / ở chi tiết. */
.hd-gc-ngan { display:block; max-width:100%; margin-top:2px; font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hd-gc-ngan .ic-chu { vertical-align:-2px; margin-right:4px; }

/* Bộ lọc khoảng ngày: hàng riêng, đủ vùng bấm trên điện thoại. */
.itn-time-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; width: 100%; margin: 12px 0 16px; box-sizing: border-box; }
.itn-time-range > label { display: grid; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-main); }
.itn-time-range input { box-sizing: border-box; width: 160px; max-width: 100%; min-height: 44px; background: var(--bg-input, var(--bg-card)); color: var(--text-main); }
.itn-time-range > button { min-height: 44px; }
.itn-time-range [data-range-error] { flex-basis: 100%; }
@media (max-width: 760px) { .itn-time-range > label { flex: 1 1 140px; } .itn-time-range input { width: 100%; } }

/* Điểm bán theo check-in; nhãn nhỏ, không đổi chi nhánh kho. */
.hd-dvc { display:inline-block; vertical-align:middle; padding:2px 6px; margin-left:4px; border:1px solid var(--theme-border,#c8dcf8); border-radius:4px; font-size:11px; line-height:1.4; font-weight:600; color:var(--theme-accent-strong,#235da3); background:var(--theme-surface-alt,#ecf4ff); }

/* Mã HĐ gọn: nhãn thiếu xuống dòng trong cột, không đẩy rộng bảng. */
.inv-main-table .inv-ma-col { width:112px !important; min-width:112px; max-width:112px; padding-left:10px; padding-right:10px; }
.inv-main-table .inv-ma-col .hd-chips { max-width:92px; }
.inv-main-table .inv-ma-col .ctd-nhan { max-width:92px; white-space:normal; }
.inv-main-table .inv-ma-col .ctd-nhan span { white-space:normal; overflow-wrap:break-word; }
.hd-chips:empty { display:none; }

/* ══ Khung app A — Khách hàng & Tài khoản trên điện thoại (anh Nghĩa duyệt bản xem trước 13/10/2026, câu Q2 / Q4 / Q5) ══════════════
   Khách hàng (≤760px, app.js veKhachDienThoai): danh sách một dòng / khách trên một bề mặt thẻ (như danh sách Hóa đơn điện thoại),
   bộ lọc thời gian / chi nhánh / lọc gom một hàng 3 ô chọn, cuộn tới đâu tải tới đó; chạm dòng → màn chi tiết đẩy từ phải.
   Tài khoản (≤760px, app.js tkmGocHtml / tkmApDung): danh sách mục kiểu Cài đặt iOS; mỗi mục bật đúng khối cũ của trang (data-tkm-khoi).
   Máy tính: danh sách mục + nút quay lại ẩn, trang như cũ. Màu chỉ dùng token theme; bo ≤ 8px (ảnh đại diện tròn); ô bấm ≥ 44px. */
.khm-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; }
.khm-dau h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 800; color: var(--text-main); }
.khm-nut-ic { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--text-main); cursor: pointer; box-shadow: none; }
.khm-ghi { margin: 2px 0 12px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.khm-tim .tim-o { min-width: 0 !important; }
.khm-tim input.tim-chung { min-height: 44px; font-size: 16px !important; }   /* < 16px thì iOS phóng to trang khi gõ */
.khm-tim .tim-xoa { right: 0 !important; display: grid; place-items: center; min-width: 44px; min-height: 44px; }   /* nút ✕ đủ 44px (gợi ý F3 đã ẩn trên màn cảm ứng) */
/* Ô chọn dạng chip vừa chữ: chữ đang chọn hiện ở .khm-chon-chu, <select> thật phủ trong suốt lên trên (bấm / đọc màn hình như ô chọn thường). */
.khm-loc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.khm-chon { position: relative; box-sizing: border-box; display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding: 0 26px 0 10px;
  border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input, var(--bg-card)); color: var(--text-main); font-size: 13px; font-weight: 600; }
.khm-chon.is-bat { border-color: var(--theme-accent-strong); background: var(--theme-accent-soft, var(--bg-input)); color: var(--txt-accent, var(--text-main)); }
.khm-chon-chu { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.khm-chon::after { content: ""; position: absolute; right: 10px; top: 50%; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.khm-chon select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; font-size: 16px; cursor: pointer; }
.khm-chon:focus-within { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.khm :is([data-chip-bo], [data-chip-het]) { min-height: 44px; }
.khm-nap { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
.khm-nap :is(button, a) { min-height: 44px; }
.khm-tong { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 14px 2px 10px; font-size: 14px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
.khm-tong strong { font-size: 17px; color: var(--text-main); font-variant-numeric: tabular-nums; }
.khm-ds { list-style: none; margin: 10px 0 0; padding: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.khm-ds > li + li { border-top: 1px solid var(--border-color); }
.khm-dong { box-sizing: border-box; display: grid; gap: 4px; width: 100%; min-height: 64px; margin: 0; padding: 12px 14px; border: 0; border-radius: 0; background: transparent;
  color: var(--text-main); font: inherit; text-align: left; text-decoration: none; cursor: pointer; box-shadow: none; }
.khm-dong:hover, .khm-dong:active { background: var(--bg-card-hover, var(--bg-input)); }
.khm-dong:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: -2px; }
.khm-r1, .khm-r2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.khm-r1 { justify-content: space-between; font-size: 16px; font-weight: 700; line-height: 1.35; }
.khm-ten { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.khm-tien { flex: none; font-variant-numeric: tabular-nums; }
.khm-r2 { font-size: 13px; line-height: 1.35; color: var(--text-muted); }
.khm-phu { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.khm-ngay { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; }
.khm-r3, .khm-gc { font-size: 13px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.khm-gc .ic-chu { vertical-align: -2px; margin-right: 4px; }
.khm-the { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: 6px;
  background: var(--theme-accent-soft, var(--bg-input)); color: var(--txt-accent, var(--text-main)); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; }
.khm-the.is-ok { background: transparent; color: var(--txt-ok, var(--text-main)); }
.khm-the.is-bad { background: transparent; color: var(--txt-bad, var(--text-main)); }
.khm-them { box-sizing: border-box; display: block; width: 100%; min-height: 44px; margin: 12px 0 0; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-card); color: var(--txt-accent, var(--text-main)); font: inherit; font-weight: 600; cursor: pointer; box-shadow: none; }
.khm-them:focus-visible, .khm-nut-ic:focus-visible, .khm-nut:focus-visible, .khm-lui:focus-visible, .tkm-lui:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
/* Màn chi tiết khách — thay danh sách, đẩy từ phải; nút "‹ Khách hàng" thay lối "← Quay lại" chung (một nút quay lại). */
.khm-ct.is-vao { animation: khm-vao .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes khm-vao { from { transform: translateX(28px); opacity: .4; } to { transform: none; opacity: 1; } }
#module-content:has(> .khm-ct) > .itn-mobile-backbar, #module-content:has(> .tk-trang.is-tkm-con) > .itn-mobile-backbar { display: none; }
.khm-ct-dau, .tkm-dau { margin: 0 0 8px; }
.khm-lui, .tkm-lui { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; margin: 0 0 0 -6px; padding: 0 12px 0 4px; border: 0; border-radius: 8px;
  background: transparent; color: var(--txt-accent, var(--text-main)); font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; box-shadow: none; }
.khm-ct-head { display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; }
.khm-av, .tkm-av { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--theme-accent-soft, var(--bg-input));
  color: var(--txt-accent, var(--text-main)); font-size: 22px; font-weight: 700; }
.khm-ct-ten { min-width: 0; }
.khm-ct-ten h1 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; color: var(--text-main); overflow-wrap: anywhere; }
.khm-ct-phu { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.khm-ct-the { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.khm-sdt { margin-top: 12px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; }
.khm-nhan-nho { display: block; font-size: 12px; color: var(--text-muted); }
.khm-sdt-so strong { display: block; margin-top: 2px; font-size: 20px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--text-main);
  -webkit-user-select: text; user-select: text; overflow-wrap: anywhere; }
.khm-sdt-nut { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.khm-sdt-nut.is-hai { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.khm-nut { box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; margin: 0; padding: 6px 8px; border: 1px solid var(--border-color);
  border-radius: 8px; background: var(--bg-input, var(--bg-card)); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.25; text-align: center;
  text-decoration: none; cursor: pointer; box-shadow: none; }
.khm-nut svg { flex: none; color: var(--txt-accent, var(--text-main)); }
.khm-muc { margin: 18px 2px 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.khm-tt { margin: 0; padding: 0 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; }
.khm-tt-dong { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; padding: 11px 0; }
.khm-tt-dong + .khm-tt-dong { border-top: 1px solid var(--border-color); }
.khm-tt dt { font-size: 14px; color: var(--text-muted); }
.khm-tt dd { margin: 0; font-size: 14px; color: var(--text-main); text-align: right; overflow-wrap: anywhere; }
.khm-chua { color: var(--text-muted); }
.khm-canh { color: var(--txt-warn, var(--text-main)); font-weight: 600; }
.khm-trong { margin: 0; padding: 4px 2px; font-size: 14px; }
.khm-sua, .khm-xem-hd { width: 100%; margin-top: 10px; gap: 6px; }
.khm-xem-hd { display: flex; align-items: center; justify-content: center; }
.khm-form { display: grid; gap: 10px; margin-top: 10px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; }
.khm-form label { display: grid; gap: 4px; font-size: 13px; color: var(--text-muted); }
.khm-form input { box-sizing: border-box; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input, var(--bg-card));
  color: var(--text-main); font: inherit; font-size: 16px; }
.khm-form input:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 1px; }
.khm-form-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Tài khoản: máy tính không có danh sách mục / nút quay lại. */
.tkm-goc, .tkm-dau { display: none; }
@media (max-width: 760px) {
  .tk-trang .tkm-goc, .tk-trang .tkm-goc[hidden] { display: block; }
  .tk-trang.is-tkm-con .tkm-goc, .tk-trang.is-tkm-con > .tk-h1, .tk-trang > .tk-lien-ket { display: none !important; }   /* liên kết chân trang đã thành mục ở màn gốc */
  .tk-trang.is-tkm-con > .tkm-dau { display: block; }
  .tk-trang [data-tkm-khoi]:not(.is-tkm-mo) { display: none !important; }
  .tk-trang.is-tkm-vao .is-tkm-mo { animation: khm-vao .22s cubic-bezier(.2, .8, .2, 1); }
  .tkm-nhom-h { margin: 0 2px 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
  .tkm-nhom { list-style: none; margin: 0 0 20px; padding: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
  .tkm-nhom > li + li { border-top: 1px solid var(--border-color); }
  .tkm-dong { box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; margin: 0; padding: 8px 12px 8px 14px; border: 0; border-radius: 0;
    background: transparent; color: var(--text-main); font: inherit; font-size: 16px; line-height: 1.3; text-align: left; text-decoration: none; cursor: pointer; box-shadow: none; }
  .tkm-dong:hover, .tkm-dong:active { background: var(--bg-card-hover, var(--bg-input)); }
  .tkm-dong:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: -2px; }
  .tkm-dong:disabled { opacity: .55; cursor: default; }
  .tkm-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--theme-accent-soft, var(--bg-input)); color: var(--txt-accent, var(--text-main)); }
  .tkm-chu { flex: 1; min-width: 0; display: grid; gap: 2px; }
  .tkm-ten { font-weight: 500; overflow-wrap: anywhere; }
  .tkm-phu { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
  .tkm-gt { flex: none; font-size: 14px; font-weight: 400; color: var(--text-muted); }
  .tkm-chev { flex: none; display: grid; color: var(--text-muted); }
  .tkm-hs { min-height: 76px; }
  .tkm-hs .tkm-av { width: 52px; height: 52px; font-size: 20px; }
  .tkm-hs .tkm-ten { font-size: 18px; font-weight: 600; }
  .tkm-giua { justify-content: center; text-align: center; font-weight: 600; color: var(--txt-accent, var(--text-main)); }
  .tkm-nguy { color: var(--txt-bad, var(--text-main)); }
}
@media (prefers-reduced-motion: reduce) {
  .khm-ct.is-vao, .tk-trang.is-tkm-vao .is-tkm-mo { animation: none; }
}
