/* ============ FleetWorks Design System — Comprehensive Standardization ============
   This file extends the main style.css with a complete component library, utilities,
   and design tokens to ensure consistency across ALL pages, modals, forms, and tabs.
   Load AFTER style.css to override/extend base styles.
   ============================================================ */

:root {
  /* Form fields: selects are white in every theme, so their option lists must be too */
  --field-bg: #ffffff;
  --field-fg: #1c2733;

  /* Enhanced Design Tokens */
  --navy: #0f1e33;
  --navy-2: #16294a;
  --navy-3: #1d3a63;
  --navy-light: #e1ecf8;
  --navy-50: #f8fafd;

  --amber: #f5a623;
  --amber-dark: #d98f0f;
  --amber-light: #fef3e2;
  --amber-50: #fffbf5;

  --green: #16a34a;
  --green-light: #eafaf0;
  --green-50: #f7fdfa;

  --red: #dc2626;
  --red-light: #fdecec;
  --red-50: #fefcfc;

  --blue: #2563eb;
  --blue-light: #eff4ff;
  --blue-50: #f7faff;

  --orange: #e69120;
  --orange-light: #fff5e6;
  --orange-50: #fffbf5;

  --ink: #1c2733;
  --ink2: #52514e;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --bg-light: #f9fafb;
  --line: #e2e8f0;
  --border: #e2e8f0;

  /* Typography Scale */
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.95rem;
  --text-md: 0.92rem;
  --text-lg: 1.15rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.65rem;
  --text-3xl: 2.2rem;
  --text-4xl: 3.2rem;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 28px;
  --space-4xl: 32px;
  --space-5xl: 36px;
  --space-6xl: 42px;

  /* Border Radius Scale */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-2xl: 18px;
  --radius-3xl: 20px;
  --radius-full: 100px;

  /* Shadow System */
  --shadow-xs: 0 1px 2px rgba(15, 30, 51, 0.05);
  --shadow-sm: 0 2px 4px rgba(15, 30, 51, 0.08);
  --shadow-md: 0 4px 8px rgba(15, 30, 51, 0.10);
  --shadow: 0 10px 30px rgba(15, 30, 51, 0.10);
  --shadow-lg: 0 20px 50px rgba(15, 30, 51, 0.18);
  --shadow-xl: 0 30px 60px rgba(15, 30, 51, 0.25);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.25s ease;

  /* Z-Index Scale */
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-navbar: 100;
  --z-modal: 200;
  --z-tooltip: 300;
  --z-toast: 400;
}

/* ========== TYPOGRAPHY ==========*/
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  color: var(--ink);
  font-weight: var(--fw-bold);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p, span, li { line-height: 1.6; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-regular { font-weight: var(--fw-regular); }
.font-medium { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.font-bold { font-weight: var(--fw-bold); }
.font-extrabold { font-weight: var(--fw-extrabold); }

.text-muted { color: var(--muted); }
.text-navy { color: var(--navy); }
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ========== BUTTONS — COMPREHENSIVE ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  font-family: inherit;
  font-weight: var(--fw-semibold);
  font-size: var(--text-base);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
  visibility: visible;
  opacity: 1;
  will-change: auto;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Menu button style (sidebar/navigation) */
.btn-menu {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-lg);
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  color: #94a3b8;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  visibility: visible;
  opacity: 1;
}

.btn-menu:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.btn-menu.active {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  font-weight: var(--fw-semibold);
}

.btn-menu svg,
.btn-menu i[data-icon] {
  flex: none;
  width: 18px;
  height: 18px;
}

.btn-menu .menu-label {
  flex: 1;
  text-align: left;
}

/* Size variants */
.btn-xs { padding: 6px 12px; font-size: var(--text-xs); }
.btn-sm { padding: 9px 16px; font-size: var(--text-sm); }
.btn-base { padding: 12px 24px; font-size: var(--text-base); }
.btn-lg { padding: 14px 28px; font-size: var(--text-lg); }
.btn-xl { padding: 16px 32px; font-size: var(--text-lg); }

/* Width variants */
.btn-block { width: 100%; }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; }

/* Primary button: Amber background, navy text — Action buttons */
.btn-primary {
  background: var(--amber);
  color: var(--navy);
  border: none;
  visibility: visible;
  opacity: 1;
  font-weight: var(--fw-semibold);
}
.btn-primary:hover:not(:disabled) {
  background: var(--amber-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  visibility: visible;
  opacity: 1;
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}

/* Secondary button: Subtle styling for secondary actions */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  visibility: visible;
  opacity: 1;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.2);
  visibility: visible;
  opacity: 1;
}

/* Outline button: Minimal outline style */
.btn-outline {
  background: transparent;
  color: #94a3b8;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  visibility: visible;
  opacity: 1;
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.3);
  visibility: visible;
  opacity: 1;
}

/* Light button: Light theme button */
.btn-light {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  visibility: visible;
  opacity: 1;
}
.btn-light:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--line);
  visibility: visible;
  opacity: 1;
}

