/* ============================================================
   TRANSPORT ADMIN — DESIGN SYSTEM
   نظام التصميم الأساسي المشترك لجميع صفحات المشروع
   RTL-First | Arabic-friendly | Clean & Minimal
   ============================================================ */

/* ── متغيرات التصميم الأساسية ─────────────────────────────── */
:root {
  /* الخطوط */
  --font-heading: "Changa", "IBM Plex Sans Arabic", sans-serif;
  --font-body:    "IBM Plex Sans Arabic", "Changa", sans-serif;

  /* ألوان الخلفية */
  --bg-app:        #f4f6f8;
  --bg-app-alt:    #ebeff3;

  /* الأسطح */
  --surface-1:     #ffffff;
  --surface-2:     #f8fafc;
  --surface-3:     #eef2f5;
  --surface-dark:  #0e1726;
  --surface-dark-2:#111d30;
  --surface-dark-3:#162235;

  /* ألوان النصوص */
  --text-1:  #111827;
  --text-2:  #5b6472;
  --text-3:  #8a94a6;
  --text-inv: #ffffff;

  /* اللون الأساسي — أزرق عميق */
  --primary:        #0f5d73;
  --primary-dark:   #0b4c5e;
  --primary-darker: #083948;
  --primary-soft:   #dceff3;
  --primary-muted:  rgba(15, 93, 115, 0.10);

  /* اللون الثانوي — أخضر مزرق */
  --accent:       #1e7a63;
  --accent-dark:  #16604d;
  --accent-soft:  #dcefe8;
  --accent-muted: rgba(30, 122, 99, 0.10);

  /* ألوان الحالة */
  --success:      #1f8a4c;
  --success-soft: #e2f4e8;
  --danger:       #c64747;
  --danger-soft:  #f9e4e4;
  --warning:      #c98a2e;
  --warning-soft:  #fbf0db;
  --info:         #2d6ea3;
  --info-soft:    #e3eef8;

  /* حدود وظلال */
  --border-soft:   rgba(17, 24, 39, 0.08);
  --border-medium: rgba(17, 24, 39, 0.12);
  --border-strong: rgba(17, 24, 39, 0.18);
  --shadow-xs:  0 1px 3px rgba(15,23,42,.05), 0 1px 2px rgba(15,23,42,.03);
  --shadow-sm:  0 2px 8px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.03);
  --shadow-md:  0 8px 24px rgba(15,23,42,.08), 0 3px 10px rgba(15,23,42,.05);
  --shadow-lg:  0 18px 40px rgba(15,23,42,.10), 0 6px 18px rgba(15,23,42,.06);
  --shadow-xl:  0 28px 60px rgba(15,23,42,.12), 0 10px 24px rgba(15,23,42,.08);
  --shadow-dark: 0 26px 58px rgba(8,17,29,.34), 0 10px 24px rgba(8,17,29,.22);

  /* نصف قطر */
  --radius-xs:  8px;
  --radius-sm:  12px;
  --radius-md:  16px;
  --radius-lg:  20px;
  --radius-xl:  24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* أبعاد Sidebar */
  --sidebar-width: 288px;
  --topbar-height: 72px;
  --content-max-width: 1480px;

  /* متغيرات ديناميكية (تُعيَّن لكل صفحة) */
  --page-accent:      #0f5d73;
  --page-accent-dark: #0b4c5e;
  --page-accent-soft: #dceff3;
  --page-accent-muted: rgba(15, 93, 115, 0.10);
  --hero-bg:         rgba(15, 93, 115, 0.08);
  --hero-bg-alt:     rgba(30, 122, 99, 0.05);
  --hero-glow:       rgba(15, 93, 115, 0.16);

  /* شبكة */
  --grid-gap: 1.25rem;

  /* Dark Mode Colors (minimal) */
  --dark-bg-app:         #0b0f19;
  --dark-bg-app-alt:     #0f1420;
  --dark-surface-1:      #111827;
  --dark-surface-2:      #1a2332;
  --dark-surface-3:      #1f2937;
  --dark-text-1:         #f3f4f6;
  --dark-text-2:         #9ca3af;
  --dark-text-3:         #6b7280;
  --dark-border-soft:    rgba(255,255,255,0.08);
  --dark-border-medium:  rgba(255,255,255,0.12);
  --dark-border-strong:  rgba(255,255,255,0.18);
}

