/* ============================================================
   CTAMS — Centre Technique Auto & Multiservices
   Design System v2.0 — Enterprise Edition
   Palette: Royal Blue #1B2DA8 / Crimson #CC1111 / Navy #080F3A
   Typography: Rajdhani (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  /* Brand */
  --c-navy-950:  #020818;
  --c-navy-900:  #080F3A;
  --c-navy-800:  #0D1550;
  --c-navy-700:  #111C5C;
  --c-blue-700:  #1B2DA8;
  --c-blue-600:  #2540CC;
  --c-blue-500:  #3A58E8;
  --c-blue-200:  #A8B8F5;
  --c-blue-100:  #E0E7FF;
  --c-blue-50:   #F0F3FF;
  --c-red-700:   #A50E0E;
  --c-red-600:   #CC1111;
  --c-red-500:   #E01F1F;
  --c-red-100:   #FDEAEA;
  --c-red-50:    #FFF5F5;

  /* Neutral */
  --c-gray-900:  #111827;
  --c-gray-800:  #1F2937;
  --c-gray-700:  #374151;
  --c-gray-600:  #4B5563;
  --c-gray-500:  #6B7280;
  --c-gray-400:  #9CA3AF;
  --c-gray-300:  #D1D5DB;
  --c-gray-200:  #E5E7EB;
  --c-gray-150:  #EDF0F5;
  --c-gray-100:  #F3F5F9;
  --c-gray-50:   #F9FAFB;
  --c-white:     #FFFFFF;

  /* Semantic */
  --c-success:   #059669;
  --c-success-bg:#D1FAE5;
  --c-warning:   #D97706;
  --c-warning-bg:#FEF3C7;
  --c-danger:    #DC2626;
  --c-danger-bg: #FEE2E2;
  --c-info:      #2563EB;
  --c-info-bg:   #DBEAFE;

  /* Layout */
  --sidebar-w:   240px;
  --topbar-h:    64px;

  /* Typography */
  --font-display:'Rajdhani', 'Segoe UI', sans-serif;
  --font-body:   'DM Sans', 'Segoe UI', sans-serif;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-md:   0 4px 14px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:   0 10px 28px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.06);
  --shadow-xl:   0 20px 50px rgba(0,0,0,.12), 0 8px 20px rgba(0,0,0,.08);

  /* Borders */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 24px;

  /* Transitions */
  --ease:  0.18s ease;
  --ease-slow: 0.3s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--c-gray-900);
  background: var(--c-gray-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5 { line-height: 1.2; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-gray-400); }

/* ================================================================
   AUTHENTICATED LAYOUT  (shell / sidebar / topbar / content)
   ================================================================ */

.ctams-shell {
  display: flex;
  min-height: 100vh;
  background: var(--c-gray-100);
}

/* ── Sidebar ── */
.ctams-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--c-navy-900);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.ctams-sidebar::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.06) 30%, rgba(255,255,255,.06) 70%, transparent);
}

/* Sidebar brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  object-fit: contain;
  background: var(--c-white);
  padding: 3px;
  flex-shrink: 0;
}

.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--c-white);
  letter-spacing: .5px;
  line-height: 1;
}
.sidebar-brand-tagline {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 14px 16px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: color var(--ease), background var(--ease);
}

.sidebar-link:hover {
  color: var(--c-white);
  background: rgba(255,255,255,.06);
}

.sidebar-link.active {
  color: var(--c-white);
  background: rgba(27,45,168,.35);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--c-red-600);
  border-radius: 0 2px 2px 0;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: .8;
  transition: opacity var(--ease);
}

.sidebar-link:hover i,
.sidebar-link.active i { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 12px 16px;
  flex-shrink: 0;
}

.sidebar-footer-version {
  font-size: 11px;
  color: rgba(255,255,255,.25);
  letter-spacing: .3px;
}

/* ── Main area ── */
.ctams-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.ctams-topbar {
  height: var(--topbar-h);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.topbar-page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--c-navy-700);
  letter-spacing: .3px;
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-blue-700), var(--c-blue-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-white);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.topbar-user-info { display: flex; flex-direction: column; }
.topbar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-gray-800);
  line-height: 1.2;
}
.topbar-role {
  font-size: 11px;
  color: var(--c-gray-500);
  line-height: 1;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--c-gray-200);
}