/* Ghost button: Minimal transparent button */
.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: none;
  visibility: visible;
  opacity: 1;
}
.btn-ghost:hover:not(:disabled) {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  visibility: visible;
  opacity: 1;
}

/* Danger button: Red */
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  visibility: visible;
  opacity: 1;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
  visibility: visible;
  opacity: 1;
}

/* Success button: Green */
.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  visibility: visible;
  opacity: 1;
}
.btn-success:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
  visibility: visible;
  opacity: 1;
}

/* Link button: Text only */
.link-btn {
  background: none;
  border: none;
  color: var(--navy);
  font-weight: var(--fw-bold);
  font-size: var(--text-sm);
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast);
  visibility: visible;
  opacity: 1;
}
.link-btn:hover {
  color: var(--amber-dark);
  text-decoration: underline;
  visibility: visible;
  opacity: 1;
}

/* White text buttons (for dark backgrounds) */
.btn-light-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  visibility: visible;
  opacity: 1;
}
.btn-light-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
  color: #fff;
  visibility: visible;
  opacity: 1;
}

.btn-ghost-light {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  visibility: visible;
  opacity: 1;
}
.btn-ghost-light:hover:not(:disabled) {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
  visibility: visible;
  opacity: 1;
}

/* ========== FORMS ==========*/
label {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--navy);
  visibility: visible;
  opacity: 1;
  will-change: auto;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: var(--text-md);
  color: var(--ink);
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.18);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-alt);
  color: var(--muted);
  cursor: not-allowed;
}

input.invalid,
select.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

input.valid,
select.valid {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

/* Select options styling */
select option {
  font-weight: var(--fw-bold);
  color: var(--field-fg);
  background-color: var(--field-bg);
}

select optgroup {
  font-weight: var(--fw-extrabold);
  color: var(--field-fg);
  background-color: var(--field-bg);
  font-style: normal;
}

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

/* Form helpers */
.field-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: var(--fw-medium);
  margin-top: var(--space-sm);
}

.field-error {
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  margin-top: var(--space-sm);
}

.field-success {
  color: var(--green);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  margin-top: var(--space-sm);
}

.form-note {
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: center;
  margin-top: var(--space-md);
}

/* Checkbox and radio */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--amber);
}

/* File input */
input[type="file"] {
  padding: var(--space-lg);
  background: var(--bg-alt);
  border-style: dashed;
  cursor: pointer;
}

/* Form grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.form-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.form-row.full {
  grid-template-columns: 1fr;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ========== NAVIGATION & MENUS ========== */

/* Sidebar navigation */
.nav-sidebar {
  background: #0f1e33;
  color: #94a3b8;
  padding: 12px 8px;
  border-radius: var(--radius-lg);
}

.nav-section {
  margin-bottom: var(--space-lg);
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  margin-bottom: var(--space-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all var(--transition-fast);
  visibility: visible;
  opacity: 1;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  font-weight: var(--fw-semibold);
}

.nav-item.active::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
  margin-left: auto;
}