/* Minimal dark mode variable override */
[data-theme="dark"] {
  --bg-app: var(--dark-bg-app);
  --bg-app-alt: var(--dark-bg-app-alt);
  --surface-1: var(--dark-surface-1);
  --surface-2: var(--dark-surface-2);
  --surface-3: var(--dark-surface-3);
  --text-1: var(--dark-text-1);
  --text-2: var(--dark-text-2);
  --text-3: var(--dark-text-3);
  --border-soft: var(--dark-border-soft);
  --border-medium: var(--dark-border-medium);
  --border-strong: var(--dark-border-strong);
}

/* ── إعادة الضبط الأساسية ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 72%, white);
  outline-offset: 2px;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-1);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

img  { display: block; max-width: 100%; }
a    { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
hr {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: 1rem 0;
}

/* ── Utilities: Display ─────────────────────────────────────── */
.d-flex        { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid        { display: grid !important; }
.d-none        { display: none !important; }

@media (max-width: 991.98px) { .d-lg-none { display: inline-flex !important; } }
@media (min-width: 992px)    { .d-lg-none { display: none !important; } }

/* ── Utilities: Flex ───────────────────────────────────────── */
.flex-wrap    { flex-wrap: wrap !important; }
.flex-fill    { flex: 1 1 0 !important; }
.align-items-center { align-items: center !important; }
.align-items-start  { align-items: flex-start !important; }
.align-items-end    { align-items: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-center  { justify-content: center !important; }

/* ── Utilities: Sizing ─────────────────────────────────────── */
.w-100  { width: 100% !important; }
.w-auto { width: auto !important; }
.minw-120 { min-width: 120px; }
.minw-150 { min-width: 150px; }
.minw-160 { min-width: 160px; }
.minw-170 { min-width: 170px; }
.minw-180 { min-width: 180px; }
.minw-190 { min-width: 190px; }
.minw-220 { min-width: 220px; }
.maxw-120 { max-width: 120px; }
.maxw-170 { max-width: 170px; }
.maxw-220 { max-width: 220px; }
.maxw-280 { max-width: 280px; }
.width-110 { width: 110px; }
.width-150 { width: 150px; }
.wrap-normal { white-space: normal !important; }

/* ── Utilities: Spacing ────────────────────────────────────── */
.m-0  { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.me-1 { margin-inline-end: .35rem !important; }
.gap-1 { gap: .25rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: .75rem !important; }
.py-4  { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5  { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

/* ── Utilities: Text ───────────────────────────────────────── */
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }
.text-muted  { color: var(--text-3) !important; }
.small, small { font-size: .85rem; }
.pointer { cursor: pointer; }

/* ── Utilities: Visibility ─────────────────────────────────── */
.section-hidden { display: none !important; }

/* ── Grid System (12-column) ───────────────────────────────── */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0,1fr));
  gap: var(--grid-gap);
}
.row > * { min-width: 0; grid-column: span 12; }
.g-3     { gap: 1rem !important; }
.col-12  { grid-column: span 12; }
.col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-12, .col-xl-6 { grid-column: span 12; }

@media (min-width: 768px) {
  .col-md-2  { grid-column: span 2; }
  .col-md-3  { grid-column: span 3; }
  .col-md-4  { grid-column: span 4; }
  .col-md-5  { grid-column: span 5; }
  .col-md-6  { grid-column: span 6; }
  .col-md-7  { grid-column: span 7; }
  .col-md-12 { grid-column: span 12; }
}
@media (min-width: 1200px) {
  .col-xl-6 { grid-column: span 6; }
}
@media (max-width: 767.98px) {
  .row { grid-template-columns: 1fr; }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .65rem 1.1rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}
.btn:hover   { transform: translateY(-1px); }
.btn:active  { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-sm {
  min-height: 36px;
  padding: .48rem .85rem;
  font-size: .82rem;
  border-radius: var(--radius-sm);
}

/* Filled buttons */
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(15,93,115,.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #146d85 0%, var(--primary-dark) 100%);
  box-shadow: 0 10px 22px rgba(15,93,115,.28);
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(30,122,99,.22);
}
.btn-success:hover {
  box-shadow: 0 10px 22px rgba(30,122,99,.28);
}

.btn-warning {
  color: #fff;
  background: linear-gradient(135deg, #d59a45 0%, var(--warning) 100%);
  border-color: var(--warning);
  box-shadow: 0 6px 16px rgba(201,138,46,.22);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #d86161 0%, var(--danger) 100%);
  border-color: var(--danger);
  box-shadow: 0 6px 16px rgba(198,71,71,.22);
}

/* Outlined / ghost buttons */
.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
  background: rgba(255,255,255,.94);
  border-color: var(--border-medium);
  color: var(--text-1);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-danger:hover {
  background: #fff;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-outline-primary { color: var(--primary); border-color: rgba(15,93,115,.24); }
.btn-outline-danger  { color: var(--danger);  border-color: rgba(198,71,71,.22); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-control,
.form-select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: .6rem 1rem;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(248,250,252,.92);
  color: var(--text-1);
  font-size: .92rem;
  line-height: 1.5;
  appearance: none;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}
.form-control::placeholder { color: var(--text-3); }
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15,93,115,.12);
}
.form-control-sm,
.form-select-sm {
  min-height: 38px;
  padding-block: .42rem;
  font-size: .84rem;
  border-radius: var(--radius-sm);
}

/* Custom select arrow */
.form-select {
  padding-inline-end: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left .85rem center;
  background-size: 14px;
}

.form-label {
  display: inline-block;
  margin-bottom: .5rem;
  color: var(--text-2);
  font-size: .87rem;
  font-weight: 600;
}
.form-text {
  margin-top: .35rem;
  color: var(--text-3);
  font-size: .8rem;
}

/* Checkbox */
.form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  appearance: none;
  vertical-align: middle;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.form-check-input:checked {
  border-color: var(--primary);
  background: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23fff'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 0 1 0 1.4l-8 8a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.4L8 12.6l7.3-7.3a1 1 0 0 1 1.4 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px;
}

/* Input group */
.input-group {
  display: flex;
  align-items: stretch;
  gap: .6rem;
}
.input-group > .form-control,
.input-group > .btn { min-width: 0; }

/* ── Table ─────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}
.table tbody td,
.table thead th {
  padding: 13px 14px;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}
.table-sm thead th,
.table-sm tbody td { padding-block: .7rem; }

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
}
.table tbody tr:hover td {
  background: rgba(15,93,115,.03);
}
.table tbody tr:last-child td { border-bottom: none; }
.align-middle td, .align-middle th { vertical-align: middle; }

.row-number-head, .row-number-cell {
  text-align: center;
  width: 52px;
}
.row-number-cell { color: var(--text-3); font-weight: 600; }

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .35rem .75rem;
  border-radius: var(--radius-full);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
}
.text-bg-secondary,
.badge.bg-secondary  { color: var(--primary); background: var(--primary-soft) !important; }
.badge-status-paid   { color: var(--success); background: var(--success-soft); }
.badge-status-unpaid { color: var(--danger);  background: var(--danger-soft); }
.badge-status-pending{ color: var(--warning); background: var(--warning-soft); }
.badge-status-invoiced { color: var(--primary); background: var(--primary-soft); }

/* ── Code Inline ───────────────────────────────────────────── */
code {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: .15rem .5rem;
  border-radius: 8px;
  background: var(--primary-muted);
  color: var(--primary);
  font-size: .8rem;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
}
.modal.show { display: flex; }
body.modal-open { overflow: hidden; }

.modal-dialog {
  width: min(100%, 640px);
  max-height: calc(100vh - 40px);
  margin: auto;
}
.modal-dialog.modal-lg  { width: min(100%, 920px); }
.modal-dialog.modal-xl  { width: min(100%, 1160px); }
.modal-dialog-centered  { display: flex; align-items: center; }

.modal-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 40px);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 32px 80px rgba(0,0,0,.2);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.modal-body {
  overflow: auto;
  padding: 24px;
  flex: 1;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}

/* Close button */
.btn-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  position: relative;
  flex-shrink: 0;
  transition: background 150ms;
}
.btn-close:hover { background: var(--danger-soft); }
.btn-close::before,
.btn-close::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 2px;
  border-radius: 999px;
  background: var(--text-2);
}
.btn-close:hover::before,
.btn-close:hover::after { background: var(--danger); }
.btn-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.btn-close::after  { transform: translate(-50%,-50%) rotate(-45deg); }

