/* =============================================================
   CRM VỰA MEDIA — MODERN ENTERPRISE DESIGN SYSTEM (UI/UX 2.0)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary & Brand Colors */
  --blue: #2563EB;
  --blue-h: #1D4ED8;
  --blue-d: #1E40AF;
  --blue-light: #EFF6FF;
  --blue-border: #BFDBFE;
  --azure: #0EA5E9;
  
  /* Neutral Slate Palette */
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --ink-4: #94A3B8;
  
  /* Backgrounds & Surfaces */
  --bg: #F1F5F9;
  --bg-alt: #F8FAFC;
  --card: #FFFFFF;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;

  /* Form controls */
  --input-bg: #FFFFFF;
  --input-border: #E2E8F0;
  --input-color: #0F172A;
  --input-placeholder: #94A3B8;
  --input-focus-border: #2563EB;
  --input-focus-ring: rgba(37, 99, 235, 0.14);
  
  /* Accent & Semantic Status Colors */
  --ok: #059669;
  --ok-bg: #ECFDF5;
  --ok-border: #A7F3D0;
  
  --warn: #D97706;
  --warn-bg: #FFFBEB;
  --warn-border: #FDE68A;
  
  --bad: #DC2626;
  --bad-bg: #FEF2F2;
  --bad-border: #FECACA;
  
  --purple: #7C3AED;
  --purple-bg: #F5F3FF;
  --purple-border: #DDD6FE;
  
  /* Radii & Shadows */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 9999px;
  
  /* Sidebar & Topbar Defaults */
  --bg-sidebar: #FFFFFF;
  --border-sidebar: #E2E8F0;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --border-topbar: #E2E8F0;
  --search-bg: #F8FAFC;
  --sidebar-link-color: #64748B;
  --sidebar-link-hover-bg: #F1F5F9;
  --sidebar-link-hover-color: #0F172A;
  --sidebar-active-bg: #EFF6FF;
  --sidebar-active-color: #2563EB;
  --sidebar-active-glow: rgba(37, 99, 235, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 4px 16px -2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 10px 24px -4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 20px 35px -5px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px -4px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.03);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.025em;
  font-weight: 800;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--blue); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--blue-h); }

/* =============================================================
   LOGIN GATE SCREEN
   ============================================================= */
#gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 700px at 50% -5%, #1E40AF 0%, #0F172A 60%, #020617 100%);
  position: relative;
  overflow: hidden;
}

#gate::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.15), transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(124, 58, 237, 0.12), transparent 40%);
  pointer-events: none;
}

.gate-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--r-xl);
  padding: 38px 34px 34px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: gateFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gateFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.gate-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563EB, #0EA5E9);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.gate-card h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.gate-card p.sub {
  color: var(--ink-3);
  font-size: 13.5px;
  margin: 6px 0 22px;
}

.who {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.who button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.who button:hover {
  border-color: var(--blue);
  background: #F8FAFC;
  transform: translateY(-1px);
}

.who button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 1px var(--blue);
  color: var(--blue-d);
}

.who .av {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pinrow {
  display: flex;
  gap: 10px;
}

.pinrow input {
  flex: 1;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 17px;
  letter-spacing: 0.25em;
  font-weight: 700;
  color: var(--ink);
  transition: all 150ms ease;
}

.pinrow input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* =============================================================
   BUTTON SYSTEM
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13.5px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  line-height: 1.25;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  background: var(--blue-h);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--blue), #1D4ED8);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #1D4ED8, #1E40AF);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

.btn.ghost:hover {
  background: #F8FAFC;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn.sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn.dang {
  background: var(--bad-bg);
  border-color: var(--bad-border);
  color: var(--bad);
}

.btn.dang:hover {
  background: #FEE2E2;
  border-color: #F87171;
}