.topbar-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  color: var(--c-gray-600);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--c-gray-200);
  transition: all var(--ease);
}

.topbar-logout:hover {
  color: var(--c-red-600);
  border-color: var(--c-red-100);
  background: var(--c-red-50);
}

/* ── Content ── */
.ctams-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ================================================================
   PAGE HEADER (inside content)
   ================================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-left {}
.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--c-navy-700);
  letter-spacing: .3px;
  line-height: 1.1;
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--c-gray-500);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--c-gray-200);
  color: var(--c-gray-700);
  background: var(--c-white);
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:hover {
  border-color: var(--c-gray-300);
  background: var(--c-gray-50);
  color: var(--c-gray-900);
  box-shadow: var(--shadow-xs);
}

.btn-primary {
  background: var(--c-blue-700);
  color: var(--c-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(27,45,168,.25);
}

.btn-primary:hover {
  background: var(--c-blue-600);
  color: var(--c-white);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(27,45,168,.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--c-red-600);
  color: var(--c-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(204,17,17,.2);
}
.btn-danger:hover {
  background: var(--c-red-700);
  color: var(--c-white);
  border-color: transparent;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--r-md);
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--c-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-gray-200);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-navy-700);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.card-body {
  padding: 18px 20px;
}

.card-body + .card-body {
  border-top: 1px solid var(--c-gray-150);
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--c-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-gray-200);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--ease), box-shadow var(--ease);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card--blue::before  { background: linear-gradient(90deg, var(--c-blue-700), var(--c-blue-500)); }
.kpi-card--red::before   { background: linear-gradient(90deg, var(--c-red-700), var(--c-red-500)); }
.kpi-card--green::before { background: linear-gradient(90deg, #047857, #059669); }
.kpi-card--amber::before { background: linear-gradient(90deg, #B45309, #D97706); }
.kpi-card--purple::before { background: linear-gradient(90deg, #6D28D9, #7C3AED); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-gray-500);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.kpi-icon--blue   { background: var(--c-blue-100);   color: var(--c-blue-700); }
.kpi-icon--red    { background: var(--c-red-100);    color: var(--c-red-600); }
.kpi-icon--green  { background: #D1FAE5;              color: #047857; }
.kpi-icon--amber  { background: #FEF3C7;              color: #B45309; }
.kpi-icon--purple { background: #EDE9FE;              color: #6D28D9; }

.kpi-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--c-navy-700);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-detail {
  font-size: 12.5px;
  color: var(--c-gray-500);
}

/* ── Module Cards (dashboard shortcuts) ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.module-card {
  display: flex;
  flex-direction: column;
  background: var(--c-white);
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-xl);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: all var(--ease);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.module-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-blue-700), var(--c-blue-500));
  transform: scaleX(0);
  transition: transform var(--ease);
  transform-origin: left;
}

.module-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-blue-100);
}

.module-card:hover::after { transform: scaleX(1); }

.module-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--c-blue-100);
  color: var(--c-blue-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
  transition: all var(--ease);
}

.module-card:hover .module-icon {
  background: var(--c-blue-700);
  color: var(--c-white);
}

.module-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--c-navy-700);
  margin-bottom: 6px;
}

.module-desc {
  font-size: 13px;
  color: var(--c-gray-500);
  line-height: 1.5;
  flex: 1;
}

.module-link {
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-blue-700);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: gap var(--ease);
}
.module-card:hover .module-link { gap: 8px; }

/* ================================================================
   TABLES
   ================================================================ */
.table-wrap {
  background: var(--c-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-gray-200);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.ctams-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.ctams-table thead tr {
  border-bottom: 2px solid var(--c-gray-150);
}

.ctams-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-gray-500);
  text-transform: uppercase;
  letter-spacing: .6px;
  background: var(--c-gray-50);
  white-space: nowrap;
}

.ctams-table th:first-child { border-radius: var(--r-xl) 0 0 0; }
.ctams-table th:last-child  { border-radius: 0 var(--r-xl) 0 0; }

.ctams-table td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--c-gray-800);
  border-bottom: 1px solid var(--c-gray-150);
  vertical-align: middle;
}

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

.ctams-table tbody tr {
  transition: background var(--ease);
}

.ctams-table tbody tr:hover { background: var(--c-gray-50); }

.table-empty {
  text-align: center;
  color: var(--c-gray-400);
  padding: 40px 16px !important;
  font-size: 14px;
}

/* Avatar initials in table */
.avatar-initials {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-blue-100);
  color: var(--c-blue-700);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.table-cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-cell-main { font-weight: 600; color: var(--c-gray-900); line-height: 1.2; }
.table-cell-sub  { font-size: 12px; color: var(--c-gray-500); margin-top: 2px; }

.cell-mono {
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  background: var(--c-gray-100);
  padding: 3px 7px;
  border-radius: var(--r-sm);
  color: var(--c-navy-700);
  font-weight: 700;
  white-space: nowrap;
}

/* ================================================================
   BADGES / TAGS / PILLS
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: var(--c-blue-100);  color: var(--c-blue-700); }
.badge-red    { background: var(--c-red-100);   color: var(--c-red-700); }
.badge-green  { background: #D1FAE5;             color: #065F46; }
.badge-amber  { background: #FEF3C7;             color: #92400E; }
.badge-gray   { background: var(--c-gray-100);  color: var(--c-gray-600); }
.badge-purple { background: #EDE9FE;             color: #5B21B6; }

/* Status badges */
.status-open       { background: #DBEAFE; color: #1E40AF; }
.status-in-progress { background: #FEF3C7; color: #92400E; }
.status-done       { background: #D1FAE5; color: #065F46; }
.status-cancelled  { background: var(--c-gray-100); color: var(--c-gray-500); }
.status-active     { background: #D1FAE5; color: #065F46; }
.status-inactive   { background: var(--c-gray-100); color: var(--c-gray-500); }

/* ================================================================
   FILTERS / SEARCH BAR
   ================================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  background: var(--c-white);
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gray-400);
  font-size: 13px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-md);
  padding: 9px 12px 9px 36px;
  font-size: 13.5px;
  color: var(--c-gray-900);
  background: var(--c-gray-50);
  transition: all var(--ease);
  outline: none;
}

.search-input:focus {
  border-color: var(--c-blue-500);
  background: var(--c-white);
  box-shadow: 0 0 0 3px var(--c-blue-100);
}

.filter-select {
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-md);
  padding: 9px 32px 9px 12px;
  font-size: 13.5px;
  color: var(--c-gray-700);
  background: var(--c-gray-50);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--ease);
}

.filter-select:focus {
  border-color: var(--c-blue-500);
  background-color: var(--c-white);
  box-shadow: 0 0 0 3px var(--c-blue-100);
}

/* Period filter */
.period-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.period-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-gray-500);
}

/* ================================================================
   FORMS
   ================================================================ */
.form-card {
  background: var(--c-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.form-section-header {
  padding: 14px 20px;
  background: var(--c-gray-50);
  border-bottom: 1px solid var(--c-gray-150);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-body { padding: 20px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: 14px;
  color: var(--c-gray-900);
  background: var(--c-white);
  outline: none;
  transition: all var(--ease);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--c-blue-500);
  box-shadow: 0 0 0 3px var(--c-blue-100);
}

.field textarea { min-height: 110px; resize: vertical; }

.field-error { font-size: 12px; color: var(--c-danger); }
.field-help  { font-size: 12px; color: var(--c-gray-400); }

.field select[multiple] { min-height: 140px; }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-top: 1px solid var(--c-gray-150);
  background: var(--c-gray-50);
}

.form-error-banner {
  margin: 0 20px 16px;
  padding: 12px 14px;
  background: var(--c-danger-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--r-md);
  color: #991B1B;
  font-size: 13.5px;
}

/* ================================================================
   ALERTS / MESSAGES
   ================================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.alert i { margin-top: 1px; flex-shrink: 0; font-size: 14px; }

.alert-success { background: var(--c-success-bg); color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: var(--c-warning-bg); color: #92400E; border: 1px solid #FDE68A; }
.alert-danger  { background: var(--c-danger-bg);  color: #991B1B; border: 1px solid #FCA5A5; }
.alert-info    { background: var(--c-info-bg);    color: #1E40AF; border: 1px solid #BFDBFE; }

.alert-group { margin-bottom: 20px; }

.messages-block { margin-bottom: 20px; }

/* ================================================================
   DETAIL VIEW (profile/info cards)
   ================================================================ */
.detail-hero {
  background: var(--c-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-gray-200);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--c-blue-700), var(--c-blue-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-white);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
}

.detail-hero-info { flex: 1; min-width: 200px; }
.detail-hero-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--c-navy-700);
  margin-bottom: 4px;
}
.detail-hero-meta {
  font-size: 13.5px;
  color: var(--c-gray-500);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Info grid (dl/dt/dd) */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
}

.info-item {}
.info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 3px;
}
.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-gray-900);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--c-gray-200);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-gray-500);
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--ease);
}