/* ── Action buttons in tables ──────────────────────────────── */
.action-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-2);
  transition: all 150ms ease;
}
.action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}
.action-btn.text-primary   { color: var(--primary) !important; }
.action-btn.text-danger    { color: var(--danger) !important; }
.action-btn.text-secondary { color: var(--text-2) !important; }
.action-btn.text-info      { color: var(--info) !important; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 2.5rem 1.5rem;
  color: var(--text-3);
  text-align: center;
}
.empty-state i {
  font-size: 2rem;
  opacity: .5;
}

/* ── Mini stat ─────────────────────────────────────────────── */
.mini-stat {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.mini-stat small {
  color: var(--text-3);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.mini-stat strong {
  font-weight: 700;
}

/* ── Basic Focus Ring ─────────────────────────────────────── */
.focus-glow {
  outline: none;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.focus-glow:focus,
.focus-glow:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-soft, rgba(15,93,115,.12));
}

/* ── Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(15, 93, 115, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 93, 115, 0.40);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 93, 115, 0.25) transparent;
}

/* ── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .action-btn,
  .form-control,
  .form-select,
  .form-check-input {
    transition: none !important;
  }

  .focus-glow {
    transition: none !important;
  }
}

/* ============================================================
   2026 REDESIGN LAYER
   Cleaner admin surfaces, tighter radius, stronger readability.
   ============================================================ */
:root {
  --bg-app: #f5f7fb;
  --bg-app-alt: #edf2f7;
  --surface-1: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #edf2f7;
  --text-1: #172033;
  --text-2: #536173;
  --text-3: #7b8797;
  --primary: #2457a6;
  --primary-dark: #183f7c;
  --primary-darker: #102a55;
  --primary-soft: #e6eefc;
  --primary-muted: rgba(36, 87, 166, 0.10);
  --accent: #118568;
  --accent-dark: #0c6a54;
  --accent-soft: #e4f5ef;
  --accent-muted: rgba(17, 133, 104, 0.10);
  --success: #12804f;
  --success-soft: #e4f6ed;
  --danger: #bf3d4a;
  --danger-soft: #fde7ea;
  --warning: #b87618;
  --warning-soft: #fff1d7;
  --info: #256a9a;
  --info-soft: #e4f0f8;
  --border-soft: rgba(23, 32, 51, 0.08);
  --border-medium: rgba(23, 32, 51, 0.14);
  --border-strong: rgba(23, 32, 51, 0.22);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, .10);
  --shadow-lg: 0 18px 36px rgba(15, 23, 42, .12);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, .14);
  --shadow-dark: 0 20px 48px rgba(15, 23, 42, .18);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-2xl: 10px;
  --page-accent: var(--primary);
  --page-accent-dark: var(--primary-dark);
  --page-accent-soft: var(--primary-soft);
  --page-accent-muted: var(--primary-muted);
  --hero-bg: rgba(36, 87, 166, 0.06);
  --hero-bg-alt: rgba(17, 133, 104, 0.06);
  --hero-glow: rgba(36, 87, 166, 0.12);
}