.nav-icon {
  flex: none;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  font-size: var(--text-xs);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

/* ========== DROPDOWNS & MENUS ========== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 200px;
  margin-top: var(--space-sm);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.dropdown-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  padding: var(--space-md) var(--space-lg);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--bg-alt);
  color: var(--navy);
}

.dropdown-item.active {
  background-color: rgba(245, 166, 35, 0.1);
  color: var(--amber-dark);
  font-weight: var(--fw-semibold);
}

.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-sm) 0;
}

/* ========== MODALS & DIALOGS ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 22, 38, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(16px);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-xl);
}

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

.modal.modal-sm { max-width: 400px; }
.modal.modal-md { max-width: 560px; }
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--navy);
  margin: 0;
}

.modal-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  margin-top: var(--space-xs);
}

.modal-body {
  margin-bottom: var(--space-2xl);
}

.modal-footer {
  display: flex;
  gap: var(--space-lg);
  justify-content: flex-end;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.modal-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: var(--bg-alt);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--line);
  color: var(--ink);
}

/* ========== CARDS & CONTAINERS ========== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow);
  transition: all var(--transition-base);
}

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

.card.no-hover:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--line);
}

.card-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--navy);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  margin-top: var(--space-xs);
}

.card-body {
  margin-bottom: var(--space-lg);
}

.card-footer {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}

/* Card variants */
.card.highlight {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.card.highlight .card-title {
  color: #fff;
}

.card.highlight .card-subtitle {
  color: #c7d2e0;
}

.card.success {
  border-color: var(--green);
  background: var(--green-light);
}

.card.warning {
  border-color: var(--orange);
  background: var(--orange-light);
}

.card.danger {
  border-color: var(--red);
  background: var(--red-light);
}

.card.info {
  border-color: var(--blue);
  background: var(--blue-light);
}

/* ========== CHIPS, BADGES, & PILLS ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: default;
  transition: all var(--transition-fast);
}

.chip.interactive {
  cursor: pointer;
}

.chip.interactive:hover {
  border-color: var(--amber);
  background: rgba(245, 166, 35, 0.1);
}

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge-primary {
  background: rgba(245, 166, 35, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.4);
}

.badge-success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.badge-danger {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.badge-warning {
  background: var(--orange-light);
  color: var(--orange);
  border: 1px solid rgba(230, 145, 32, 0.3);
}

.badge-info {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.pill {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  color: var(--ink);
}

/* ========== ALERTS & STATUS ========== */
.alert {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.alert-icon {
  flex: none;
  font-size: 1.25rem;
  line-height: 1;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-xs);
}

.alert-message {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.alert-success {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}

.alert-danger {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

.alert-warning {
  background: var(--orange-light);
  border-color: var(--orange);
  color: var(--orange);
}

.alert-info {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

/* ========== TABS ========== */
.tab-bar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.tab-btn:not(.side-item) {
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--ink);
  transition: all var(--transition-fast);
}

.tab-btn:not(.side-item):hover {
  background: var(--bg-alt);
  color: var(--navy);
}

.tab-btn.active:not(.side-item) {
  background: var(--navy);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead {
  background: var(--navy);
  color: #fff;
}

th {
  text-align: left;
  padding: var(--space-lg) var(--space-md);
  font-weight: var(--fw-semibold);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--bg-alt);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ========== UTILITY CLASSES ========== */

/* Spacing utilities */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.my-xs { margin: var(--space-xs) 0; }
.my-sm { margin: var(--space-sm) 0; }
.my-md { margin: var(--space-md) 0; }
.my-lg { margin: var(--space-lg) 0; }
.my-xl { margin: var(--space-xl) 0; }

.mx-auto { margin: 0 auto; }

.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.px-lg { padding: 0 var(--space-lg); }
.py-lg { padding: var(--space-lg) 0; }

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-start { justify-content: flex-start; }
.flex-end { justify-content: flex-end; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Display utilities */
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.italic { font-style: italic; }
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lowercase { text-transform: lowercase; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }

/* ========== RESPONSIVE ========== */
@media (max-width: 960px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .form-row { grid-template-columns: 1fr; }

  .modal {
    padding: 20px;
    max-width: 95vw;
  }

  .card {
    padding: var(--space-lg);
  }

  .btn { padding: 10px 16px; font-size: var(--text-sm); }

  table { font-size: 0.75rem; }
  th, td { padding: var(--space-sm); }

  .tab-bar { gap: var(--space-xs); padding: var(--space-sm); }
  .tab-btn:not(.side-item) { padding: var(--space-sm) var(--space-md); }
}

/* Utility breakpoint helpers */
@media (max-width: 768px) {
  .hide-mobile { display: none; }
}

@media (min-width: 769px) {
  .show-mobile { display: none; }
}

/* Compact controls: anything given an inline fixed height (e.g. 28px selects in
   dialogs) must not also get the roomy vertical padding above, or the box has
   no room left for its text and the selected value looks blank. */
select[style*="height"],
input[style*="height"]:not([type="checkbox"]):not([type="radio"]) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Filter bars: compact dropdowns that sit in a row above a dashboard. */
.fw-filter-select {
  width: auto;
  min-width: 150px;
  max-width: 260px;
  height: 34px;
  padding: 0 10px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
}
.fw-filter-select:disabled { opacity: 0.55; cursor: not-allowed; }

/* Multi-select dropdown (js/multiselect.js) */
.fw-multi { position: relative; }
.fw-multi-trigger {
  width: 100%; height: 44px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: inherit; font-size: var(--text-md); color: var(--ink); text-align: left; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-md);
}
.fw-multi-trigger:focus-visible, .fw-multi-trigger[aria-expanded="true"] { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.18); outline: none; }
.fw-multi-placeholder { color: var(--muted); }
.fw-multi-panel {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(11, 22, 38, 0.18); padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.fw-multi-panel[hidden] { display: none; }
.fw-multi-search { height: 38px !important; padding: 0 12px !important; font-size: 0.9rem !important; }
.fw-multi-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; }
.fw-multi-opt { flex-direction: row !important; align-items: center !important; gap: 10px !important; padding: 8px 10px; border-radius: 8px; font-weight: 500 !important; font-size: 0.92rem !important; color: var(--ink) !important; cursor: pointer; }
.fw-multi-opt:hover { background: var(--bg-alt); }
.fw-multi-opt input { width: 18px; flex: none; }
.fw-multi-opt small { display: block; color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.fw-multi-empty { margin: 8px 10px; color: var(--muted); font-size: 0.88rem; }
.fw-multi-create {
  font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--amber-dark, #b45309); background: transparent;
  border: 1px dashed var(--line); border-radius: 8px; padding: 9px 10px; cursor: pointer; text-align: left;
}
.fw-multi-create:hover { background: var(--bg-alt); }

/* Destructive text button (Remove, Delete). */
.link-btn.danger { color: var(--red, #dc2626); }
.link-btn.danger:hover { color: #b91c1c; }

/* A responsive row of small label/value pairs (summaries, detail lists). */
.fw-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px 14px; }
