/* ============================================================
   SAASAPPARC — Modern theme layer
   Loaded after main.css: overrides colors, typography and key
   components without touching the legacy stylesheet.
   ============================================================ */

@import url('../vendor/google-fonts/inter-cairo.css');
/* SR-18: Theme 2 ("modern") - every rule scoped to html[data-visual-theme="modern"]; Theme 1 (this file) unchanged. */
@import url("theme-modern.css?v=19");

:root {
  /* UX polish: AA tokens - fills carry white text at >= 4.5:1, --link is the text colour on surfaces */
  --primary: #0F766E;
  --primary-hover: #115E59;
  --primary-light: #E1F5F3;
  --link: #0F766E;
  --link-hover: #115E59;
  --on-primary: #FFFFFF;

  --secondary: #7C3AED;
  --secondary-light: #F1EAFE;

  --success: #15803D;
  --success-light: #E8F8EE;

  --danger: #C8302A;
  --danger-light: #FDEAEA;

  --warning: #B45309;
  --warning-light: #FEF3E0;

  --info: #0369A1;
  --info-light: #E5F6FE;

  --ink-900: #0F1B1A;
  --ink-700: #364240;
  --ink-500: #64726F;

  --border: #E1E8E6;
  --surface: #FFFFFF;
  --canvas: #F3F7F6;

  --sidebar-start: #0B2524;
  --sidebar-end: #0F766E;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-pop: 0 4px 12px rgba(16, 24, 40, .12);
}

/* ---------- Dark theme ---------- */
html[data-theme="dark"] {
  --primary-light: #113B37;
  --link: #2DD4BF;
  --link-hover: #5EEAD4;
  --secondary-light: #2C2049;
  --success-light: #123522;
  --danger-light: #3B1817;
  --warning-light: #3A2B0D;
  --info-light: #0E2E3B;

  --ink-900: #F1F5F4;
  --ink-700: #C7D1CE;
  --ink-500: #92A19D;

  --border: #253431;
  --surface: #16211F;
  --canvas: #0E1614;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-pop: 0 4px 16px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] body.authentication {
  background: linear-gradient(135deg, var(--sidebar-start), var(--primary)), url(../img/bg5.jpg);
}
html[data-theme="dark"] .login-screen {
  background: var(--surface);
  color: var(--ink-900);
}
html[data-theme="dark"] .header {
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] .table-container {
  background: var(--surface);
}
html[data-theme="dark"] .table {
  background: var(--surface);
  color: var(--ink-700);
}
html[data-theme="dark"] .table thead {
  background: var(--sidebar-end);
}
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
  color: var(--ink-900);
  border-color: var(--border);
}
html[data-theme="dark"] .table tbody tr:nth-of-type(even) {
  background-color: rgba(255, 255, 255, .03);
}
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, .02);
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] select.form-control,
html[data-theme="dark"] .bootstrap-select .dropdown-toggle {
  background-color: var(--canvas);
  border-color: var(--border);
  color: var(--ink-900);
}
html[data-theme="dark"] .form-control::placeholder {
  color: var(--ink-500);
}
html[data-theme="dark"] .dropdown-menu {
  background-color: var(--surface);
  border-color: var(--border);
}
html[data-theme="dark"] .dropdown-item {
  color: var(--ink-700);
}
html[data-theme="dark"] .modal-content {
  background-color: var(--surface);
  color: var(--ink-900);
}
html[data-theme="dark"] .breadcrumb .breadcrumb-item a { color: var(--ink-500); }
html[data-theme="dark"] #notificationBell .notif-header,
html[data-theme="dark"] #notificationBell .notif-footer {
  border-color: var(--border);
}
html[data-theme="dark"] #notificationBell .notif-item {
  border-color: var(--border);
}
html[data-theme="dark"] #notificationBell .notif-item:hover {
  background: rgba(255, 255, 255, .04);
}
html[data-theme="dark"] #notificationBell .notif-item.unread {
  background: rgba(13, 148, 136, .15);
}
html[data-theme="dark"] #notificationBell .notif-body .notif-time {
  color: var(--ink-500);
}

/* ---------- Theme toggle switch ---------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .08);
  transition: background .15s ease, color .15s ease;
  font-size: 1.1rem;
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, .18);
  color: #ffffff;
}
.theme-toggle-btn .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-sun1 { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: inline-block; }

html[dir="rtl"] body,
html[dir="rtl"] .btn,
html[dir="rtl"] .form-control {
  font-family: 'Cairo', 'Open Sans', sans-serif;
}

/* ---------- Base ---------- */
body {
  font-family: 'Inter', 'Open Sans', sans-serif;
  background: var(--canvas);
  color: var(--ink-900);
}