.tab-btn:hover { color: var(--c-gray-800); background: var(--c-gray-50); }
.tab-btn.active { color: var(--c-blue-700); border-bottom-color: var(--c-blue-700); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ================================================================
   STATS / LIST cards
   ================================================================ */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--c-gray-150);
  border-radius: var(--r-md);
  font-size: 13.5px;
  transition: background var(--ease);
}

.stats-list-item:hover { background: var(--c-gray-50); }

.stats-list-label { color: var(--c-gray-700); }
.stats-list-value { font-weight: 700; color: var(--c-navy-700); }

/* ================================================================
   CONTENT GRID LAYOUTS
   ================================================================ */
.content-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.content-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ================================================================
   SECTION HEADERS inside cards
   ================================================================ */
.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-gray-150);
}

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}

.page-link {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-gray-600);
  border: 1px solid var(--c-gray-200);
  background: var(--c-white);
  transition: all var(--ease);
  text-decoration: none;
}

.page-link:hover { border-color: var(--c-blue-500); color: var(--c-blue-700); background: var(--c-blue-50); }
.page-link.active { background: var(--c-blue-700); color: var(--c-white); border-color: transparent; }

/* ================================================================
   NOTES / TEXT CONTENT
   ================================================================ */
.notes-text {
  font-size: 13.5px;
  color: var(--c-gray-500);
  line-height: 1.6;
  font-style: italic;
  padding: 12px 14px;
  background: var(--c-gray-50);
  border-radius: var(--r-md);
  border-left: 3px solid var(--c-gray-200);
}