[data-theme="dark"] {
  --bg-app: #10141d;
  --bg-app-alt: #151b26;
  --surface-1: #171d28;
  --surface-2: #1d2532;
  --surface-3: #263142;
  --text-1: #f4f7fb;
  --text-2: #bdc8d6;
  --text-3: #8794a5;
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
}

body {
  background: var(--bg-app);
  letter-spacing: 0;
}

.btn {
  min-height: 40px;
  border-radius: var(--radius-md);
  font-weight: 700;
  box-shadow: none;
}

.btn:hover {
  box-shadow: var(--shadow-sm);
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-danger {
  background-image: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-success {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
  background: var(--surface-1);
  border-color: var(--border-medium);
  backdrop-filter: none;
}

.form-control,
.form-select {
  min-height: 42px;
  border-radius: var(--radius-md);
  background-color: var(--surface-1);
  border-color: var(--border-medium);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 166, .12);
}

.table thead th {
  background: var(--surface-2);
  color: var(--text-2);
  letter-spacing: 0;
}

.table tbody td,
.table thead th {
  padding: 11px 12px;
}

.badge {
  border-radius: 6px;
  letter-spacing: 0;
}

.modal-content {
  border-radius: var(--radius-xl);
}

.action-btn {
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

/* ============================================================
   2027 LIGHT/DARK REDESIGN
   ============================================================ */
[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f5f7fb;
  --bg-app-alt: #edf2f8;
  --surface-1: rgba(255, 255, 255, 0.96);
  --surface-2: rgba(248, 250, 252, 0.96);
  --surface-3: #e9eef6;
  --surface-glass: rgba(255, 255, 255, 0.78);
  --surface-hover: #eef4fb;
  --text-1: #172033;
  --text-2: #536173;
  --text-3: #7b8797;
  --text-inv: #ffffff;
  --primary: #2457a6;
  --primary-dark: #183f7c;
  --primary-darker: #102a55;
  --primary-soft: #e6eefc;
  --primary-muted: rgba(36, 87, 166, 0.10);
  --accent: #118568;
  --accent-dark: #0c6a54;
  --accent-soft: #e4f5ef;
  --accent-muted: rgba(17, 133, 104, 0.10);
  --success: #12804f;
  --success-soft: #e4f6ed;
  --danger: #bf3d4a;
  --danger-soft: #fde7ea;
  --warning: #b87618;
  --warning-soft: #fff1d7;
  --info: #256a9a;
  --info-soft: #e4f0f8;
  --border-soft: rgba(23, 32, 51, 0.08);
  --border-medium: rgba(23, 32, 51, 0.14);
  --border-strong: rgba(23, 32, 51, 0.22);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, .07);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, .10);
  --shadow-lg: 0 22px 48px rgba(15, 23, 42, .12);
  --shadow-xl: 0 28px 64px rgba(15, 23, 42, .14);
  --shadow-dark: 0 20px 48px rgba(15, 23, 42, .18);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-2xl: 10px;
  --page-accent: var(--primary);
  --page-accent-dark: var(--primary-dark);
  --page-accent-soft: var(--primary-soft);
  --page-accent-muted: var(--primary-muted);
  --hero-bg: rgba(36, 87, 166, 0.06);
  --hero-bg-alt: rgba(17, 133, 104, 0.06);
  --hero-glow: rgba(36, 87, 166, 0.12);
}