body.authentication {
  background: linear-gradient(135deg, var(--sidebar-start), var(--primary)), url(../img/bg5.jpg);
  background-blend-mode: multiply;
  background-size: cover;
  background-position: center center;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* ---------- Header ---------- */
.header {
  background: linear-gradient(90deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .12);
  margin-bottom: 0;
}
.header a.logo {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -.02em;
}
.header .user-settings .user-name { color: #ffffff; }
.header .header-actions > li > a {
  color: rgba(255, 255, 255, .85);
}
.header .header-actions > li > a i {
  color: rgba(255, 255, 255, .85);
}
.header .header-actions > li > a:hover,
.header .header-actions > li > a:hover i {
  color: #ffffff;
}
.header .quick-actions-menu .dropdown-menu {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  overflow: hidden;
}
.header .quick-actions-menu .dropdown-item {
  color: var(--ink-700);
}
.header .quick-actions-menu .dropdown-item i {
  color: var(--link);
  width: 20px;
  display: inline-block;
}
.header .quick-actions-menu .dropdown-item:hover {
  background: var(--primary-light);
  color: var(--link);
}

/* ---------- Top navigation ---------- */
.custom-navbar {
  background: linear-gradient(90deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-card);
}
.custom-navbar ul.navbar-nav li.nav-item .nav-link {
  border-radius: var(--radius-sm);
  margin: 6px 3px;
  opacity: .88;
  transition: background .15s ease, opacity .15s ease, color .15s ease;
}
.custom-navbar ul.navbar-nav li.nav-item .nav-link:hover {
  background: rgba(255, 255, 255, .14);
  color: #ffffff;
  opacity: 1;
}
.custom-navbar ul.navbar-nav li.nav-item .nav-link.active-page {
  background: rgba(255, 255, 255, .18);
  opacity: 1;
  box-shadow: inset 0 -2px 0 #ffffff;
}
.custom-navbar ul.navbar-nav ul.dropdown-menu {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  overflow: hidden;
}
.dropdown-menu .dropdown-item:hover {
  background: var(--primary-light);
  color: var(--link);
}

/* ---------- Canvas / breadcrumb ---------- */
.content-wrapper {
  background: var(--canvas);
}
.page-header .breadcrumb {
  background: transparent;
  padding-left: 0;
}
.breadcrumb .breadcrumb-item.active {
  color: var(--ink-900);
  font-weight: 600;
}
.breadcrumb .breadcrumb-item a { color: var(--ink-500); }

/* .page-header keeps its dark navy strip from main.css: force light text */
.page-header .breadcrumb .breadcrumb-item.active,
.page-header .breadcrumb .breadcrumb-item {
  color: #ffffff;
}
.page-header .breadcrumb .breadcrumb-item a {
  color: rgba(255, 255, 255, .75);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card .card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card .card-header .card-title {
  color: var(--ink-900);
  font-weight: 700;
}

/* ---------- KPI / dashboard tiles ---------- */
.hospital-tiles {
  background: var(--surface);
  color: var(--ink-900);
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 16px 18px;
}
.hospital-tiles img {
  opacity: 1;
  max-width: 22px;
  max-height: 22px;
  padding: 9px;
  margin: 0 0 .75rem 0;
  background: var(--primary);
  border-radius: var(--radius-sm);
  filter: none;
}
.hospital-tiles p {
  color: var(--ink-500);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.hospital-tiles h2 {
  color: var(--ink-900);
  font-size: 1.75rem;
  font-weight: 800;
}
.hospital-tiles.primary { background: var(--surface); border-left-color: var(--primary); }
.hospital-tiles.primary img { background: var(--primary); }
.hospital-tiles.blue { background: var(--surface); border-left-color: var(--info); }
.hospital-tiles.blue img { background: var(--info); }
.hospital-tiles.secondary { background: var(--surface); border-left-color: var(--secondary); }
.hospital-tiles.secondary img { background: var(--secondary); }
.hospital-tiles.green { background: var(--surface); border-left-color: var(--success); }
.hospital-tiles.green img { background: var(--success); }
.hospital-tiles.yellow { background: var(--surface); border-left-color: var(--warning); }
.hospital-tiles.yellow img { background: var(--warning); }
.hospital-tiles.red { background: var(--surface); border-left-color: var(--danger); }
.hospital-tiles.red img { background: var(--danger); }

/* ---------- Badges (soft style) ---------- */
.badge.badge-success {
  background: var(--success-light);
  color: var(--success);
  font-weight: 600;
}
.badge.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-info {
  background: var(--info);
  border-color: var(--info);
}
.btn-info:hover {
  filter: brightness(.92);
}

/* ---------- Login screen ---------- */
.login-screen {
  box-shadow: var(--shadow-pop);
}

/* ---------- Charts ---------- */
.bars-legend .legend-item { color: var(--ink-700); }

/* ============================================================
   Left vertical sidebar — replaces the old horizontal top nav
   bar (hover-flyout dropdowns) with a proper collapsible sidebar.
   function/menu.php renders the markup; menu_active()/menu_open()
   there decide which item/section gets the "active-page"/"show"
   classes server-side.
   ============================================================ */
:root {
  --sb-accent-soft: rgba(22, 86, 214, .28);
}

/* Targets the specific top-level container-fluid that wraps menu.php +
   .main-container on every page (body's direct child) - header.php has
   its own separate .container-fluid nested inside <header>, one level
   deeper, so it's untouched by this rule. */
body > div.container-fluid {
  display: flex;
  align-items: flex-start;
  padding: 0 !important;
}

.sidebar-nav {
  width: 260px;
  flex: 0 0 260px;
  min-height: calc(100vh - 70px);
  background: var(--sidebar-start);
  padding: 14px 0 40px 0;
  box-shadow: 2px 0 12px rgba(16, 24, 40, .08);
}
/* Bootstrap's .collapse is display:none unless .show is present - force it
   visible on desktop. Scoped to >=993px only: unscoped, this !important
   rule beat the mobile media query below (which has no !important of its
   own) regardless of source order, permanently defeating the hamburger
   toggle below 992px - confirmed live, the toggle button worked but the
   sidebar never actually collapsed. */
@media (min-width: 993px) {
  .sidebar-nav .navbar-collapse {
    display: block !important;
  }
}
.sidebar-nav .navbar-toggler {
  display: none;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-section-title {
  padding: 18px 22px 6px 22px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
}

.sidebar-item { position: relative; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .72);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-link.active-page {
  background: var(--sidebar-end);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 86, 214, .45);
}

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.sidebar-label { flex: 1 1 auto; }

.sidebar-caret {
  font-size: 1.1rem;
  transition: transform .2s ease;
  opacity: .7;
}
.sidebar-link[aria-expanded="true"] .sidebar-caret {
  transform: rotate(180deg);
}

.submenu ul {
  list-style: none;
  margin: 2px 10px 6px 10px;
  padding: 4px 0 4px 20px;
  border-left: 2px solid rgba(255, 255, 255, .1);
}

.submenu-link {
  display: block;
  padding: 8px 14px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .72);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.submenu-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #ffffff;
  text-decoration: none;
}
.submenu-link.active-page {
  background: var(--sb-accent-soft);
  color: #ffffff;
  font-weight: 700;
}

.sidebar-nav .navbar-toggler {
  margin: 0 16px 10px 16px;
}

.main-container {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 !important;
}

@media (max-width: 992px) {
  body > div.container-fluid { flex-direction: column; }
  .sidebar-nav {
    width: 100%;
    flex: 0 0 auto;
    min-height: 0;
    padding: 8px 0;
  }
  .sidebar-nav .navbar-toggler { display: inline-block; }
  .sidebar-nav .navbar-collapse:not(.show) { display: none; }
}

/* ============================================================
   PHASE I — extended dark-theme coverage (shared root-cause fix)
   Bootstrap components that ship hardcoded light colors and were
   left unreadable on the dark canvas (list groups, input add-ons,
   modals, badges, pagination, light buttons, utility bg/text).
   All rules scoped to html[data-theme="dark"] so light is untouched.
   ============================================================ */
html[data-theme="dark"] body { background: var(--canvas); color: var(--ink-900); }

/* List groups (details_setting, details_car/client/agence, dashboards) */
html[data-theme="dark"] .list-group { background: transparent; }
html[data-theme="dark"] .list-group-item {
  background-color: var(--surface);
  color: var(--ink-900);
  border-color: var(--border);
}
html[data-theme="dark"] .list-group-item-action:hover { background-color: var(--canvas); color: var(--ink-900); }

/* Upload add-ons / input groups */
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .custom-file-label,
html[data-theme="dark"] .custom-file-label::after {
  background-color: var(--canvas);
  color: var(--ink-700);
  border-color: var(--border);
}
html[data-theme="dark"] .custom-control-label { color: var(--ink-900); }

/* Modals */
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: var(--border); }
html[data-theme="dark"] .modal-title { color: var(--ink-900); }
html[data-theme="dark"] .close { color: var(--ink-900); text-shadow: none; opacity: .8; }

/* Utility overrides frequently used inline */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light { background-color: var(--surface) !important; }
html[data-theme="dark"] .text-dark { color: var(--ink-900) !important; }
html[data-theme="dark"] .text-muted { color: var(--ink-500) !important; }

/* Default (secondary) badge + light buttons */
html[data-theme="dark"] .badge-secondary,
html[data-theme="dark"] .badge-light { background-color: var(--canvas); color: var(--ink-900); }
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-lighten {
  background-color: var(--canvas);
  color: var(--ink-900);
  border-color: var(--border);
}

/* Pagination (pagination_helper markup) */
html[data-theme="dark"] .pagination .page-link {
  background-color: var(--surface);
  color: var(--ink-700);
  border-color: var(--border);
}
html[data-theme="dark"] .pagination .page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
html[data-theme="dark"] .pagination .page-item.disabled .page-link { color: var(--ink-500); background-color: var(--canvas); }

/* bordered tables + card-body text */
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered td,
html[data-theme="dark"] .table-bordered th { border-color: var(--border); }
html[data-theme="dark"] .card-body { color: var(--ink-900); }

/* Focus visibility (accessibility) */
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .bootstrap-select .dropdown-toggle:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .15rem rgba(13, 148, 136, .35);
}

/* ============================================================
   PHASE I6 — print / PDF isolation (CRITICAL).
   Printing and any print-to-PDF must NEVER inherit the dark UI:
   force a light ground and dark ink regardless of data-theme, so
   invoices/contracts never render black-on-black or with black
   backgrounds. Server-side PDF (mPDF) renders its own
   templates and does not load this file, but this protects the
   browser Print path and any print-CSS-based export.
   ============================================================ */
@media print {
  html, html[data-theme="dark"], body, html[data-theme="dark"] body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  html[data-theme="dark"] .card,
  html[data-theme="dark"] .list-group-item,
  html[data-theme="dark"] .table,
  html[data-theme="dark"] .modal-content {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #cccccc !important;
  }
}

/* ============================================================
   SR-3 — dark-theme contrast fixes for components that ship their
   own hardcoded light colors (jQuery-steps wizard, profile
   dropdown, notifications dropdown). Central; scoped to dark.
   ============================================================ */
/* jQuery-steps wizard (add_car / edit_car): the .content surface is
   hardcoded near-white, so themed light labels became invisible on it. */
html[data-theme="dark"] .wizard > .content,
html[data-theme="dark"] .wizard .content {
  background: var(--surface);
  color: var(--ink-900);
}
html[data-theme="dark"] .wizard .content .body label { color: var(--ink-700); }
html[data-theme="dark"] .wizard .content .body input,
html[data-theme="dark"] .wizard .content .body textarea { color: var(--ink-900); }
html[data-theme="dark"] .wizard > .steps a,
html[data-theme="dark"] .wizard > .steps a:hover,
html[data-theme="dark"] .wizard > .steps a:active { color: var(--ink-500); }
html[data-theme="dark"] .wizard > .steps .current a,
html[data-theme="dark"] .wizard > .steps .current a:hover { color: #ffffff; }
html[data-theme="dark"] .wizard > .steps .done a { color: var(--ink-700); }
html[data-theme="dark"] .wizard > .actions a { color: #ffffff; }

/* Profile dropdown (function/header.php: .header-profile-actions) */
html[data-theme="dark"] .header-profile-actions { background: var(--surface); }
html[data-theme="dark"] .header-user-profile h5,
html[data-theme="dark"] .header-profile-actions h5 { color: var(--ink-900); }
html[data-theme="dark"] .header-profile-actions a { color: var(--ink-700); }
html[data-theme="dark"] .header-profile-actions a:hover { background: var(--canvas); color: var(--link); }
html[data-theme="dark"] .user-settings .user-name { color: #ffffff; }

/* Notifications dropdown (#notificationBell) */
html[data-theme="dark"] .notif-header span,
html[data-theme="dark"] .notif-title,
html[data-theme="dark"] #notificationList .notif-item,
html[data-theme="dark"] #notificationList .notif-item a { color: var(--ink-900); }
html[data-theme="dark"] .notif-time,
html[data-theme="dark"] .notif-empty,
html[data-theme="dark"] .notif-body .notif-text { color: var(--ink-500); }
html[data-theme="dark"] .notif-header a,
html[data-theme="dark"] .notif-footer a { color: var(--link); }

/* SR-3: remaining form controls on dark (custom-select, disabled, file). */
html[data-theme="dark"] select.custom-select,
html[data-theme="dark"] .custom-select {
  background-color: var(--surface);
  color: var(--ink-900);
  border-color: var(--border);
}
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .custom-select:disabled {
  background-color: var(--canvas);
  color: var(--ink-500);
  border-color: var(--border);
}
/* SR-14 HOTFIX 3: on dark a disabled field had the same background as an editable one -
   make it read as not editable (light keeps Bootstrap's grey background). */
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .custom-select:disabled { opacity: .55; }
.form-control:disabled, .custom-select:disabled { cursor: not-allowed; }
html[data-theme="dark"] .wizard .content .body { background: transparent; }

/* ============================================================
   SR7-04 — vehicle wizard (add_car / edit_car) step labels and the
   PDF/image upload boxes (.upload, also add_accident) + native file
   inputs. Root cause: .upload is hardcoded #FFFFFF (upload_multiple.css)
   while the SR-3 dark rule turns wizard input text near-white, and the
   jQuery-steps header/footer strips stay #f1f6fb in dark, under light
   (or white) step labels. Central, component-scoped, both themes.
   ============================================================ */
/* Light: step labels on the #f1f6fb strip reach >= 4.5:1. The "html" prefix
   out-ranks vendor/wizard/jquery.steps.css, which pages load AFTER theme.css. */
html .wizard > .steps .disabled a,
html .wizard > .steps .disabled a:hover,
html .wizard > .steps .disabled a:active { color: #56607a; }
html .wizard > .steps .done a,
html .wizard > .steps .done a:hover,
html .wizard > .steps .done a:active { color: #15803d; }
html .wizard > .steps > ul > li a .number { color: #56607a; }
html .wizard > .steps > ul > li.done a .number { background: #15803d; border-color: #15803d; }
html .wizard > .steps > ul > li.current a .number,
html .wizard > .steps > ul > li.done a .number { color: #ffffff; }

/* Upload box + native file input: visible focus, disabled and error states. */
html .upload:focus-within { border-color: var(--primary); }
input[type="file"]:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
input[type="file"]:disabled { cursor: not-allowed; opacity: .65; }
html .wizard .content .body input[type="file"].error { border: 1px solid #b42318; }

/* Dark: wizard strips, numbers, action buttons. */
html[data-theme="dark"] .wizard > .steps,
html[data-theme="dark"] .wizard > .actions { background: var(--canvas); }
html[data-theme="dark"] .wizard > .steps .disabled a,
html[data-theme="dark"] .wizard > .steps .disabled a:hover,
html[data-theme="dark"] .wizard > .steps .disabled a:active { color: var(--ink-500); }
html[data-theme="dark"] .wizard > .steps .current a,
html[data-theme="dark"] .wizard > .steps .current a:hover,
html[data-theme="dark"] .wizard > .steps .current a:active { color: var(--ink-900); }
html[data-theme="dark"] .wizard > .steps .done a,
html[data-theme="dark"] .wizard > .steps .done a:hover,
html[data-theme="dark"] .wizard > .steps .done a:active { color: #4ade80; }
html[data-theme="dark"] .wizard > .steps > ul > li a .number {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink-700);
}
html[data-theme="dark"] .wizard > .steps > ul > li.current a .number {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}
html[data-theme="dark"] .wizard > .steps > ul > li.done a .number {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}
html[data-theme="dark"] .wizard > .actions .disabled a,
html[data-theme="dark"] .wizard > .actions .disabled a:hover,
html[data-theme="dark"] .wizard > .actions .disabled a:active {
  background: var(--border);
  color: var(--ink-500);
}
html[data-theme="dark"] .wizard > .content > .body label.error { color: #fca5a5; }
/* vendor input.error paints a light-pink field: light text on it was unreadable */
html[data-theme="dark"] .wizard > .content > .body input.error {
  background: var(--danger-light);
  border: 1px solid #f87171;
  color: var(--ink-900);
}

/* Dark: upload boxes, previews and every native file input. */
html[data-theme="dark"] .upload {
  background: var(--canvas);
  border-color: var(--ink-500);
  color: var(--ink-900);
}
html[data-theme="dark"] .upload:focus-within { border-color: var(--primary); }
html[data-theme="dark"] .upload__description { color: var(--ink-500); }
html[data-theme="dark"] .preview { background: var(--surface); color: var(--ink-900); }
html[data-theme="dark"] .preview__thumb { background: var(--canvas); border-color: var(--border); }
html[data-theme="dark"] input[type="file"] { color: var(--ink-900); background-color: transparent; }
html[data-theme="dark"] input[type="file"].form-control { background-color: var(--surface); border-color: var(--border); }
html[data-theme="dark"] input[type="file"]::file-selector-button {
  background: var(--surface);
  color: var(--ink-900);
  border: 1px solid var(--ink-500);
  border-radius: 4px;
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
}
html[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  background: var(--surface);
  color: var(--ink-900);
  border: 1px solid var(--ink-500);
  border-radius: 4px;
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
}
html[data-theme="dark"] input[type="file"]:hover::file-selector-button { background: var(--primary-light); border-color: var(--primary); }
html[data-theme="dark"] input[type="file"]:hover::-webkit-file-upload-button { background: var(--primary-light); border-color: var(--primary); }
html[data-theme="dark"] input[type="file"]:disabled { color: var(--ink-500); }
html[data-theme="dark"] input[type="file"]:disabled::file-selector-button { background: var(--canvas); color: var(--ink-500); border-color: var(--border); cursor: not-allowed; }
html[data-theme="dark"] input[type="file"]:disabled::-webkit-file-upload-button { background: var(--canvas); color: var(--ink-500); border-color: var(--border); cursor: not-allowed; }

/* ============================================================
   SR-10 — shared app shell: footer placement + language switcher
   ============================================================ */
/* Footer. function/footer.php is included by every page as the THIRD child of
   the sidebar flex row (body > div.container-fluid: .sidebar-nav | .main-container
   | .main-footer), so it rendered as an extra column pinned to the top-right
   ("© Company 2026" beside the dashboard). On desktop the shell becomes a
   2-column grid: the sidebar spans the full height, the footer takes its own row
   UNDER the main content - after the content on long pages, at the bottom of the
   viewport on short ones (no fixed / absolute positioning). Mobile (<= 992px)
   keeps the existing flex column, where the footer already comes last. Grid
   columns follow the document direction, so RTL mirrors automatically. */
@media (min-width: 993px) {
  body > div.container-fluid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: start;
    min-height: calc(100vh - 70px);
  }
  body > div.container-fluid > .sidebar-nav { grid-column: 1; grid-row: 1 / span 2; align-self: stretch; }
  body > div.container-fluid > .main-container { grid-column: 2; grid-row: 1; }
  body > div.container-fluid > .main-footer { grid-column: 2; grid-row: 2; }
}
/* Mobile (<= 992px): the shell is a flex COLUMN whose align-items:flex-start let
   .main-container size itself to its widest content (e.g. 513px on a 390px
   phone), widening the whole page. Stretch the shell's children to the screen
   width instead - wide tables then scroll inside their .table-responsive box.
   The same minimum height as desktop lets .main-container (flex: 1 1 auto)
   absorb the spare space, so on a short page the footer sits at the bottom
   of the screen instead of floating mid-screen. */
@media (max-width: 992px) {
  body > div.container-fluid { align-items: stretch; min-height: calc(100vh - 70px); }
  body > div.container-fluid > .main-container { width: auto; max-width: 100%; }
}
/* Legacy pages whose own markup closes the shell early (a surplus </div> in the
   page body) end up with the footer either inside .main-container or directly
   under <body>, after the whole shell. Same look there; under <body> on desktop
   it is shifted past the 260px sidebar column so it lines up with the content
   (margin-inline-start mirrors for RTL; rule placed after the block below). */
body > div.container-fluid > .main-footer,
body > div.container-fluid > .main-container > .main-footer,
body > .main-footer {
  background: transparent;
  color: var(--ink-500);
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin: 1.5rem 1.3rem 0;
  padding: .9rem 0 1.1rem;
  font-size: .78rem;
  text-align: center;
  width: auto;
}
@media (min-width: 993px) {
  body > .main-footer { margin-inline-start: calc(260px + 1.3rem); }
}

/* Language switcher: function/language_selector.php ships its own light-only
   style block (#f8f9fa buttons, #ddd borders, #e9ecef hover) that stayed white
   in dark mode. Dark theme via the shared tokens, the active language stays
   distinct, and keyboard focus is visible in both themes. The html[data-theme]
   prefix out-ranks the component's own two-class selectors. */
html[data-theme="dark"] .language-selector .lang-btn {
  background: var(--surface);
  color: var(--ink-900);
  border-color: var(--border);
}
html[data-theme="dark"] .language-selector .lang-btn:hover {
  background: var(--primary-light);
  color: var(--ink-900);
}
html[data-theme="dark"] .language-selector .lang-btn.active,
html[data-theme="dark"] .language-selector .lang-btn.active:hover {
  /* light teal chip: stands out from both the dark buttons and the teal header */
  background: #5eead4;
  border-color: #5eead4;
  color: #0B2524;
}
.language-selector .lang-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  position: relative;
  z-index: 1;
}
html[data-theme="dark"] .language-selector .lang-btn:focus-visible { outline-color: #5eead4; }

/* Status badges (contract / reservation states): text contrast >= 4.5:1 (WCAG AA)
   in both themes. Same design - success / danger keep the soft tint (darker ink
   in light, lighter ink in dark), info / warning stay solid with white text on a
   deeper shade (#0EA5E9 / #F59E0B with white measured 2.8 / 2.2). */
.badge.badge-success { color: #166534; }
.badge.badge-danger { color: #B42318; }
.badge.badge-info { background: #0369A1; color: #ffffff; }
.badge.badge-warning { background: #B45309; color: #ffffff; }
html[data-theme="dark"] .badge.badge-success { color: #4ADE80; }
html[data-theme="dark"] .badge.badge-danger { color: #FCA5A5; }

/* Arabic (RTL): the jQuery Steps wizard (add_car.php / edit_car.php, vendor/wizard/
   jquery.steps.css) hides its screen-reader labels with left:-999em. In an RTL page the
   scroll origin is the right edge, so that off-screen-left text became a ~24000px
   horizontal scroll. Mirror it to the right (not scrollable in RTL); same a11y intent. */
html[dir="rtl"] .wizard > .steps .current-info,
html[dir="rtl"] .tabcontrol > .steps .current-info,
html[dir="rtl"] .wizard > .content > .title,
html[dir="rtl"] .tabcontrol > .content > .title { left: auto; right: -999em; }

/* ============================================================
   SR-11 - overdue returns list (dashboard) + vehicle profitability page
   ============================================================ */
/* Overdue returns: compact rows on the theme surfaces (no raw grey blocks), most
   overdue first; logical properties so Arabic (RTL) mirrors automatically. */
.overdue-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.overdue-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
  margin-bottom: .45rem;
  color: var(--ink-900);
}
.overdue-head { display: flex; align-items: center; gap: .45rem; }
.overdue-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--danger-light); color: #B42318; font-weight: 700; font-size: .75rem;
}
html[data-theme="dark"] .overdue-icon { color: #FCA5A5; }
.overdue-num { font-weight: 600; font-size: .85rem; overflow-wrap: anywhere; }
.overdue-days { margin-inline-start: auto; white-space: nowrap; }
.overdue-meta { font-size: .8rem; color: var(--ink-700); margin-top: .15rem; overflow-wrap: anywhere; }
.overdue-plate { color: var(--ink-500); font-size: .75rem; }
.overdue-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .3rem; font-size: .78rem; color: var(--ink-700); }
.overdue-link { padding: .1rem .55rem; font-size: .75rem; }
.overdue-all { display: inline-block; font-size: .8rem; font-weight: 600; margin-top: .1rem; }

/* Vehicle profitability (stat_vehicule.php) */
.fin-kpi {
  background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .75rem; height: 100%;
}
.fin-kpi-label { font-size: .75rem; color: var(--ink-500); }
.fin-kpi-value { font-size: 1.05rem; font-weight: 700; color: var(--ink-900); overflow-wrap: anywhere; }
.fin-num { text-align: end; white-space: nowrap; }
.fin-table td, .fin-table th { vertical-align: middle; }
.fin-total th, .fin-total td { border-top: 2px solid var(--border); }
.fin-h { font-size: .85rem; font-weight: 700; color: var(--ink-700); margin: .25rem 0 .5rem; }
.fin-pos { color: #166534; }
.fin-neg { color: #B42318; }
html[data-theme="dark"] .fin-pos { color: #4ADE80; }
html[data-theme="dark"] .fin-neg { color: #FCA5A5; }
.fin-declared { background: var(--warning-light); border-radius: var(--radius-sm); padding: .5rem .75rem; color: var(--ink-900); }
.fin-chart { min-height: 300px; }
.fin-period-note { font-size: .75rem; }

/* SR-12: readable notices (the legacy .alert-* use white text on saturated fills, < 4.5:1) */
.app-notice { display: block; padding: .7rem 1rem; border: 1px solid; border-radius: 6px; font-size: .875rem; line-height: 1.45; margin-bottom: 1rem; }
.app-notice a { color: inherit; font-weight: 600; text-decoration: underline; }
.app-notice ul { padding-left: 1.1rem; }
[dir="rtl"] .app-notice ul { padding-left: 0; padding-right: 1.1rem; }
.app-notice-warning { background: #FFF7E6; color: #7A4B00; border-color: #F5C26B; }
.app-notice-info { background: #E8F4FD; color: #0B4A6F; border-color: #9CCDF0; }
.app-notice-success { background: #E9F7EF; color: #14532D; border-color: #9FD8B5; }
.app-notice-danger { background: #FDECEC; color: #8A1C17; border-color: #F2A9A5; }
[data-theme="dark"] .app-notice-warning { background: #2E2310; color: #F6D38E; border-color: #6B5020; }
[data-theme="dark"] .app-notice-info { background: #0F2A3A; color: #A9D8F5; border-color: #1F5673; }
[data-theme="dark"] .app-notice-success { background: #0F2A1C; color: #A7E3BE; border-color: #1F5C3A; }
[data-theme="dark"] .app-notice-danger { background: #3A1414; color: #F5B5B1; border-color: #7A2A26; }
/* SR-12: vehicle expense ledger + stat1 export buttons */
.stat1-exports .btn-group { margin: 0 .5rem .5rem 0; }
[dir="rtl"] .stat1-exports .btn-group { margin: 0 0 .5rem .5rem; }
.vexp-types .vexp-type-total { font-size: .8rem; font-weight: 500; margin: 0 .35rem .35rem 0; padding: .4rem .6rem; }
[dir="rtl"] .vexp-types .vexp-type-total { margin: 0 0 .35rem .35rem; }
.vexp-total { font-weight: 600; }
.vexp-actions .btn { min-width: 8rem; }
.vexp-car-note { font-size: .85rem; margin-bottom: 1rem; }
[data-theme="dark"] .vexp-types .vexp-type-total { background: #1d2a28; color: #C7D1CE; border: 1px solid #2c3d3a; }
@media (max-width: 575.98px) {
  #vexpTable td, #vexpTable th { font-size: .8rem; }
  .vexp-actions .btn { width: 100%; }
}

/* SR-13: document appearance gallery (edit_document_settings.php) */
.doctpl-intro { max-width: 60rem; }
.doctpl-option { display: block; cursor: pointer; margin: 0; border: 2px solid #E1E8E6; border-radius: 8px; overflow: hidden; background: #FFFFFF; transition: border-color .15s, box-shadow .15s; }
.doctpl-option:hover { border-color: #99D5CE; }
.doctpl-option.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, .18); }
.doctpl-option.is-locked { cursor: not-allowed; }
.doctpl-thumb { position: relative; display: block; height: 250px; overflow: hidden; background: #FFFFFF; border-bottom: 1px solid #E1E8E6; }
.doctpl-thumb iframe { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; border: 0; transform-origin: 0 0; transform: scale(.36); pointer-events: none; background: #FFFFFF; }
[dir="rtl"] .doctpl-thumb iframe { left: auto; right: 0; transform-origin: 100% 0; }
.doctpl-lock { position: absolute; left: 0; right: 0; bottom: 0; padding: .45rem .75rem; background: rgba(17, 24, 39, .82); color: #FFFFFF; font-size: .8rem; font-weight: 600; }
.doctpl-option.is-locked .doctpl-thumb iframe { opacity: .55; }
.doctpl-meta { display: block; padding: .7rem .8rem; }
.doctpl-meta input[type=radio] { margin-right: .4rem; vertical-align: middle; }
[dir="rtl"] .doctpl-meta input[type=radio] { margin-right: 0; margin-left: .4rem; }
.doctpl-name { font-weight: 600; color: #1F2937; vertical-align: middle; }
.doctpl-default { margin: 0 .35rem; vertical-align: middle; }
.doctpl-desc { display: block; margin-top: .3rem; font-size: .82rem; color: #4B5563; }
.doctpl-plans { display: block; margin-top: .35rem; font-size: .8rem; color: #7A4B00; }
.doctpl-preview-link { display: inline-block; margin-top: .35rem; font-size: .82rem; }
[data-theme="dark"] .doctpl-option { background: #16211F; border-color: #2C3D3A; }
[data-theme="dark"] .doctpl-option.is-selected { border-color: #2DD4BF; box-shadow: 0 0 0 3px rgba(45, 212, 191, .2); }
[data-theme="dark"] .doctpl-thumb { border-bottom-color: #2C3D3A; }
[data-theme="dark"] .doctpl-name { color: #E5ECEA; }
[data-theme="dark"] .doctpl-desc { color: #B5C2BF; }
[data-theme="dark"] .doctpl-plans { color: #F6D38E; }
@media (max-width: 575.98px) { .doctpl-thumb { height: 300px; } }

/* ===== SR-16 Rental operations (document checks, contract operations, timeline) ===== */
.ro-doc-panel { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ro-doc-title { font-weight: 600; color: var(--ink-900); margin-bottom: 6px; }
.ro-doc-list { list-style: none; margin: 0 0 8px; padding: 0; }
.ro-issue { padding: 6px 10px; border-radius: var(--radius-sm); margin-bottom: 4px; font-size: .92rem; overflow-wrap: anywhere; }
.ro-issue-block { background: var(--danger-light); color: var(--danger); }
.ro-issue-confirm { background: var(--warning-light); color: #92400E; }
.ro-issue-warn { background: var(--info-light); color: #075985; }
[data-theme="dark"] .ro-issue-confirm { color: #F6D38E; }
[data-theme="dark"] .ro-issue-warn { color: #9BD8F5; }
[data-theme="dark"] .ro-issue-block { color: #F5A8A4; }
.ro-doc-ack .form-check-input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; }
.ro-doc-ack .form-check-label { padding-left: .35rem; }
.ro-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-card); margin-bottom: 16px; }
.ro-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ro-card-title { font-weight: 600; color: var(--ink-900); margin: 0; }
.ro-card-body { padding: 12px 16px; }
.ro-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ro-actions .btn { min-height: 44px; }
.ro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ro-fact { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px; min-width: 0; }
.ro-fact-label { font-size: .78rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: .02em; }
.ro-fact-value { font-weight: 600; color: var(--ink-900); overflow-wrap: anywhere; }
.ro-badge-est { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--warning-light); color: #92400E; }
[data-theme="dark"] .ro-badge-est { color: #F6D38E; }
.ro-table { width: 100%; border-collapse: collapse; }
.ro-table th, .ro-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.ro-table th { font-size: .78rem; color: var(--ink-500); font-weight: 600; }
.ro-timeline { list-style: none; margin: 0; padding: 0; }
.ro-timeline li { position: relative; padding: 4px 0 10px 22px; border-inline-start: 2px solid var(--border); margin-inline-start: 6px; }
[dir="rtl"] .ro-timeline li { padding: 4px 22px 10px 0; }
.ro-timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.ro-timeline .ro-when { font-size: .8rem; color: var(--ink-500); }
.ro-modal-form .form-control, .ro-modal-form select { min-height: 44px; }
.ro-compare td.ro-diff { color: var(--danger); font-weight: 600; }
.ro-msg { margin-top: 8px; }
@media (max-width: 575.98px) {
  .ro-card-head, .ro-card-body { padding: 10px 12px; }
  .ro-actions .btn { flex: 1 1 100%; }
  .ro-table thead { display: none; }
  .ro-table tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .ro-table td { display: block; border: 0; padding: 2px 4px; }
  .ro-table td[data-label]::before { content: attr(data-label) " : "; color: var(--ink-500); font-size: .8rem; }
}

/* ==========================================================================
   SR-17 - UX intelligence & fleet experience. Colours come from the theme
   tokens above (dark mode follows them); logical properties / [dir=rtl]
   overrides keep the Arabic layout mirrored; phone rules at the end.
   ========================================================================== */

/* Priority chip (notifications, operations centre) */
.ux-prio { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.ux-prio-critical { background: var(--danger-light); color: #B42318; }
.ux-prio-warning { background: var(--warning-light); color: #92400E; }
.ux-prio-info { background: var(--info-light); color: #075985; }
html[data-theme="dark"] .ux-prio-critical { color: #FCA5A5; }
html[data-theme="dark"] .ux-prio-warning { color: #FCD34D; }
html[data-theme="dark"] .ux-prio-info { color: #7DD3FC; }

/* Shell: avatar + profile panel */
.ux-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em; flex: 0 0 auto; }
.ux-avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
.ux-profile-menu { min-width: 280px; padding: 0 0 6px; }
.ux-profile-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.ux-profile-id { min-width: 0; color: var(--ink-900); overflow-wrap: anywhere; }
.ux-profile-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; padding: 10px 16px; font-size: .8rem; }
.ux-profile-facts dt { color: var(--ink-500); font-weight: 500; }
.ux-profile-facts dd { margin: 0; color: var(--ink-900); overflow-wrap: anywhere; }
.ux-profile-shortcuts { border-top: 1px solid var(--border); padding-top: 4px; }

/* Global search results (the dropdown itself is positioned in function/header.php) */
#elGlobalSearchResults { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-pop); }
#elGlobalSearchResults .dropdown-header { color: var(--ink-500); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
#elGlobalSearchResults .gs-item { white-space: normal; color: var(--ink-900); }
#elGlobalSearchResults .gs-item:hover, #elGlobalSearchResults .gs-item.active, #elGlobalSearchResults .gs-item:focus { background: var(--primary-light); color: var(--ink-900); }
.gs-label { font-weight: 600; }
.gs-sub { font-size: .75rem; }
html[dir="rtl"] #elGlobalSearchResults { left: auto; right: 0; }
html[dir="rtl"] #elGlobalSearchWrapper { margin-right: 0; margin-left: 8px; }

/* Notification bell 2.0 + history */
.notif-type { display: block; font-size: .7rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: .03em; }
.notif-prio-critical .notif-icon-circle { background: var(--danger-light); color: var(--danger); }
.notif-prio-warning .notif-icon-circle { background: var(--warning-light); color: #B45309; }
.notif-prio-info .notif-icon-circle { background: var(--info-light); color: var(--info); }
.notif-cond { display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; font-size: .7rem; }
.notif-cond-active { background: var(--warning-light); color: #92400E; }
.notif-cond-resolved { background: var(--success-light); color: #166534; }
html[data-theme="dark"] .notif-cond-active { color: #FCD34D; }
html[data-theme="dark"] .notif-cond-resolved { color: #86EFAC; }
.ux-filters label { color: var(--ink-700); }
.ux-table td { vertical-align: middle; }
.ux-table tr.ux-unread td { font-weight: 600; }
.ux-table tr.ux-unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
html[dir="rtl"] .ux-table tr.ux-unread td:first-child { box-shadow: inset -3px 0 0 var(--primary); }
.ux-notif-link { color: var(--ink-900); }
.ux-anchor-row:target { background: var(--primary-light); }
.ux-anchor-row:target td { background: transparent; }

/* Operations centre 2.0 (+ data quality, which reuses the item list) */
.oc-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.oc-stat { display: flex; flex-direction: column; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); color: var(--ink-900); text-decoration: none; border-inline-start: 4px solid var(--border); }
.oc-stat:hover, .oc-stat:focus { text-decoration: none; color: var(--ink-900); background: var(--canvas); }
.oc-stat-urgent { border-inline-start-color: var(--danger); }
.oc-stat-today { border-inline-start-color: var(--warning); }
.oc-stat-upcoming { border-inline-start-color: var(--info); }
.oc-stat-watch { border-inline-start-color: var(--ink-500); }
.oc-stat-n { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.oc-stat-l { font-size: .8rem; color: var(--ink-500); }
.oc-quiet { display: flex; align-items: center; gap: 8px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-md); background: var(--success-light); color: #166534; font-weight: 600; }
html[data-theme="dark"] .oc-quiet { color: #86EFAC; }
.oc-empty { color: var(--ink-500); margin: 0; font-size: .85rem; }
.oc-family + .oc-family { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.oc-family-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink-900); margin: 0 0 6px; }
.oc-items { list-style: none; margin: 0; padding: 0; }
.oc-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.oc-item:last-child { border-bottom: 0; }
.oc-item-text { min-width: 0; overflow-wrap: anywhere; }
.oc-item-main { font-weight: 600; color: var(--ink-900); }
.oc-item-sub { color: var(--ink-500); font-size: .8rem; }
.oc-action { flex: 0 0 auto; white-space: nowrap; }
.dq-issue .ro-card-title { font-size: .95rem; }

/* Company profile (details_setting.php) */
.cp-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cp-title { font-size: 1.15rem; font-weight: 700; color: var(--ink-900); margin: 0; overflow-wrap: anywhere; }
.cp-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 12px 14px; }
.cp-card-title { font-size: .85rem; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 8px; }
.cp-fields { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 4px 10px; margin: 0; font-size: .85rem; }
.cp-fields dt { color: var(--ink-500); font-weight: 500; }
.cp-fields dd { margin: 0; color: var(--ink-900); overflow-wrap: anywhere; }
.cp-fields dd.cp-missing { font-style: italic; }

/* Vehicle catalog (add / edit car) */
.vc-model-image { margin: 0; max-width: 220px; }
.vc-model-image img { display: block; width: 100%; height: auto; max-height: 140px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--canvas); }
.postal-lookup { font-size: .8rem; }
.postal-lookup-note { color: var(--danger) !important; }

/* Analytics 2.0 (stat2.php) */
.an-page .fin-kpis .col-xl { min-width: 150px; }
.an-sort label { color: var(--ink-700); }
.an-util { display: inline-block; vertical-align: middle; width: 48px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-inline-end: 4px; }
.an-util-bar { display: block; height: 100%; background: var(--success); }
html[dir="rtl"] .an-util-bar { margin-left: auto; }
.an-parts { white-space: nowrap; }
.an-notes div + div { margin-top: 2px; }
#anTable th { white-space: nowrap; }
/* the visually-hidden action labels are position:absolute - keep them inside the scrolling table (no page overflow) */
#anVehicles .table-responsive, .ux-table-wrap { position: relative; }

@media (max-width: 767.98px) {
  .oc-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-fields { grid-template-columns: 1fr; }
  .cp-fields dd { margin-bottom: 4px; }
}
@media (max-width: 575.98px) {
  .oc-item { flex-wrap: wrap; }
  .oc-action { width: 100%; }
  .ux-profile-menu { min-width: 0; width: calc(100vw - 32px); max-width: 320px; }
  .ux-table thead { display: none; }
  .ux-table tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .ux-table td { display: block; border: 0; padding: 2px 4px; }
  .ux-table td[data-label]::before { content: attr(data-label) " : "; color: var(--ink-500); font-size: .8rem; }
}

/* ==========================================================================
   SR-18 - governance, activity, operations centre 3.0, vehicle cards, theme picker.
   Token-based (works in Theme 1 and Theme 2, light / dark); logical properties for RTL.
   ========================================================================== */
.gov-page .card, .gov-section { margin-bottom: 16px; }
.gov-h { font-size: 1rem; font-weight: 700; color: var(--ink-900); margin: 0 0 12px; }
.gov-lead { max-width: 70ch; }
.gov-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.gov-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gov-kpis { display: flex; flex-wrap: wrap; gap: 10px; }
.gov-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 120px; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--ink-900); text-decoration: none; box-shadow: var(--shadow-card); }
.gov-kpi:hover, .gov-kpi:focus { text-decoration: none; color: var(--ink-900); background: var(--canvas); }
.gov-kpi.is-current { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.gov-kpi-n { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.gov-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.gov-badge-success { background: var(--success-light); color: #166534; }
.gov-badge-warning { background: var(--warning-light); color: #92400E; }
.gov-badge-info { background: var(--info-light); color: #075985; }
.gov-badge-muted { background: var(--canvas); color: var(--ink-500); border-color: var(--border); }
.gov-badge-tier, .gov-badge-action, .gov-badge-floor { background: var(--canvas); color: var(--ink-700); border-color: var(--border); }
.gov-tier-super_admin { background: var(--accent-light, var(--canvas)); color: var(--ink-900); border-color: var(--ink-500); }
.gov-risk-sensitive { background: var(--warning-light); color: #92400E; }
.gov-risk-critical { background: var(--danger-light); color: #991B1B; }
html[data-theme="dark"] .gov-badge-success { color: #86EFAC; }
html[data-theme="dark"] .gov-badge-warning, html[data-theme="dark"] .gov-risk-sensitive { color: #FCD34D; }
html[data-theme="dark"] .gov-badge-info { color: #7DD3FC; }
html[data-theme="dark"] .gov-risk-critical { color: #FCA5A5; }
.gov-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gov-person > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.gov-table td { vertical-align: middle; }
.gov-row-actions .btn { margin-block: 2px; }
.gov-pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; padding: 10px; }
.gov-empty { text-align: center; padding: 32px 16px; color: var(--ink-500); }
.gov-empty i { font-size: 2rem; display: block; margin-bottom: 8px; color: var(--ink-500); }
.gov-quiet { color: #166534; font-weight: 600; display: flex; align-items: center; gap: 6px; }
html[data-theme="dark"] .gov-quiet { color: #86EFAC; }
.gov-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.gov-grid-rights { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gov-grid-roles { grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); }
.gov-side { display: grid; gap: 16px; }
.gov-section .gov-msg { margin-bottom: 12px; }
.gov-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.gov-identity .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.gov-identity-main { flex: 1 1 280px; min-width: 0; }
.gov-identity-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.gov-identity-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gov-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: .85rem; }
.gov-facts dt { color: var(--ink-500); font-weight: 500; }
.gov-facts dd { margin: 0; color: var(--ink-900); overflow-wrap: anywhere; }
.gov-effective dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); margin-top: 10px; }
.gov-effective dd { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gov-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--canvas); border: 1px solid var(--border); font-size: .8rem; color: var(--ink-900); }
.gov-flags .gov-flag { padding: 4px 0; }
.gov-flag.is-locked label, .gov-matrix-code.is-locked label { color: var(--ink-500); }
.gov-code-lock { font-size: .72rem; color: var(--ink-500); font-style: italic; }
.gov-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.gov-matrix-module { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; background: var(--surface); }
.gov-matrix-module legend { width: auto; font-size: .85rem; font-weight: 700; color: var(--ink-900); padding: 0 6px; margin: 0; }
.gov-matrix-codes { list-style: none; margin: 0; padding: 0; }
.gov-matrix-code { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px dashed var(--border); }
.gov-matrix-code:first-child { border-top: 0; }
.gov-matrix-code input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.gov-matrix-code label { display: flex; flex-direction: column; gap: 3px; margin: 0; cursor: pointer; }
.gov-code-label { font-weight: 600; color: var(--ink-900); }
.gov-code-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.gov-code-deps { font-size: .72rem; color: var(--ink-500); }
.gov-matrix-code.is-above-tier .gov-code-label::after { content: " *"; color: var(--danger); }
.gov-role-list { list-style: none; margin: 0; padding: 0 0 8px; }
.gov-role-item a { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; color: var(--ink-900); text-decoration: none; border-inline-start: 3px solid transparent; }
.gov-role-item a:hover { background: var(--canvas); text-decoration: none; }
.gov-role-item.is-current a { border-inline-start-color: var(--primary); background: var(--primary-light); }
.gov-role-item.is-inactive strong { color: var(--ink-500); text-decoration: line-through; }
.gov-role-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gov-signals { margin: 0 0 8px; padding-inline-start: 18px; }
.gov-signals li { color: var(--ink-900); padding: 2px 0; }
.gov-signals li i { color: var(--warning); }

/* activity timeline / feed */
.act-timeline, .act-feed { list-style: none; margin: 0; padding: 0; }
.act-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.act-item:first-child { border-top: 0; }
.act-icon { flex: 0 0 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--canvas); color: var(--ink-700); border: 1px solid var(--border); }
.act-item.is-failure .act-icon { background: var(--warning-light); color: #92400E; }
.act-body { min-width: 0; flex: 1 1 auto; }
.act-line { color: var(--ink-900); overflow-wrap: anywhere; }
.act-meta { font-size: .78rem; color: var(--ink-500); }
.act-feed li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: .84rem; }
.act-feed li:first-child { border-top: 0; }
.act-feed-who { font-weight: 600; color: var(--ink-900); }
.act-feed-what { grid-column: 1 / -1; color: var(--ink-700); overflow-wrap: anywhere; }
.act-feed-when { grid-row: 1; grid-column: 2; color: var(--ink-500); font-size: .76rem; white-space: nowrap; }

/* operations centre 3.0 layout */
.oc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.oc-aside { display: grid; gap: 16px; }
.oc-dq-list { list-style: none; margin: 0 0 10px; padding: 0; }
.oc-dq-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--border); font-size: .84rem; }
.oc-dq-list li:first-child { border-top: 0; }
.oc-empty i { color: var(--success); }

/* vehicle cards */
.vc-view-toggle { display: inline-flex; gap: 4px; margin-bottom: 12px; }
.vc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 12px; }
.vc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column; }
.vc-card-img { display: block; background: var(--canvas); aspect-ratio: 16 / 9; }
.vc-card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.vc-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.vc-card-head { display: flex; justify-content: space-between; gap: 8px; }
.vc-card-make { font-size: .75rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: .04em; }
.vc-card-model { font-size: 1.05rem; font-weight: 700; color: var(--ink-900); margin: 0; overflow-wrap: anywhere; }
.vc-card-rate { text-align: end; white-space: nowrap; }
.vc-card-rate strong { display: block; font-size: 1.05rem; color: var(--ink-900); }
.vc-card-rate small { color: var(--ink-500); }
.vc-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vc-plate { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--ink-900); }
.vc-state { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.vc-state-available { background: var(--success-light); color: #166534; }
.vc-state-rented { background: var(--info-light); color: #075985; }
.vc-state-repair, .vc-state-blocked { background: var(--warning-light); color: #92400E; }
.vc-state-retired { background: var(--canvas); color: var(--ink-500); border: 1px solid var(--border); }
html[data-theme="dark"] .vc-state-available { color: #86EFAC; }
html[data-theme="dark"] .vc-state-rented { color: #7DD3FC; }
html[data-theme="dark"] .vc-state-repair, html[data-theme="dark"] .vc-state-blocked { color: #FCD34D; }
.vc-card-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--ink-700); }
.table-responsive[hidden] + #elVehiclePager { display: none; }

/* profile menu: appearance */
.ux-profile-theme { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 16px; border-top: 1px solid var(--border); }
.ux-profile-theme-label { width: 100%; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); }
.ux-theme-choice { border: 1px solid var(--border); background: var(--surface); color: var(--ink-700); font-size: .78rem; padding: 3px 8px; }
.ux-theme-choice.is-current { border-color: var(--primary); color: var(--link); font-weight: 700; }

/* appearance page */
.theme-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.theme-choice { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-md); cursor: pointer; background: var(--surface); }
.theme-choice:has(input:checked), .theme-choice.is-current { border-color: var(--primary); }
.theme-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-choice input:focus-visible + .theme-preview { outline: 2px solid var(--link); outline-offset: 2px; }
.theme-preview { display: grid; grid-template-columns: 30% 1fr 1fr; grid-template-rows: 18px 1fr; gap: 4px; height: 90px; padding: 6px; border-radius: 8px; }
.theme-preview .tp-side { grid-row: 1 / span 2; border-radius: 4px; }
.theme-preview .tp-top { grid-column: 2 / span 2; border-radius: 4px; }
.theme-preview .tp-card { border-radius: 4px; }
.theme-preview-classic { background: #F3F7F6; }
.theme-preview-classic .tp-side { background: linear-gradient(180deg, #0B2524, #0F766E); }
.theme-preview-classic .tp-top { background: linear-gradient(90deg, #0B2524, #0F766E); }
.theme-preview-classic .tp-card { background: #FFFFFF; border: 1px solid #E1E8E6; }
.theme-preview-modern { background: #EEF3F8; }
.theme-preview-modern .tp-side { background: #FFFFFF; border: 1px solid #E3E9F0; }
.theme-preview-modern .tp-top { background: #FFFFFF; border: 1px solid #E3E9F0; }
.theme-preview-modern .tp-card { background: #FFFFFF; border: 1px solid #E3E9F0; box-shadow: 0 2px 6px rgba(15,23,42,.06); }

@media (max-width: 991.98px) {
  .gov-grid, .gov-grid-rights, .gov-grid-roles, .oc-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
  .gov-kpi { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); }
  /* the agent / role tables use the shared phone card view (js/mobile_tables.js + .table-mobile-priority in css/main.css) */
  .gov-matrix { grid-template-columns: minmax(0, 1fr); }
  .gov-matrix-code input { width: 22px; height: 22px; }
}

/* ---------- Top bar layout (SR-18 hotfix) - Theme 1 + Theme 2, every language ----------
   One row that never wraps or spills out of its column: utility buttons, languages and profile keep their
   size; the global search is the only flexible item and gives way first. Narrow widths (< 992px): the profile
   shows the avatar only and the language buttons get compact. RTL: dir="rtl" mirrors the rows by itself,
   only physical offsets are mirrored below (this file is versioned, so a cached rtl.css cannot bring back the
   former row-reverse). */
.header .header-actions { flex-wrap: nowrap; min-width: 0; margin: 0; padding: 0; list-style: none; }
.header .header-actions > li { flex: 0 0 auto; }
.header .header-actions > li#elGlobalSearchWrapper { flex: 0 1 240px; min-width: 96px; }
.header #elGlobalSearchInput { width: 100%; min-width: 0; }
@media (max-width: 991.98px) {
  .header .header-actions > li > a.user-settings span.user-name { display: none; }
  .header .language-selector .lang-btn { padding: 6px 7px; }
}
html[dir="rtl"] .header a.logo,
html[dir="rtl"] .header .header-actions { flex-direction: row; }
html[dir="rtl"] .header .header-actions > li > a.user-settings { padding: 0 18px 0 0; }
html[dir="rtl"] .header .header-actions > li > a.user-settings span.user-name { margin-right: 0; margin-left: 5px; }
html[dir="rtl"] .header .header-actions > li > a .count-label { right: auto; left: 10px; }
html[dir="rtl"] .header .header-actions > li > a .count-label.count-label-badge { right: auto; left: 2px; }
/* RTL header menus open towards the page (start-aligned): the global rtl.css rule `.dropdown-menu { right: 0 }`
   would otherwise win over Popper's inline left and grow them off the left edge (also the hover-open path) */
html[dir="rtl"] .header #quickActionsMenu,
html[dir="rtl"] .header #notificationBell .dropdown-menu,
html[dir="rtl"] .header .ux-profile-menu { left: 0; right: auto; }


/* ============================================================
   UX polish (2026-10) - contrast, action buttons, cancel, logo, uploads
   Tokens (:root / dark / theme-modern.css): --primary is the FILL colour (white text >= 4.5:1),
   --link the TEXT colour on surfaces (bright teal in dark mode), --on-primary the text on a fill.
   Verified by tests/test_ux_polish_browser.php (WCAG AA on every visible text node, both themes,
   light / dark, FR / EN / AR, 1440 / 1024 / 820 / 390).
   ============================================================ */

/* ---------- legacy utilities (main.css hardcodes pre-token colours) ---------- */
a:hover { color: var(--link-hover, var(--link)); }
.text-primary { color: var(--link) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--ink-500) !important; }
html[data-theme="dark"] .text-success { color: #4ADE80 !important; }
html[data-theme="dark"] .text-info { color: #38BDF8 !important; }
html[data-theme="dark"] .text-warning { color: #FBBF24 !important; }
html[data-theme="dark"] .text-danger { color: #F87171 !important; }
.bg-primary, a.bg-primary { background-color: var(--primary) !important; }
.btn.btn-primary, .btn.btn-primary:disabled, .btn.btn-primary.disabled { color: var(--on-primary, #fff); background-color: var(--primary); border-color: var(--primary); }
.btn.btn-primary:hover, .btn.btn-primary:focus, .btn.btn-primary:not(:disabled):active { color: var(--on-primary, #fff); background-color: var(--primary-hover); border-color: var(--primary-hover); }
.btn.btn-success, .btn.btn-success:disabled { color: #fff; background-color: var(--success); border-color: var(--success); }
.btn.btn-success:hover, .btn.btn-success:focus { color: #fff; background-color: #166534; border-color: #166534; }
.btn.btn-danger, .btn.btn-danger:disabled { color: #fff; background-color: var(--danger); border-color: var(--danger); }
.btn.btn-danger:hover, .btn.btn-danger:focus { color: #fff; background-color: #A1251F; border-color: #A1251F; }
.btn.btn-info, .btn.btn-info:disabled { color: #fff; background-color: var(--info); border-color: var(--info); }
.btn.btn-info:hover, .btn.btn-info:focus { color: #fff; background-color: #075985; border-color: #075985; }
.btn.btn-warning, .btn.btn-warning:disabled { color: #1F1300; background-color: #F59E0B; border-color: #F59E0B; }
.btn.btn-warning:hover, .btn.btn-warning:focus { color: #1F1300; background-color: #D97706; border-color: #D97706; }
.btn.btn-secondary, .btn.btn-secondary:disabled { color: #fff; background-color: #4B5563; border-color: #4B5563; }
.btn.btn-secondary:hover, .btn.btn-secondary:focus { color: #fff; background-color: #374151; border-color: #374151; }
.btn.btn-outline-primary { color: var(--link); border-color: var(--primary); background-color: transparent; }
.btn.btn-outline-primary:hover, .btn.btn-outline-primary:focus, .btn.btn-outline-primary.active { color: var(--on-primary, #fff); background-color: var(--primary); border-color: var(--primary); }
.btn.btn-link { color: var(--link); }
.btn.btn-outline-secondary { color: var(--ink-700); border-color: var(--ink-500); }
.btn.btn-outline-secondary:hover, .btn.btn-outline-secondary:focus { color: var(--surface); background-color: var(--ink-700); border-color: var(--ink-700); }
.btn.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn.btn-outline-success { color: var(--success); border-color: var(--success); }
.btn.btn-outline-info { color: var(--info); border-color: var(--info); }
.btn.btn-outline-warning { color: var(--warning); border-color: var(--warning); }
html[data-theme="dark"] .btn.btn-outline-danger { color: #F87171; border-color: #F87171; }
html[data-theme="dark"] .btn.btn-outline-success { color: #4ADE80; border-color: #4ADE80; }
html[data-theme="dark"] .btn.btn-outline-info { color: #38BDF8; border-color: #38BDF8; }
html[data-theme="dark"] .btn.btn-outline-warning { color: #FBBF24; border-color: #FBBF24; }
.btn.btn-outline-danger:hover, .btn.btn-outline-danger:focus { color: #fff; background-color: var(--danger); border-color: var(--danger); }
.btn.btn-outline-success:hover, .btn.btn-outline-success:focus { color: #fff; background-color: var(--success); border-color: var(--success); }
.btn.btn-outline-info:hover, .btn.btn-outline-info:focus { color: #fff; background-color: var(--info); border-color: var(--info); }
.btn.btn-outline-warning:hover, .btn.btn-outline-warning:focus { color: #1F1300; background-color: #F59E0B; border-color: #F59E0B; }
.btn.btn-lighten { color: var(--ink-900); background-color: var(--surface); border: 1px solid var(--border); }
/* legacy alerts (main.css paints every .alert teal with white text, even .alert-light) and status backgrounds */
.alert.alert-success { background: var(--success); color: #fff; }
.alert.alert-danger { background: var(--danger); color: #fff; }
.alert.alert-info { background: var(--info); color: #fff; }
.alert.alert-warning, .alert.alert-warning .alert-link, .alert.alert-warning .close { background: #F59E0B; color: #1F1300; }
.alert.alert-warning .close { background: transparent; }
.alert.alert-light { background: var(--surface); color: var(--ink-900); border: 1px solid var(--border); }
.alert.alert-light .alert-link { color: var(--link); }
.bg-success, a.bg-success { background-color: var(--success) !important; }
.bg-info, a.bg-info { background-color: var(--info) !important; }
.bg-danger, a.bg-danger { background-color: var(--danger) !important; }
.badge-primary { color: var(--on-primary, #fff); background-color: var(--primary); }
.badge-success { color: #fff; background-color: var(--success); }
.badge-danger { color: #fff; background-color: var(--danger); }
.badge-info { color: #fff; background-color: var(--info); }
.badge-warning { color: #1F1300; background-color: #F59E0B; }
.page-item.active .page-link { color: var(--on-primary, #fff); background-color: var(--primary); border-color: var(--primary); }
.page-link { color: var(--link); }
.language-selector .lang-btn.active { color: var(--on-primary, #fff); background: var(--primary); border-color: var(--primary); }
html body div.dataTables_wrapper div.dataTables_info { color: var(--ink-500); }
.bootstrap-select .bs-placeholder .filter-option-inner-inner { color: var(--ink-500); }
.sidebar-section-title { color: rgba(255, 255, 255, .7); }
html[data-visual-theme="modern"] .sidebar-section-title { color: var(--ink-500); }
.breadcrumb-item.active, .breadcrumb-item.active a { color: inherit; }
/* document toolbars (contract / quote / invoice details): wrap instead of widening the page on a phone (longer Arabic labels) */
.invoice-header .btn-group.float-right { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 100%; }
.invoice-header .btn-group.float-right > .btn { border-radius: var(--radius-sm) !important; margin: 0 !important; }
.page-header .arc-header-text { color: #fff; }
html[data-visual-theme="modern"] .page-header .arc-header-text { color: var(--ink-700); }
.ux-avatar { background: var(--primary); color: var(--on-primary, #fff); }
.list-group-item.active, .list-group-item.active h1, .list-group-item.active h2, .list-group-item.active h3, .list-group-item.active h4, .list-group-item.active h5, .list-group-item.active h6,
html[data-visual-theme="modern"] .list-group-item.active, html[data-visual-theme="modern"] .list-group-item.active h6 { color: var(--on-primary, #fff); }
html[data-theme="dark"] .page-header .breadcrumb .breadcrumb-item a { color: rgba(255, 255, 255, .85); }

/* ---------- canonical action buttons (.arc-actions / .arc-act / .arc-act--<kind>) ----------
   One neutral style for every action; the icon says what it does, the accessible name (aria-label + title)
   says it to assistive technology; destructive actions are red AND carry the trash / ban icon AND ask for a
   confirmation AND sit apart from the others (never colour alone). Permissions are decided by the server:
   a control the user may not use is not rendered (CSS never hides one). */
.arc-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; vertical-align: middle; }
.arc-actions > form, .arc-actions .arc-act-form { display: inline-flex; margin: 0; }
.arc-actions.btn-group > .btn, .arc-actions.btn-group > form > .btn { border-radius: var(--radius-sm) !important; margin: 0 !important; flex: 0 0 auto; }
.arc-actions .btn.arc-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; min-height: 36px; padding: 0 9px; line-height: 1;
  color: var(--ink-700); background-color: var(--surface); border: 1px solid var(--border);
  font-size: 1rem; text-decoration: none; box-shadow: none;
}
.arc-actions .btn.arc-act i { font-size: 1rem; line-height: 1; }
.arc-actions .btn.arc-act:hover { color: var(--link); background-color: var(--primary-light); border-color: var(--primary); }
.arc-actions .btn.arc-act:focus-visible, .arc-cancel:focus-visible, .arc-upload button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; box-shadow: none; z-index: 1; }
.arc-actions .btn.arc-act:focus:not(:focus-visible) { box-shadow: none; }
.arc-actions .btn.arc-act--approve, .arc-actions .btn.arc-act--pay, .arc-actions .btn.arc-act--create { color: var(--success); }
html[data-theme="dark"] .arc-actions .btn.arc-act--approve, html[data-theme="dark"] .arc-actions .btn.arc-act--pay, html[data-theme="dark"] .arc-actions .btn.arc-act--create { color: #4ADE80; }
.arc-actions .btn.arc-act--danger { color: var(--danger); border-color: currentColor; margin-inline-start: 8px !important; }
html[data-theme="dark"] .arc-actions .btn.arc-act--danger { color: #F87171; }
.arc-actions .btn.arc-act--danger:hover, .arc-actions .btn.arc-act--danger:focus-visible { color: #fff; background-color: var(--danger); border-color: var(--danger); }
.arc-actions .btn.arc-act:disabled, .arc-actions .btn.arc-act.disabled { opacity: .45; cursor: not-allowed; }
.arc-act__label { white-space: nowrap; font-size: .82rem; font-weight: 600; }
@media (max-width: 575.98px) {
  .arc-actions { gap: 4px; }
  .arc-actions .btn.arc-act { min-width: 40px; min-height: 40px; }
}

/* ---------- cancel (function/nav_helper.php): a plain link back to the list ---------- */
.btn.arc-cancel { color: var(--ink-900); background-color: var(--surface); border: 1px solid var(--border); margin-inline-end: 6px; }
.btn.arc-cancel:hover { color: var(--ink-900); background-color: var(--canvas); border-color: var(--ink-500); }

/* ---------- logos: shown whole, never cropped ---------- */
.arc-brand-logo { width: auto !important; height: auto !important; margin: .25rem auto 1rem; text-align: center; }
.arc-brand-logo img { width: auto !important; height: auto !important; max-width: min(260px, 100%); max-height: 110px; object-fit: contain !important; border-radius: 12px !important; }
.header a.logo img, .padmin-brand img, img.arc-logo { object-fit: contain; }

/* ---------- upload component (js/arc_upload.js) ---------- */
.arc-upload { margin-top: 8px; display: grid; gap: 8px; }
.arc-upload:empty { display: none; }
.arc-upload-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-900); min-width: 0; }
.arc-upload-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--canvas); display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: var(--ink-700); border: 1px solid var(--border); }
.arc-upload-meta { min-width: 0; }
.arc-upload-name { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-upload-info { font-size: .78rem; color: var(--ink-500); }
.arc-upload-bar { height: 6px; border-radius: 3px; background: var(--canvas); overflow: hidden; margin-top: 5px; }
.arc-upload-bar > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s linear; }
.arc-upload-item[data-state="done"] .arc-upload-bar > span { background: var(--success); }
.arc-upload-item[data-state="error"] { border-color: var(--danger); }
.arc-upload-item[data-state="error"] .arc-upload-bar > span { background: var(--danger); }
.arc-upload-status { font-size: .78rem; font-weight: 600; }
.arc-upload-item[data-state="error"] .arc-upload-status { color: var(--danger); }
html[data-theme="dark"] .arc-upload-item[data-state="error"] .arc-upload-status { color: #F87171; }
.arc-upload-item[data-state="done"] .arc-upload-status { color: var(--success); }
html[data-theme="dark"] .arc-upload-item[data-state="done"] .arc-upload-status { color: #4ADE80; }
.arc-upload-actions button { min-width: 36px; min-height: 36px; }
.arc-upload-sending { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-700); }
@media (prefers-reduced-motion: reduce) { .arc-upload-bar > span { transition: none; } }

/* Moroccan number plate (function/plate_helper.php): MA | number | Arabic letter over Latin letter | prefecture */
.ma-plate { display: inline-flex; align-items: stretch; background: #fff; color: #111; border: 2px solid #111; border-radius: 5px; box-shadow: 0 0 0 1px #fff inset; font-family: "Arial Narrow", Arial, sans-serif; font-weight: 700; line-height: 1; white-space: nowrap; direction: ltr; }
.ma-plate > span { display: flex; align-items: center; justify-content: center; padding: 3px 7px; border-left: 2px solid #111; }
.ma-plate > span:first-child { border-left: 0; font-size: .62rem; padding: 3px 5px; }
.ma-plate-n { font-size: 1.05rem; letter-spacing: 1px; }
.ma-plate-l { flex-direction: column; padding: 1px 7px !important; gap: 1px; font-size: .78rem; }
.ma-plate-ar { font-size: .85rem; }
.ma-plate-la { font-size: .7rem; border-top: 1px solid #111; padding-top: 1px; }
.ma-plate-p { font-size: 1.05rem; }
.ma-plate-raw { display: none; }
.ma-thumb { height: 34px; width: auto; max-width: 78px; object-fit: contain; vertical-align: middle; margin-right: 6px; background: transparent; }