/* ================================================================
   DASHBOARD ACTIVITY / RECENT
   ================================================================ */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-gray-100);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-blue-500);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ================================================================
   LOGIN PAGE (standalone — no sidebar)
   ================================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  font-family: var(--font-body);
}

.login-brand {
  width: 420px;
  flex-shrink: 0;
  background: var(--c-navy-900);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

/* Decorative diagonal stripe */
.login-brand::before {
  content: '';
  position: absolute;
  top: -60px; right: -80px;
  width: 240px;
  height: 550px;
  background: rgba(204,17,17,.12);
  transform: rotate(-20deg);
  border-radius: 40px;
}
.login-brand::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -60px;
  width: 200px;
  height: 400px;
  background: rgba(27,45,168,.18);
  transform: rotate(-20deg);
  border-radius: 40px;
}

.login-brand-content { position: relative; z-index: 1; }

.login-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: var(--r-xl);
  background: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.login-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }

.login-brand-name {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--c-white);
  letter-spacing: .5px;
  line-height: 1;
  margin-bottom: 6px;
}

.login-brand-sub {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  letter-spacing: .3px;
  margin-bottom: 36px;
}

.login-brand-divider {
  width: 40px;
  height: 3px;
  background: var(--c-red-600);
  border-radius: 2px;
  margin-bottom: 28px;
}

.login-brand-pitch {
  font-size: 22px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--c-white);
  line-height: 1.35;
  margin-bottom: 24px;
}

.login-feature-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,.75);
}

.login-feature i {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: rgba(27,45,168,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--c-blue-200);
  flex-shrink: 0;
}

/* Login form panel */
.login-form-panel {
  flex: 1;
  background: var(--c-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.login-form-box {
  width: 100%;
  max-width: 400px;
}

.login-form-header {
  margin-bottom: 28px;
}

.login-form-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--c-navy-700);
  margin-bottom: 6px;
}

