/* ============================================================
   NEXZU MOBILITY — COLLECTIONS
   Design System v2 — Polished SaaS UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Brand palette — deep teal-green */
  --brand-50:  #edfdf5;
  --brand-100: #d4f7e7;
  --brand-200: #a8efce;
  --brand-300: #6fe0b0;
  --brand-400: #3ac98e;
  --brand-500: #16b076;
  --brand-600: #0d9162;
  --brand-700: #0c7452;
  --brand-800: #0d5c43;
  --brand-900: #0c4c38;

  /* Accent */
  --accent-500: #f59e0b;
  --accent-100: #fef3c7;
  --accent-800: #78350f;

  /* Danger */
  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;

  /* Info */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  /* Neutral palette */
  --gray-0:   #ffffff;
  --gray-25:  #fafbfc;
  --gray-50:  #f5f7fa;
  --gray-100: #eaecf0;
  --gray-200: #d5d9e2;
  --gray-300: #b8bfcc;
  --gray-400: #8f99ab;
  --gray-500: #6b7585;
  --gray-600: #4e5869;
  --gray-700: #36404f;
  --gray-800: #22293a;
  --gray-900: #131926;

  /* Semantic tokens */
  --brand:          var(--brand-500);
  --brand-dark:     var(--brand-700);
  --brand-glow:     rgba(22, 176, 118, 0.14);
  --danger:         var(--red-600);
  --danger-bg:      var(--red-50);
  --danger-border:  var(--red-200);
  --warning:        var(--accent-500);
  --warning-bg:     var(--accent-100);
  --success:        var(--brand-600);
  --success-bg:     var(--brand-50);
  --info:           var(--blue-600);
  --info-bg:        var(--blue-50);

  /* Surface */
  --surface:        var(--gray-0);
  --surface-raised: var(--gray-0);
  --bg:             var(--gray-50);
  --bg-subtle:      var(--gray-25);

  /* Text */
  --ink:   var(--gray-900);
  --ink-80: var(--gray-800);
  --ink-60: var(--gray-600);
  --ink-40: var(--gray-500);
  --ink-20: var(--gray-400);
  --ink-10: var(--gray-300);

  /* Borders */
  --line:      var(--gray-200);
  --line-soft: var(--gray-100);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(19, 25, 38, 0.05);
  --shadow-sm: 0 1px 3px rgba(19, 25, 38, 0.07), 0 1px 2px rgba(19, 25, 38, 0.04);
  --shadow:    0 4px 8px rgba(19, 25, 38, 0.06), 0 2px 4px rgba(19, 25, 38, 0.04);
  --shadow-md: 0 8px 16px rgba(19, 25, 38, 0.08), 0 4px 6px rgba(19, 25, 38, 0.04);
  --shadow-lg: 0 16px 32px rgba(19, 25, 38, 0.10), 0 6px 12px rgba(19, 25, 38, 0.06);
  --shadow-xl: 0 24px 48px rgba(19, 25, 38, 0.12), 0 10px 20px rgba(19, 25, 38, 0.07);

  /* Typography */
  --font-body:    'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl:20px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width:    256px;
  --sidebar-bg:       #0e1a26;
  --sidebar-border:   rgba(255,255,255,0.06);
  --sidebar-text:     #c8d8e4;
  --sidebar-muted:    #6a8a9a;
  --sidebar-active-bg:   rgba(22, 176, 118, 0.12);
  --sidebar-active-text: #4ade90;
  --sidebar-hover-bg:    rgba(255,255,255,0.05);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Transitions */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:    120ms;
  --t-base:    160ms;
  --t-slow:    250ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a  { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 200;
  border-right: 1px solid var(--sidebar-border);
  transition: transform var(--t-slow) var(--ease), width var(--t-slow) var(--ease);
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.brand-logo {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--brand-400) 0%, var(--brand-700) 100%);
  color: white;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12), inset 0 1px 0 rgba(255,255,255,0.18);
}

.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-text small {
  display: block;
  font-size: 11px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  line-height: 1.3;
}

