@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@400,500,600,700,800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ═══════════════════════════════════════
   DESIGN TOKENS — LIGHT MODE
═══════════════════════════════════════ */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #eef2ff;
  --primary-glow:  rgba(99,102,241,0.18);

  --sidebar-bg:      #0f172a;
  --sidebar-border:  #1e293b;
  --sidebar-text:    #ffffff;
  --sidebar-hover:   rgba(99,102,241,0.18);
  --sidebar-active:  rgba(99,102,241,0.28);
  --sidebar-width:   260px;

  --body-bg:      #f0f4f8;
  --card-bg:      #ffffff;
  --card-raised:  #f8fafc;
  --border:       #e2e8f0;
  --border-light: #f1f5f9;

  --text-primary:   #0f172a;
  --text-secondary: #1e293b;
  --text-muted:     #374151;

  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  --radius:    14px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.10), 0 10px 10px -5px rgba(0,0,0,0.04);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════
   BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Cabinet Grotesk', 'Space Grotesk', system-ui, sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
#sidebar {
  position: fixed; top: 0; left: 0; z-index: 1000;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}
.brand-name {
  display: block;
  color: #f1f5f9;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-sub {
  display: block;
  color: var(--sidebar-text);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-label {
  padding: 14px 10px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.42);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px 10px 9px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  color: var(--sidebar-text);
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}
.nav-link.active {
  background: var(--sidebar-active);
  color: #ffffff;
  border-left-color: var(--primary);
}
.nav-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.975rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  transition: var(--transition);
}
.nav-link.active .nav-icon {
  background: rgba(99,102,241,0.25);
  color: #ffffff;
}
.nav-link:hover .nav-icon { background: rgba(255,255,255,0.07); }