/* =============================================================
   LEFT SIDEBAR NAVIGATION & MODERN APP LAYOUT
   ============================================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* Backdrop cho Drawer Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 26, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Left Sidebar cố định 260px */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.logo-vua {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-vua svg {
  width: 100%;
  height: 100%;
}

.sidebar-brand:hover .logo-vua {
  transform: scale(1.08) rotate(-2deg);
}

.brand-text {
  min-width: 0;
}

.brand-title {
  display: block;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.role-pill {
  font-size: 9px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.pill-admin {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.pill-ctv {
  background: #F5F3FF;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px 6px;
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sidebar-link-color);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: transparent;
  border: none;
}

.sidebar-link:hover {
  background: var(--sidebar-link-hover-bg);
  color: var(--sidebar-link-hover-color);
  transform: translateX(2px);
}

.sidebar-link.active,
.sidebar-link[aria-selected="true"] {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-link.active .sidebar-icon,
.sidebar-link[aria-selected="true"] .sidebar-icon {
  color: var(--blue);
  transform: scale(1.1);
}

.sidebar-icon {
  font-size: 18px;
  line-height: 1;
  color: inherit;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.sidebar-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1.5px 7px;
  border-radius: 999px;
  line-height: 1.2;
}

.sidebar-badge.badge-amber {
  background: #FF7828;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(255, 120, 40, 0.4);
}

.sidebar-badge.badge-red {
  background: #EF4444;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Sidebar User Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-sidebar);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.12);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-card .user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sidebar-user-card .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-card .user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-card .user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.sidebar-user-card .user-logout-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-sidebar);
  color: var(--ink-3);
  text-decoration: none;
  transition: all 0.15s ease;
}

.sidebar-user-card .user-logout-btn:hover,
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #EF4444 !important;
}

/* =============================================================
   TOPBAR NAVIGATION & SEARCH
   ============================================================= */
.app-main {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: 64px;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  max-width: 520px;
}

.topbar-menu-btn {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-topbar);
  color: var(--ink-2);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  place-items: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

/* Search Bar in Topbar */
.topbar-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--search-bg);
  border: 1px solid var(--border-sidebar);
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  width: 100%;
  max-width: 380px;
  transition: all 0.2s ease;
}

.topbar-search-bar:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.15);
}

.topbar-search-bar .search-icon {
  font-size: 16px;
  color: var(--blue);
}

.topbar-search-bar .search-placeholder {
  font-size: 13px;
  color: var(--ink-3);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-search-bar .search-kbd,
#globalSearchTrigger kbd {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink-3);
  font-family: inherit;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--search-bg);
  border: 1px solid var(--border-sidebar);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.topbar-chip i {
  color: var(--blue);
  font-size: 15px;
}

.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--search-bg);
  border: 1px solid var(--border-sidebar);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: all 0.15s ease;
}

.topbar-btn:hover {
  background: var(--sidebar-link-hover-bg);
  border-color: var(--blue);
  color: var(--ink);
  transform: translateY(-1px);
}

.topbar-btn .bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #FF7828;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(255, 120, 40, 0.5);
  border: 2px solid var(--bg-sidebar);
}

.topbar-user-mini {
  margin-left: 4px;
}

.topbar-user-mini .user-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13.5px;
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.15);
}

/* =============================================================
   APP CONTENT CONTAINER
   ============================================================= */
.app-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px 80px;
  box-sizing: border-box;
}

/* =============================================================
   DATABAR / HERO BANNER
   ============================================================= */
.databar {
  background: linear-gradient(135deg, #051336 0%, #0A225C 50%, #103B8E 100%);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  box-shadow: 0 10px 25px -5px rgba(5, 19, 54, 0.25), 0 8px 10px -6px rgba(5, 19, 54, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.databar::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(0, 198, 255, 0.18), transparent 70%);
  pointer-events: none;
}

.databar-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #38BDF8;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.databar-info {
  flex: 1;
  min-width: 230px;
}

.databar-info h3 {
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.databar-info p {
  margin: 3px 0 0;
  font-size: 13px;
  color: #94A3B8;
  line-height: 1.45;
}

.databar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.databar .btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  backdrop-filter: blur(8px);
}

.databar .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