.sidebar-toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-muted);
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
}

.sidebar-toggle:hover { background: rgba(255,255,255,0.1); color: white; }

.nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-muted);
  padding: 8px 10px 4px;
  opacity: 0.7;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 13.5px;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover { background: var(--sidebar-hover-bg); color: white; }

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--brand-400);
  border-radius: 0 2px 2px 0;
}

.nav-icon { flex-shrink: 0; width: 17px; height: 17px; }

.nav-badge {
  margin-left: auto;
  background: var(--red-600);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}

.user-info strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #e8f0f5;
  white-space: nowrap;
}

.user-info small {
  display: block;
  font-size: 10.5px;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.logout-btn {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}

.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--t-slow) var(--ease);
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: var(--space-7) var(--space-8);
  max-width: 1560px;
  width: 100%;
}

/* ============================================================
   PAGE HEADER — Consistent across all pages
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--line-soft);
}

.page-header-left { min-width: 0; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-600);
}

.eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-400);
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.2;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ============================================================
   METRICS GRID
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  position: relative;
  overflow: hidden;
}

.metric:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--metric-accent, var(--brand-400));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--metric-icon-bg, var(--brand-50));
  color: var(--metric-icon-color, var(--brand-600));
}

.metric-icon svg { width: 18px; height: 18px; }

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--ink-20);
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-skeleton {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  height: 100px;
  position: relative;
  overflow: hidden;
}

.metric-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.7) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   PANELS — Consistent cards
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.panel-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-40);
}

/* ============================================================
   TABS BAR
   ============================================================ */
.tabs-bar {
  display: flex;
  gap: 3px;
  margin-bottom: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow-xs);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-40);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}

.tab-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.tab-btn:hover {
  background: var(--gray-100);
  color: var(--ink);
}

.tab-btn.active {
  background: var(--brand);
  color: white;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(22, 176, 118, 0.35);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeUp 0.16s var(--ease-out);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar { margin-bottom: var(--space-5); }

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

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

.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink-20);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-subtle);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  line-height: 1.4;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-400);
  background: white;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.filter-select, .filter-date {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 130px;
  line-height: 1.4;
  height: 38px;
}

.filter-select:focus, .filter-date:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* Filter grid */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: end;
}

.filter-apply-btn {
  justify-self: stretch;
  justify-content: center;
}

/* Date input */
.date-input-wrap {
  position: relative;
  min-width: 130px;
}

.date-input-wrap .filter-date {
  display: block;
  width: 100%;
  padding-right: 32px;
}

.date-input-wrap .filter-date.is-empty { color: transparent; }
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit,
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit-fields-wrapper,
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit-text,
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit-month-field,
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit-day-field,
.date-input-wrap .filter-date.is-empty::-webkit-datetime-edit-year-field { color: transparent; }

.date-input-wrap .filter-date.is-empty:focus,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit-fields-wrapper,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit-text,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit-month-field,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit-day-field,
.date-input-wrap .filter-date.is-empty:focus::-webkit-datetime-edit-year-field { color: var(--ink); }

.date-placeholder {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-20);
  pointer-events: none;
  font-size: 13px;
  transition: opacity 0.15s;
}

.date-input-wrap .filter-date:not(.is-empty) + .date-placeholder,
.date-input-wrap .filter-date:focus + .date-placeholder { opacity: 0; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 580px;
}

thead { position: sticky; top: 0; z-index: 1; }

th {
  padding: 10px 13px;
  background: var(--gray-50);
  color: var(--ink-40);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-80);
}

tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: rgba(22, 176, 118, 0.025); }
tbody tr:last-child td { border-bottom: none; }

.col-actions { width: 1%; white-space: nowrap; text-align: right; }

.td-primary  { font-weight: 700; color: var(--ink); font-size: 13px; }
.td-mono     { font-family: var(--font-mono); font-size: 12px; color: var(--ink-60); }
.td-secondary{ color: var(--ink-40); font-size: 12.5px; }

/* ============================================================
   ACTION DROPDOWN
   ============================================================ */
.action-menu { position: relative; display: inline-block; }