.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 12px;
  border-top: 1px solid var(--sidebar-border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  transition: var(--transition);
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.user-name-text {
  display: block;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}
.user-role-text {
  display: block;
  color: var(--sidebar-text);
  font-size: 0.72rem;
  margin-top: 1px;
}
.user-info { flex: 1; min-width: 0; }
.logout-btn {
  width: 28px; height: 28px;
  border: none;
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { background: #ef4444; color: white; }

/* ═══════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════ */
#main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title  { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.topbar-date {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.8rem; color: var(--text-secondary);
  background: var(--card-raised);
  padding: 7px 13px;
  border-radius: 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════
   CONTENT
═══════════════════════════════════════ */
.content { padding: 24px 28px; flex: 1; }

/* ═══════════════════════════════════════
   WELCOME BANNER
═══════════════════════════════════════ */
.welcome-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 24px rgba(99,102,241,0.25);
  border: 1px solid rgba(99,102,241,0.25);
}
.welcome-banner::before {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.welcome-banner::after {
  content: '';
  position: absolute; right: 80px; bottom: -60px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.welcome-text h4 {
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.welcome-text p { color: rgba(255,255,255,0.65); font-size: 0.875rem; }
.welcome-icon {
  font-size: 3rem;
  opacity: 0.2;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient, linear-gradient(90deg, var(--primary), #818cf8));
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.green::after  { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.amber::after  { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.emerald::after { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.red::after     { background: linear-gradient(90deg, var(--danger), #f87171); }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c7d2e6; }

.stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stat-icon-wrap {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: white;
}
.si-indigo  { background: linear-gradient(135deg, #6366f1, #818cf8); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.si-blue    { background: linear-gradient(135deg, #3b82f6, #60a5fa); box-shadow: 0 4px 12px rgba(59,130,246,0.35); }
.si-amber   { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 4px 12px rgba(245,158,11,0.35); }
.si-emerald { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 4px 12px rgba(16,185,129,0.35); }
.si-red     { background: linear-gradient(135deg, #ef4444, #f87171); box-shadow: 0 4px 12px rgba(239,68,68,0.35); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(16,185,129,0.12);
  color: #047857;
}

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}
.card-header h6 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h6 .icon-badge {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
}
.card-header h6 .icon-badge.indigo { background: var(--primary-light); color: var(--primary); }
.card-body { padding: 20px; }

/* ═══════════════════════════════════════
   TABLES
═══════════════════════════════════════ */
.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.modern-table thead tr th {
  padding: 11px 16px;
  background: var(--card-raised);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.modern-table tbody tr td {
  padding: 13px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.modern-table tbody tr:last-child td { border-bottom: none; }
.modern-table tbody tr { transition: var(--transition); }
.modern-table tbody tr:hover { background: var(--card-raised); }

/* DataTables override */
table.dataTable thead th {
  background: var(--card-raised) !important;
  color: var(--text-secondary) !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border) !important;
  padding: 11px 16px !important;
  font-weight: 600;
}
table.dataTable tbody td {
  padding: 13px 16px !important;
  border-bottom: 1px solid var(--border-light) !important;
  font-size: 0.875rem;
  font-weight: 500;
  vertical-align: middle;
  color: var(--text-primary);
  background: var(--card-bg);
}
table.dataTable tbody tr:last-child td { border-bottom: none !important; }
table.dataTable tbody tr:hover td { background: var(--card-raised) !important; }
div.dataTables_wrapper div.dataTables_filter input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  background: var(--card-raised);
  color: var(--text-primary);
}
div.dataTables_wrapper div.dataTables_filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
div.dataTables_wrapper div.dataTables_length select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--card-raised);
  color: var(--text-primary);
}
div.dataTables_wrapper div.dataTables_info { font-size: 0.82rem; color: var(--text-secondary); }
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  border-radius: var(--radius-xs) !important;
  font-size: 0.82rem !important;
  color: var(--text-secondary) !important;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
  background: var(--card-raised) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}
div.dataTables_wrapper { color: var(--text-primary); }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.badge-draft      { background: rgba(100,116,139,0.12); color: #475569; }
.badge-sent       { background: rgba(59,130,246,0.12);  color: #1d4ed8; }
.badge-accepted   { background: rgba(16,185,129,0.12);  color: #047857; }
.badge-rejected   { background: rgba(239,68,68,0.12);   color: #b91c1c; }
.badge-approved   { background: rgba(16,185,129,0.12);  color: #047857; }
.badge-cancelled  { background: rgba(239,68,68,0.12);   color: #b91c1c; }
.badge-secondary  { background: rgba(100,116,139,0.12); color: #475569; }
.badge-info       { background: rgba(59,130,246,0.12);  color: #1d4ed8; }
.badge-success    { background: rgba(16,185,129,0.12);  color: #047857; }
.badge-danger     { background: rgba(239,68,68,0.12);   color: #b91c1c; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,0.45); color: white; }

.btn-success {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; background: var(--success); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  text-decoration: none; box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-success:hover { background: #059669; transform: translateY(-1px); color: white; }

.btn-light {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  background: var(--card-raised);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.btn-light:hover { background: #e8edf5; color: var(--text-primary); border-color: #94a3b8; }

.btn-icon {
  width: 32px; height: 32px;
  border: none; border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon-edit  { background: rgba(99,102,241,0.10); color: #4f46e5; }
.btn-icon-edit:hover { background: var(--primary); color: white; }
.btn-icon-del   { background: rgba(239,68,68,0.10); color: #dc2626; }
.btn-icon-del:hover  { background: var(--danger); color: white; }
.btn-icon-pdf   { background: rgba(16,185,129,0.10); color: #059669; }
.btn-icon-pdf:hover  { background: var(--success); color: white; }
.btn-icon-view  { background: rgba(245,158,11,0.10); color: #d97706; }
.btn-icon-view:hover { background: var(--warning); color: white; }
.btn-icon-mail  { background: rgba(99,102,241,0.10); color: #4f46e5; border: 1px solid rgba(99,102,241,0.25); }
.btn-icon-mail:hover { background: var(--primary); color: white; border-color: transparent; }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: #1e293b !important;
  -webkit-text-fill-color: #1e293b !important;
  background: #ffffff !important;
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  caret-color: #1e293b;
}
.form-select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px !important;
  cursor: pointer;
}
.form-control:hover, .form-select:hover {
  border-color: #94a3b8;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  background: #fafbff !important;
  color: #1e293b !important;
  -webkit-text-fill-color: #1e293b !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}
.form-control::placeholder { color: #6b7280; -webkit-text-fill-color: #6b7280; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Bootstrap form overrides */
.form-select option { background: #ffffff; color: #1e293b; }

/* ═══════════════════════════════════════
   MODALS
═══════════════════════════════════════ */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--card-bg);
}
.modal-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border: none;
  padding: 18px 24px;
}
.modal-title { font-size: 1rem; font-weight: 700; color: white; }
.modal-header .btn-close { filter: invert(1) brightness(2); opacity: 0.8; }
.modal-body   { padding: 24px; background: var(--card-bg); color: var(--text-primary); }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--card-raised); }

/* Bootstrap modal backdrop */
.modal-backdrop { background-color: #000; }

/* ═══════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--body-bg);
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #060b14 0%, #0e1628 50%, #141c35 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.login-left::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%);
}
.login-left::after {
  content: '';
  position: absolute; bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129,140,248,0.1) 0%, transparent 70%);
}
.login-brand-wrap { text-align: center; margin-bottom: 40px; position: relative; z-index: 1; }
.login-brand-icon {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.8rem;
  color: white;
  box-shadow: 0 8px 32px rgba(99,102,241,0.45);
}
.login-brand-wrap h2 { color: #f1f5f9; font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.03em; }
.login-brand-wrap p  { color: rgba(255,255,255,0.45); font-size: 0.9rem; max-width: 280px; margin: 0 auto; }

.login-features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.login-feature-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 18px;
  backdrop-filter: blur(8px);
  min-width: 280px;
}
.login-feature-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(99,102,241,0.25);
  display: flex; align-items: center; justify-content: center;
  color: #a5b4fc;
  font-size: 1rem;
  flex-shrink: 0;
}
.login-feature-text strong { display: block; color: #c7d4e5; font-size: 0.88rem; font-weight: 600; }
.login-feature-text span   { color: rgba(255,255,255,0.35); font-size: 0.78rem; }

.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--card-bg);
}
.login-form-box { width: 100%; max-width: 360px; }
.login-form-box h3 { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; letter-spacing: -0.03em; }
.login-form-box > p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 32px; }

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  letter-spacing: 0.01em;
}
.login-btn:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.5); }
.login-btn:active { transform: translateY(0); }

.input-wrap { position: relative; margin-bottom: 18px; }
.input-wrap .input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.85rem;
}
.input-wrap .form-control { padding-left: 38px; }

.login-error {
  display: none;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #f87171;
  margin-bottom: 18px;
  gap: 8px;
  align-items: center;
}
.login-error.show { display: flex; }

/* ═══════════════════════════════════════
   QUOTATION / PROFORMA FORM
═══════════════════════════════════════ */
.items-table { width: 100%; border-collapse: collapse; }
.items-table thead th {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 11px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.items-table tbody tr { border-bottom: 1px solid var(--border-light); transition: var(--transition); }
.items-table tbody tr:hover { background: var(--card-raised); }
.items-table tbody td { padding: 8px 10px; vertical-align: middle; }
.items-table input,
.items-table select {
  width: 100%; padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  background: var(--card-raised);
  color: var(--text-primary);
}
.items-table select {
  padding-right: 28px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.items-table input:focus,
.items-table select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.items-table input::placeholder { color: var(--text-muted); }

.totals-box {
  background: var(--card-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8rem;
}
.totals-row:last-child { border-bottom: none; }
.totals-row.grand {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 18px;
}
.totals-row .label { color: var(--text-secondary); font-weight: 500; }
.totals-row .value { font-weight: 600; color: var(--text-primary); }
.totals-row.grand .label, .totals-row.grand .value { color: white; }

/* filter pills */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  padding: 7px 16px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  background: var(--card-raised);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.pill:hover { border-color: var(--primary); color: #a5b4fc; }
.pill.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 2px 8px rgba(99,102,241,0.35); }

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
.text-muted { color: var(--text-muted) !important; }
.text-primary-clr { color: var(--primary) !important; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Bootstrap alert dark overrides */
.alert { border-radius: var(--radius-sm); }
.alert-success { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.3); color: #047857; }
.alert-danger  { background: rgba(239,68,68,0.10);  border-color: rgba(239,68,68,0.3);  color: #b91c1c; }
.alert-warning { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.3); color: #92400e; }
.alert-info    { background: rgba(59,130,246,0.10);  border-color: rgba(59,130,246,0.3); color: #1d4ed8; }
.alert .btn-close { opacity: 0.6; }

/* Bootstrap table dark overrides */
.table { color: var(--text-primary); }
.table > :not(caption) > * > * { background-color: transparent; border-bottom-color: var(--border-light); }

/* ═══════════════════════════════════════
   GLOBAL WHITE-BACKGROUND KILL
   Catch any Bootstrap / browser-default whites
═══════════════════════════════════════ */

/* Dropdowns */
.dropdown-menu {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}
.dropdown-item { color: var(--text-primary); }
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--card-raised);
  color: var(--text-primary);
}
.dropdown-divider { border-color: var(--border); }

/* Bootstrap list-group */
.list-group-item {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text-primary);
}
.list-group-item:hover { background: var(--card-raised); }

/* Popover / Tooltip */
.popover {
  background: var(--card-bg);
  border-color: var(--border);
}
.popover-header { background: var(--card-raised); color: var(--text-primary); border-color: var(--border); }
.popover-body   { color: var(--text-primary); }
.tooltip-inner  { background: var(--card-raised); color: var(--text-primary); }

/* Browser autofill override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #1e293b !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  caret-color: var(--text-primary);
}

/* Catch-all: any element with explicit white/light background still gets readable text */
[style*="background: white"] { color: var(--text-primary) !important; }
[style*="background:white"]  { color: var(--text-primary) !important; }
[style*="background:#fff"]   { color: var(--text-primary) !important; }
[style*="background: #fff"]  { color: var(--text-primary) !important; }
[style*="background:#f0fdf4"] { color: #065f46 !important; }
[style*="background:#fffbeb"] { color: #92400e !important; }

/* ═══════════════════════════════════════
   TOM SELECT — light theme
═══════════════════════════════════════ */
/* Tom Select copies the <select>'s classes (e.g. form-select) to .ts-wrapper.
   Strip the background-image arrow that .form-select applies, so only the
   ::after arrow on .ts-control is shown — no double arrow. */
.ts-wrapper {
  width: 100%;
  background-image: none !important;
  background-color: transparent !important;
  padding: 0 !important;      /* cancel any padding-right from .form-select */
  border: none !important;    /* border lives on .ts-control, not the wrapper */
  box-shadow: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

/* The visible control box */
.ts-control {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--radius-sm) !important;
  color: #1e293b !important;
  padding: 8px 36px 8px 12px !important;
  min-height: 40px !important;
  cursor: pointer !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
}
.ts-control:hover { border-color: #94a3b8 !important; }
.ts-wrapper.focus .ts-control {
  border-color: var(--primary) !important;
  background: #fafbff !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}
/* Selected item text */
.ts-control .item {
  color: #1e293b !important;
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 0.875rem;
  font-weight: 500 !important;
}
/* The inline search input inside the control */
.ts-control > input {
  color: #1e293b !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  caret-color: #1e293b;
  min-width: 60px;
  flex: 1;
}
.ts-control > input::placeholder { color: #6b7280 !important; }

/* Dropdown arrow — replace Tom Select's border-triangle with our SVG chevron */
.ts-wrapper.single .ts-control:after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  right: 13px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 12px !important;
  height: 8px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-size: 12px !important;
  background-color: transparent !important;
  border: none !important;
  border-width: 0 !important;
  margin: 0 !important;
}
.ts-wrapper.single.input-active .ts-control:after {
  transform: translateY(-50%) rotate(180deg) !important;
}

/* Dropdown panel */
.ts-dropdown {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06) !important;
  margin-top: 4px !important;
  z-index: 9999 !important;
  overflow: hidden !important;
}
/* Search input inside dropdown */
.ts-dropdown .ts-dropdown-content { max-height: 240px; overflow-y: auto; }
.ts-dropdown input.search-input,
.ts-dropdown input {
  background: #f8fafc !important;
  border: none !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
  padding: 9px 13px !important;
  font-size: 0.85rem !important;
  font-family: inherit !important;
  width: 100% !important;
  outline: none !important;
  display: block !important;
}
.ts-dropdown input:focus { border-bottom-color: var(--primary) !important; }

/* Options */
.ts-dropdown .option,
.ts-dropdown [data-selectable] {
  color: #1e293b !important;
  padding: 9px 14px !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: background 0.12s;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: rgba(99,102,241,0.10) !important;
  color: var(--primary) !important;
}
.ts-dropdown .option.selected {
  color: var(--primary) !important;
  font-weight: 600;
}
.ts-dropdown .no-results {
  color: var(--text-muted) !important;
  padding: 10px 14px !important;
  font-size: 0.85rem !important;
}
/* Optgroup headers */
.ts-dropdown .optgroup-header {
  color: var(--text-muted) !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 8px 14px 4px !important;
  background: #f1f5f9 !important;
}
/* Scrollbar */
.ts-dropdown .ts-dropdown-content::-webkit-scrollbar { width: 5px; }
.ts-dropdown .ts-dropdown-content::-webkit-scrollbar-track { background: #f8fafc; }
.ts-dropdown .ts-dropdown-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* sm-size selects (form-select-sm) — Tom Select copies the class to ts-wrapper */
.ts-wrapper.form-select-sm .ts-control {
  min-height: 34px !important;
  padding: 5px 32px 5px 10px !important;
  font-size: 0.8rem !important;
}
.ts-wrapper.form-select-sm .ts-control .item { font-size: 0.8rem !important; }

/* Items-table row selects */
.items-table .ts-wrapper { min-width: 0; }
.items-table .ts-control {
  background: var(--card-raised) !important;
  border-color: var(--border) !important;
  min-height: 36px !important;
  padding: 6px 28px 6px 8px !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-xs) !important;
}
.items-table .ts-control .item { font-size: 0.85rem !important; }
.items-table .ts-wrapper.focus .ts-control {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow) !important;
}
