:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Brand colors (Configurable by Admin) */
  --evn-primary: #0072ce;
  --evn-blue: #004b87;
  --evn-electric-blue: #0072ce;
  --evn-orange: #ff6b00;
  --evn-yellow: #f59e0b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #0284c7;

  /* Theme: Dark (Default) */
  --bg-app: #080c14;
  --bg-surface: #0f1523;
  --bg-surface-elevated: #182235;
  --bg-surface-glass: rgba(15, 21, 35, 0.88);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: rgba(0, 114, 206, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  --header-height: 72px;
  --sidebar-width: 250px;
}

body.theme-light {
  --bg-app: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-glass: rgba(255, 255, 255, 0.9);
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: rgba(0, 114, 206, 0.4);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOP APP BAR */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.evn-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.evn-logo-img:hover {
  transform: scale(1.06);
}

.evn-logo-img.large {
  width: 68px;
  height: 68px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 16px rgba(0, 114, 206, 0.4));
}

.evn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--evn-blue), var(--evn-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 114, 206, 0.3);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  flex-shrink: 0;
}

.company-name {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--evn-primary);
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
}

.system-title {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  white-space: nowrap;
  line-height: 1.2;
}

/* PORTAL MODE TABS (HEADER SWITCHER) */
.portal-mode-tabs {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.portal-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.portal-tab-btn.active {
  background: var(--evn-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 114, 206, 0.35);
}

.portal-tab-text-mobile {
  display: none;
}
.portal-tab-text-desktop {
  display: inline;
}

.admin-badge {
  font-size: 0.65rem;
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
  white-space: nowrap;
}

/* USER SWITCHER */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.user-switcher-container {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 2px 6px 2px 8px;
  gap: 6px;
  flex-shrink: 0;
}

.user-avatar-small {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--evn-primary), var(--evn-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.user-meta-header {
  display: flex;
  flex-direction: column;
}

.user-role-indicator {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f59e0b;
  line-height: 1.1;
}

.user-dropdown {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  padding: 0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.action-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* PORTAL VIEW CONTAINERS */
.portal-view {
  display: none;
  flex: 1;
}

.portal-view.active {
  display: flex;
  flex-direction: column;
}

/* EXECUTIVE ALERT */
.executive-alert-card {
  margin: 14px 20px 0 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.alert-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.alert-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.alert-icon-box.warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.alert-content-preview { display: none; }
.btn-toggle-alert { display: none; }

.alert-expandable-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.alert-tag { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.6px; color: #f59e0b; }
.alert-message { font-size: 0.85rem; color: var(--text-primary); }
.alert-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* MAIN BODY & SIDEBAR */
.main-body {
  display: flex;
  flex: 1;
}

.desktop-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  position: relative;
}

.nav-item i { font-size: 1rem; width: 20px; text-align: center; }
.nav-item:hover { background: var(--bg-surface-elevated); color: var(--text-primary); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 114, 206, 0.15), rgba(0, 75, 135, 0.25));
  color: var(--evn-primary);
  border: 1px solid rgba(0, 114, 206, 0.3);
  font-weight: 700;
}

.nav-badge {
  margin-left: auto;
  background: var(--evn-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.nav-badge.bg-warning {
  background: #f59e0b;
}

.nav-tag-admin {
  margin-left: auto;
  font-size: 0.65rem;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.sidebar-footer { padding-top: 14px; border-top: 1px solid var(--border-color); }
.source-link-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}
.source-info { display: flex; flex-direction: column; }
.source-title { color: var(--text-muted); font-size: 0.66rem; }
.source-link { color: var(--text-primary); font-weight: 700; }

/* CONTENT VIEWPORT */
.content-viewport {
  flex: 1;
  padding: 22px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 14px;
}

.page-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.3px; }
.page-subtitle { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* KPI CARDS & GRIDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.kpi-card.highlight-blue { border-top: 4px solid var(--evn-primary); }
.kpi-card.highlight-orange { border-top: 4px solid var(--evn-orange); }

.kpi-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kpi-code { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.8px; color: var(--text-muted); }
.kpi-name { font-size: 1.05rem; font-weight: 700; margin-top: 2px; }
.kpi-numbers { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; flex-wrap: wrap; }
.primary-num { display: flex; align-items: baseline; gap: 8px; }
.primary-num .val { font-size: 2rem; font-weight: 800; }
.primary-num .unit { font-size: 0.82rem; color: var(--text-muted); }
.target-sub { font-size: 0.8rem; color: var(--text-secondary); }

.progress-container { margin-bottom: 14px; }
.progress-bar-bg { height: 8px; background: var(--bg-surface-elevated); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 6px; }
.progress-bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.7s ease; }
.bg-electric-blue { background: linear-gradient(90deg, #005baa, var(--evn-primary)); }
.bg-energetic-orange { background: linear-gradient(90deg, #ea580c, var(--evn-orange)); }
.progress-labels { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--text-secondary); }

.kpi-footer-stats { display: grid; grid-template-columns: 1fr 1fr; padding-top: 12px; border-top: 1px solid var(--border-color); gap: 12px; }
.sub-stat { display: flex; flex-direction: column; }
.sub-stat .label { font-size: 0.68rem; color: var(--text-muted); }
.sub-stat .val { font-size: 0.9rem; font-weight: 700; margin-top: 2px; }

.grid-2-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 700; }
.chart-wrapper { padding: 18px; height: 300px; position: relative; }
.chart-legend-custom { display: flex; gap: 14px; font-size: 0.76rem; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.bg-blue { background-color: var(--evn-primary); }
.bg-orange { background-color: var(--evn-orange); }

/* TASK MANAGEMENT STYLES */
.task-top-bar {
  margin-bottom: 14px;
}
.task-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.task-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-utility-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-util {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* TASK FILTER CONTAINER (DESKTOP & BASE) */
.task-filter-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}
.task-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.task-search-row .filter-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  position: relative;
  min-width: 220px;
}
.task-search-row .filter-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  width: 100%;
}
.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
}
.btn-toggle-filter {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.btn-toggle-filter.active {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
}
.filter-count-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

/* QUICK FILTER CHIPS */
.quick-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.quick-filter-chips::-webkit-scrollbar {
  display: none;
}
.chip-filter {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.chip-filter:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-focus);
}
.chip-filter.active {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
  box-shadow: 0 2px 8px rgba(0, 114, 206, 0.35);
}

/* DETAILED FILTER DRAWER */
.detailed-filter-drawer {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: none;
  animation: fadeIn 0.2s ease;
}
.detailed-filter-drawer.open {
  display: block;
}
.detailed-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.filter-item label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.filter-item select {
  width: 100%;
}
.filter-drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.task-mobile-header { display: none; }
.mobile-only-inline { display: none; }
.desktop-only-cell { display: flex; align-items: center; }
.desktop-only-inline { display: inline-block; }

.view-toggle-group { display: flex; background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 2px; }
.toggle-btn { background: transparent; border: none; color: var(--text-muted); padding: 5px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; }
.toggle-btn.active { background: var(--bg-surface); color: var(--evn-primary); }

.user-permission-banner { background: rgba(2, 132, 199, 0.1); border: 1px solid rgba(2, 132, 199, 0.25); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 14px; display: none; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-primary); }

.task-list-view { display: none; flex-direction: column; gap: 14px; }
.task-list-view.active { display: flex; }
.task-group-section { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.task-group-header { padding: 10px 16px; background: var(--bg-surface-elevated); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.task-group-title { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700; }
.task-row { display: grid; grid-template-columns: 80px 1fr 130px 110px 150px 30px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; gap: 12px; transition: background-color 0.15s ease; }
.task-row:hover { background-color: rgba(255, 255, 255, 0.02); }
.task-code-badge { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; color: var(--evn-primary); background: rgba(0, 114, 206, 0.12); padding: 2px 6px; border-radius: var(--radius-sm); text-align: center; }
.task-title-text { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-sub-meta { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-top: 2px; }

.task-priority-tag { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; }
.priority-urgent { color: var(--color-danger); }
.priority-high { color: var(--evn-orange); }
.priority-medium { color: var(--color-warning); }
.priority-low { color: var(--text-muted); }

/* KANBAN */
.task-kanban-board { display: none; grid-template-columns: repeat(4, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 18px; }
.task-kanban-board.active { display: grid; }
.kanban-col { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 12px; min-width: 270px; display: flex; flex-direction: column; gap: 10px; }
.kanban-header { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.kanban-header h3 { font-size: 0.76rem; font-weight: 800; letter-spacing: 0.6px; color: var(--text-secondary); }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; }
.status-indicator.todo { background-color: var(--text-muted); }
.status-indicator.in_progress { background-color: var(--evn-primary); }
.status-indicator.review { background-color: var(--evn-orange); }
.status-indicator.done { background-color: var(--color-success); }
.count-pill { margin-left: auto; font-size: 0.68rem; font-weight: 700; background: var(--bg-surface-elevated); padding: 2px 6px; border-radius: var(--radius-full); color: var(--text-muted); }
.kanban-cards-wrapper { display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kanban-card { background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; cursor: pointer; transition: all 0.15s ease; }
.kanban-card:hover { border-color: var(--border-focus); transform: translateY(-2px); }
.kanban-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kanban-card-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.kanban-card-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--text-muted); }

/* BIỂU MẪU ĐÁNH GIÁ NLĐ (BM 01 - BM 07) STYLING */
.bm-tabs-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.bm-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.bm-tab-btn.active {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
}

.bm-tab-btn span {
  font-weight: 800;
}

.official-form-header {
  border-bottom: 2px solid var(--evn-primary);
  padding-bottom: 14px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.official-title-box h3 {
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-primary);
}

.official-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: var(--bg-surface-elevated);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  font-size: 0.82rem;
}

/* ========================================================================= */
/* PORTAL 2: HỆ THỐNG ADMIN QUẢN TRỊ STYLES                                 */
/* ========================================================================= */
.admin-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  align-self: flex-start;
  overflow-y: auto;
  z-index: 10;
}

.admin-sidebar .sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.admin-sidebar .sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 16px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.admin-sidebar-header h3 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.admin-sidebar-header span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.admin-content {
  flex: 1;
  padding: 24px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.admin-pane {
  display: none;
}

.admin-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.color-option-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-option-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.color-option-card.active {
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* TABLES & DATA GRIDS */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; text-align: left; }
.data-table th { padding: 10px 14px; background: var(--bg-surface-elevated); color: var(--text-muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); vertical-align: middle; }
.data-table.compact th, .data-table.compact td { padding: 6px 9px; font-size: 0.76rem; }

.sheetlab-input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  outline: none;
}
.sheetlab-input[readonly] { background: transparent; border-color: transparent; }

/* BADGES & BUTTONS */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 700; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.badge-primary { background: rgba(0, 114, 206, 0.15); color: var(--evn-primary); }
.badge-info { background: rgba(2, 132, 199, 0.15); color: var(--color-info); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius-md); font-family: var(--font-family); font-size: 0.82rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s ease; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--evn-primary); color: #fff; box-shadow: 0 4px 12px rgba(0, 114, 206, 0.3); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-warning { background: var(--evn-orange); color: #fff; }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-outline:hover { background: var(--bg-surface-elevated); }
.btn-sm { padding: 4px 9px; font-size: 0.74rem; }

.custom-select, .form-input, .form-textarea { font-family: var(--font-family); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 12px; border-radius: var(--radius-md); font-size: 0.84rem; outline: none; }
.custom-select.sm { padding: 5px 9px; font-size: 0.76rem; }

.w-100 { width: 100% !important; box-sizing: border-box; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group > label { font-weight: 600; font-size: 0.83rem; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.form-textarea { width: 100%; box-sizing: border-box; resize: vertical; font-family: var(--font-family); line-height: 1.5; }
.form-input, .custom-select { box-sizing: border-box; }

/* Modal 2-column grid */
.modal-dialog .grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .modal-dialog .grid-2-col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Date picker styles */
input[type="date"].form-input {
  cursor: pointer;
  min-height: 38px;
}
body.theme-dark input[type="date"] {
  color-scheme: dark;
}
body.theme-light input[type="date"] {
  color-scheme: light;
}

/* MODALS & TOAST */
.modal-overlay { 
  position: fixed; inset: 0; 
  background: rgba(0, 0, 0, 0.78); 
  backdrop-filter: blur(8px); 
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; 
  z-index: 2000; opacity: 0; pointer-events: none; 
  transition: opacity 0.2s ease; padding: 16px; 
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-dialog { 
  background: var(--bg-surface); 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-xl); 
  max-width: 680px; width: 100%; 
  max-height: 90vh; overflow-y: auto; 
  box-shadow: var(--shadow-lg); 
}
.modal-dialog.modal-sm { max-width: 440px; }
.modal-header { 
  padding: 16px 20px; 
  border-bottom: 1px solid var(--border-color); 
  display: flex; justify-content: space-between; align-items: center; 
}
.modal-close-btn { 
  background: none; border: none; 
  color: var(--text-muted); font-size: 1.6rem; 
  cursor: pointer; line-height: 1; padding: 4px;
}
.modal-body { padding: 20px; }

.toast-notification { 
  position: fixed; bottom: 85px; right: 24px; 
  background: var(--bg-surface-elevated); 
  border: 1px solid var(--border-color); 
  box-shadow: var(--shadow-lg); 
  padding: 11px 20px; border-radius: var(--radius-full); 
  display: flex; align-items: center; gap: 10px; 
  font-size: 0.85rem; font-weight: 600; 
  color: var(--color-success); z-index: 2100; 
  opacity: 0; transform: translateY(10px); 
  transition: all 0.2s ease; pointer-events: none; 
}
.toast-notification.active { opacity: 1; transform: translateY(0); }

/* MOBILE BOTTOM NAVIGATION BAR */
.mobile-bottom-nav { 
  display: none; 
  position: fixed; bottom: 0; left: 0; right: 0; 
  height: 64px; 
  background: var(--bg-surface-glass); 
  backdrop-filter: blur(20px); 
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color); 
  z-index: 100; 
  justify-content: space-around; align-items: center; 
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}
.mobile-nav-item { 
  display: flex; flex-direction: column; 
  align-items: center; justify-content: center; 
  gap: 4px; background: none; border: none; 
  color: var(--text-muted); font-size: 0.68rem; 
  font-weight: 600; font-family: var(--font-family); 
  cursor: pointer; flex: 1; height: 100%; 
  transition: color 0.15s ease;
  padding: 6px 2px;
}
.mobile-nav-item i { font-size: 1.15rem; }
.mobile-nav-item.active { 
  color: var(--evn-primary); 
  font-weight: 700;
}

/* MOBILE ADMIN TABS BAR */
.mobile-admin-tabs-bar {
  display: none;
  overflow-x: auto;
  white-space: nowrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-admin-tabs-bar::-webkit-scrollbar { display: none; }
.mobile-admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.mobile-admin-tab-btn.active {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
  box-shadow: 0 2px 8px rgba(0, 114, 206, 0.35);
}

/* CHIP TAB SELECTOR CHO BIỂU MẪU BM 01 - BM 07 */
.bm-tabs-container {
  display: flex;
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 4px 2px 8px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bm-tabs-container::-webkit-scrollbar { display: none; }
.bm-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.bm-tab-btn span {
  font-weight: 800;
  color: var(--text-primary);
}
.bm-tab-btn.active {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
}
.bm-tab-btn.active span {
  color: #fff;
}

/* ========================================================================= */
/* TỐI ƯU HÓA TOÀN DIỆN CHO THIẾT BỊ DI ĐỘNG (MOBILE UI/UX RESPONSIVE)      */
/* ========================================================================= */
@media (max-width: 900px) {
  /* KHÓA CHỐNG TRÀN NGANG TUYỆT ĐỐI TRÊN DI ĐỘNG */
  html, body {
    max-width: 100vw !important;
    width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
  }
  .app-container, .app-main-wrapper, .portal-view, .main-body {
    max-width: 100vw !important;
    width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Ẩn Sidebar máy tính, hiển thị Mobile Bottom Nav */
  .desktop-sidebar, .admin-sidebar { display: none !important; }
  .mobile-bottom-nav { display: flex !important; z-index: 1000 !important; }
  .mobile-admin-tabs-bar { display: flex !important; }
  
  .content-viewport, .admin-content { 
    padding: 10px 12px 84px 12px !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* TOP HEADER TRÊN ĐIỆN THOẠI: AN TOÀN TRÁNH TAI THỎ (SAFE AREA NOTCH), RÕ RÀNG VÀ TỰ NHIÊN */
  .app-header { 
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-height: calc(56px + env(safe-area-inset-top, 0px)) !important;
    height: auto !important;
    padding-top: max(env(safe-area-inset-top, 0px), 8px) !important;
    padding-bottom: 8px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    z-index: 900 !important;
    gap: 6px !important;
    max-width: 100vw !important;
    background: var(--bg-surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  /* Khi dùng sticky, nội dung bên dưới chiếm luồng tự nhiên không bị giật hay che mất */
  .app-main-wrapper {
    padding-top: 0 !important;
    box-sizing: border-box !important;
  }

  .header-left {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
  }
  .evn-logo-img {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
  }
  .company-name {
    display: block !important;
    font-size: 0.58rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: var(--evn-primary) !important;
    line-height: 1.1 !important;
  }
  .system-title { 
    font-size: 0.76rem !important; 
    font-weight: 800 !important;
    max-width: none !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.1 !important;
  }

  /* NÚT CHUYỂN VIỆC / ADMIN: RÕ RÀNG, CHẠM DỄ DÀNG */
  .portal-mode-tabs {
    display: flex !important;
    padding: 2px !important;
    gap: 2px !important;
    background: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-full) !important;
    flex-shrink: 0 !important;
  }
  .portal-tab-btn {
    padding: 4px 6px !important;
    min-height: 30px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-full) !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }
  .portal-tab-btn.active {
    background: var(--evn-primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 114, 206, 0.4) !important;
  }
  .portal-tab-text-desktop {
    display: none !important;
  }
  .portal-tab-text-mobile {
    display: inline !important;
    font-weight: 700 !important;
    font-size: 0.74rem !important;
  }
  .portal-tab-btn .admin-badge {
    display: none !important; /* Ẩn huy hiệu Trưởng phòng dài dòng */
  }
  .portal-tab-btn i {
    font-size: 0.85rem !important;
    margin: 0 !important;
  }

  /* CÁC NÚT ĐIỀU KHIỂN BÊN PHẢI HEADER */
  .header-right {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  /* Ẩn các nút không cần thiết trên mobile header */
  .btn-download-zip {
    display: none !important; /* Không tải zip 2MB trên điện thoại */
  }
  .period-header-badge {
    display: none !important; /* Ẩn chọn kỳ trên header mobile */
  }
  .user-role-indicator {
    display: none !important;
  }
  .sync-status-text {
    display: none !important;
  }

  /* Nút đồng bộ LAN/Cloud: ẩn trên mobile header để nhường trọn vẹn không gian cho Đăng xuất, Sáng/Tối và Admin */
  .btn-sync-hub {
    display: none !important;
  }

  /* User switcher gọn gàng dạng nút tròn 32px: chạm vào là mở danh sách chọn cán bộ */
  .user-switcher-container {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    background: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-color) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
  }
  .user-avatar-small {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    pointer-events: none !important;
  }
  .user-meta-header {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .user-dropdown {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* NÚT ĐỔI GIAO DIỆN SÁNG/TỐI: 100% HIỂN THỊ & DỄ BẤM */
  #themeToggleBtn, .action-circle-btn {
    display: inline-flex !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-size: 0.88rem !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }
  #themeToggleBtn:active {
    transform: scale(0.92);
  }

  /* NÚT ĐỔI MẬT KHẨU CÁ NHÂN: DẠNG TRÒN 32PX TIỆN CHẠM TRÊN MOBILE */
  .btn-change-pwd {
    display: inline-flex !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }
  .btn-change-pwd .change-pwd-text {
    display: none !important;
  }
  .btn-change-pwd i {
    font-size: 0.88rem !important;
    margin: 0 !important;
  }

  /* NÚT ĐĂNG XUẤT: 100% HIỂN THỊ, NỔI BẬT VIỀN ĐỎ & DỄ BẤM */
  #btnLogout, .btn-logout {
    display: inline-flex !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    font-size: 0.88rem !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
  }
  #btnLogout:active {
    transform: scale(0.92);
    background: rgba(239, 68, 68, 0.25) !important;
  }
  #btnLogout .logout-text, .logout-text {
    display: none !important;
  }
  #btnLogout i {
    color: #ef4444 !important;
    font-size: 0.88rem !important;
  }

  @media (max-width: 365px) {
    #btnSyncHub {
      display: none !important;
    }
    .system-title {
      max-width: 52px !important;
    }
    .user-dropdown {
      max-width: 48px !important;
    }
  }

  /* EXECUTIVE ALERT BANNER: DẠNG COMPACT COLLAPSIBLE TIẾT KIỆM KHÔNG GIAN */
  .executive-alert-card {
    margin: 6px 10px 0 10px !important;
    padding: 8px 12px !important;
    border-radius: var(--radius-md) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }
  .alert-header-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    width: 100% !important;
  }
  .alert-content-preview {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-width: 0 !important;
  }
  .alert-tag {
    font-size: 0.68rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .alert-preview-text {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.25 !important;
  }
  .btn-toggle-alert {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
    padding: 4px !important;
    cursor: pointer !important;
    transition: transform 0.2s ease !important;
    flex-shrink: 0 !important;
  }
  .alert-expandable-content {
    display: none !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding-top: 8px !important;
    border-top: 1px dashed rgba(245, 158, 11, 0.25) !important;
  }
  .executive-alert-card.expanded .alert-expandable-content {
    display: flex !important;
  }
  .executive-alert-card.expanded #iconToggleAlert {
    transform: rotate(180deg) !important;
  }
  .alert-actions {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .alert-actions .btn {
    flex: 1 !important;
    font-size: 0.76rem !important;
    padding: 7px 8px !important;
    justify-content: center !important;
  }

  /* SECTION TOP BAR & TASK ACTION BUTTONS (MOBILE FIRST) */
  .section-top-bar {
    margin-bottom: 10px !important;
    gap: 10px !important;
  }
  .page-title {
    font-size: 1.15rem !important;
    letter-spacing: -0.2px !important;
  }
  .page-subtitle {
    font-size: 0.76rem !important;
    line-height: 1.35 !important;
  }

  .task-actions-toolbar {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .task-action-buttons {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .task-action-buttons .btn {
    flex: 1 !important;
    padding: 9px 10px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-md) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
  }
  .task-utility-buttons {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .btn-util {
    flex: 1 !important;
    padding: 6px 8px !important;
    font-size: 0.74rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    border-radius: var(--radius-md) !important;
    white-space: nowrap !important;
  }
  .view-toggle-group {
    flex-shrink: 0 !important;
  }

  /* TASK SEARCH & FILTER CONTROLS TRÊN MOBILE */
  .task-filter-container {
    gap: 8px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .task-search-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .task-search-row .filter-search {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 6px 12px !important;
  }
  .task-search-row .filter-search input {
    font-size: 0.82rem !important;
  }
  .btn-toggle-filter {
    padding: 6px 12px !important;
    font-size: 0.78rem !important;
  }
  .quick-filter-chips {
    gap: 6px !important;
    padding: 2px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .chip-filter {
    font-size: 0.74rem !important;
    padding: 5px 11px !important;
  }

  .detailed-filter-drawer {
    padding: 12px !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .detailed-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .detailed-filter-grid .filter-item {
    width: 100% !important;
  }
  .detailed-filter-grid .filter-item select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* USER PERMISSION NOTICE GỌN */
  .user-permission-banner {
    padding: 8px 12px !important;
    font-size: 0.74rem !important;
    margin-bottom: 10px !important;
  }

  /* DANH SÁCH THẺ CÔNG VIỆC TRÊN MOBILE (APPLE / LINEAR STYLE: GỌN GÀNG, KHÔNG RỐI MẮT) */
  .task-list-view {
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  .task-group-section {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
    overflow: visible !important;
  }
  .task-group-header {
    background: transparent !important;
    border: none !important;
    padding: 4px 2px 8px 2px !important;
  }
  .task-group-title {
    font-size: 0.85rem !important;
  }
  .task-rows-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  /* THẺ CÔNG VIỆC CHÍNH */
  .task-row {
    display: flex !important;
    flex-direction: column !important;
    padding: 12px 14px !important;
    border-radius: var(--radius-lg) !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    gap: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    transition: transform 0.15s ease, background 0.15s ease !important;
  }
  .task-row:active {
    transform: scale(0.99) !important;
    background: var(--bg-surface-elevated) !important;
  }

  /* ẨN CÁC CỘT DESKTOP TRÊN MOBILE */
  .desktop-only-cell, .desktop-only-inline {
    display: none !important;
  }
  .mobile-only-inline {
    display: inline-flex !important;
    align-items: center !important;
  }

  /* HÀNG HEADER THẺ MOBILE: MÃ, NHÓM, TUẦN, TRẠNG THÁI & ƯU TIÊN */
  .task-mobile-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 6px !important;
    margin-bottom: 4px !important;
  }
  .task-mobile-tags {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
  }
  .task-mobile-tags .task-code-badge {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
  .task-mobile-status {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
  }
  .task-mobile-status .badge {
    padding: 2px 7px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
  }
  .task-mobile-status .task-priority-tag {
    font-size: 0.7rem !important;
    font-weight: 800 !important;
  }

  /* TIÊU ĐỀ THẺ CÔNG VIỆC */
  .task-row .task-title-text {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: var(--text-primary) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
    margin-bottom: 4px !important;
  }

  /* ẨN ĐOẠN ĐẦU RA 4 DÒNG DÀI GÂY RỐI MẮT (BẤM VÀO THẺ ĐỂ XEM ĐẦY ĐỦ TRONG MODAL) */
  .task-deliverable-line {
    display: none !important;
  }

  /* HÀNG THÔNG TIN NGƯỜI CHỦ TRÌ & PHỐI HỢP */
  .task-people-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 2px !important;
  }
  .badge-assignee, .badge-coop, .mobile-target-chip {
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
    border-radius: var(--radius-full) !important;
    background: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
  }
  .badge-assignee strong, .badge-coop strong {
    color: var(--text-primary) !important;
  }

  /* THANH TIẾN ĐỘ ĐỊNH LƯỢNG ĐÁY THẺ */
  .col-task-progress {
    width: 100% !important;
    margin-top: 4px !important;
    background: var(--bg-surface-elevated) !important;
    padding: 7px 10px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-subtle) !important;
    box-sizing: border-box !important;
  }

  /* TAB 1: DASHBOARD CHỈ TIÊU TRÊN MOBILE */
  #tab-dashboard .quick-filter-group {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  #tab-dashboard .quick-filter-group select {
    flex: 1 !important;
    min-width: 0 !important;
  }
  #tab-dashboard .quick-filter-group .btn {
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
  }
  .kpi-grid, .grid-2-col, .unit-cards-grid, .task-kanban-board { 
    grid-template-columns: 1fr !important; 
    gap: 12px !important;
  }
  .kpi-card {
    padding: 14px 16px !important;
    border-radius: var(--radius-lg) !important;
  }
  .kpi-card .primary-num .val {
    font-size: 1.65rem !important;
  }
  .kpi-footer-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* Card padding tinh gọn trên mobile */
  .card {
    padding: 14px !important;
  }

  /* BẢNG DỮ LIỆU TRÊN MOBILE: DỄ NHÌN, CUỘN TRƠN TRU */
  .table-responsive {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .data-table {
    font-size: 0.84rem !important;
    min-width: 580px !important;
  }

  /* Modal trên di động */
  .modal-dialog {
    max-width: 96% !important;
    margin: 8px auto !important;
    border-radius: var(--radius-lg) !important;
  }
  .modal-body {
    padding: 16px !important;
  }
  .form-input, .custom-select, .form-textarea {
    font-size: 16px !important; /* Ngăn iOS zoom */
  }
}

/* ========================================================================= */
/* MÀN HÌNH ĐĂNG NHẬP CHUYÊN NGHIỆP EVN / PCSL (LOGIN SCREEN)               */
/* ========================================================================= */
.login-screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 25%, #0d1e38 0%, #080c14 85%);
  padding: 20px;
  overflow-y: auto;
}

body.theme-light .login-screen-wrapper {
  background: radial-gradient(circle at 50% 25%, #e0edff 0%, #edf2f9 85%);
}

.login-card-container {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 114, 206, 0.15);
  padding: 32px 28px;
  animation: loginFadeIn 0.35s ease-out;
  margin: auto;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-glow {
  display: inline-flex;
  margin-bottom: 14px;
  position: relative;
}

.login-logo-glow::after {
  content: '';
  position: absolute;
  top: -6px; left: -6px; right: -6px; bottom: -6px;
  background: radial-gradient(circle, rgba(0, 114, 206, 0.45), transparent 70%);
  border-radius: 50%;
  z-index: 0;
  animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.95; }
}

.evn-icon.large {
  width: 60px;
  height: 60px;
  font-size: 1.8rem;
  position: relative;
  z-index: 1;
}

.company-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--evn-primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.dept-title-login {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.app-sub-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.login-error-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  animation: shakeAlert 0.3s ease;
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-form .form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 44px;
}

.btn-toggle-pwd {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.btn-toggle-pwd:hover {
  color: var(--text-primary);
}

.btn-login-submit {
  height: 46px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #0072ce 0%, #004b87 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(0, 114, 206, 0.4);
  transition: all 0.25s ease;
  margin-top: 10px;
}

.btn-login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 114, 206, 0.5);
}

.quick-login-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.quick-login-title {
  text-align: center;
  margin-bottom: 12px;
}

.quick-login-title span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.quick-users-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 2px;
}

.quick-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.quick-user-card:hover {
  border-color: var(--evn-primary);
  background: rgba(0, 114, 206, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.quick-user-card.leader {
  grid-column: span 2;
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.quick-user-card.leader:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
}

.quick-user-card.delegated {
  border-color: rgba(16, 185, 129, 0.4);
}

.user-avatar-tag {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.user-info-tag {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-info-tag strong {
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info-tag small {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info-tag code {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--evn-yellow);
}

/* NÚT ĐĂNG XUẤT TRÊN TOP HEADER */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.35);
}

.btn-logout:hover i {
  color: #fff !important;
}

/* NÚT TẢI BỘ CÀI ZIP TRÊN TOP HEADER */
.btn-download-zip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--evn-primary);
  background: rgba(0, 114, 206, 0.1);
  border: 1px solid rgba(0, 114, 206, 0.35);
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-download-zip:hover {
  background: var(--evn-primary);
  color: #fff;
  border-color: var(--evn-primary);
  box-shadow: 0 3px 12px rgba(0, 114, 206, 0.4);
}

.btn-download-zip:hover i {
  color: #fff !important;
}

/* NÚT ĐỔI MẬT KHẨU TRÊN TOP HEADER */
.btn-change-pwd {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-change-pwd:hover {
  background: #f59e0b;
  color: #1e293b;
  border-color: #f59e0b;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.35);
}

.btn-change-pwd:hover i {
  color: #1e293b !important;
}

#changePasswordModal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 99999 !important;
}

/* NHÃN TÊN CỐ ĐỊNH CHO CHUYÊN VIÊN TRÊN TOP HEADER */
.user-static-name {
  display: flex;
  align-items: center;
  padding: 2px 0;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-static-name span {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ĐỊNH KIỂU FORM ĐỔI MẬT KHẨU CÁ NHÂN */
.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   ENHANCED STYLES FOR DYNAMIC MASTER CATALOG & BM01 / BM03 WORKFLOW
   ========================================================================== */

.sub-tabs-bar {
  display: flex;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 6px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.sub-tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sub-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.sub-tab-btn.active {
  background: var(--evn-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 114, 206, 0.35);
}

.staff-selector-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.staff-pill-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.staff-pill-btn:hover {
  border-color: var(--evn-primary);
  color: var(--text-primary);
}

.staff-pill-btn.active {
  background: var(--evn-primary);
  border-color: var(--evn-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 114, 206, 0.3);
}

.week-btn-group {
  display: inline-flex;
  gap: 4px;
}

.week-btn {
  width: 32px;
  height: 28px;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.week-btn.active {
  background: var(--evn-primary);
  border-color: var(--evn-primary);
  color: #ffffff;
  font-weight: 800;
}

.eval-task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  transition: all var(--transition-normal);
}

.eval-task-card:hover {
  border-color: rgba(0, 114, 206, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.eval-task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.criteria-table th, .criteria-table td {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
}

.criteria-table th {
  background: var(--bg-surface-elevated);
  font-weight: 700;
  color: var(--text-secondary);
}

.score-input {
  width: 65px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 700;
  text-align: center;
}

.score-input:focus {
  border-color: var(--evn-primary);
  outline: none;
}

/* === CHỦ TRÌ & PHỐI HỢP BADGES & SELECT BOX === */
.task-people-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.badge-assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-coop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.kanban-people-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.custom-select {
  cursor: pointer;
}

/* ========================================================================== */
/* QUẢN LÝ KỲ ĐÁNH GIÁ (MONTH / PERIOD MANAGEMENT & LOCK)                     */
/* ========================================================================== */
.period-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
}

.period-header-select {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  outline: none;
  padding-right: 4px;
}

.period-header-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.period-management-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--evn-primary);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.period-control-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.period-select-custom {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.period-select-custom:focus {
  border-color: var(--evn-primary);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.15);
}

.badge-period-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-period-locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.locked-period-alert {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.06));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.locked-period-alert i {
  font-size: 1.2rem;
  color: #f59e0b;
}

/* ========================================================================= */
/* NÚT VÀ GIAO DIỆN TRUNG TÂM ĐỒNG BỘ HYBRID (LAN & SUPABASE)               */
/* ========================================================================= */
.btn-sync-hub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-sync-hub:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #0ea5e9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.net-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.net-dot.lan-mode {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.net-dot.internet-mode {
  background: #0ea5e9;
  box-shadow: 0 0 8px #0ea5e9;
}

.net-dot.offline-mode {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.sync-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.sync-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.sync-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.sync-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sync-card-info strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.badge-status-pill {
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinning {
  animation: fa-spin 1s infinite linear;
}

/* ========================================================================= */
/* TỐI ƯU HÓA THANH TIÊU ĐỀ (HEADER) CHỐNG TRÀN NGANG TRÊN MÀN HÌNH LAPTOP    */
/* ========================================================================= */

@media (max-width: 900px) {
  /* STYLING DÀNH CHO NATIVE MOBILE BOTTOM SHEET & BOTTOM NAV */
  #mobileQuickMenuModal,
  .modal-overlay:has(.mobile-bottom-sheet) {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  #mobileQuickMenuModal .modal-dialog,
  .modal-dialog.mobile-bottom-sheet {
    align-self: flex-end !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-bottom: none !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px) !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45) !important;
    animation: slideUpSheet 0.26s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .bottom-sheet-handle-bar {
    width: 44px;
    height: 5px;
    border-radius: 4px;
    background: var(--border-color);
    margin: 10px auto 4px auto;
  }

  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    background: var(--bg-surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-top: 1px solid var(--border-color) !important;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15) !important;
    z-index: 1000 !important;
    align-items: center !important;
    justify-content: space-around !important;
    box-sizing: border-box !important;
  }
}

@media (min-width: 901px) {
  .mobile-bottom-nav,
  .mobile-admin-tabs-bar,
  #mobileQuickMenuModal {
    display: none !important;
  }
}

@media (min-width: 901px) and (max-width: 1750px) {
  .app-header {
    padding: 0 10px !important;
    gap: 6px !important;
  }
  .header-left {
    gap: 8px !important;
  }
  .logo-badge {
    gap: 8px !important;
  }
  .evn-icon, .evn-logo-img {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
  }
  .company-name {
    display: block !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    color: var(--evn-primary) !important;
    line-height: 1.15 !important;
  }
  .system-title {
    font-size: 0.92rem !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    max-width: none !important;
    text-overflow: clip !important;
    line-height: 1.15 !important;
  }
  .portal-mode-tabs {
    padding: 2px !important;
    gap: 2px !important;
  }
  .portal-tab-btn {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    gap: 5px !important;
  }
  .portal-tab-btn .admin-badge {
    display: none !important; /* Đã có icon vương miện */
  }
  .btn-sync-hub {
    padding: 4px 8px !important;
    font-size: 0.74rem !important;
    gap: 5px !important;
  }
  .period-header-badge {
    padding: 3px 6px !important;
    font-size: 0.74rem !important;
    gap: 4px !important;
  }
  .period-header-select {
    font-size: 0.74rem !important;
    max-width: 105px !important;
  }
  #headerPeriodLockBadge {
    display: none !important;
  }
  .user-switcher-container {
    padding: 2px 5px !important;
    gap: 5px !important;
  }
  .user-avatar-small {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.68rem !important;
  }
  .user-role-indicator {
    display: none !important; /* Chức danh đã có trong danh sách chọn */
  }
  .user-dropdown {
    max-width: 115px !important;
    font-size: 0.74rem !important;
  }
  /* Biến nút Tải ZIP, Đổi MK và Đăng xuất thành dạng icon tròn cực gọn, không chiếm diện tích */
  .change-pwd-text {
    display: none !important;
  }
  .btn-change-pwd {
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .download-text {
    display: none !important;
  }
  .btn-download-zip {
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .logout-text {
    display: none !important;
  }
  .btn-logout {
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .action-circle-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .portal-tab-btn .portal-tab-text,
  .portal-tab-btn .portal-tab-text-desktop {
    display: none !important; /* Khi màn hình dưới 1180px, thu gọn tab thành icon */
  }
  .portal-tab-btn {
    padding: 6px 10px !important;
  }
  .portal-tab-btn i {
    font-size: 0.95rem !important;
    margin: 0 !important;
  }
  .system-title {
    max-width: 180px !important;
  }
}


