/* ============================================================
   BUSINESS PORTAL — Global Stylesheet
   Modern dark theme with glassmorphism and smooth animations
   ============================================================ */

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

/* ============================================================
   CSS VARIABLES — Design Tokens
   ============================================================ */
:root {
  /* Brand Colors - MRE Enterprises */
  --accent:         #F97316;
  --accent-light:   #FB923C;
  --accent-dark:    #EA580C;
  --accent-glow:    rgba(249, 115, 22, 0.15);

  /* Background Layers */
  --bg-base:        #F8FAFC;
  --bg-surface:     #FFFFFF;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #F1F5F9;
  --bg-input:       #FFFFFF;
  --bg-sidebar:     #071E4D; /* Dark Blue Sidebar */

  /* Borders */
  --border:         #E2E8F0;
  --border-active:  #0B2E73; /* Primary Blue */

  /* Text */
  --text-primary:   #0F172A;
  --text-secondary: #64748B;
  --text-muted:     #94A3B8;
  --text-accent:    #F97316;

  /* Status Colors */
  --color-success:  #22C55E;
  --color-warning:  #F59E0B;
  --color-danger:   #EF4444;
  --color-info:     #3B82F6;
  --color-purple:   #A855F7;
  --color-muted:    #64748B;

  /* Gradients */
  --gradient-accent: linear-gradient(135deg, #F97316, #EA580C);
  --gradient-success: linear-gradient(135deg, #22C55E, #10B981);
  --gradient-card:   linear-gradient(145deg, #FFFFFF 0%, #F8FAFC 100%);

  /* Spacing */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   LIGHT THEME VARIABLES
   ============================================================ */
[data-theme="dark"] {
  /* Background Layers */
  --bg-base:        #060B16;
  --bg-surface:     #0C1428;
  --bg-card:        #121D3A;
  --bg-card-hover:  #1B2A52;
  --bg-input:       #0E1932;
  --bg-sidebar:     #080F1E;

  /* Borders */
  --border:         rgba(249, 115, 22, 0.15);
  --border-active:  rgba(249, 115, 22, 0.6);

  /* Text */
  --text-primary:   #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;
  --text-accent:    #FB923C;

  /* Accent Adjustments */
  --accent-glow:    rgba(249, 115, 22, 0.2);
  --gradient-accent: linear-gradient(135deg, #F97316, #EA580C);
  --gradient-card:  linear-gradient(145deg, #121D3A 0%, #0C1428 100%);
  --shadow-card:    0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow:    0 0 30px rgba(249, 115, 22, 0.15);

  /* Status Colors */
  --color-success:  #22C55E;
  --color-warning:  #F59E0B;
  --color-danger:   #EF4444;
  --color-info:     #3B82F6;
  --color-purple:   #A855F7;
  --color-muted:    #94A3B8;

  /* Category Colors for Dark Mode */
  --cat-task:             #818cf8;
  --cat-task-bg:          rgba(129, 140, 248, 0.15);
  --cat-task-border:      rgba(129, 140, 248, 0.3);
  --cat-client:           #2dd4bf;
  --cat-client-bg:        rgba(45, 212, 191, 0.15);
  --cat-client-border:    rgba(45, 212, 191, 0.3);
  --cat-vendor:           #c084fc;
  --cat-vendor-bg:        rgba(192, 132, 252, 0.15);
  --cat-vendor-border:    rgba(192, 132, 252, 0.3);
  --cat-supplier:         #fb923c;
  --cat-supplier-bg:      rgba(251, 146, 60, 0.15);
  --cat-supplier-border:  rgba(251, 146, 60, 0.3);
  --cat-project:          #fbbf24;
  --cat-project-bg:       rgba(251, 191, 36, 0.15);
  --cat-project-border:   rgba(251, 191, 36, 0.3);
  --cat-amc:              #f87171;
  --cat-amc-bg:           rgba(248, 113, 113, 0.15);
  --cat-amc-border:       rgba(248, 113, 113, 0.3);
  --cat-request:          #4ade80;
  --cat-request-bg:       rgba(74, 222, 128, 0.15);
  --cat-request-border:   rgba(74, 222, 128, 0.3);
  --cat-system:           #9ca3af;
  --cat-system-bg:        rgba(156, 163, 175, 0.15);
  --cat-system-border:    rgba(156, 163, 175, 0.3);
}

[data-theme="light"] {
  /* Background Layers */
  --bg-base:        #f4f6fa;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #e6e9f0;
  --bg-input:       #f4f6fa;
  --bg-sidebar:     #ffffff;

  /* Borders */
  --border:         #d1d5db;
  --border-active:  rgba(255, 107, 0, 0.6);

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --text-accent:    #cc5500;

  /* Accent Adjustments */
  --accent-glow:    rgba(255, 107, 0, 0.1);
  --gradient-accent: linear-gradient(135deg, #e65c00, #ff8533);
  --gradient-card:  linear-gradient(145deg, #ffffff 0%, #f4f6fa 100%);
  --shadow-card:    0 10px 30px rgba(15, 23, 42, 0.05), 0 1px 4px rgba(15, 23, 42, 0.02);
  --shadow-glow:    0 0 30px rgba(255, 107, 0, 0.08);

  /* Status Colors */
  --color-success:  #15803D; /* Deep forest green */
  --color-warning:  #B45309; /* Deep amber */
  --color-danger:   #DC2626; /* Deep red */
  --color-info:     #1D4ED8; /* Deep blue */
  --color-purple:   #7C3AED; /* Deep purple */
  --color-muted:    #475569;

  /* Category Colors for Light Mode */
  --cat-task:             #4f46e5;
  --cat-task-bg:          rgba(79, 70, 229, 0.1);
  --cat-task-border:      rgba(79, 70, 229, 0.25);
  --cat-client:           #0d9488;
  --cat-client-bg:        rgba(13, 148, 136, 0.1);
  --cat-client-border:    rgba(13, 148, 136, 0.25);
  --cat-vendor:           #7c3aed;
  --cat-vendor-bg:        rgba(124, 58, 237, 0.1);
  --cat-vendor-border:    rgba(124, 58, 237, 0.25);
  --cat-supplier:         #ea580c;
  --cat-supplier-bg:      rgba(234, 88, 12, 0.1);
  --cat-supplier-border:  rgba(234, 88, 12, 0.25);
  --cat-project:          #d97706;
  --cat-project-bg:       rgba(217, 119, 6, 0.1);
  --cat-project-border:   rgba(217, 119, 6, 0.25);
  --cat-amc:              #e11d48;
  --cat-amc-bg:           rgba(225, 29, 72, 0.1);
  --cat-amc-border:       rgba(225, 29, 72, 0.25);
  --cat-request:          #16a34a;
  --cat-request-bg:       rgba(22, 163, 74, 0.1);
  --cat-request-border:   rgba(22, 163, 74, 0.25);
  --cat-system:           #4b5563;
  --cat-system-bg:        rgba(75, 85, 99, 0.1);
  --cat-system-border:    rgba(75, 85, 99, 0.25);
}

/* Light Theme Component Adjustments */
[data-theme="light"] .sidebar-brand {
  background: linear-gradient(135deg, rgba(99,102,241,0.02), rgba(0,0,0,0));
}
[data-theme="light"] .nav-item:hover {
  background: rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .user-card {
  background: rgba(15, 23, 42, 0.03);
}
[data-theme="light"] .user-card:hover {
  background: rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.8);
}
[data-theme="light"] table.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
}
[data-theme="light"] table.data-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.01);
}
[data-theme="light"] .progress-bar-wrap {
  background: rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .avatar-stack .avatar-sm {
  border-color: var(--bg-card);
}
[data-theme="light"] [data-tooltip]::after {
  background: #0f172a;
  border-color: #1e293b;
}

/* Light theme input/focus fixes */
[data-theme="light"] .form-control {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
[data-theme="light"] .form-control:focus {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(168,85,247,0.6);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.12);
}
[data-theme="light"] .form-control::placeholder {
  color: #94a3b8;
}
[data-theme="light"] select.form-control option {
  background: #ffffff;
  color: #0f172a;
}
/* Light mode filter-bar inputs */
[data-theme="light"] .filter-bar select,
[data-theme="light"] .filter-bar input {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
/* Light logo */
.logo-light-theme {
  display: none !important;
}
[data-theme="light"] .logo-dark-theme {
  display: none !important;
}
[data-theme="light"] .logo-light-theme {
  display: block !important;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background dots */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139,92,246,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 4px; }

/* ============================================================
   LAYOUT — Sidebar + Main
   ============================================================ */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow: visible;
}

.sidebar nav {
  flex: 1;
  overflow-y: auto;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(0,0,0,0));
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.sidebar-brand a:hover {
  opacity: 1;
}

/* Login logo */
.login-logo {
  width: 56px; height: 56px;
  background: var(--gradient-accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-glow);
}


/* Nav Groups */
.nav-group {
  padding: 16px 12px 8px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid var(--border-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background var(--transition);
}

.user-card:hover { background: rgba(255,255,255,0.08); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-info .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
  flex: 1;
}

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

/* ── Global Enterprise Zoom Controls Capsule ── */
.topbar-zoom-controls {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  background: #202734 !important;
  border: 1px solid #3B4658 !important;
  border-radius: 12px !important;
  padding: 2px 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  margin-right: 6px !important;
  white-space: nowrap !important;
  transition: border-color 180ms ease, box-shadow 180ms ease !important;
}

.topbar-zoom-controls:hover {
  border-color: #4B5970 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35) !important;
}

.zoom-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
  color: #C7D0DB !important;
  font-size: 12px !important;
  cursor: pointer !important;
  padding: 0 !important;
  line-height: 1 !important;
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.zoom-btn:hover {
  background: #2B3443 !important;
  color: #F3F6FA !important;
}

.zoom-btn:active {
  transform: scale(0.92) !important;
  background: #5B8DEF !important;
  color: #FFFFFF !important;
}

.zoom-btn:focus-visible {
  outline: 2px solid #5B8DEF !important;
  outline-offset: 1px !important;
}

.zoom-badge {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #F3F6FA !important;
  min-width: 42px !important;
  padding: 2px 5px !important;
  text-align: center !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  font-variant-numeric: tabular-nums !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: background 180ms ease, color 180ms ease !important;
}

.zoom-badge:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #5B8DEF !important;
}

.zoom-divider {
  width: 1px !important;
  height: 16px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  margin: 0 2px !important;
}

.page-content {
  padding: 28px 28px;
  flex: 1;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  animation: fadeSlideUp 0.4s ease both;
}

.stat-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent-glow);
  transform: translate(30%, -30%);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-icon.indigo  { background: rgba(99,102,241,0.15); color: var(--accent-light); }
.stat-icon.green   { background: rgba(16,185,129,0.15); color: var(--color-success); }
.stat-icon.amber   { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.stat-icon.red     { background: rgba(239,68,68,0.15);  color: var(--color-danger); }
.stat-icon.purple  { background: rgba(168,85,247,0.15); color: var(--color-purple); }
.stat-icon.blue    { background: rgba(59,130,246,0.15); color: var(--color-info); }

.stat-value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-change {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up   { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

/* ============================================================
   DATA TABLES
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: fadeSlideUp 0.4s ease both;
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 20px 24px; }

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition);
}

table.data-table tbody tr:last-child { border-bottom: none; }

table.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }

table.data-table td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: break-word;
}

table.data-table td.td-main {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge::before { content: '●'; font-size: 8px; }

.badge-info     { background: rgba(59,130,246,0.12);  color: var(--color-info); }
.badge-primary  { background: rgba(249,115,22,0.12);   color: var(--text-accent); }
.badge-success  { background: rgba(16,185,129,0.12);  color: var(--color-success); }
.badge-warning  { background: rgba(245,158,11,0.12);  color: var(--color-warning); }
.badge-danger   { background: rgba(239,68,68,0.12);   color: var(--color-danger); }
.badge-purple   { background: rgba(168,85,247,0.12);  color: var(--color-purple); }
.badge-secondary{ background: rgba(100,116,139,0.12); color: var(--color-muted); }
.badge-muted    { background: rgba(107,114,128,0.12); color: var(--color-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.10); color: var(--text-primary); }

.btn-success  { background: rgba(16,185,129,0.15); color: var(--color-success); border: 1px solid rgba(16,185,129,0.3); }
.btn-danger   { background: rgba(239,68,68,0.15);  color: var(--color-danger);  border: 1px solid rgba(239,68,68,0.3); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* Ensure all icons inside buttons have clean right spacing */
.btn i:not(:only-child),
button i:not(:only-child),
a.btn i:not(:only-child),
.btn svg:not(:only-child),
button svg:not(:only-child) {
  margin-right: 6px !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(26, 32, 53, 0.8);
}

.form-control::placeholder { color: var(--text-muted); }

/* Source/category badges must never wrap mid-word */
.source-badge { white-space: nowrap !important; }
.cat-badge    { white-space: nowrap !important; }
.badge        { white-space: nowrap; }

select.form-control option { background: var(--bg-card); color: var(--text-primary); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.field-confidential {
  border-color: rgba(245, 158, 11, 0.3) !important;
  background: rgba(245,158,11,0.05) !important;
}

.confidential-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-warning);
  background: rgba(245,158,11,0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 20px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.green  { background: var(--gradient-success); }
.progress-bar.amber  { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* ============================================================
   PRIORITY & STATUS
   ============================================================ */
.priority-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.priority-dot.low    { background: var(--color-success); }
.priority-dot.medium { background: var(--color-warning); }
.priority-dot.high   { background: var(--color-danger); }
.priority-dot.urgent { background: #ff0000; box-shadow: 0 0 8px rgba(255,0,0,0.5); animation: pulse 1s infinite; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  padding-top: var(--banner-offset, 0px);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 18px; font-weight: 700; font-family: 'Plus Jakarta Sans', sans-serif; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(239,68,68,0.15); color: var(--color-danger); }

/* Pass flex chain through <form> so .modal-body scrolls correctly inside the border-radius */
.modal > form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body { padding: 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  border-left: 4px solid;
  animation: fadeSlideUp 0.3s ease;
}

.alert-success { background: rgba(34, 197, 94, 0.1); border-color: var(--color-success); color: #166534; }
.alert-danger  { background: rgba(239, 68, 68, 0.1);  border-color: var(--color-danger);  color: #991b1b; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: var(--color-warning); color: #92400e; }
.alert-info    { background: rgba(59, 130, 246, 0.1); border-color: var(--color-info);    color: #1e40af; }

[data-theme="dark"] .alert-success { color: #34d399; }
[data-theme="dark"] .alert-danger  { color: #f87171; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }
[data-theme="dark"] .alert-info    { color: #60a5fa; }

/* Red highlighting for received unread alerts */
.alert-unread {
  border-left: 4px solid var(--color-danger) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: var(--color-danger) !important;
}
.alert-unread .text-primary, .alert-unread .text-secondary {
  color: var(--color-danger) !important;
}
[data-theme="light"] .alert-unread {
  background: rgba(239, 68, 68, 0.04) !important;
}
[data-theme="light"] .alert-unread .text-primary, 
[data-theme="light"] .alert-unread .text-secondary {
  color: #991b1b !important;
}

/* ============================================================
   SEARCH & FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

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

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px 9px 38px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
}

.search-box input:focus { border-color: var(--border-active); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 70%, rgba(139,92,246,0.10) 0%, transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-card);
  animation: fadeSlideUp 0.5s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 60px;
  height: 60px;
  background: var(--gradient-accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.login-brand h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-brand p { font-size: 14px; color: var(--text-muted); }

/* ============================================================
   CHARTS PLACEHOLDER (for future Chart.js integration)
   ============================================================ */
.chart-container {
  position: relative;
  height: 240px;
  width: 100%;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; cursor: help; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 999;
}

[data-tooltip]:hover::after { opacity: 1; }

[data-tooltip].tooltip-bottom::after {
  bottom: auto;
  top: calc(100% + 8px);
}

/* ============================================================
   GLOBAL HINT ENGINE — Contextual help icons
   Usage: <i class="fa-solid fa-circle-question hint-icon"
              data-hint="Explanation text here."
              data-hint-title="Label"></i>
   ============================================================ */
i.hint-icon,
span.hint-icon,
.hint-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 17px !important;
  height: 17px !important;
  border-radius: 50% !important;
  background: rgba(99, 102, 241, 0.18) !important;
  color: #818cf8 !important;
  font-size: 10px !important;
  cursor: pointer !important;
  vertical-align: middle !important;
  margin-left: 5px !important;
  border: 1px solid rgba(129, 140, 248, 0.45) !important;
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s !important;
  flex-shrink: 0 !important;
  position: relative !important;
  top: -1px !important;
  user-select: none !important;
  text-decoration: none !important;
  line-height: 1 !important;
  pointer-events: auto !important;
  z-index: 10 !important;
}
i.hint-icon:hover,
span.hint-icon:hover,
.hint-icon:hover {
  background: rgba(99, 102, 241, 0.38) !important;
  color: #a5b4fc !important;
  transform: scale(1.18) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22) !important;
}
/* Light theme */
[data-theme="light"] i.hint-icon,
[data-theme="light"] span.hint-icon,
[data-theme="light"] .hint-icon {
  background: rgba(79, 70, 229, 0.12) !important;
  color: #4f46e5 !important;
  border-color: rgba(79, 70, 229, 0.4) !important;
}
[data-theme="light"] i.hint-icon:hover,
[data-theme="light"] span.hint-icon:hover,
[data-theme="light"] .hint-icon:hover {
  background: rgba(79, 70, 229, 0.25) !important;
  color: #3730a3 !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

/* Hint Popover */
.hint-popover {
  position: fixed;
  z-index: 999999;
  max-width: 290px;
  background: #1e293b;
  border: 1px solid rgba(129,140,248,0.45);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(129,140,248,0.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-weight: 400;
  letter-spacing: 0.01em;
  display: none;
}
.hint-popover.hint-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.hint-popover::before {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  background: #1e293b;
  border-top: 1px solid rgba(129,140,248,0.45);
  border-left: 1px solid rgba(129,140,248,0.45);
  transform: rotate(45deg);
  top: -5px; left: 14px;
}
.hint-popover.hint-above::before {
  top: auto; bottom: -5px;
  transform: rotate(225deg);
}
.hint-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: #818cf8;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme="light"] .hint-popover {
  background: #1e293b;
  color: #e2e8f0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-content { padding: 16px; }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar-title {
    font-size: 15px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-zoom-controls {
    display: none !important;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin { animation: spin 1s linear infinite; }

/* Stagger animation for children */
.stagger > * { animation: fadeSlideUp 0.4s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent-light); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }

.font-bold      { font-weight: 700; }
.font-semibold  { font-weight: 600; }
.font-medium    { font-weight: 500; }

.text-xs  { font-size: 12px; }
.text-sm  { font-size: 14px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 22px; }

.d-flex    { display: flex; }
.items-center { align-items: center; }
.gap-2     { gap: 8px; }
.gap-3     { gap: 12px; }
.gap-4     { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full   { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

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

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(99,102,241,0.12);
  color: var(--accent-light);
  border: 1px solid rgba(99,102,241,0.2);
  white-space: nowrap;    /* prevent mid-word wrap in narrow columns */
}

.avatar-stack { display: flex; }
.avatar-stack .avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-accent);
  border: 2px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  margin-left: -8px;
}
.avatar-stack .avatar-sm:first-child { margin-left: 0; }

/* ============================================================
   MULTI-VIEW CONTROLS (List, Details, Tiles, Content)
   ============================================================ */

.view-switcher-container {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  align-items: center;
}
.view-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.view-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.view-btn.active {
  color: #fff;
  background: var(--accent);
}

/* 1. TILES / CARDS VIEW MODE */
.view-mode-tiles .table-wrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.view-mode-tiles .data-table {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 20px !important;
  background: transparent !important;
  border: none !important;
  width: 100% !important;
}
.view-mode-tiles .data-table thead {
  display: none !important;
}
.view-mode-tiles .data-table tbody {
  display: contents !important;
}
.view-mode-tiles .data-table tr {
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 20px !important;
  gap: 10px !important;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.view-mode-tiles .data-table tr:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.05);
}
.view-mode-tiles .data-table td {
  display: block !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  text-align: left !important;
}
.view-mode-tiles .data-table td.td-main {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

/* 2. CONTENT VIEW MODE (Distraction-Free) */
.view-mode-content .data-table thead {
  display: none !important;
}
.view-mode-content .data-table tbody {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
}
.view-mode-content .data-table tr {
  display: flex !important;
  flex-direction: column !important;
  padding: 16px 20px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  gap: 6px;
}
.view-mode-content .data-table td:not(.td-main) {
  display: none !important;
}
.view-mode-content .data-table td.td-main {
  display: block !important;
  font-size: 15px;
  font-weight: 600;
  padding: 0 !important;
  border: none !important;
}


/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
.notif-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  pointer-events: all;
  animation: toast-in 0.3s ease;
  transition: opacity 0.4s, transform 0.4s;
}
.notif-toast.fade-out {
  opacity: 0;
  transform: translateX(20px);
}
@keyframes toast-in {
  from { opacity:0; transform: translateX(20px); }
  to   { opacity:1; transform: translateX(0); }
}
[data-theme="light"] .notif-toast {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}

/* ============================================================
   RESPONSIVE IMAGE VIEWER
   ============================================================ */
.modal-img-viewer img,
.file-preview-img img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ============================================================
   PREMIUM TABBED UI COMPONENT STYLES
   ============================================================ */
.amc-tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.amc-tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary) !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none !important;
  transition: all var(--transition);
  white-space: nowrap;
}

.amc-tab-btn:hover {
  color: var(--text-primary) !important;
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.amc-tab-btn.active {
  color: #fff !important;
  background: var(--gradient-accent) !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-glow);
}

/* Disable bullet prepending on all navigation and tab count badges globally */
.amc-tab-btn .badge::before,
.table-tab .badge::before,
.table-tabs .badge::before,
.badge-count::before {
  content: "" !important;
  display: none !important;
}

.amc-tab-btn .badge,
.table-tab .badge,
.table-tabs .badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px !important;
  border-radius: 10px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  margin-left: 6px;
  vertical-align: middle;
  line-height: normal !important;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}

[data-theme="dark"] .amc-tab-btn .badge {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.amc-tab-btn.active .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.amc-section {
  display: none;
}

.amc-section.active {
  display: block;
}

/* ============================================================
   MRE ENTERPRISES CUSTOM SIDEBAR OVERRIDES
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: #071E4D !important; /* Dark Blue */
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.sidebar .nav-item {
  color: rgba(255, 255, 255, 0.7) !important;
  border-radius: 8px !important;
  border: none !important;
}

.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.sidebar .nav-item.active {
  background: #F97316 !important; /* Accent Orange */
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.sidebar .nav-item.active::before {
  display: none !important; /* Remove legacy line indicator */
}

.sidebar .nav-group-label {
  color: rgba(255, 255, 255, 0.35) !important;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: rgba(0, 0, 0, 0.15) !important;
}

.sidebar-footer .user-card {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.sidebar-footer .user-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

.sidebar-footer .user-name {
  color: #ffffff !important;
}

.sidebar-footer .user-role {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* ============================================================
   SPLIT LAYOUT LOGIN SCREEN STYLES
   ============================================================ */
.login-split-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.login-left-pane {
  flex: 1.2;
  background: linear-gradient(135deg, #071E4D, #0B2E73);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  color: #ffffff;
  overflow: hidden;
  text-align: center;
}

.login-left-pane::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(249, 115, 22, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.login-left-pane .tech-graphics {
  max-width: 80%;
  margin-top: 30px;
  opacity: 0.85;
}

.login-right-pane {
  flex: 1;
  background: var(--bg-surface);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

@media (max-width: 991px) {
  .login-left-pane {
    display: none;
  }
}

/* ============================================================
   NOTIFICATION TOAST STYLES
   ============================================================ */
.notif-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  width: 320px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.notif-toast.fade-out {
  opacity: 0;
  transform: translateX(100px);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================
   PENDING ACTIONS PANEL — Standardized Themes
   ============================================================ */
.pa-dash-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(239, 68, 68, 0.1);
}
[data-theme="light"] .pa-dash-categories {
  background: rgba(0, 0, 0, 0.04);
}

.pa-sev-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  text-transform: uppercase;
}
.pa-sev-badge.critical {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}
.pa-sev-badge.high {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}
.pa-sev-badge.medium {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-info);
}
.pa-sev-badge.low {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.pa-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}
.pa-category-pill.task {
  color: var(--cat-task);
  background: var(--cat-task-bg);
  border: 1px solid var(--cat-task-border);
}
.pa-category-pill.client {
  color: var(--cat-client);
  background: var(--cat-client-bg);
  border: 1px solid var(--cat-client-border);
}
.pa-category-pill.vendor {
  color: var(--cat-vendor);
  background: var(--cat-vendor-bg);
  border: 1px solid var(--cat-vendor-border);
}
.pa-category-pill.supplier {
  color: var(--cat-supplier);
  background: var(--cat-supplier-bg);
  border: 1px solid var(--cat-supplier-border);
}
.pa-category-pill.project {
  color: var(--cat-project);
  background: var(--cat-project-bg);
  border: 1px solid var(--cat-project-border);
}
.pa-category-pill.amc {
  color: var(--cat-amc);
  background: var(--cat-amc-bg);
  border: 1px solid var(--cat-amc-border);
}
.pa-category-pill.request {
  color: var(--cat-request);
  background: var(--cat-request-bg);
  border: 1px solid var(--cat-request-border);
}
.pa-category-pill.system {
  color: var(--cat-system);
  background: var(--cat-system-bg);
  border: 1px solid var(--cat-system-border);
}

.pa-category-pill .count-badge {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 9px;
  font-weight: 800;
}
[data-theme="dark"] .pa-category-pill .count-badge {
  background: rgba(255, 255, 255, 0.15);
}

/* Category Dot Indicator styling */
.pa-dash-cat-dot.task { color: var(--cat-task); background: var(--cat-task-bg); }
.pa-dash-cat-dot.client { color: var(--cat-client); background: var(--cat-client-bg); }
.pa-dash-cat-dot.vendor { color: var(--cat-vendor); background: var(--cat-vendor-bg); }
.pa-dash-cat-dot.supplier { color: var(--cat-supplier); background: var(--cat-supplier-bg); }
.pa-dash-cat-dot.project { color: var(--cat-project); background: var(--cat-project-bg); }
.pa-dash-cat-dot.amc { color: var(--cat-amc); background: var(--cat-amc-bg); }
.pa-dash-cat-dot.request { color: var(--cat-request); background: var(--cat-request-bg); }
.pa-dash-cat-dot.system { color: var(--cat-system); background: var(--cat-system-bg); }

/* ============================================================
   RESPONSIVE DISPLAY SCALING — Auto Zoom Rules (Logged-in only)
   ============================================================ */
@media (min-width: 1400px) {
  html[data-logged-in="true"]:not([data-scale-override]) {
    zoom: 1.0;
  }
}
@media (min-width: 1920px) {
  html[data-logged-in="true"]:not([data-scale-override]) {
    zoom: 1.0;
  }
}
@media (min-width: 2560px) {
  html[data-logged-in="true"]:not([data-scale-override]) {
    zoom: 1.08;
  }
}
@media (min-width: 3840px) {
  html[data-logged-in="true"]:not([data-scale-override]) {
    zoom: 1.2;
  }
}

/* ============================================================
   BOOTSTRAP UTILITY SPACING FALLBACKS
   ============================================================ */
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-4 { margin-right: 1.5rem !important; }
.me-5 { margin-right: 3rem !important; }

.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-4 { margin-left: 1.5rem !important; }
.ms-5 { margin-left: 3rem !important; }

.pe-1 { padding-right: 0.25rem !important; }
.pe-2 { padding-right: 0.5rem !important; }
.pe-3 { padding-right: 1rem !important; }
.pe-4 { padding-right: 1.5rem !important; }
.pe-5 { padding-right: 3rem !important; }

.ps-1 { padding-left: 0.25rem !important; }
.ps-2 { padding-left: 0.5rem !important; }
.ps-3 { padding-left: 1rem !important; }
.ps-4 { padding-left: 1.5rem !important; }
.ps-5 { padding-left: 3rem !important; }

/* ============================================================
   ENTERPRISE RESPONSIVE LAYOUT ENGINE (ERLE) v1.0
   MR Enterprises CRM — Centralized Responsive Framework
   Covers: Mobile → Tablet → Laptop → Desktop → 4K → 5K
   NO page-level overrides needed — all modules inherit this.
   ============================================================ */

/* ----------------------------------------------------------
   ERLE-1: LAPTOP / SMALL DESKTOP (992px – 1199px)
   e.g., 13–15 inch laptops, older screens
   ---------------------------------------------------------- */
@media (min-width: 992px) and (max-width: 1199px) {
  :root {
    --sidebar-width: 220px;
    --topbar-height: 58px;
  }
  .page-content { padding: 18px 20px; }
  .stat-value { font-size: 26px; }
  .card-title { font-size: 14px; }
  .topbar-title { font-size: 15px; }
  .modal { max-width: min(700px, 88vw); }
}

/* ----------------------------------------------------------
   ERLE-2: MEDIUM DESKTOP — 32" at 1377×768, 24–27" monitors
   Key fix for the reported display issue.
   Range: 1200px – 1439px
   ---------------------------------------------------------- */
@media (min-width: 1200px) and (max-width: 1439px) {
  :root {
    --sidebar-width: 225px;
    --topbar-height: 60px;
  }
  .page-content { padding: 22px 24px; }
  .stat-value { font-size: 28px; }
  .topbar-title { font-size: clamp(14px, 1.2vw, 18px); }
  /* Modals grow to use available space */
  .modal { max-width: min(780px, 82vw); }
  /* Stats grid stays fluid — auto-fit handles it */
  .stats-grid { gap: 16px; }
}

/* ----------------------------------------------------------
   ERLE-3: TOPBAR ACTION BUTTONS — Icon-only at ≤1380px
   Prevents topbar overflow on 1377px viewport width.
   Tooltips (data-tooltip + tooltip-bottom) already present.
   ---------------------------------------------------------- */
@media (max-width: 1380px) {
  .topbar-btn-text {
    display: none !important;
  }
  .topbar-btn {
    padding: 5px 9px !important;
    gap: 0 !important;
  }
  .topbar-zoom-controls {
    padding: 3px 6px !important;
    gap: 2px !important;
    margin-right: 4px !important;
  }
  #zoom-percentage-val {
    min-width: 30px !important;
    font-size: 11px !important;
  }
  .topbar { gap: 10px; padding: 0 16px; }
  .topbar-actions { gap: 6px; }
}

/* ----------------------------------------------------------
   ERLE-4: FULL HD / LARGE DESKTOP (1440px – 1599px)
   27" at native resolution, some 32" configurations
   ---------------------------------------------------------- */
@media (min-width: 1440px) and (max-width: 1599px) {
  :root {
    --sidebar-width: 240px;
  }
  .page-content { padding: 26px 30px; }
  .modal { max-width: min(860px, 78vw); }
  .stats-grid { gap: 20px; }
}

/* ----------------------------------------------------------
   ERLE-5: FULL HD — 1080p (1600px – 1919px)
   Standard 24–27" Full HD displays
   ---------------------------------------------------------- */
@media (min-width: 1600px) and (max-width: 1919px) {
  :root {
    --sidebar-width: 260px;
  }
  .page-content { padding: 28px 32px; }
  .stat-value { font-size: 34px; }
  .modal { max-width: min(900px, 72vw); }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
  }
}

/* ----------------------------------------------------------
   ERLE-6: QHD / 2K (1920px – 2559px)
   High-res 27–32" monitors, dual-monitor setups
   ---------------------------------------------------------- */
@media (min-width: 1920px) and (max-width: 2559px) {
  :root {
    --sidebar-width: 280px;
    --topbar-height: 68px;
  }
  .page-content { padding: 32px 40px; }
  .stat-value { font-size: 38px; }
  .stat-icon { width: 52px; height: 52px; font-size: 22px; }
  .modal { max-width: min(1000px, 65vw); }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
  }
  .nav-item { font-size: 15px; padding: 10px 14px; }
  .topbar-title { font-size: 20px; }
  table.data-table td { padding: 15px 18px; }
  table.data-table thead th { padding: 12px 18px; }
}

/* ----------------------------------------------------------
   ERLE-7: 4K UHD (2560px – 3839px)
   Already had zoom:1.08 — supplement with fluid layout
   ---------------------------------------------------------- */
@media (min-width: 2560px) and (max-width: 3839px) {
  :root {
    --sidebar-width: 300px;
    --topbar-height: 72px;
  }
  .page-content { padding: 36px 48px; }
  .stat-value { font-size: 44px; }
  .stat-icon { width: 60px; height: 60px; font-size: 26px; }
  .modal { max-width: min(1100px, 55vw); }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
  }
  .nav-item { font-size: 16px; padding: 11px 16px; }
  .topbar-title { font-size: 22px; }
  .btn { font-size: 15px; padding: 10px 20px; }
  .btn-sm { font-size: 13px; padding: 6px 14px; }
  table.data-table td { padding: 16px 20px; }
}

/* ----------------------------------------------------------
   ERLE-8: MOBILE TABLET ENHANCEMENT (768px – 991px)
   Fills gaps in existing mobile rules
   ---------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  #sidebar-toggle { display: flex !important; }
  .page-content { padding: 16px 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .modal { max-width: min(600px, 94vw); }
  .topbar-zoom-controls { display: none !important; }
}

/* ----------------------------------------------------------
   ERLE-9: ULTRA-WIDE / 5K+ (3840px+)
   Supplement existing zoom:1.2 rule
   ---------------------------------------------------------- */
@media (min-width: 3840px) {
  :root {
    --sidebar-width: 340px;
    --topbar-height: 80px;
  }
  .page-content { padding: 44px 60px; }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 32px;
  }
  .modal { max-width: min(1200px, 45vw); }
  .topbar-title { font-size: 26px; }
}

/* ----------------------------------------------------------
   ERLE-10: MODAL GLOBAL IMPROVEMENTS
   Applied at all breakpoints — viewport-relative sizing
   ---------------------------------------------------------- */
.modal-overlay {
  padding: 16px;                /* Prevents modal edge-flush on small screens */
}

.modal {
  /* Already overflow-y: auto from previous fix */
  width: clamp(320px, 90vw, 900px); /* Fluid width — grows on wide screens */
}

/* Ensure modal footer is always sticky at bottom of visible area */
.modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  z-index: 2;
  border-top: 1px solid var(--border);
}

/* ----------------------------------------------------------
   ERLE-11: FLUID PAGE CONTENT CONTAINER
   Uses clamp() for smooth scaling across all breakpoints
   ---------------------------------------------------------- */
.page-content {
  /* Override with smooth clamp for base padding */
  padding: clamp(16px, 2vw, 32px) clamp(16px, 2.5vw, 40px);
}

/* ----------------------------------------------------------
   ERLE-12: FLUID TYPOGRAPHY ENGINE
   Uses clamp() — auto-scales between min/preferred/max
   ---------------------------------------------------------- */
.stat-value {
  font-size: clamp(24px, 2.2vw, 40px);
}

.topbar-title {
  font-size: clamp(14px, 1.4vw, 20px);
}

.card-title {
  font-size: clamp(14px, 1.1vw, 18px);
}

/* ----------------------------------------------------------
   ERLE-13: CONTAINER / WRAPPER SAFETY RULES
   Prevent any fixed-width overflow at any resolution
   ---------------------------------------------------------- */
.main-content {
  min-width: 0;
  overflow-x: hidden;
}

.page-content > * {
  max-width: 100%;
}

table.data-table {
  min-width: 0;
}

.filters-bar {
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   ERLE-14: SIDEBAR TOGGLE VISIBILITY ENGINE
   Ensures hamburger appears correctly across breakpoints
   ---------------------------------------------------------- */
@media (min-width: 992px) {
  #sidebar-toggle { display: none !important; }
}

@media (max-width: 991px) {
  #sidebar-toggle { display: flex !important; }
}

/* ============================================================
   END: ENTERPRISE RESPONSIVE LAYOUT ENGINE v1.0
   ============================================================ */

/* ----------------------------------------------------------
   ERLE-15: MOBILE PHONES (max-width: 767px)
   Fills the critical gap below ERLE-8 (768px–991px).
   Without this, main-content retains margin-left:260px at
   phone widths, leaving only ~140px of usable content area.
   ---------------------------------------------------------- */
@media (max-width: 767px) {
  /* Horizontal scrollable tab headers for professional mobile look */
  .amc-tabs-header {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px !important;
    scrollbar-width: none !important; /* Hide scrollbar for Firefox */
  }
  .amc-tabs-header::-webkit-scrollbar {
    display: none !important; /* Hide scrollbar for Chrome/Safari/Webkit */
  }
  .amc-tab-btn {
    flex-shrink: 0 !important; /* Prevent tab buttons from squeezing */
  }

  .sidebar          { transform: translateX(-100%) !important; }
  .sidebar.open     { transform: translateX(0) !important; }
  .main-content     { margin-left: 0 !important; }
  .topbar           { padding: 0 14px !important; gap: 8px !important; }
  .topbar-zoom-controls { display: none !important; }
  
  /* Mobile Topbar Cleanups — Hides secondary actions to prevent title truncation */
  .topbar-actions a[data-tooltip="Feedback"],
  .topbar-actions a[data-tooltip="New Vendor"],
  #report-issue-btn {
    display: none !important;
  }
  .topbar-title {
    font-size: 14px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
  }

  /* Fix trailing gap after + button — collapse wrapper gap on mobile */
  .topbar-btn-group {
    gap: 0 !important;
  }
  /* Tighten topbar right padding so + button sits snug on the right edge */
  .topbar { padding-right: 8px !important; }

  .page-content     { padding: 14px 16px !important; }
  .stats-grid       { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .modal            { max-width: min(94vw, 600px) !important; }
  .rem-form-grid    { grid-template-columns: 1fr !important; }

  /* Force modal headers to not wrap titles and close buttons on mobile */
  .modal-header {
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 14px 16px !important;
  }
  .modal-title {
    flex: 1 !important;
    margin-right: 12px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .modal-close {
    flex-shrink: 0 !important;
  }

  /* Force inline grids inside modal dialogs and details sections to stack on mobile */
  .modal-body div[style*="display:grid"],
  .modal-body div[style*="display: grid"],
  .modal-body div[style*="grid-template-columns"],
  .card div[style*="display:grid"],
  .card div[style*="display: grid"],
  .card div[style*="grid-template-columns"],
  .amc-section div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}




/* Global Reminders Form Grid */
.rem-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