html[data-theme="light"] {
  background: #f5f7fb;
}

html[data-theme="light"] body {
  background: var(--bg-app);
  color: var(--text-1);
}

html[data-theme="light"] .btn-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
}

html[data-theme="light"] .btn-success {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

html[data-theme="light"] .btn-warning {
  color: #ffffff;
  background: var(--warning);
  border-color: var(--warning);
  box-shadow: none;
}

html[data-theme="light"] .btn-danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: none;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] textarea.form-control {
  color: var(--text-1);
  background-color: #ffffff;
  border-color: var(--border-medium);
}

html[data-theme="light"] .form-control:focus,
html[data-theme="light"] .form-select:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 166, .12);
}

html[data-theme="light"] .modal-content,
html[data-theme="light"] .content-card,
html[data-theme="light"] .workspace-summary-card,
html[data-theme="light"] .toolbar-surface,
html[data-theme="light"] .table-responsive,
html[data-theme="light"] .workspace-table-shell,
html[data-theme="light"] .hero-metric,
html[data-theme="light"] .hero-note,
html[data-theme="light"] .kpi-card,
html[data-theme="light"] .dash-status-item,
html[data-theme="light"] .dash-top-item,
html[data-theme="light"] .dash-doc-summary-chip,
html[data-theme="light"] .dash-doc-alert-item {
  color: var(--text-1);
  background: var(--surface-1);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
  border-radius: 8px;
}

