/* ============================================================
   ContractGuard Design System — Light Theme
   Version: 20260317
   ============================================================ */

/* --- Google Font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   BASE TOKENS
   ============================================================ */
:root {
  /* Primary brand colour */
  --primary:        #4366F6;
  --primary-light:  #6B8AF9;
  --primary-dark:   #2D4ED4;
  --primary-bg:     rgba(67, 102, 246, 0.08);

  /* Backgrounds */
  --bg-base:      #F5F7FA;
  --bg-sidebar:   #1B2559;   /* Deep navy blue sidebar */
  --bg-surface:   #ffffff;
  --bg-surface-2: #f1f5f9;
  --bg-elevated:  #e2e8f0;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #64748b;
  --text-label:     #94a3b8;

  /* Borders */
  --border:       #EEF2F6;
  --border-light: #F5F7FA;
  --border-focus: var(--dept-primary);

  /* Department defaults (PBP — indigo) */
  --dept-primary:       #6366f1;
  --dept-primary-light: #4f46e5;
  --dept-gradient:      linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --dept-focus-ring:    rgba(99, 102, 241, 0.2);
  --dept-active-bg:     rgba(99, 102, 241, 0.08);

  /* Status colours — for light backgrounds */
  --status-active:     #059669;
  --status-active-bg:  #ecfdf5;
  --status-active-br:  #a7f3d0;
  --status-expiring:     #d97706;
  --status-expiring-bg:  #fffbeb;
  --status-expiring-br:  #fde68a;
  --status-expired:     #dc2626;
  --status-expired-bg:  #fef2f2;
  --status-expired-br:  #fecaca;
  --status-terminated:     #64748b;
  --status-terminated-bg:  #f8fafc;
  --status-terminated-br:  #e2e8f0;
  --status-paused:     #ca8a04;
  --status-paused-bg:  #fefce8;
  --status-paused-br:  #fef08a;

  /* Shadows — subtle for clean design */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-xl:  0 8px 32px rgba(0,0,0,0.10);

  /* Radii — rounder corners */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-pill:  100px;

  /* Layout */
  --sidebar-width:    250px;
  --topbar-height:    64px;
  --content-padding:  28px;

  /* Table tokens */
  --table-header-bg:    #F8FAFC;
  --table-row-hover:    #F8FAFC;
  --table-border:       #F1F5F9;
  --table-header-text:  #64748B;

  /* Toolbar */
  --toolbar-gap:  12px;

  /* Action menu */
  --action-menu-width:  180px;
  --action-menu-shadow: 0 4px 20px rgba(0,0,0,0.12);

  /* Transitions */
  --transition: all 0.18s ease;
}