.action-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink-60);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.action-trigger svg { width: 13px; height: 13px; }
.action-trigger:hover { border-color: var(--ink-20); background: var(--bg-subtle); color: var(--ink); }

.action-dropdown {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 168px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out);
}

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

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 13px;
  border: none;
  background: transparent;
  color: var(--ink-80);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.action-dropdown-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.action-dropdown-item:hover { background: var(--bg-subtle); color: var(--ink); }
.action-dropdown-item.danger { color: var(--danger); }
.action-dropdown-item.danger:hover { background: var(--danger-bg); }
.action-dropdown-item.success { color: var(--success); }
.action-dropdown-item.success:hover { background: var(--success-bg); }

.action-dropdown-divider { height: 1px; background: var(--line-soft); margin: 3px 0; }

/* ============================================================
   BADGES / STATUS CHIPS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status badges */
.badge-success, .badge.paid    { background: var(--brand-100); color: var(--brand-800); }
.badge-danger, .badge.overdue  { background: var(--red-50);    color: var(--red-700); }
.badge-warning, .badge.sent,
.badge.link_created             { background: #fef9c3;          color: #854d0e; }
.badge-info, .badge.created    { background: var(--blue-100);  color: var(--blue-800); }
.badge-neutral                  { background: var(--gray-100);  color: var(--ink-60); }
.badge-orange                   { background: #fff7ed;          color: #9a3412; }
.badge-active                   { background: var(--brand-100); color: var(--brand-800); }
.badge-inactive                 { background: var(--gray-100);  color: var(--gray-500); }

/* Reminder stages */
.reminder-stage-1 { background: var(--blue-100); color: #075985; }
.reminder-stage-2 { background: #fef9c3; color: #854d0e; }
.reminder-stage-3 { background: #fff7ed; color: #9a3412; }
.reminder-stage-4 { background: var(--red-100); color: var(--red-800); }

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ============================================================
   BUTTONS — Consistent, standardized
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }

.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 2px rgba(22, 176, 118, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 3px 8px rgba(22, 176, 118, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: white;
  color: var(--ink-60);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--gray-50);
  color: var(--ink);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--red-200);
}

.btn-danger:hover { background: var(--red-100); box-shadow: 0 2px 6px rgba(220,38,38,0.18); }

.btn-ghost {
  background: transparent;
  color: var(--ink-40);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: var(--gray-50); color: var(--ink-60); border-color: var(--gray-300); }

.btn-link {
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-200);
  font-size: 12px;
  padding: 4px 10px;
}

.btn-link:hover { background: var(--brand-100); }

.btn-full { width: 100%; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  gap: 4px;
}

.btn-sm svg { width: 12px; height: 12px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-5);
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

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

.form-field-full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-60);
  letter-spacing: 0.01em;
}

.label-hint {
  font-weight: 500;
  color: var(--ink-20);
  font-size: 11px;
  margin-left: 4px;
}

input:not([type=checkbox]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: white;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  line-height: 1.5;
  height: 38px;
}

textarea { height: auto; resize: vertical; }

input:not([type=checkbox]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

input:not([type=checkbox]):hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) { border-color: var(--gray-300); }

input::placeholder, textarea::placeholder { color: var(--ink-20); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-60);
  font-weight: 600;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), border-color var(--t-fast);
}

.checkbox-label:hover { background: var(--gray-50); border-color: var(--gray-300); }

.checkbox-label input[type=checkbox] {
  width: 15px !important;
  height: 15px !important;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line-soft);
}

.rider-form { display: flex; flex-direction: column; gap: 0; }

/* ============================================================
   FORM INFO CARDS
   ============================================================ */
.form-info-card {
  padding: 20px 22px;
  position: sticky;
  top: 28px;
}

.form-info-card h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-4);
}

.plan-info-list, .rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--space-4);
}

.plan-info-item, .rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--gray-25);
  border: 1px solid var(--line-soft);
}

.plan-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.plan-dot.daily   { background: var(--info); }
.plan-dot.weekly  { background: var(--warning); }
.plan-dot.monthly { background: var(--brand); }