.login-form-sub {
  font-size: 13.5px;
  color: var(--c-gray-500);
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 7px;
}

.login-field-wrap { position: relative; }

.login-field input {
  width: 100%;
  border: 1.5px solid var(--c-gray-200);
  border-radius: var(--r-md);
  padding: 12px 42px 12px 14px;
  font-size: 14px;
  color: var(--c-gray-900);
  background: var(--c-white);
  outline: none;
  transition: all var(--ease);
}

.login-field input:focus {
  border-color: var(--c-blue-500);
  box-shadow: 0 0 0 3px var(--c-blue-100);
}

.login-field-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gray-400);
  font-size: 14px;
  pointer-events: none;
}

.login-toggle {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gray-400);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  transition: color var(--ease);
}
.login-toggle:hover { color: var(--c-gray-700); }

.login-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--c-gray-600);
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--c-blue-700);
}

.login-forgot {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-blue-700);
  transition: color var(--ease);
}
.login-forgot:hover { color: var(--c-blue-600); text-decoration: underline; }

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--c-blue-700);
  color: var(--c-white);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(27,45,168,.35);
  font-family: var(--font-display);
  letter-spacing: .3px;
}

.btn-login:hover {
  background: var(--c-blue-600);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27,45,168,.45);
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--c-gray-500);
}

.login-footer a {
  color: var(--c-blue-700);
  font-weight: 600;
  transition: color var(--ease);
}
.login-footer a:hover { color: var(--c-blue-600); text-decoration: underline; }

/* ================================================================
   PUBLIC LANDING PAGE (standalone)
   ================================================================ */
.landing-page {
  min-height: 100vh;
  background: var(--c-gray-100);
  font-family: var(--font-body);
}

.landing-nav {
  background: var(--c-navy-900);
  padding: 0 40px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  object-fit: contain;
  background: var(--c-white);
  padding: 3px;
}

.landing-nav-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-white);
  letter-spacing: .4px;
}

.landing-nav-actions { display: flex; gap: 10px; }

.landing-hero {
  background: var(--c-navy-900);
  padding: 80px 40px;
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(ellipse, rgba(27,45,168,.3) 0%, transparent 70%);
  border-radius: 50%;
}

.landing-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.landing-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(204,17,17,.15);
  color: #FF6B6B;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.landing-hero-title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: var(--c-white);
  line-height: 1.05;
  margin-bottom: 16px;
}

.landing-hero-title span {
  color: var(--c-red-500);
}

.landing-hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,.65);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 480px;
}

.landing-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-hero-primary {
  background: var(--c-red-600);
  color: var(--c-white);
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(204,17,17,.3);
  transition: all var(--ease);
  text-decoration: none;
  font-family: var(--font-display);
  letter-spacing: .3px;
}

.btn-hero-primary:hover {
  background: var(--c-red-700);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(204,17,17,.4);
}

.btn-hero-secondary {
  background: rgba(255,255,255,.1);
  color: var(--c-white);
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all var(--ease);
}
.btn-hero-secondary:hover { background: rgba(255,255,255,.15); }

.landing-hero-card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-2xl);
  padding: 28px;
  backdrop-filter: blur(8px);
}

.hero-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 14px;
  color: rgba(255,255,255,.8);
}
.hero-feature-item:last-child { border-bottom: none; }

.hero-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: rgba(27,45,168,.5);
  color: var(--c-blue-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.landing-features {
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 40px;
}

.landing-section-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-red-600);
  margin-bottom: 10px;
}

.landing-section-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--c-navy-700);
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--c-white);
  border: 1px solid var(--c-gray-200);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--ease);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-blue-100);
}

.feature-card-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--r-lg);
  background: var(--c-blue-100);
  color: var(--c-blue-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.feature-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--c-navy-700);
  margin-bottom: 8px;
}

.feature-card-desc {
  font-size: 13.5px;
  color: var(--c-gray-500);
  line-height: 1.55;
}