/* Department accent overrides — injected by Flask from session.selected_department */
body.dept-PBP {
  --dept-primary:       #6366f1;
  --dept-primary-light: #4f46e5;
  --dept-gradient:      linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --dept-focus-ring:    rgba(99, 102, 241, 0.2);
  --dept-active-bg:     rgba(99, 102, 241, 0.08);
}
body.dept-IDC {
  --dept-primary:       #10b981;
  --dept-primary-light: #059669;
  --dept-gradient:      linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --dept-focus-ring:    rgba(16, 185, 129, 0.2);
  --dept-active-bg:     rgba(16, 185, 129, 0.08);
}
body.dept-PBL {
  --dept-primary:       #0ea5e9;
  --dept-primary-light: #0284c7;
  --dept-gradient:      linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
  --dept-focus-ring:    rgba(14, 165, 233, 0.2);
  --dept-active-bg:     rgba(14, 165, 233, 0.08);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--dept-primary);
  text-decoration: none;
}
a:hover {
  color: var(--dept-primary-light);
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

p {
  color: var(--text-secondary);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ============================================================
   BOOTSTRAP 5 GLOBAL OVERRIDES
   ============================================================ */

/* --- Forms & Inputs --- */
.form-control,
.form-select {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.9375rem !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}
.form-control::placeholder,
.form-select::placeholder {
  color: var(--text-label) !important;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--bg-surface) !important;
  border-color: var(--dept-primary) !important;
  box-shadow: 0 0 0 3px var(--dept-focus-ring) !important;
  color: var(--text-primary) !important;
  outline: none !important;
}
.form-control:disabled,
.form-select:disabled {
  background-color: var(--bg-surface-2) !important;
  color: var(--text-muted) !important;
  opacity: 0.7 !important;
}

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Form labels */
.form-label,
label {
  color: var(--text-secondary) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  margin-bottom: 0.375rem !important;
}

/* Form text (helpers) */
.form-text {
  color: var(--text-muted) !important;
  font-size: 0.8125rem !important;
}

/* Input groups */
.input-group-text {
  background-color: var(--bg-surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}

/* Form check (checkbox / radio) */
.form-check-input {
  background-color: var(--bg-surface) !important;
  border: 1.5px solid var(--border) !important;
  width: 1.1em !important;
  height: 1.1em !important;
}
.form-check-input:checked {
  background-color: var(--dept-primary) !important;
  border-color: var(--dept-primary) !important;
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px var(--dept-focus-ring) !important;
  border-color: var(--dept-primary) !important;
}
.form-check-label {
  color: var(--text-secondary) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 400 !important;
}

/* Select option */
select.form-select option,
select.form-control option {
  background-color: #ffffff !important;
  color: var(--text-primary) !important;
}

/* --- Buttons --- */
.btn {
  font-weight: 500 !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.9rem !important;
  padding: 0.5rem 1.1rem !important;
  transition: var(--transition) !important;
  letter-spacing: 0.01em !important;
}
.btn:focus,
.btn:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px var(--dept-focus-ring) !important;
}
.btn:disabled,
.btn.disabled {
  opacity: 0.45 !important;
  pointer-events: none !important;
}

/* Primary */
.btn-primary {
  background: var(--dept-gradient) !important;
  border: none !important;
  color: #fff !important;
}
.btn-primary:hover {
  filter: brightness(1.08) !important;
  color: #fff !important;
}

/* Secondary */
.btn-secondary {
  background-color: var(--bg-surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}
.btn-secondary:hover {
  background-color: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
}

/* Outline primary */
.btn-outline-primary {
  background: transparent !important;
  border: 1.5px solid var(--dept-primary) !important;
  color: var(--dept-primary) !important;
}
.btn-outline-primary:hover {
  background: var(--dept-active-bg) !important;
  color: var(--dept-primary-light) !important;
}

/* Outline secondary */
.btn-outline-secondary {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}
.btn-outline-secondary:hover {
  background: var(--bg-surface-2) !important;
  color: var(--text-primary) !important;
}

/* Danger */
.btn-danger {
  background-color: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
}
.btn-danger:hover {
  background-color: #fee2e2 !important;
  color: #b91c1c !important;
}

/* Outline danger */
.btn-outline-danger {
  background: transparent !important;
  border: 1.5px solid #fca5a5 !important;
  color: #dc2626 !important;
}
.btn-outline-danger:hover {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
}

/* Success */
.btn-success {
  background-color: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #059669 !important;
}
.btn-success:hover {
  background-color: #d1fae5 !important;
  color: #047857 !important;
}

/* Warning */
.btn-warning {
  background-color: #fffbeb !important;
  border: 1px solid #fde68a !important;
  color: #d97706 !important;
}
.btn-warning:hover {
  background-color: #fef3c7 !important;
  color: #b45309 !important;
}

/* Info */
.btn-info {
  background-color: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #0284c7 !important;
}
.btn-info:hover {
  background-color: #e0f2fe !important;
}

/* Light/Dark */
.btn-light {
  background-color: var(--bg-surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}
.btn-dark {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #f1f5f9 !important;
}

/* Link button */
.btn-link {
  color: var(--dept-primary) !important;
  text-decoration: none !important;
  padding: 0 !important;
}
.btn-link:hover {
  color: var(--dept-primary-light) !important;
}

/* --- Cards --- */
.card {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm) !important;
}
.card-header {
  background-color: var(--bg-surface-2) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  padding: 1rem 1.25rem !important;
}
.card-body {
  color: var(--text-secondary) !important;
  padding: 1.25rem !important;
}
.card-footer {
  background-color: var(--bg-surface-2) !important;
  border-top: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  padding: 0.875rem 1.25rem !important;
}
.card-title {
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
}
.card-subtitle {
  color: var(--text-secondary) !important;
}

/* --- Tables --- */
.table {
  color: var(--text-primary) !important;
  --bs-table-bg: transparent !important;
  --bs-table-striped-bg: rgba(0,0,0,0.015) !important;
  --bs-table-hover-bg: rgba(0,0,0,0.025) !important;
  --bs-table-border-color: var(--border) !important;
}
.table > thead {
  background-color: var(--bg-surface-2) !important;
}
.table > thead > tr > th {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 0.75rem 1rem !important;
  background-color: var(--bg-surface-2) !important;
}
.table > tbody > tr > td {
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 0.75rem 1rem !important;
  vertical-align: middle !important;
}
.table > tbody > tr > td:first-child {
  color: var(--text-primary) !important;
  font-weight: 500 !important;
}
.table > tbody > tr:hover > td {
  background-color: rgba(0,0,0,0.02) !important;
}
.table > tbody > tr:last-child > td {
  border-bottom: none !important;
}
.table-bordered > :not(caption) > * > * {
  border-color: var(--border) !important;
}
.table-responsive {
  border-radius: var(--radius-md) !important;
  overflow: hidden !important;
}

/* --- Modals --- */
.modal-content {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
}
.modal-header {
  background: var(--dept-gradient) !important;
  border-bottom: none !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1.25rem 1.5rem !important;
}
.modal-header .modal-title {
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 1.05rem !important;
}
.modal-header .btn-close {
  filter: invert(1) brightness(2) !important;
  opacity: 0.8 !important;
}
.modal-body {
  background-color: var(--bg-surface) !important;
  color: var(--text-secondary) !important;
  padding: 1.5rem !important;
}
.modal-footer {
  background-color: var(--bg-surface-2) !important;
  border-top: 1px solid var(--border) !important;
  padding: 1rem 1.5rem !important;
}
.modal-backdrop.show {
  opacity: 0.4 !important;
}

/* --- Alerts --- */
.alert {
  border-radius: var(--radius-md) !important;
  font-size: 0.9rem !important;
  padding: 0.875rem 1.125rem !important;
}
.alert-success {
  background-color: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #065f46 !important;
}
.alert-danger {
  background-color: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #991b1b !important;
}
.alert-warning {
  background-color: #fffbeb !important;
  border: 1px solid #fde68a !important;
  color: #92400e !important;
}
.alert-info {
  background-color: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #075985 !important;
}
.alert-primary {
  background-color: var(--dept-active-bg) !important;
  border: 1px solid var(--dept-primary) !important;
  color: var(--dept-primary-light) !important;
}
.alert-secondary {
  background-color: var(--bg-surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}

/* --- Badges --- */
.badge {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0.3em 0.65em !important;
  border-radius: 100px !important;
}
.badge.bg-success, .badge.text-bg-success {
  background-color: var(--status-active-bg) !important;
  color: var(--status-active) !important;
  border: 1px solid var(--status-active-br) !important;
}
.badge.bg-warning, .badge.text-bg-warning {
  background-color: var(--status-expiring-bg) !important;
  color: var(--status-expiring) !important;
  border: 1px solid var(--status-expiring-br) !important;
}
.badge.bg-danger, .badge.text-bg-danger {
  background-color: var(--status-expired-bg) !important;
  color: var(--status-expired) !important;
  border: 1px solid var(--status-expired-br) !important;
}
.badge.bg-secondary, .badge.text-bg-secondary {
  background-color: var(--status-terminated-bg) !important;
  color: var(--status-terminated) !important;
  border: 1px solid var(--status-terminated-br) !important;
}
.badge.bg-primary, .badge.text-bg-primary {
  background: var(--dept-gradient) !important;
  color: #fff !important;
  border: none !important;
}
.badge.bg-info, .badge.text-bg-info {
  background-color: #f0f9ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}
.badge.bg-dark, .badge.text-bg-dark {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}
.badge.bg-light, .badge.text-bg-light {
  background-color: var(--bg-surface-2) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
}

/* Status badge helpers */
.badge-active    { background-color: var(--status-active-bg) !important; color: var(--status-active) !important; border: 1px solid var(--status-active-br) !important; border-radius: 100px; padding: 0.3em 0.65em; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-expiring  { background-color: var(--status-expiring-bg) !important; color: var(--status-expiring) !important; border: 1px solid var(--status-expiring-br) !important; border-radius: 100px; padding: 0.3em 0.65em; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-expired   { background-color: var(--status-expired-bg) !important; color: var(--status-expired) !important; border: 1px solid var(--status-expired-br) !important; border-radius: 100px; padding: 0.3em 0.65em; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-terminated{ background-color: var(--status-terminated-bg) !important; color: var(--status-terminated) !important; border: 1px solid var(--status-terminated-br) !important; border-radius: 100px; padding: 0.3em 0.65em; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-paused    { background-color: var(--status-paused-bg) !important; color: var(--status-paused) !important; border: 1px solid var(--status-paused-br) !important; border-radius: 100px; padding: 0.3em 0.65em; font-size: 0.75rem; font-weight: 600; display: inline-block; }

/* --- Navigation --- */
.nav-tabs {
  border-bottom: 1px solid var(--border) !important;
}
.nav-tabs .nav-link {
  color: var(--text-muted) !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  padding: 0.625rem 1rem !important;
  font-weight: 500 !important;
  transition: color 0.15s !important;
}
.nav-tabs .nav-link:hover {
  color: var(--text-primary) !important;
  border-color: transparent !important;
}
.nav-tabs .nav-link.active {
  color: var(--dept-primary) !important;
  border-bottom-color: var(--dept-primary) !important;
  background: transparent !important;
}

.nav-pills .nav-link {
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background: var(--dept-gradient) !important;
  color: #fff !important;
}

/* --- Dropdowns --- */
.dropdown-menu {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0.375rem !important;
}
.dropdown-item {
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.5rem 0.875rem !important;
  font-size: 0.9rem !important;
  transition: var(--transition) !important;
}
.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--dept-active-bg) !important;
  color: var(--text-primary) !important;
}
.dropdown-item.active {
  background: var(--dept-gradient) !important;
  color: #fff !important;
}
.dropdown-divider {
  border-top: 1px solid var(--border) !important;
  margin: 0.375rem 0 !important;
}
.dropdown-header {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 0.5rem 0.875rem !important;
}

/* --- List Groups --- */
.list-group-item {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  transition: var(--transition) !important;
}
.list-group-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}
.list-group-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
}
.list-group-item:hover {
  background-color: var(--dept-active-bg) !important;
  color: var(--text-primary) !important;
}
.list-group-item.active {
  background: var(--dept-gradient) !important;
  border-color: transparent !important;
  color: #fff !important;
}

/* --- Pagination --- */
.pagination .page-link {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  transition: var(--transition) !important;
}
.pagination .page-link:hover {
  background-color: var(--dept-active-bg) !important;
  color: var(--dept-primary) !important;
  border-color: var(--dept-primary) !important;
}
.pagination .page-item.active .page-link {
  background: var(--dept-gradient) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.pagination .page-item.disabled .page-link {
  background-color: var(--bg-surface-2) !important;
  color: var(--text-label) !important;
  opacity: 0.6 !important;
}

/* --- Progress --- */
.progress {
  background-color: var(--bg-elevated) !important;
  border-radius: 100px !important;
  height: 6px !important;
}
.progress-bar {
  background: var(--dept-gradient) !important;
  border-radius: 100px !important;
}

/* --- Accordion --- */
.accordion-item {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
}
.accordion-button {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  font-weight: 500 !important;
}
.accordion-button:not(.collapsed) {
  background-color: var(--dept-active-bg) !important;
  color: var(--dept-primary) !important;
  box-shadow: none !important;
}
.accordion-body {
  color: var(--text-secondary) !important;
  background-color: var(--bg-surface) !important;
}

/* --- Tooltips & Popovers --- */
.tooltip .tooltip-inner {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  font-size: 0.8125rem !important;
}
.popover {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
}
.popover-header {
  background-color: var(--bg-surface-2) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border) !important;
}
.popover-body {
  color: var(--text-secondary) !important;
}

/* --- Spinner --- */
.spinner-border,
.spinner-grow {
  color: var(--dept-primary) !important;
}

/* --- Offcanvas --- */
.offcanvas {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.offcanvas-header {
  border-bottom: 1px solid var(--border) !important;
}

/* --- Toast --- */
.toast {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-md) !important;
}
.toast-header {
  background-color: var(--bg-surface-2) !important;
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary   { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted)     !important; }
.text-dept      { color: var(--dept-primary)   !important; }
.text-dept-light{ color: var(--dept-primary-light) !important; }

.bg-surface   { background-color: var(--bg-surface)   !important; }
.bg-surface-2 { background-color: var(--bg-surface-2) !important; }
.bg-base      { background-color: var(--bg-base)      !important; }
.bg-dept      { background: var(--dept-gradient)      !important; }

.border-theme { border: 1px solid var(--border) !important; }

/* ============================================================
   DASHBOARD / PAGE LAYOUT HELPERS
   ============================================================ */
.page-title {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}
.page-subtitle,
.dashboard-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.section-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Dashboard grid */
.dashboard-container {
  padding: 1.75rem;
}
.dashboard-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.dashboard-grid {
  display: grid;
  gap: 1.25rem;
}
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto-fit { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-cards   { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* Metric card */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.metric-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--dept-gradient);
}
.metric-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--dept-primary);
}
.metric-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

/* Dashboard card */
.dashboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-header-bar .card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.card-content {
  padding: 1.25rem;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar-wrapper {
  position: relative;
}
.search-bar-wrapper input {
  padding-left: 2.5rem !important;
}
.search-bar-wrapper .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.1rem 0.35rem;
  font-family: monospace;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-messages {
  padding: 0.75rem 1.75rem 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.5rem;
  color: var(--text-label);
  margin-bottom: 1rem;
  display: block;
}
.empty-state h5 {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .dashboard-container { padding: 1rem; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 1.25rem; }
}
@media (max-width: 480px) {
  .dashboard-container { padding: 0.75rem; }
  .grid-cols-4 { grid-template-columns: 1fr; }
}