.plan-info-item strong, .rule-item strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.plan-info-item small, .rule-item small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-40);
  margin-top: 1px;
}

.rule-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rule-icon svg { width: 13px; height: 13px; }
.rule-icon-info    { background: var(--info-bg);    color: var(--info); }
.rule-icon-success { background: var(--success-bg); color: var(--success); }
.rule-icon-warning { background: var(--warning-bg); color: var(--warning); }

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--brand-700);
  line-height: 1.5;
}

.info-note svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.pagination-info { font-size: 12px; color: var(--ink-40); }

.pagination-controls { display: flex; align-items: center; gap: 3px; }

.page-btn {
  display: grid;
  place-items: center;
  min-width: 30px; height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink-60);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
}

.page-btn:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-300); color: var(--ink); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn.current { background: var(--brand); color: white; border-color: var(--brand); }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state td {
  padding: 44px 20px;
  text-align: center;
}

.empty-state-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-20);
  font-size: 13px;
}

/* ============================================================
   REPORTS GRID
   ============================================================ */
.reports-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-4);
  width: 100%;
}

.reports-grid .wide { grid-column: 1 / -1; }

/* ============================================================
   STACK LIST (Reports)
   ============================================================ */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--gray-25);
  transition: background var(--t-fast);
}

.stack-item:hover { background: var(--gray-100); }

.stack-item strong {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
}

.stack-progress {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 8px;
}

.stack-progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

/* Status/Reminder containers in reports */
.status-reminder-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ============================================================
   FINANCE PAGE — Summary stats
   ============================================================ */
.finance-summary {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.finance-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.finance-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.finance-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* Finance filter — bring it into design system */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.filters-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-60);
}

.filters-row select,
.filters-row input[type="date"] {
  min-width: 120px;
  width: auto;
}

/* ============================================================
   OVERDUE DAYS INDICATOR
   ============================================================ */
.days-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 13px;
}

.days-badge.critical { color: var(--red-600); }
.days-badge.warning  { color: var(--warning); }
.days-badge.mild     { color: var(--ink-60); }

/* ============================================================
   REMINDER LEGEND
   ============================================================ */
.reminder-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.legend-label {
  font-size: 11px;
  color: var(--ink-20);
  margin-left: 2px;
}

/* ============================================================
   FORM BADGE (edit mode)
   ============================================================ */
.form-badge { display: flex; align-items: center; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 360px;
  width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--gray-900);
  color: white;
  box-shadow: var(--shadow-xl);
  font-size: 13px;
  font-weight: 600;
  animation: slideInToast 0.22s var(--ease-spring);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.toast-success { background: #064e35; border-left: 3px solid var(--brand-400); }
.toast.toast-error   { background: var(--red-800);  border-left: 3px solid var(--red-400); }
.toast.toast-warning { background: var(--accent-800); border-left: 3px solid var(--accent-500); }

.toast-icon { flex-shrink: 0; width: 15px; height: 15px; margin-top: 1px; }

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(16px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 19, 30, 0.6);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalFadeIn 0.14s var(--ease-out);
}

.modal-overlay[hidden] { display: none; }

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 28px 30px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.2s var(--ease-spring);
  text-align: center;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

.modal-icon.warning { background: var(--warning-bg); color: var(--warning); }
.modal-icon.danger  { background: var(--danger-bg);  color: var(--danger); }
.modal-icon svg { width: 22px; height: 22px; }

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.modal-body {
  font-size: 13.5px;
  color: var(--ink-40);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions .btn { min-width: 100px; }

/* Finance update modal — inline form */
#financeUpdateForm label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: var(--space-4);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-60);
}

#financeUpdateForm select,
#financeUpdateForm textarea {
  text-align: left;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  min-height: 100vh;
  background: var(--gray-900);
  background-image:
    radial-gradient(ellipse at 15% 55%, rgba(22, 176, 118, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(22, 176, 118, 0.08) 0%, transparent 50%);
}

.login-container {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 440px;
  align-items: stretch;
}