.landing-footer {
  background: var(--c-navy-900);
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-footer-text {
  font-size: 13px;
  color: rgba(255,255,255,.4);
}

/* ================================================================
   VEHICLE REGISTRATION PLATE STYLE
   ================================================================ */
.plate {
  display: inline-flex;
  align-items: center;
  background: var(--c-white);
  border: 2px solid var(--c-gray-300);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--c-gray-900);
  letter-spacing: 1.5px;
  box-shadow: var(--shadow-xs);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }

  .sidebar-brand-text,
  .sidebar-section-label,
  .sidebar-link span,
  .sidebar-footer-version { display: none; }

  .sidebar-brand { padding: 18px 12px; justify-content: center; }
  .sidebar-link { padding: 12px; justify-content: center; }
  .sidebar-link.active::before { left: 0; top: 0; bottom: 0; width: 3px; height: auto; border-radius: 0; }

  .ctams-topbar { padding: 0 16px; }
  .ctams-content { padding: 16px; }
  .landing-hero-inner { grid-template-columns: 1fr; }
  .landing-hero-title { font-size: 38px; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .ctams-sidebar {
    transform: translateX(-100%);
    transition: transform var(--ease-slow);
  }

  .ctams-sidebar.open { transform: translateX(0); --sidebar-w: 240px; width: 240px; }

  .ctams-main { margin-left: 0; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .content-grid-2 { grid-template-columns: 1fr; }
  .content-grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr 1fr; }

  .login-brand { display: none; }
  .login-form-panel { padding: 32px 24px; }

  .landing-features { padding: 48px 20px; }
  .features-grid { grid-template-columns: 1fr; }
  .landing-hero { padding: 48px 20px; }
  .landing-nav { padding: 0 20px; }
  .landing-footer { padding: 20px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .landing-hero-title { font-size: 30px; }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.muted { color: var(--c-gray-400); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: 'Courier New', monospace; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* Separator line */
.sep { border: none; border-top: 1px solid var(--c-gray-150); margin: 16px 0; }

/* Loading state */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.loading { animation: pulse 1.4s ease infinite; }

/* Fade in animation for page content */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ctams-content { animation: fadeUp 0.25s ease; }

/* ================================================================
   THEME TOGGLE BUTTON
   ================================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-gray-200);
  background: var(--c-white);
  color: var(--c-gray-500);
  cursor: pointer;
  transition: all var(--ease);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--c-blue-500);
  color: var(--c-blue-700);
  background: var(--c-blue-50);
}

/* Sun icon visible only in dark mode */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Smooth transitions on theme switch — applied to key surfaces */
body,
.ctams-topbar,
.ctams-sidebar,
.card, .kpi-card, .module-card, .feature-card, .form-card, .detail-hero,
.table-wrap, .ctams-table th, .ctams-table td,
.filter-bar, .stats-list-item, .tab-btn, .page-link,
.btn, .theme-toggle, .topbar-logout,
.field input, .field select, .field textarea,
.login-form-panel, .login-field input,
.notes-text, .plate, .cell-mono, .badge,
.form-section-header, .form-actions, .form-error-banner,
.alert, .search-input, .filter-select,
.sidebar-link, .sidebar-brand {
  transition:
    background-color 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
}

/* ================================================================
   DARK MODE — [data-theme="dark"] on <html>
   ================================================================ */

/* ── Neutral palette remap ── */
[data-theme="dark"] {
  /* Page background */
  --c-gray-100: #0E1628;
  /* Card alt surfaces (table headers, form sections, sidebar hover) */
  --c-gray-50:  #111A2D;
  /* Card / surface (white → dark blue surface) */
  --c-white:    #162032;

  /* Borders */
  --c-gray-150: #1C2A44;
  --c-gray-200: #243252;
  --c-gray-300: #374D72;
  --c-gray-400: #516088;

  /* Text (inverted) */
  --c-gray-500: #6B84A8;
  --c-gray-600: #95A8C8;
  --c-gray-700: #B2C3DA;
  --c-gray-800: #CDDAED;
  --c-gray-900: #E2EAF5;

  /* Blue tints (for badges, focus rings) */
  --c-blue-50:  #0C1535;
  --c-blue-100: #162060;

  /* Red tints */
  --c-red-50:   #1A0606;
  --c-red-100:  #350E0E;

  /* Semantic backgrounds */
  --c-success-bg: #052E16;
  --c-warning-bg: #1C1100;
  --c-danger-bg:  #1F0606;
  --c-info-bg:    #0C1F3F;

  /* Stronger shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
  --shadow-md: 0 4px 14px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 28px rgba(0,0,0,.5), 0 4px 10px rgba(0,0,0,.3);

  /* Navy headings → light blue in dark mode */
  --c-navy-700: #BFD1F8;
  --c-navy-800: #A8C0F0;
}

/* ── Hardcoded-color component overrides ── */

/* Badges */
[data-theme="dark"] .badge-green  { background: #052E16; color: #34D399; }
[data-theme="dark"] .badge-amber  { background: #1C1100; color: #FBBF24; }
[data-theme="dark"] .badge-purple { background: #1E1045; color: #A78BFA; }
[data-theme="dark"] .badge-gray   { background: #1C2A44; color: #95A8C8; }

/* Status badges */
[data-theme="dark"] .status-active      { background: #052E16; color: #34D399; }
[data-theme="dark"] .status-done        { background: #052E16; color: #34D399; }
[data-theme="dark"] .status-open        { background: #0C1F3F; color: #60A5FA; }
[data-theme="dark"] .status-in-progress { background: #1C1100; color: #FBBF24; }
[data-theme="dark"] .status-cancelled   { background: #1C2A44; color: #95A8C8; }
[data-theme="dark"] .status-inactive    { background: #1C2A44; color: #6B84A8; }

/* Alerts */
[data-theme="dark"] .alert-success { background: #052E16; color: #34D399; border-color: #065F46; }
[data-theme="dark"] .alert-warning { background: #1C1100; color: #FBBF24; border-color: #92400E; }
[data-theme="dark"] .alert-danger  { background: #1F0606; color: #F87171; border-color: #991B1B; }
[data-theme="dark"] .alert-info    { background: #0C1F3F; color: #60A5FA; border-color: #1E40AF; }

/* KPI icon colored backgrounds */
[data-theme="dark"] .kpi-icon--green  { background: #052E16; color: #34D399; }
[data-theme="dark"] .kpi-icon--amber  { background: #1C1100; color: #FBBF24; }
[data-theme="dark"] .kpi-icon--purple { background: #1E1045; color: #A78BFA; }

/* Form error banner */
[data-theme="dark"] .form-error-banner {
  background: #1F0606;
  border-color: #7F1D1D;
  color: #FCA5A5;
}

/* Notes block */
[data-theme="dark"] .notes-text {
  background: #1C2A44;
  border-left-color: #374D72;
  color: #95A8C8;
}

/* Registration plate */
[data-theme="dark"] .plate {
  background: #1C2A44;
  border-color: #374D72;
  color: #E2EAF5;
}

/* Code/mono cells */
[data-theme="dark"] .cell-mono {
  background: #1C2A44;
  color: #A8B8F5;
}

/* Search & filter inputs */
[data-theme="dark"] .search-input {
  background: #1C2A44;
  color: #E2EAF5;
  border-color: #243252;
}
[data-theme="dark"] .search-input:focus {
  background: #162032;
  border-color: var(--c-blue-500);
}
[data-theme="dark"] .search-input::placeholder { color: #516088; }

[data-theme="dark"] .filter-select {
  background-color: #1C2A44;
  color: #E2EAF5;
  border-color: #243252;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B84A8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* Form fields */
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea {
  background: #1C2A44;
  color: #E2EAF5;
  border-color: #243252;
}
[data-theme="dark"] .field input::placeholder,
[data-theme="dark"] .field textarea::placeholder { color: #516088; }

/* Login form panel (right side) */
[data-theme="dark"] .login-form-panel { background: #0E1628; }
[data-theme="dark"] .login-form-title { color: #E2EAF5; }
[data-theme="dark"] .login-field input {
  background: #1C2A44;
  border-color: #243252;
  color: #E2EAF5;
}
[data-theme="dark"] .login-field input::placeholder { color: #516088; }
[data-theme="dark"] .login-field input:focus {
  background: #162032;
  border-color: var(--c-blue-500);
}
[data-theme="dark"] .login-logo-wrap { background: #FFFFFF; }
[data-theme="dark"] .sidebar-brand-logo { background: #FFFFFF; }

/* Table */
[data-theme="dark"] .ctams-table th        { background: #111A2D; }
[data-theme="dark"] .ctams-table tbody tr:hover { background: #1C2A44; }
[data-theme="dark"] .ctams-table td { border-bottom-color: #1C2A44; }

/* Topbar user info */
[data-theme="dark"] .topbar-username { color: #E2EAF5; }
[data-theme="dark"] .topbar-logout { border-color: #243252; color: #95A8C8; }
[data-theme="dark"] .topbar-logout:hover {
  background: var(--c-red-100);
  border-color: var(--c-red-100);
  color: #F87171;
}
[data-theme="dark"] .topbar-divider { background: #243252; }

/* Tabs */
[data-theme="dark"] .tab-btn:hover { background: #1C2A44; color: #E2EAF5; }
[data-theme="dark"] .tab-nav { border-bottom-color: #243252; }

/* Module card hover */
[data-theme="dark"] .module-card:hover { border-color: #374D72; }

/* Buttons */
[data-theme="dark"] .btn {
  background: #1C2A44;
  border-color: #374D72;
  color: #B2C3DA;
}
[data-theme="dark"] .btn:hover {
  background: #243252;
  border-color: #4A608A;
  color: #E2EAF5;
}

/* Landing page feature cards */
[data-theme="dark"] .landing-section-title { color: #E2EAF5; }
[data-theme="dark"] .landing-page { background: #0E1628; }

/* Theme toggle in dark mode */
[data-theme="dark"] .theme-toggle {
  border-color: #374D72;
  background: #1C2A44;
  color: #FBBF24;
}
[data-theme="dark"] .theme-toggle:hover {
  background: #243252;
  border-color: #FBBF24;
  color: #FDE68A;
}

/* ── White text on non-remapped dark/colored backgrounds ──
   --c-white is remapped to a dark surface (#162032), but text on
   blue buttons, navy hero/brand panels, and avatars must stay #FFFFFF */

[data-theme="dark"] .sidebar-brand-name,
[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .sidebar-link.active { color: #FFFFFF; }

[data-theme="dark"] .topbar-avatar,
[data-theme="dark"] .detail-avatar { color: #FFFFFF; }

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-danger,
[data-theme="dark"] .btn-danger:hover { color: #FFFFFF; }

[data-theme="dark"] .btn-login,
[data-theme="dark"] .btn-login:hover { color: #FFFFFF; }

[data-theme="dark"] .btn-hero-primary,
[data-theme="dark"] .btn-hero-primary:hover,
[data-theme="dark"] .btn-hero-secondary,
[data-theme="dark"] .btn-hero-secondary:hover { color: #FFFFFF; }

[data-theme="dark"] .page-link.active { color: #FFFFFF; }

/* Landing & login brand panels sit on --c-navy-900 (not remapped) */
[data-theme="dark"] .landing-hero-title,
[data-theme="dark"] .landing-nav-name { color: #FFFFFF; }

[data-theme="dark"] .login-brand-name,
[data-theme="dark"] .login-brand-pitch { color: #FFFFFF; }

/* ── Blue accent links & interactive elements ──
   --c-blue-700 (#1B2DA8) is dark — invisible on dark surfaces.
   Remap to a lighter periwinkle blue for readability. */

[data-theme="dark"] .tab-btn.active {
  color: #7BA7F7;
  border-bottom-color: #7BA7F7;
}
[data-theme="dark"] .module-link { color: #7BA7F7; }
[data-theme="dark"] .login-forgot { color: #7BA7F7; }
[data-theme="dark"] .login-footer a { color: #7BA7F7; }
[data-theme="dark"] .page-link:hover { color: #7BA7F7; border-color: #7BA7F7; }
[data-theme="dark"] .module-card:hover .module-icon {
  background: #2540CC;
  color: #FFFFFF;
}

/* ── Badges & KPI icons using blue/red hardcoded values ── */
[data-theme="dark"] .badge-blue { background: #162060; color: #7BA7F7; }
[data-theme="dark"] .badge-red  { background: #350E0E; color: #F87171; }

[data-theme="dark"] .kpi-icon--blue { background: #162060; color: #7BA7F7; }
[data-theme="dark"] .kpi-icon--red  { background: #350E0E; color: #F87171; }

/* Avatar initials in tables */
[data-theme="dark"] .avatar-initials { background: #162060; color: #7BA7F7; }