html[data-theme="light"] .table thead th {
  color: var(--text-2);
  background: var(--surface-3);
}

html[data-theme="light"] .table tbody tr:hover td {
  background: rgba(36, 87, 166, .05);
}

html[data-theme="light"] .page-eyebrow,
html[data-theme="light"] .workspace-results-pill,
html[data-theme="light"] .dashboard-period-chip {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(36, 87, 166, 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-app: #050b14;
  --bg-app-alt: #07111d;
  --surface-1: rgba(12, 21, 34, 0.94);
  --surface-2: rgba(16, 29, 46, 0.92);
  --surface-3: rgba(22, 39, 61, 0.96);
  --surface-glass: rgba(10, 19, 32, 0.76);
  --surface-hover: rgba(31, 50, 75, 0.88);
  --text-1: #f5f8fc;
  --text-2: #b7c5d8;
  --text-3: #7f90a6;
  --text-inv: #06101c;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --primary-darker: #0369a1;
  --primary-soft: rgba(56, 189, 248, 0.16);
  --primary-muted: rgba(56, 189, 248, 0.10);
  --accent: #2dd4bf;
  --accent-dark: #14b8a6;
  --accent-soft: rgba(45, 212, 191, 0.15);
  --accent-muted: rgba(45, 212, 191, 0.10);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.15);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.15);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.15);
  --border-soft: rgba(148, 163, 184, 0.14);
  --border-medium: rgba(148, 163, 184, 0.22);
  --border-strong: rgba(203, 213, 225, 0.34);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.36);
  --shadow-xl: 0 34px 78px rgba(0, 0, 0, 0.44);
  --shadow-dark: 0 28px 70px rgba(0, 0, 0, 0.44);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-2xl: 10px;
  --page-accent: var(--primary);
  --page-accent-dark: var(--primary-dark);
  --page-accent-soft: var(--primary-soft);
  --page-accent-muted: var(--primary-muted);
  --hero-bg: rgba(56, 189, 248, 0.08);
  --hero-bg-alt: rgba(45, 212, 191, 0.08);
  --hero-glow: rgba(56, 189, 248, 0.14);
}

html[data-theme="dark"] {
  background: #050b14;
}

html[data-theme="dark"] body {
  background: #050b14;
  color: var(--text-1);
}

html[data-theme="dark"] a {
  color: inherit;
}

html[data-theme="dark"] ::selection {
  color: #03111f;
  background: rgba(56, 189, 248, 0.82);
}