/* =============================================================
   KPI CARDS WIDGETS
   ============================================================= */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: all 220ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: var(--line-strong);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kpi .lb {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-alt);
  display: grid;
  place-items: center;
  font-size: 17px;
  color: var(--ink-2);
  flex-shrink: 0;
  transition: all 200ms ease;
}

.kpi .vl {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.2;
}

.kpi .ft {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 5px;
  font-weight: 500;
}

.kpi.acc-blue::before { background: linear-gradient(90deg, #0062FF, #00C6FF); }
.kpi.acc-blue .vl { color: #1D4ED8; }
.kpi.acc-blue .kpi-icon { background: #EFF6FF; color: #2563EB; }

.kpi.acc-green::before { background: linear-gradient(90deg, #059669, #34D399); }
.kpi.acc-green .vl { color: #047857; }
.kpi.acc-green .kpi-icon { background: #ECFDF5; color: #059669; }

.kpi.acc-purple::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.kpi.acc-purple .vl { color: #6D28D9; }
.kpi.acc-purple .kpi-icon { background: #F5F3FF; color: #7C3AED; }

.kpi.acc-red::before { background: linear-gradient(90deg, #DC2626, #F87171); }
.kpi.acc-red .vl { color: #B91C1C; }
.kpi.acc-red .kpi-icon { background: #FEF2F2; color: #DC2626; }

.kpi.acc-warn::before { background: linear-gradient(90deg, #D97706, #FBBF24); }
.kpi.acc-warn .vl { color: #B45309; }
.kpi.acc-warn .kpi-icon { background: #FFFBEB; color: #D97706; }

/* =============================================================
   PANELS & LAYOUT GRIDS
   ============================================================= */
.grid2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.grid2.even { grid-template-columns: 1fr 1fr; }
.grid-form {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 1080px) {
  .grid2, .grid2.even, .grid-form { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 20px;
}

.ph {
  padding: 16px 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}

.ph h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.ph em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
}

.pb {
  padding: 18px 20px 22px;
}

/* =============================================================
   FORMS & INPUT CONTROLS
   ============================================================= */
.fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.wide { grid-column: 1 / -1; }

label.lb {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
}

label.lb i {
  font-style: normal;
  color: var(--bad);
  margin-left: 2px;
}

.field input[type=text],
.field input[type=date],
.field input[type=number],
.field input[type=search],
.field input[type=email],
.field input[type=password],
.field input[type=month],
.field input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]),
.field select,
.field textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--input-border, var(--line));
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--input-color, var(--ink));
  background: var(--input-bg, #FFFFFF);
  width: 100%;
  transition: all 150ms ease;
  -webkit-text-fill-color: var(--input-color, var(--ink));
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--input-focus-border, var(--blue));
  box-shadow: 0 0 0 3.5px var(--input-focus-ring, rgba(37, 99, 235, 0.14));
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--input-placeholder, #94A3B8);
  -webkit-text-fill-color: var(--input-placeholder, #94A3B8);
  opacity: 1;
}

.field small {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  line-height: 1.4;
}

/* Checkbox lines */
.chkline {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-alt, #F8FAFC);
  border: 1px solid var(--line, #E2E8F0);
  padding: 10px 14px;
  border-radius: var(--r-sm, 8px);
  font-size: 13.5px;
  color: var(--ink);
}

.chkline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--blue);
}

/* Job rows in orders */
.job-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--card, #FFFFFF);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 6px;
}

.job-item-row select,
.job-item-row input {
  border: 1px solid var(--input-border, var(--line));
  border-radius: 4px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--input-bg, #FFFFFF);
  color: var(--input-color, var(--ink));
  -webkit-text-fill-color: var(--input-color, var(--ink));
}

/* Segmented Toggle */
.seg {
  display: flex;
  gap: 4px;
  background: var(--bg-alt, #F1F5F9);
  padding: 4px;
  border-radius: var(--r);
  border: 1px solid var(--line);
}

.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
  transition: all 150ms ease;
}

.seg button[aria-pressed="true"] {
  background: var(--card, #FFFFFF);
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  font-weight: 800;
}

/* Live Calc Widget */
.calc {
  background: linear-gradient(145deg, #0F172A 0%, #1E293B 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 20px;
  position: sticky;
  top: 76px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.calc h3 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
}

.calc .big {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
  color: #FFFFFF;
}

.calc .big small {
  font-size: 14px;
  font-weight: 700;
  color: #94A3B8;
  margin-left: 4px;
}

.calc .rows {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 10px;
  font-size: 13px;
}

.calc .rw {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.calc .rw span { color: #94A3B8; font-weight: 500; }
.calc .rw b { font-weight: 700; color: #F1F5F9; }
.calc .rw.tot {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 800;
}

.calc .split {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.calc .split div {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r);
  padding: 10px 12px;
}

.calc .split .l {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94A3B8;
}

.calc .split .v {
  font-size: 18px;
  font-weight: 900;
  margin-top: 2px;
}

.calc .split .ctv .v { color: #C4B5FD; }
.calc .split .co .v { color: #6EE7B7; }

/* =============================================================
   TABLES & DATA GRIDS
   ============================================================= */
.tw {
  overflow-x: auto;
  max-height: 640px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

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

th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
  text-align: left;
  padding: 11px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  font-weight: 800;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
  z-index: 2;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  white-space: nowrap;
  color: var(--ink);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #F8FAFC;
}

td.r, th.r { text-align: right; }

tfoot td {
  position: sticky;
  bottom: 0;
  background: #F8FAFC;
  font-weight: 800;
  border-top: 2px solid var(--line-strong);
  z-index: 2;
}

/* Status Tags & Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tag i {
  font-size: 13px;
  line-height: 1;
}

.t-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.t-part { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.t-no { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-border); }
.t-bh { background: var(--blue-light); color: var(--blue-d); border: 1px solid var(--blue-border); }
.t-cn { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.t-co { background: #F1F5F9; color: var(--ink-2); border: 1px solid var(--line); }
.t-off { background: #F1F5F9; color: var(--ink-3); border: 1px solid var(--line); }

.pos { color: var(--ok); font-weight: 800; }
.neg { color: var(--bad); font-weight: 800; }

.toast {
  border-radius: var(--r);
  padding: 13px 20px;
  margin-bottom: 18px;
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(11, 25, 56, 0.06);
  animation: toastSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.toast i {
  font-size: 19px;
  flex-shrink: 0;
}

.toast.ok { background: var(--ok-bg); color: #065F46; border-color: var(--ok-border); }
.toast.bad { background: var(--bad-bg); color: #991B1B; border-color: var(--bad-border); }

/* Tools bar */
.tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 20px 0;
}

.tools select,
.tools input[type=search],
.tools input[type=month],
.tools input[type=date] {
  padding: 8px 12px;
  border: 1.5px solid var(--input-border, var(--line));
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--input-color, var(--ink));
  background: var(--input-bg, #FFFFFF);
  transition: all 150ms ease;
  -webkit-text-fill-color: var(--input-color, var(--ink));
}

.tools select:focus,
.tools input:focus {
  outline: none;
  border-color: var(--input-focus-border, var(--blue));
  box-shadow: 0 0 0 3px var(--input-focus-ring, rgba(37, 99, 235, 0.12));
}

/* Two Revenue Streams Card */
.hai-luong {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.hai-luong .lu {
  flex: 1;
  min-width: 240px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-left: 4px solid var(--purple);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.hai-luong .lu.page {
  border-left-color: var(--azure);
}

.hai-luong .lu.mkt {
  border-left-color: var(--ok);
}

.hai-luong .l {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hai-luong .l small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.hai-luong .v {
  font-size: 22px;
  font-weight: 900;
  color: var(--purple);
  margin-top: 6px;
}

.hai-luong .lu.page .v { color: #0284C7; }

/* Empty state */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 500;
}

footer.f {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

/* Print Stylesheet */
@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  body { background: #fff !important; font-family: var(--font-main); }
  .app-sidebar, .app-topbar, .sidebar-backdrop, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; width: 100% !important; }
  body * { visibility: hidden !important; }
  .payslip-print-container, .payslip-print-container * { visibility: visible !important; }
  .payslip-print-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
  }
  .payslip-print {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
  }
  .payslip-print .ph { padding: 0 0 12px; border-bottom: 2px solid #0F172A; background: #fff; }
  .payslip-print .pb { padding: 14px 0 0; }
  .payslip-print table { font-size: 11pt; }
  .payslip-print td { padding: 6px 4px; white-space: normal; }
  .payslip-print tfoot td { position: static; background: #fff; border-top: 2px solid #0F172A; }

  .payslip-orders-print {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-top: 0 !important;
    page-break-before: always !important;
    break-before: page !important;
  }
  .payslip-orders-print .ph { padding: 0 0 10px; border-bottom: 2px solid #0F172A; background: #fff; }
  .payslip-orders-print .tw { overflow: visible !important; }
  .payslip-orders-print table { font-size: 10pt; width: 100%; }
  .payslip-orders-print th, .payslip-orders-print td { padding: 6px 4px; }
  .payslip-orders-print tfoot td { position: static; background: #fff; border-top: 2px solid #0F172A; }

  .no-print { display: none !important; }
  .direct-orders-row { display: table-row !important; }
}

/* Nút toggle [+] và Bảng danh sách đơn khách trả thẳng */
.btn-toggle-direct {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.15s ease;
}
.btn-toggle-direct:hover {
  background: #DBEAFE;
  color: #1E40AF;
}
.direct-orders-box {
  background: #FEF2F2;
  border: 1px dashed #FCA5A5;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 6px 0;
}
.direct-orders-title {
  font-size: 12px;
  font-weight: 700;
  color: #991B1B;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-sub-direct {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.table-sub-direct th {
  background: #FEE2E2;
  color: #991B1B;
  padding: 5px 6px;
  font-size: 11px;
  text-align: left;
}
.table-sub-direct td {
  padding: 5px 6px;
  border-bottom: 1px solid #FECACA;
}
.table-sub-direct tfoot td {
  border-top: 1.5px solid #F87171;
  background: #FEE2E2;
}

/* =============================================================
   PHÂN HỆ KPI NHÂN SỰ & TIẾN ĐỘ REALTIME (Phase 07.2)
   ============================================================= */
.kpi-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #E2E8F0);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.15s ease;
}
.kpi-card:hover {
  border-color: var(--blue, #0284c7);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
}
.kpi-card.is-completed {
  border-color: #86EFAC;
  background: #F0FDF4;
}
.kpi-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.kpi-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #0F172A);
  margin-bottom: 4px;
  line-height: 1.35;
}
.kpi-meta {
  font-size: 12px;
  color: var(--ink-3, #64748B);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.kpi-progress-wrap {
  margin: 12px 0 8px;
}
.kpi-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  margin-bottom: 5px;
}
.kpi-progress-bar-bg {
  height: 10px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}
.kpi-progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.kpi-matching-orders-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 12px;
}
.kpi-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #E2E8F0);
  flex-wrap: wrap;
}

/* =============================================================
   DARK MODE THEME SYSTEM
   ============================================================= */
html.dark-mode {
  color-scheme: dark;
  /* Dark Slate Luxury Palette tương ứng mẫu tham khảo */
  --bg: #0F121F;
  --bg-alt: #131629;
  --bg-sidebar: #131629;
  --border-sidebar: #23284A;
  --topbar-bg: rgba(19, 22, 41, 0.92);
  --border-topbar: #23284A;
  --search-bg: #1A1D36;
  --card: #1A1D36;
  --line: #272C4E;
  --line-strong: #333966;
  --ink: #FFFFFF;
  --ink-2: #CBD5E1;
  --ink-3: #8E9BB5;
  --ink-4: #606C88;

  /* Form controls in dark mode */
  --input-bg: #14172B;
  --input-border: #272C4E;
  --input-color: #FFFFFF;
  --input-placeholder: #8E9BB5;
  --input-focus-border: #0088FF;
  --input-focus-ring: rgba(0, 136, 255, 0.25);

  --sidebar-link-color: #8E9BB5;
  --sidebar-link-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-link-hover-color: #FFFFFF;
  --sidebar-active-bg: linear-gradient(90deg, rgba(0, 136, 255, 0.22) 0%, rgba(0, 136, 255, 0.06) 100%);
  --sidebar-active-color: #FFFFFF;
  --sidebar-active-glow: rgba(0, 136, 255, 0.2);

  --blue: #0088FF;
  --blue-h: #0070D2;
  --blue-d: #005BBB;
  --blue-light: #16203D;
  --blue-border: #234080;
  --azure: #00D2FF;

  --ok: #10B981;
  --ok-bg: rgba(16, 185, 129, 0.15);
  --ok-border: rgba(16, 185, 129, 0.35);

  --warn: #FF7828;
  --warn-bg: rgba(255, 120, 40, 0.15);
  --warn-border: rgba(255, 120, 40, 0.35);

  --bad: #EF4444;
  --bad-bg: rgba(239, 68, 68, 0.15);
  --bad-border: rgba(239, 68, 68, 0.35);

  --purple: #A855F7;
  --purple-bg: rgba(168, 85, 247, 0.15);
  --purple-border: rgba(168, 85, 247, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html.dark-mode .panel,
html.dark-mode .box {
  background: #1A1D36;
  border-color: #272C4E;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

html.dark-mode .databar {
  background: linear-gradient(135deg, #1A1E3C 0%, #151833 100%);
  border-color: #282E56;
}

html.dark-mode .databar-icon {
  background: rgba(0, 136, 255, 0.18);
  color: #0088FF;
  box-shadow: 0 0 18px rgba(0, 136, 255, 0.3);
}

html.dark-mode .btn.ghost {
  background: #1A1D36;
  border-color: #272C4E;
  color: var(--ink-2);
}

html.dark-mode .btn.ghost:hover {
  background: #23284A;
  border-color: #333A66;
  color: #FFFFFF;
}

html.dark-mode input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]),
html.dark-mode select,
html.dark-mode textarea,
html.dark-mode .field input[type=text],
html.dark-mode .field input[type=date],
html.dark-mode .field input[type=number],
html.dark-mode .field input[type=search],
html.dark-mode .field input[type=email],
html.dark-mode .field input[type=password],
html.dark-mode .field input[type=month],
html.dark-mode .field input,
html.dark-mode .field select,
html.dark-mode .field textarea,
html.dark-mode .tools select,
html.dark-mode .tools input,
html.dark-mode .job-item-row select,
html.dark-mode .job-item-row input {
  background-color: #14172B !important;
  color: #FFFFFF !important;
  border-color: #272C4E !important;
  -webkit-text-fill-color: #FFFFFF !important;
}

html.dark-mode input:focus,
html.dark-mode select:focus,
html.dark-mode textarea:focus,
html.dark-mode .field input:focus,
html.dark-mode .field select:focus,
html.dark-mode .field textarea:focus,
html.dark-mode .tools select:focus,
html.dark-mode .tools input:focus,
html.dark-mode .job-item-row select:focus,
html.dark-mode .job-item-row input:focus {
  background-color: #181C35 !important;
  color: #FFFFFF !important;
  border-color: #0088FF !important;
  box-shadow: 0 0 0 3.5px rgba(0, 136, 255, 0.25) !important;
  -webkit-text-fill-color: #FFFFFF !important;
}

html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder,
html.dark-mode .field input::placeholder,
html.dark-mode .field textarea::placeholder {
  color: #8E9BB5 !important;
  -webkit-text-fill-color: #8E9BB5 !important;
  opacity: 1;
}

html.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
html.dark-mode input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

html.dark-mode .chkline {
  background: #14172B;
  border-color: #272C4E;
  color: #FFFFFF;
}

html.dark-mode .job-item-row {
  background: #14172B;
  border-color: #272C4E;
}

/* Segmented toggles in dark mode */
html.dark-mode .seg {
  background: #14172B;
  border-color: #272C4E;
}

html.dark-mode .seg button {
  color: #8E9BB5;
}

html.dark-mode .seg button:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.05);
}

html.dark-mode .seg button[aria-pressed="true"] {
  background: #23284A;
  color: #38BDF8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  font-weight: 800;
}

html.dark-mode thead th {
  background: #14172B;
  color: #8E9BB5;
  border-bottom: 1px solid #252B52;
}

html.dark-mode td {
  border-bottom-color: #23284A;
  color: #CBD5E1;
}

html.dark-mode tbody tr:hover {
  background: #202545;
}

html.dark-mode tfoot td {
  background: #14172B;
  border-top-color: #2D335A;
  color: #FFFFFF;
  font-weight: 800;
}

html.dark-mode .pol {
  background: #131629;
  border-color: var(--line);
}

html.dark-mode .hai-luong .lu {
  background: #1A1D36;
}

html.dark-mode .brand-title {
  color: #FFFFFF;
}

html.dark-mode .kpi {
  background: #1A1D36;
  border-color: #272C4E;
}

html.dark-mode .kpi .kpi-val {
  color: #FFFFFF;
}

html.dark-mode .kpi .kpi-tit {
  color: #8E9BB5;
}

html.dark-mode .kpi-icon {
  background: #131629;
  color: var(--ink-2);
}

html.dark-mode .kpi.acc-blue {
  border-color: rgba(0, 136, 255, 0.35);
  box-shadow: 0 4px 18px rgba(0, 136, 255, 0.12);
}
html.dark-mode .kpi.acc-blue .kpi-icon {
  background: rgba(0, 136, 255, 0.2);
  color: #0088FF;
}

html.dark-mode .kpi.acc-green {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12);
}
html.dark-mode .kpi.acc-green .kpi-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #10B981;
}

html.dark-mode .kpi.acc-purple {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.12);
}
html.dark-mode .kpi.acc-purple .kpi-icon {
  background: rgba(168, 85, 247, 0.2);
  color: #A855F7;
}

html.dark-mode .kpi.acc-red {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.12);
}
html.dark-mode .kpi.acc-red .kpi-icon {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

html.dark-mode .kpi.acc-warn {
  border-color: rgba(255, 120, 40, 0.35);
  box-shadow: 0 4px 18px rgba(255, 120, 40, 0.12);
}
html.dark-mode .kpi.acc-warn .kpi-icon {
  background: rgba(255, 120, 40, 0.2);
  color: #FF7828;
}

html.dark-mode .confirm-icon-wrap {
  background: rgba(255, 120, 40, 0.2);
  color: #FF7828;
}

html.dark-mode .confirm-icon-wrap.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

html.dark-mode .modal-foot {
  background: #131629;
}

html.dark-mode .modal-head {
  background: #131629;
}

html.dark-mode .pill-admin {
  background: rgba(0, 136, 255, 0.2);
  color: #38BDF8;
  border-color: rgba(0, 136, 255, 0.4);
}

html.dark-mode .pill-ctv {
  background: rgba(168, 85, 247, 0.2);
  color: #D8B4FE;
  border-color: rgba(168, 85, 247, 0.4);
}


/* =============================================================
   KANBAN BOARD SYSTEM
   ============================================================= */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}
.kanban-col {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--line);
}
.kanban-col-head h3 {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 180ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-border);
}

/* =============================================================
   INTERACTIVE CHECKLIST & PROGRESS
   ============================================================= */
.task-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.prog-track {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 10px;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #10B981);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}
.task-item.done {
  text-decoration: line-through;
  color: var(--ink-4);
}
.task-item input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
}
.task-item label {
  cursor: pointer;
  flex: 1;
  word-break: break-word;
}
.task-item:hover {
  color: var(--ink);
}

/* =============================================================
   NHIỆM VỤ TỪNG NHÂN SỰ (STAFF TASK CENTER)
   ============================================================= */
.staff-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  align-items: start;
}
.staff-task-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}
.staff-task-card:hover {
  border-color: var(--blue-border);
  box-shadow: var(--shadow-md);
}
.staff-task-head {
  padding: 16px 18px;
  background: var(--bg-alt);
  border-bottom: 1.5px solid var(--line);
}
.staff-task-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.op-item-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 180ms ease;
}
.op-item-card:hover {
  background: var(--card);
  border-color: var(--line-strong);
}

/* =============================================================
   COMMAND PALETTE / GLOBAL SEARCH (Ctrl + K)
   ============================================================= */
.cmd-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.cmd-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.cmd-box {
  width: 100%;
  max-width: 600px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: scale(0.96) translateY(-10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cmd-modal.active .cmd-box {
  transform: scale(1) translateY(0);
}
.cmd-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--line);
}
.cmd-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 !important;
  box-shadow: none !important;
}
.cmd-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--ink);
  transition: background 120ms ease;
  cursor: pointer;
}
.cmd-item:hover, .cmd-item.selected {
  background: var(--blue-light);
  color: var(--blue-d);
}
.cmd-item-title {
  font-weight: 700;
  font-size: 13.5px;
}
.cmd-item-sub {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* =============================================================
   CHARTS & DATA ANALYTICS GRIDS
   ============================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.chart-head h3 {
  font-size: 14.5px;
  font-weight: 800;
}
.chart-body {
  position: relative;
  height: 260px;
}

/* =============================================================
   SEGMENTED FILTER TABS
   ============================================================= */
.seg-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: var(--r);
  margin-bottom: 14px;
}
.seg-tab {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 8px;
  color: var(--ink-3);
  text-decoration: none;
  transition: all 120ms ease;
}
.seg-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}
.seg-tab.active {
  background: var(--card);
  color: var(--blue);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

/* =============================================================
   MOBILE & TABLET RESPONSIVENESS (iOS/Android Native Feel)
   ============================================================= */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: block;
  }
  .app-main {
    margin-left: 0;
  }
  .topbar-menu-btn {
    display: grid;
  }
  .app-topbar {
    padding: 0 16px;
  }
  .topbar-search-bar {
    max-width: 200px;
  }
  .topbar-search-bar .search-placeholder {
    display: none;
  }
  .topbar-chip {
    display: none;
  }
  main {
    padding: 16px 14px 60px;
  }
  .databar {
    padding: 12px 16px;
    gap: 10px;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi {
    padding: 12px 14px;
  }
  .kpi .vl {
    font-size: 18px;
  }
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .seg-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .seg-tabs::-webkit-scrollbar {
    display: none;
  }
  .seg-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tools {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .tools select, .tools input, .tools button {
    width: 100%;
  }
  .chip {
    padding: 4px 10px;
    font-size: 12px;
  }
}

/* =============================================================
   CHECK-IN CAMERA & ATTENDANCE SYSTEM
   ============================================================= */
.checkin-hero {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.checkin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.clock-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.clock-time {
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 900;
  color: var(--blue);
  letter-spacing: 0.5px;
}
.clock-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}
.camera-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: #0F172A;
  padding: 20px;
  border-radius: var(--r);
  color: #FFFFFF;
  margin: 16px 0;
  position: relative;
  overflow: hidden;
}
.camera-video, .camera-preview {
  width: 100%;
  max-width: 440px;
  height: 330px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: #000;
}
.camera-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.checkin-thumb-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.checkin-thumb-img:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 19, 54, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  animation: modalBackdropFadeIn 0.2s ease;
}

@keyframes modalBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--card);
  border-radius: var(--r-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 60px -15px rgba(5, 19, 54, 0.35), 0 0 0 1px var(--line-strong);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.crm-confirm-box {
  max-width: 440px;
}

.modal-head {
  padding: 16px 22px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.confirm-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #FEF3C7;
  color: #D97706;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.confirm-icon-wrap.danger {
  background: #FEE2E2;
  color: #DC2626;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-alt);
}