.login-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 60px;
  color: white;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 44px;
}

.brand-logo-large { width: 46px; height: 46px; }

.login-brand-name {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
}

.login-brand small {
  display: block;
  font-size: 11.5px;
  color: rgba(255,255,255,0.38);
  margin-top: 2px;
}

.login-tagline {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: white;
  margin-bottom: 36px;
}

.login-tagline span { color: var(--brand-400); }

.login-features {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

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

.login-feature-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(22, 176, 118, 0.13);
  border: 1px solid rgba(22, 176, 118, 0.2);
  display: grid;
  place-items: center;
  color: var(--brand-400);
  flex-shrink: 0;
}

.login-feature-icon svg { width: 15px; height: 15px; }

.login-right {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: white;
  border-radius: var(--radius-2xl);
  padding: 32px 28px;
  box-shadow: var(--shadow-xl);
}

.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 5px;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--ink-40);
  margin-bottom: 24px;
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 13px;
  background: var(--danger-bg);
  border: 1px solid var(--red-200);
  border-radius: var(--radius-sm);
  color: var(--red-700);
  font-size: 12.5px;
  margin-bottom: 18px;
}

.login-error svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================
   MOBILE HAMBURGER BUTTON
   ============================================================ */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 198;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink-60);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}

.mobile-menu-btn:hover { background: var(--gray-50); color: var(--ink); }
.mobile-menu-btn svg { width: 18px; height: 18px; }

/* ============================================================
   RESPONSIVE — Tablet (900–1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: 1fr 1fr; }
  .reports-grid .wide { grid-column: 1 / -1; }
  .form-layout { grid-template-columns: 1fr; }
  .form-info-card { position: static; }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-apply-btn { grid-column: span 3; justify-self: stretch; }
}

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

  .brand-text,
  .nav-item span,
  .nav-label,
  .user-info,
  .sidebar-toggle span { display: none; }

  .nav-item { justify-content: center; padding: 10px 8px; }
  .nav-item.active::before { display: none; }
  .sidebar-footer { justify-content: center; padding: 12px; }
  .sidebar-user { display: none; }
  .logout-btn { margin: 0; }
  .main { padding: var(--space-5) var(--space-5); }
}

/* ============================================================
   RESPONSIVE — Mobile (<768px)
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-width: 256px; }

  /* Sidebar becomes drawer */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity var(--t-slow); }
  .sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

  /* Restore sidebar labels on mobile drawer */
  .brand-text,
  .nav-item span,
  .nav-label,
  .user-info { display: block !important; }
  .nav-item { justify-content: flex-start !important; padding: 9px 10px !important; }
  .sidebar-user { display: flex !important; }

  .main-wrapper { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .main { padding: 60px 14px 16px; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .page-header h1 { font-size: 22px; }

  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .reports-grid { grid-template-columns: 1fr; }
  .reports-grid .wide { grid-column: 1; }

  .tabs-bar { width: 100%; overflow-x: auto; }
  .tab-btn { flex: 1; justify-content: center; white-space: nowrap; }

  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-apply-btn { grid-column: span 2; justify-self: stretch; }

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

  table { font-size: 12px; }
  th, td { padding: 10px 10px; }

  .pagination-bar { flex-direction: column; align-items: flex-start; gap: 8px; }

  .filters-row { flex-direction: column; align-items: stretch; }
  .filters-row label { width: 100%; }
  .filters-row select, .filters-row input[type="date"] { width: 100%; }

  .toast-container { right: 12px; bottom: 12px; width: calc(100vw - 24px); }

  .reminder-legend { display: none; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-apply-btn { grid-column: span 1; }
  .page-header h1 { font-size: 20px; }
  .metric-value { font-size: 24px; }
}

/* ============================================================
   SCROLLBAR STYLING (Webkit)
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ============================================================
   OVERFLOW PREVENTION
   ============================================================ */
.main { overflow-x: hidden; }
.panel { overflow: hidden; }
.table-wrap { overflow-x: auto; width: 100%; box-sizing: border-box; }