html[data-theme="dark"] .btn {
  min-height: 40px;
  border-radius: 8px;
  border-width: 1px;
  font-weight: 800;
  letter-spacing: 0;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-warning,
html[data-theme="dark"] .btn-danger {
  background-image: none;
  box-shadow: none;
}

html[data-theme="dark"] .btn-primary {
  color: #03111f;
  background: var(--primary);
  border-color: rgba(125, 211, 252, 0.62);
}

html[data-theme="dark"] .btn-primary:hover {
  color: #03111f;
  background: #7dd3fc;
  border-color: #bae6fd;
}

html[data-theme="dark"] .btn-success {
  color: #03170f;
  background: var(--success);
  border-color: rgba(110, 231, 183, 0.65);
}

html[data-theme="dark"] .btn-warning {
  color: #1c1202;
  background: var(--warning);
  border-color: rgba(253, 224, 71, 0.62);
}

html[data-theme="dark"] .btn-danger {
  color: #22050b;
  background: var(--danger);
  border-color: rgba(253, 164, 175, 0.62);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-danger {
  color: var(--text-1);
  background: rgba(13, 24, 39, 0.84);
  border-color: var(--border-medium);
}

html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-danger:hover {
  color: var(--text-1);
  background: rgba(23, 39, 61, 0.98);
  border-color: var(--border-strong);
}

html[data-theme="dark"] .btn-outline-primary {
  color: var(--primary);
  border-color: rgba(56, 189, 248, 0.34);
}

html[data-theme="dark"] .btn-outline-danger {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.34);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control {
  color: var(--text-1);
  background-color: rgba(5, 13, 24, 0.82);
  border-color: var(--border-medium);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .form-control::placeholder {
  color: var(--text-3);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  color: var(--text-1);
  background-color: rgba(8, 18, 31, 0.98);
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

html[data-theme="dark"] .form-label {
  color: var(--text-2);
}

html[data-theme="dark"] .form-check-input {
  background: rgba(5, 13, 24, 0.86);
  border-color: var(--border-strong);
}

html[data-theme="dark"] .table {
  color: var(--text-1);
}

html[data-theme="dark"] .table thead th {
  color: #d9e5f4;
  background: rgba(19, 34, 53, 0.98);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .table thead th {
  border-bottom-color: var(--border-soft);
}

html[data-theme="dark"] .table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.07);
}

html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .workspace-table-shell {
  background: rgba(7, 16, 28, 0.78);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] code {
  border: 1px solid rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] code {
  color: #a5f3fc;
  background: rgba(56, 189, 248, 0.12);
}

html[data-theme="dark"] .text-bg-secondary,
html[data-theme="dark"] .badge.bg-secondary {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.14) !important;
}

html[data-theme="dark"] .badge-status-paid {
  color: #bbf7d0;
  background: rgba(52, 211, 153, 0.15);
}

html[data-theme="dark"] .badge-status-unpaid {
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.15);
}

html[data-theme="dark"] .badge-status-pending {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.15);
}

html[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.68);
}

html[data-theme="dark"] .modal-content {
  color: var(--text-1);
  background: rgba(10, 18, 31, 0.98);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-xl);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  background: rgba(15, 27, 43, 0.98);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .btn-close {
  background: rgba(17, 31, 49, 0.96);
  border: 1px solid var(--border-soft);
}

html[data-theme="dark"] .action-btn {
  color: var(--text-2);
  background: rgba(10, 20, 34, 0.88);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .action-btn:hover {
  color: var(--text-1);
  background: rgba(24, 42, 65, 0.98);
  border-color: var(--border-medium);
}

html[data-theme="dark"] .mini-stat,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .workspace-summary-card,
html[data-theme="dark"] .toolbar-surface,
html[data-theme="dark"] .workspace-helper-strip,
html[data-theme="dark"] .workspace-inline-meta-item,
html[data-theme="dark"] .hero-metric,
html[data-theme="dark"] .hero-note {
  color: var(--text-1);
  background: rgba(10, 20, 34, 0.80);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .section-surface {
  background: rgba(10, 20, 34, 0.80);
}

html[data-theme="dark"] .workspace-results-pill,
html[data-theme="dark"] .page-eyebrow,
html[data-theme="dark"] .dashboard-period-chip {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.13);
  border-color: rgba(56, 189, 248, 0.24);
}

html[data-theme="dark"] .card-title i,
html[data-theme="dark"] .kpi-icon,
html[data-theme="dark"] .owners-owner-avatar {
  color: #03111f;
  background: linear-gradient(135deg, #7dd3fc, #2dd4bf);
  box-shadow: 0 12px 28px rgba(45, 212, 191, 0.18);
}

html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .dash-doc-alerts-card,
html[data-theme="dark"] .dash-doc-summary-chip,
html[data-theme="dark"] .dash-doc-alert-item,
html[data-theme="dark"] .dash-status-item,
html[data-theme="dark"] .dash-top-item,
html[data-theme="dark"] .dash-donut-inner {
  color: var(--text-1);
  background: rgba(10, 20, 34, 0.84);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .kpi-card {
  min-height: 224px;
}

html[data-theme="dark"] .kpi-card::after {
  display: none;
}

html[data-theme="dark"] .topbar-title {
  display: flex;
  align-items: center;
  min-height: 56px;
  overflow: visible;
  line-height: 1.28;
}

html[data-theme="dark"] .dash-doc-alerts-card {
  background: linear-gradient(180deg, rgba(24, 16, 28, 0.88), rgba(10, 20, 34, 0.90));
}

html[data-theme="dark"] .dash-donut {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .dash-top-item:hover {
  background: rgba(24, 42, 65, 0.98);
}

html[data-theme="dark"] .dash-bar {
  background: linear-gradient(180deg, #38bdf8, #2dd4bf);
  box-shadow: 0 14px 26px rgba(45, 212, 191, 0.16);
}

html[data-theme="dark"] .vehicle-doc-badge.muted {
  color: var(--text-2);
  background: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .owners-directory-table-wrap,
html[data-theme="dark"] .owners-driver-icon,
html[data-theme="dark"] .owners-vehicle-pill,
html[data-theme="dark"] .owners-action-btn {
  color: var(--text-2);
  background: rgba(10, 20, 34, 0.78);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .owners-action-btn:hover {
  color: var(--text-1);
  background: rgba(24, 42, 65, 0.98);
}

html[data-theme="dark"] .gen-month-picker,
html[data-theme="dark"] .gen-month-btn {
  color: var(--text-1);
  background: rgba(5, 13, 24, 0.82);
  border-color: var(--border-medium);
}

html[data-theme="dark"] .gen-month-btn:hover,
html[data-theme="dark"] .gen-month-btn.active {
  color: #03111f;
  background: var(--primary);
  border-color: rgba(125, 211, 252, 0.68);
}

html[data-theme="dark"] .page-hero-persistance,
html[data-theme="dark"] .filter-card,
html[data-theme="dark"] .kpi-card-p,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .chart-full-card,
html[data-theme="dark"] .table-toolbar-persistance,
html[data-theme="dark"] .pagination-footer-persistance {
  color: var(--text-1);
  background: rgba(10, 20, 34, 0.84);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .page-hero-persistance {
  background:
    linear-gradient(135deg, rgba(8, 18, 31, 0.98), rgba(9, 42, 55, 0.96) 58%, rgba(8, 54, 47, 0.94));
}

html[data-theme="dark"] .page-hero-persistance::after {
  display: none;
}

html[data-theme="dark"] .kpi-main-val,
html[data-theme="dark"] .kpi-sub-details span strong,
html[data-theme="dark"] .table-card-title,
html[data-theme="dark"] .chart-header h3 {
  color: var(--text-1);
}

html[data-theme="dark"] .kpi-title,
html[data-theme="dark"] .kpi-sub-details,
html[data-theme="dark"] .empty-state p {
  color: var(--text-2);
}

html[data-theme="dark"] .cursor-pointer:hover {
  background-color: rgba(56, 189, 248, 0.06);
}

html[data-theme="dark"] .swal2-popup {
  color: var(--text-1);
  background: rgba(10, 18, 31, 0.98);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
}

html[data-theme="dark"] .swal2-title {
  color: var(--text-1);
}

html[data-theme="dark"] .swal2-html-container {
  color: var(--text-2);
}

html[data-theme="dark"] .ui-loading-overlay {
  background: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .ui-skeleton,
html[data-theme="dark"] .ui-skeleton-card > div,
html[data-theme="dark"] .ui-skeleton-table-row > div,
html[data-theme="dark"] .skeleton,
html[data-theme="dark"] .skeleton-text,
html[data-theme="dark"] .skeleton-card {
  background: linear-gradient(90deg, rgba(18, 32, 50, 0.95), rgba(31, 50, 75, 0.95), rgba(18, 32, 50, 0.95));
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.38);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.48);
}

html[data-theme="dark"] * {
  scrollbar-color: rgba(56, 189, 248, 0.38) transparent;
}

@media (max-width: 767.98px) {
  html[data-theme="dark"] .btn {
    min-height: 42px;
  }
}
