/* ═══════════════════════════════════════════════════════════════════════════
   Brothers Garage — Design System v2
   Inspired by Linear · Vercel · Raycast
   Dark · Geometric · Precise

   Font: Inter    |  Accent: #C3DC01
   Base: #09090B  |  Surface: #111113  |  Elevated: #18181B
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══ 1. DESIGN TOKENS ═══════════════════════════════════════════════════════ */

:root {
  /* ── Color: Backgrounds ─────────────────────────────────────────────────── */
  --color-bg-base:       #09090B;
  --color-bg-surface:    #111113;
  --color-bg-elevated:   #18181B;
  --color-bg-overlay:    rgba(0, 0, 0, 0.72);
  --color-bg-input:      #0F0F11;
  --color-bg-hover:      #1F1F23;
  --color-bg-active:     #27272A;

  /* ── Color: Text ────────────────────────────────────────────────────────── */
  --color-text-primary:  #FAFAFA;
  --color-text-secondary:#A1A1AA;
  --color-text-muted:    #71717A;
  --color-text-faint:    #3F3F46;

  /* ── Color: Borders ─────────────────────────────────────────────────────── */
  --color-border:        #27272A;
  --color-border-strong: #3F3F46;
  --color-border-subtle: #1F1F23;

  /* ── Color: Accent ──────────────────────────────────────────────────────── */
  --color-accent:        #C3DC01;
  --color-accent-hover:  #D4ED11;
  --color-accent-muted:  #9FB000;
  --color-accent-dim:    rgba(195, 220, 1, 0.10);
  --color-accent-rgb:    195, 220, 1;

  /* ── Color: Semantic ────────────────────────────────────────────────────── */
  --color-success:       #22C55E;
  --color-success-dim:   rgba(34, 197, 94, 0.10);
  --color-warning:       #EAB308;
  --color-warning-dim:   rgba(234, 179, 8, 0.10);
  --color-error:         #EF4444;
  --color-error-dim:     rgba(239, 68, 68, 0.10);
  --color-info:          #3B82F6;
  --color-info-dim:      rgba(59, 130, 246, 0.10);

  /* ── Typography ─────────────────────────────────────────────────────────── */
  --font-sans:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:           'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-size-xs:        0.6875rem;  /* 11px */
  --font-size-sm:        0.75rem;    /* 12px */
  --font-size-base:      0.8125rem;  /* 13px */
  --font-size-md:        0.875rem;   /* 14px */
  --font-size-lg:        1rem;       /* 16px */
  --font-size-xl:        1.125rem;   /* 18px */
  --font-size-2xl:       1.25rem;    /* 20px */
  --font-size-3xl:       1.5rem;     /* 24px */
  --font-size-4xl:       1.875rem;   /* 30px */
  --font-size-5xl:       2.25rem;    /* 36px */
  --line-height-heading: 1.2;
  --line-height-body:    1.5;
  --line-height-ui:      1.4;
  --letter-spacing-heading: -0.02em;
  --letter-spacing-caps:    0.04em;

  /* ── Spacing (4px base) ─────────────────────────────────────────────────── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-24: 96px;

  /* ── Radii ──────────────────────────────────────────────────────────────── */
  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-full: 9999px;

  /* ── Shadows (subtle, border-first depth) ───────────────────────────────── */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:     0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.6);

  /* ── Transitions ────────────────────────────────────────────────────────── */
  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --duration:   150ms;
  --transition: var(--duration) var(--ease);

  /* ── Layout ─────────────────────────────────────────────────────────────── */
  --sidebar-w:  232px;
  --topbar-h:   48px;
  --content-max: 1200px;

  /* ── Backward-compat aliases ────────────────────────────────────────────── */
  --bg:            var(--color-bg-base);
  --bg-surface:    var(--color-bg-surface);
  --bg-elevated:   var(--color-bg-elevated);
  --bg-input:      var(--color-bg-input);
  --sidebar-bg:    var(--color-bg-base);
  --border:        var(--color-border);
  --border-hover:  var(--color-border-strong);
  --border-subtle: var(--color-border-subtle);
  --accent:        var(--color-accent);
  --accent-hover:  var(--color-accent-hover);
  --accent-dark:   var(--color-accent-muted);
  --accent-rgb:    var(--color-accent-rgb);
  --text:          var(--color-text-primary);
  --text-muted:    var(--color-text-muted);
  --text-faint:    var(--color-text-faint);
  --success:       var(--color-success);
  --success-dim:   var(--color-success-dim);
  --danger:        var(--color-error);
  --danger-dim:    var(--color-error-dim);
  --warning:       var(--color-warning);
  --warning-dim:   var(--color-warning-dim);
  --info:          var(--color-info);
  --shadow:        var(--shadow-sm);
  --shadow-lg:     var(--shadow-lg);
}

/* ── Bootstrap variable overrides ─────────────────────────────────────────── */
:root {
  --bs-body-bg:              var(--color-bg-base);
  --bs-body-color:           var(--color-text-primary);
  --bs-body-font-family:     var(--font-sans);
  --bs-body-font-size:       var(--font-size-md);
  --bs-body-line-height:     var(--line-height-body);
  --bs-border-color:         var(--color-border);
  --bs-card-bg:              var(--color-bg-surface);
  --bs-card-border-color:    var(--color-border);
  --bs-card-cap-bg:          var(--color-bg-elevated);
  --bs-table-bg:             transparent;
  --bs-table-hover-bg:       var(--color-bg-hover);
  --bs-table-border-color:   var(--color-border);
  --bs-table-color:          var(--color-text-primary);
  --bs-input-bg:             var(--color-bg-input);
  --bs-input-border-color:   var(--color-border);
  --bs-input-color:          var(--color-text-primary);
  --bs-input-focus-border-color: var(--color-accent);
  --bs-link-color:           var(--color-accent);
  --bs-link-hover-color:     var(--color-accent-hover);
}

/* ═══ 2. RESET & BASE ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: var(--line-height-body);
  min-height: 100vh;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

::selection {
  background: rgba(var(--color-accent-rgb), 0.25);
  color: var(--color-text-primary);
}

/* ═══ 3. TYPOGRAPHY ═══════════════════════════════════════════════════════════ */

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
  color: var(--color-text-primary);
  margin: 0;
}
h1 { font-size: var(--font-size-3xl); font-weight: 600; }
h2 { font-size: var(--font-size-2xl); font-weight: 600; }
h3 { font-size: var(--font-size-lg);  font-weight: 600; }
h4 { font-size: var(--font-size-md);  font-weight: 600; }

.text-muted, .text-secondary { color: var(--color-text-muted) !important; }
.text-accent  { color: var(--color-accent)  !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-error)   !important; }
.text-warning { color: var(--color-warning) !important; }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-accent-hover); }

/* ═══ 4. LAYOUT ══════════════════════════════════════════════════════════════ */

body.has-sidebar .main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--color-bg-base);
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar__brand {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
}
.brand-link:hover .brand-mark { background: var(--color-accent-hover); }
.brand-mark {
  width: 32px; height: 32px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-bg-base);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: background var(--transition);
}
.brand-text { line-height: 1; }
.brand-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* ── Sidebar Nav ──────────────────────────────────────────────────────────── */
.sidebar__nav {
  flex: 1;
  padding: var(--sp-2);
  overflow-y: auto;
}
.nav-group { margin-bottom: var(--sp-1); }
.nav-group__label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-2);
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  line-height: var(--line-height-ui);
}
.nav-item i {
  font-size: var(--font-size-md);
  width: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.nav-item:hover i { opacity: 1; }
.nav-item.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  font-weight: 500;
}
.nav-item.active i { color: var(--color-accent); opacity: 1; }
.nav-item.nav-item--accent { color: var(--color-accent); font-weight: 500; }
.nav-item.nav-item--accent:hover { background: var(--color-accent-dim); color: var(--color-accent); }
.nav-item.nav-item--accent.active { background: rgba(var(--color-accent-rgb), 0.12); }

.nav-item.nav-item--logout {
  color: var(--color-text-faint);
  font-size: var(--font-size-base);
}
.nav-item.nav-item--logout:hover {
  color: var(--color-error);
  background: var(--color-error-dim);
}

/* ── Sidebar Footer ───────────────────────────────────────────────────────── */
.sidebar__footer {
  padding: var(--sp-2) var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

/* ── Sidebar Overlay (mobile) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: 190;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* ── Mobile topbar ────────────────────────────────────────────────────────── */
.topbar-mobile {
  display: none;
  height: var(--topbar-h);
  background: var(--color-bg-base);
  border-bottom: 1px solid var(--color-border-subtle);
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-toggle, .topbar-action {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.topbar-toggle:hover, .topbar-action:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
}
.topbar-brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Page Content ─────────────────────────────────────────────────────────── */
.page-content {
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  max-width: var(--content-max);
}
.page-content--full {
  padding: var(--sp-6);
  max-width: none;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.page-header h1 {
  margin: 0;
  font-size: var(--font-size-3xl);
  font-weight: 600;
  letter-spacing: var(--letter-spacing-heading);
}

/* ═══ 5. COMPONENTS ══════════════════════════════════════════════════════════ */

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  transition: border-color var(--transition);
}
.card-header {
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.card-body { padding: var(--sp-4); }

.card--accent   { border-color: rgba(var(--color-accent-rgb), 0.25); }
.card--accent .card-header { background: var(--color-accent-dim); color: var(--color-accent); border-bottom-color: rgba(var(--color-accent-rgb), 0.15); }
.card--success  { border-color: rgba(34,197,94,0.2); }
.card--success .card-header { background: var(--color-success-dim); color: var(--color-success); border-bottom-color: rgba(34,197,94,0.15); }
.card--danger   { border-color: rgba(239,68,68,0.2); }
.card--warning  { border-color: rgba(234,179,8,0.2); }
.card--warning .card-header { background: var(--color-warning-dim); color: var(--color-warning); }

.card-dark {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.card-dark__body { padding: var(--sp-4); }
.card-dark__header {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-footer {
  background: transparent;
  border-top: 1px solid var(--color-border);
  padding: var(--sp-3) var(--sp-4);
  margin-top: auto;
}

/* Card hover & interactive */
.card-hover {
  transition: border-color var(--transition), transform var(--transition);
  cursor: pointer;
}
.card-hover:hover {
  border-color: var(--color-border-strong);
}
.card-link { cursor: pointer; }
.card-link:hover { border-color: var(--color-border-strong); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--font-size-md);
  letter-spacing: 0;
  border-radius: var(--radius);
  min-height: 36px;
  padding: var(--sp-2) var(--sp-4);
  transition: all var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  border: 1px solid transparent;
  position: relative;
  user-select: none;
}
.btn:disabled, .btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: none;
}

.btn-lg { min-height: 44px; font-size: var(--font-size-lg); padding: var(--sp-3) var(--sp-6); }
.btn-sm { min-height: 32px; font-size: var(--font-size-base); padding: var(--sp-1) var(--sp-3); }
.btn-xs { min-height: 26px; padding: 2px var(--sp-2); font-size: var(--font-size-xs); font-weight: 500; border-radius: var(--radius-sm); }

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg-base);
  font-weight: 500;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-bg-base);
}
.btn-primary:active {
  background: var(--color-accent-muted);
  border-color: var(--color-accent-muted);
}

.btn-accent { background: var(--color-accent); color: var(--color-bg-base); font-weight: 500; border: none; }
.btn-accent:hover { background: var(--color-accent-hover); color: var(--color-bg-base); }

.btn-secondary {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}
.btn-secondary:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

.btn-outline-secondary {
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

.btn-success  { background: var(--color-success); border-color: var(--color-success); color: var(--color-bg-base); font-weight: 500; }
.btn-success:hover { background: #2DD468; border-color: #2DD468; color: var(--color-bg-base); }

.btn-warning  { background: var(--color-warning); border-color: var(--color-warning); color: var(--color-bg-base); font-weight: 500; }
.btn-warning:hover { background: #F5C225; border-color: #F5C225; color: var(--color-bg-base); }

.btn-danger   { background: var(--color-error); border-color: var(--color-error); color: white; font-weight: 500; }
.btn-danger:hover { background: #F55A5A; border-color: #F55A5A; color: white; }

.btn-outline-danger  { color: var(--color-error); border-color: rgba(239,68,68,0.3); background: transparent; }
.btn-outline-danger:hover { background: var(--color-error-dim); border-color: var(--color-error); color: var(--color-error); }

.btn-outline-primary { color: var(--color-accent); border-color: rgba(var(--color-accent-rgb), 0.3); background: transparent; }
.btn-outline-primary:hover { background: var(--color-accent-dim); border-color: var(--color-accent); color: var(--color-accent); }

.btn-outline-success { color: var(--color-success); border-color: rgba(34,197,94,0.3); background: transparent; }
.btn-outline-success:hover { background: var(--color-success-dim); border-color: var(--color-success); color: var(--color-success); }

/* Ghost button */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Loading state */
.btn--loading {
  color: transparent !important;
  pointer-events: none;
}
.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: btn-spin 0.5s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ── Back Button ──────────────────────────────────────────────────────────── */
.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-back:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: var(--radius);
  min-height: 36px;
  font-size: var(--font-size-md);
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: var(--color-text-faint); }
.form-control:hover:not(:focus):not(:disabled) { border-color: var(--color-border-strong); }
.form-control:focus, .form-select:focus {
  background-color: var(--color-bg-input);
  color: var(--color-text-primary);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.10);
  outline: none;
}
.form-control:disabled, .form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.form-control.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-dim);
}
.form-control-lg, .form-select-lg { min-height: 44px; font-size: var(--font-size-lg); }

.form-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  margin-bottom: var(--sp-1);
}
.form-text { font-size: var(--font-size-sm); color: var(--color-text-faint); }

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2371717A' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 10px;
  padding-right: 36px;
}
.form-select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23C3DC01' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.form-select:hover:not(:focus) {
  border-color: var(--color-border-strong);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23A1A1AA' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.form-select option { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.input-group-text { background: var(--color-bg-elevated); border-color: var(--color-border); color: var(--color-text-muted); }

/* ── Form check / switch ──────────────────────────────────────────────────── */
.form-check-input { background-color: var(--color-bg-elevated); border-color: var(--color-border-strong); }
.form-check-input:checked { background-color: var(--color-accent); border-color: var(--color-accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.10); }
.form-switch .form-check-input { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba(150,150,150,0.8)'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2309090B'/%3e%3c/svg%3e"); }

/* btn-check toggle groups */
.btn-check + .btn-outline-success,
.btn-check + .btn-outline-primary,
.btn-check + .btn-outline-danger { background: var(--color-bg-elevated); border-color: var(--color-border); color: var(--color-text-muted); }
.btn-check:checked + .btn-outline-success { background: var(--color-success-dim); border-color: var(--color-success); color: var(--color-success); }
.btn-check:checked + .btn-outline-primary { background: var(--color-accent-dim); border-color: var(--color-accent); color: var(--color-accent); }
.btn-check:checked + .btn-outline-danger  { background: var(--color-error-dim); border-color: var(--color-error); color: var(--color-error); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table {
  color: var(--color-text-primary);
  border-color: var(--color-border);
  font-size: var(--font-size-md);
}
.table > :not(caption) > * > * {
  background-color: transparent;
  border-bottom-color: var(--color-border);
  padding: var(--sp-3) var(--sp-4);
  color: var(--color-text-primary);
}
.table thead > tr > th {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  padding: var(--sp-2) var(--sp-4);
  white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { background-color: var(--color-bg-hover); }
.table-sm > :not(caption) > * > * { padding: var(--sp-2) var(--sp-3); }
tfoot > tr > td { font-weight: 600; border-top: 1px solid var(--color-border-strong); }

/* Sortable headers */
.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable:hover { color: var(--color-text-primary); }
.sortable .sort-icon { display: inline-block; opacity: 0.25; font-size: 10px; margin-left: 3px; transition: opacity var(--transition); }
.sortable:hover .sort-icon { opacity: 0.55; }
.sort-asc .sort-icon,
.sort-desc .sort-icon { opacity: 1; color: var(--color-accent); }

/* Sticky table header */
.table-sticky thead th {
  position: sticky;
  top: 0;
  background: var(--color-bg-surface);
  z-index: 10;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 3px var(--sp-2);
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-new         { background: rgba(113,113,122,0.12); color: var(--color-text-muted); }
.badge-in-progress { background: var(--color-warning-dim); color: var(--color-warning); }
.badge-in-progress::before { animation: pulse-dot 2s ease-in-out infinite; }
.badge-done        { background: var(--color-info-dim); color: var(--color-info); }
.badge-closed      { background: var(--color-success-dim); color: var(--color-success); }
.badge-anomaly     { background: var(--color-error-dim); color: var(--color-error); }
.badge-scheduled   { background: var(--color-accent-dim); color: var(--color-accent); }
.badge-scheduled::before { background: var(--color-accent); }
.badge-low    { background: var(--color-success-dim);  color: var(--color-success); }
.badge-medium { background: var(--color-accent-dim);   color: var(--color-accent); }
.badge-high   { background: var(--color-error-dim); color: var(--color-error); }

@keyframes pulse-dot { 0%,100%{ opacity:1 } 50%{ opacity:0.3 } }

/* Bootstrap badge overrides */
.badge {
  font-weight: 500;
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
}
.badge.bg-primary   { background: var(--color-accent) !important; color: var(--color-bg-base) !important; }
.badge.bg-success   { background: var(--color-success-dim) !important; color: var(--color-success) !important; }
.badge.bg-danger    { background: var(--color-error-dim)  !important; color: var(--color-error)  !important; }
.badge.bg-warning   { background: var(--color-warning-dim) !important; color: var(--color-warning) !important; }
.badge.bg-secondary { background: rgba(113,113,122,0.12) !important; color: var(--color-text-muted) !important; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: var(--font-size-md);
}
.alert-success { background: var(--color-success-dim); border-color: rgba(34,197,94,0.2);  color: var(--color-success); }
.alert-danger  { background: var(--color-error-dim);   border-color: rgba(239,68,68,0.2);  color: var(--color-error); }
.alert-warning { background: var(--color-warning-dim); border-color: rgba(234,179,8,0.2);  color: var(--color-warning); }
.alert-primary { background: var(--color-accent-dim);  border-color: rgba(var(--color-accent-rgb),0.2); color: var(--color-accent); }
.alert-secondary { background: var(--color-bg-elevated); border-color: var(--color-border); color: var(--color-text-muted); }
.alert-info      { background: var(--color-info-dim); border-color: rgba(59,130,246,0.2); color: var(--color-info); }
.btn-close { filter: invert(1) opacity(0.4); }

/* ── Dividers ─────────────────────────────────────────────────────────────── */
hr { border-color: var(--color-border); opacity: 1; }

/* ── Section title ────────────────────────────────────────────────────────── */
.section-title {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ═══ 6. STAT CARDS ══════════════════════════════════════════════════════════ */

.stat-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  height: 100%;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--color-border-strong); }
.stat-card--danger  { border-color: rgba(239,68,68,0.2); }
.stat-card--warning { border-color: rgba(234,179,8,0.2); }
.stat-card__label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}
.stat-card__value {
  font-size: var(--font-size-3xl);
  font-weight: 600;
  line-height: 1;
  margin-bottom: var(--sp-1);
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-card__value .stat-num { white-space: nowrap; }
.stat-card__value.accent  { color: var(--color-accent); }
.stat-card__value.success { color: var(--color-success); }
.stat-card__value.danger  { color: var(--color-error); }
.stat-card__value.warning { color: var(--color-warning); }
.stat-card__sub { font-size: var(--font-size-xs); color: var(--color-text-muted); }
.stat-currency {
  font-size: 0.6em;
  font-weight: 500;
  vertical-align: middle;
  color: inherit;
  opacity: 0.6;
  letter-spacing: 0;
}

/* ═══ 7. JOB CARDS ═══════════════════════════════════════════════════════════ */

.job-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--transition), background var(--transition);
}
.job-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-elevated);
}
.job-card--active  { background: var(--color-accent-dim); }
.job-card--waiting { }
.job-card--done    { opacity: 0.5; }
.job-card--stuck   { background: var(--color-error-dim); border-color: rgba(239,68,68,0.2); }
.job-card__header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-1); }
.job-card__plate   { font-family: var(--font-mono); font-size: var(--font-size-base); font-weight: 600; color: var(--color-accent); letter-spacing: 0.04em; }
.job-card__name    { font-size: var(--font-size-md); font-weight: 500; color: var(--color-text-primary); }
.job-card__meta    { display: flex; gap: var(--sp-3); font-size: var(--font-size-sm); color: var(--color-text-muted); flex-wrap: wrap; }
.job-card__client  { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-top: var(--sp-1); }
a.job-card, a.job-card:hover { color: inherit; text-decoration: none; display: block; }

/* ═══ 8. TIMERS ══════════════════════════════════════════════════════════════ */

.timer-live { color: var(--color-accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-block {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px var(--sp-3);
}
.timer-block i { color: var(--color-accent); }
.timer-block .timer-live { color: var(--color-accent); font-variant-numeric: tabular-nums; }
.timer-pill {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-dim);
  border-radius: var(--radius-full);
  padding: 2px var(--sp-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ═══ 9. FILTER TABS ═════════════════════════════════════════════════════════ */

.filter-tabs { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.filter-tab {
  padding: 5px var(--sp-3);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  line-height: var(--line-height-ui);
}
.filter-tab:hover { border-color: var(--color-border-strong); color: var(--color-text-primary); }
.filter-tab.active {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: var(--color-bg-base);
  font-weight: 500;
}
.filter-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--sp-1);
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-left: 2px;
}
.filter-tab.active .filter-tab__count { background: rgba(0,0,0,0.15); }

/* ═══ 10. SEARCH ═════════════════════════════════════════════════════════════ */

.search-box { position: relative; }
.search-box__icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  font-size: var(--font-size-md);
  pointer-events: none;
}
.search-box__input {
  width: 100%;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-8);
  border-radius: var(--radius);
  font-size: var(--font-size-md);
  transition: border-color var(--transition);
}
.search-box__input::placeholder { color: var(--color-text-faint); }
.search-box__input:focus { outline: none; border-color: var(--color-border-strong); }

#searchResults {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
#searchResults .list-group-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: background var(--transition);
}
#searchResults .list-group-item:last-child { border-bottom: none; }
#searchResults .list-group-item:hover { background: var(--color-bg-hover); }

/* ═══ 11. EMPTY STATES ═══════════════════════════════════════════════════════ */

.empty-state {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  padding: var(--sp-12) 0;
  text-align: center;
}
.empty-state i {
  font-size: 2rem;
  display: block;
  margin-bottom: var(--sp-3);
  color: var(--color-text-faint);
}
.empty-state__text { font-size: var(--font-size-md); }

/* ═══ 12. LOADING SKELETONS ══════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 25%,
    var(--color-bg-hover) 50%,
    var(--color-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: var(--sp-2); }
.skeleton-text--sm { height: 12px; width: 60%; }
.skeleton-heading { height: 24px; width: 40%; margin-bottom: var(--sp-3); }
.skeleton-card {
  height: 80px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-3);
}
.skeleton-avatar { width: 32px; height: 32px; border-radius: var(--radius-full); }
.skeleton-row {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══ 13. TOAST / NOTIFICATIONS ══════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  pointer-events: auto;
  animation: toast-enter 200ms var(--ease) forwards;
  min-width: 280px;
  max-width: 420px;
}
.toast-item--success { border-left: 3px solid var(--color-success); }
.toast-item--error   { border-left: 3px solid var(--color-error); }
.toast-item--warning { border-left: 3px solid var(--color-warning); }
.toast-item--info    { border-left: 3px solid var(--color-info); }
.toast-item__icon { font-size: var(--font-size-lg); flex-shrink: 0; }
.toast-item__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: var(--sp-1);
  transition: color var(--transition);
}
.toast-item__close:hover { color: var(--color-text-primary); }
.toast-item--exiting { animation: toast-exit 200ms var(--ease) forwards; }

@keyframes toast-enter {
  from { opacity: 0; transform: translateX(var(--sp-4)); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-exit {
  to { opacity: 0; transform: translateX(var(--sp-4)); }
}
@keyframes slideInRight { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity:0; transform: translateX(10px); } }

/* ═══ 14. DASHBOARD ══════════════════════════════════════════════════════════ */

.dash-section-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.dash-section-title {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.dash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.dash-empty {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
  color: var(--color-text-faint);
  font-size: var(--font-size-base);
  margin-bottom: 0;
}
.dash-empty i { font-size: var(--font-size-lg); }

/* Closed-today rows */
.closed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: background var(--transition);
}
.closed-row:last-child { border-bottom: none; }
.closed-row:hover { background: var(--color-bg-hover); }
.closed-row__left { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.closed-row__plate {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.closed-row__name {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.closed-row__price {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: var(--sp-4);
  font-variant-numeric: tabular-nums;
}

/* ═══ 15. JOBS TABLE ═════════════════════════════════════════════════════════ */

.jobs-table td { padding: var(--sp-2) var(--sp-3); vertical-align: middle; }
.jobs-table th { padding: var(--sp-2) var(--sp-3); font-size: var(--font-size-xs); }
.job-vehicle { font-weight: 500; font-size: var(--font-size-md); }
.job-vehicle .text-faint { font-weight: 400; }
.job-client { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-top: 2px; }
.job-type { font-size: var(--font-size-md); }
.price-main { font-weight: 600; font-size: var(--font-size-md); white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-pct { font-size: var(--font-size-sm); margin-top: 1px; }
.tabnum { font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; color: var(--color-text-faint); }
.btn-icon-link { color: var(--color-text-faint); text-decoration: none; padding: var(--sp-1); display: flex; align-items: center; transition: color var(--transition); }
.btn-icon-link:hover { color: var(--color-text-primary); }
.price-pair { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.price-pair > div { text-align: right; min-width: 48px; }
.price-pair__sep { color: var(--color-text-faint); font-size: var(--font-size-sm); flex-shrink: 0; }

/* Clickable rows — chevron */
.job-row td:last-child { position: relative; padding-right: 28px; }
.job-row td:last-child::after {
  content: '›';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  font-size: 1.1rem;
  line-height: 1;
  transition: color var(--transition), transform var(--transition);
  pointer-events: none;
}
.job-row:hover td:last-child::after { color: var(--color-accent); transform: translateY(-50%) translateX(2px); }
.table-hover > tbody > tr.job-row:hover > *,
.table-hover > tbody > tr.client-row:hover > * { background: var(--color-bg-hover); }

/* ═══ 16. CLIENTS TABLE ══════════════════════════════════════════════════════ */

.clients-table td { padding: var(--sp-2) var(--sp-3); }
.client-name { font-weight: 500; font-size: var(--font-size-md); }
.client-notes { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-top: 2px; }
.client-phone {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-md);
  text-decoration: none;
  white-space: nowrap;
}
.client-phone:hover { color: var(--color-text-primary); }
.vehicles-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}
.vehicles-badge:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ═══ 17. CLIENT LINK BLOCK ══════════════════════════════════════════════════ */

.client-link-block {
  background: var(--color-accent-dim);
  border: 1px solid rgba(var(--color-accent-rgb), 0.2);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
}
.client-link-block__label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-2);
}
.client-link-block__url {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--sp-2);
  word-break: break-all;
}
.client-link-block__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.client-link-block__qr {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(var(--color-accent-rgb), 0.12);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.btn-copy {
  background: var(--color-accent-dim);
  border: 1px solid rgba(var(--color-accent-rgb), 0.25);
  color: var(--color-accent);
  font-weight: 500;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-3);
  transition: background var(--transition);
  min-height: 28px;
}
.btn-copy:hover { background: rgba(var(--color-accent-rgb), 0.15); color: var(--color-accent); }

.btn-telegram {
  background: rgba(44, 165, 224, 0.08);
  border: 1px solid rgba(44, 165, 224, 0.25);
  color: #2ca5e0;
  font-weight: 500;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-3);
  transition: background var(--transition);
  min-height: 28px;
}
.btn-telegram:hover { background: rgba(44, 165, 224, 0.15); color: #2ca5e0; }

/* ═══ 18. MISC COMPONENTS ════════════════════════════════════════════════════ */

/* Progress */
.progress { background: var(--color-bg-elevated); border-radius: var(--radius-full); }
.progress-bar { background: var(--color-accent); border-radius: var(--radius-full); }

/* List group */
.list-group-item { background: var(--color-bg-surface); border-color: var(--color-border); color: var(--color-text-primary); }
.list-group-item-action:hover { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.list-group-item-action:focus { background: var(--color-bg-elevated); color: var(--color-text-primary); box-shadow: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-strong); }

/* Table responsive */
.table-responsive { overflow-x: auto; }
.table-responsive::-webkit-scrollbar { height: 4px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }

/* Deviation indicators */
.dev-positive { color: var(--color-error); }
.dev-negative { color: var(--color-success); }

/* Forecast grid */
.forecast-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.forecast-cell { padding: var(--sp-4); text-align: center; border-right: 1px solid var(--color-border); }
.forecast-cell:last-child { border-right: none; }
.forecast-cell .fc-label { font-size: var(--font-size-xs); font-weight: 500; text-transform: uppercase; letter-spacing: var(--letter-spacing-caps); color: var(--color-text-muted); margin-bottom: var(--sp-1); }
.forecast-cell .fc-value { font-size: var(--font-size-3xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
@media (max-width: 576px) {
  .forecast-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-cell:nth-child(2) { border-right: none; }
  .forecast-cell:nth-child(1), .forecast-cell:nth-child(2) { border-bottom: 1px solid var(--color-border); }
}

/* Badge count */
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--color-bg-elevated); border: 1px solid var(--color-border);
  border-radius: var(--radius-full); font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-muted);
}

/* Step badges */
.step-badge {
  width: 20px; height: 20px;
  background: var(--color-accent);
  color: var(--color-bg-base);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

/* Editable card */
.editable-card { transition: border-color var(--transition); cursor: pointer; }
.editable-card:hover { border-color: rgba(var(--color-accent-rgb), 0.35); }

/* fw-600 utility */
.fw-600 { font-weight: 600 !important; }

/* Kbd */
kbd {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--color-text-muted);
}

/* ═══ 19. PHOTOS / GALLERY ═══════════════════════════════════════════════════ */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--sp-2);
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  cursor: pointer;
  transition: border-color var(--transition);
}
.photo-thumb:hover { border-color: var(--color-accent); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb__badge {
  position: absolute;
  bottom: var(--sp-1); left: var(--sp-1);
  background: rgba(0,0,0,0.8);
  color: var(--color-accent);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
  max-width: calc(100% - 8px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-thumb__del {
  position: absolute;
  top: var(--sp-1); right: var(--sp-1);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--color-error);
  font-size: var(--font-size-xs);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition);
}
.photo-thumb:hover .photo-thumb__del { opacity: 1; }

.photo-upload-zone {
  aspect-ratio: 1;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-1);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition), background var(--transition);
}
.photo-upload-zone:hover { border-color: var(--color-accent); background: var(--color-accent-dim); }
.photo-upload-zone i { font-size: 1.25rem; }

.photo-upload-split {
  aspect-ratio: 1;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  overflow: hidden;
  transition: border-color var(--transition);
}
.photo-upload-split:hover { border-color: var(--color-accent); }
.photo-upload-split__btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border: none; background: transparent; padding: 0;
  transition: background var(--transition), color var(--transition);
}
.photo-upload-split__btn:first-child { border-right: 1px solid var(--color-border); }
.photo-upload-split__btn:hover { background: var(--color-accent-dim); color: var(--color-accent); }
.photo-upload-split__btn i { font-size: 1.15rem; }

/* ═══ 20. CAMERA MODAL ═══════════════════════════════════════════════════════ */

.camera-modal {
  display: none; position: fixed; inset: 0;
  background: var(--color-bg-base); z-index: 20000;
  flex-direction: column; align-items: stretch;
}
.camera-modal.active { display: flex; }
.camera-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: rgba(0,0,0,0.6);
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.camera-type-badge {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.camera-icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.camera-icon-btn:hover { background: rgba(255,255,255,0.2); }
.camera-view {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: #000;
}
.camera-view video,
.camera-view img#cameraPreview { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 5; }
.camera-status {
  position: absolute; bottom: 50%; left: 50%; transform: translate(-50%, 50%);
  color: rgba(255,255,255,0.7); font-size: var(--font-size-md); text-align: center;
  padding: 0 var(--sp-6); pointer-events: none; z-index: 6;
}
.camera-controls {
  background: var(--color-bg-surface); padding: 20px var(--sp-8);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-6); flex-shrink: 0;
}
.camera-shutter {
  width: 64px; height: 64px; border-radius: 50%; background: transparent;
  border: 3px solid rgba(255,255,255,0.5); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s; flex-shrink: 0;
}
.camera-shutter:active { transform: scale(0.92); }
.camera-shutter__inner {
  width: 52px; height: 52px; border-radius: 50%; background: #fff;
  display: block; transition: background 0.1s;
}
.camera-shutter:active .camera-shutter__inner { background: #ccc; }

/* Lightbox */
.lightbox-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.92); z-index: 10000;
  align-items: center; justify-content: center;
}
.lightbox-overlay.active { display: flex; }
.lightbox-img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: var(--radius-lg); }
.lightbox-close {
  position: absolute; top: var(--sp-4); right: var(--sp-6);
  font-size: 2rem; color: rgba(255,255,255,0.6); cursor: pointer;
  background: none; border: none; line-height: 1; transition: color var(--transition);
}
.lightbox-close:hover { color: white; }
.lightbox-caption {
  position: absolute; bottom: var(--sp-4); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: var(--color-accent);
  font-size: var(--font-size-sm); font-weight: 600; padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-full);
}

/* ═══ 21. TOOLTIP SYSTEM ═════════════════════════════════════════════════════ */

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 6px var(--sp-3);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body);
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
  font-weight: 400;
  animation: none;
}
[data-tooltip]:hover::after { animation: tooltip-appear 120ms 400ms forwards; }
@keyframes tooltip-appear {
  from { opacity: 0; transform: translateX(-50%) translateY(3px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-border-strong);
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
  animation: none;
}
[data-tooltip]:hover::before { animation: tooltip-appear 120ms 400ms forwards; }

[data-tooltip-pos="bottom"]::after { top: calc(100% + 8px); bottom: auto; }
[data-tooltip-pos="bottom"]::before { top: calc(100% + 3px); bottom: auto; border-top-color: transparent; border-bottom-color: var(--color-border-strong); }
[data-tooltip-align="left"]::after { left: 0; transform: none; }
[data-tooltip-align="right"]::after { left: auto; right: 0; transform: none; }

@media (hover: none) {
  [data-tooltip]::after,
  [data-tooltip]::before { display: none !important; }
}

/* ═══ 22. AI CHAT ════════════════════════════════════════════════════════════ */

.quick-q:hover {
  background: var(--color-bg-hover) !important;
  border-color: var(--color-border-strong) !important;
  color: var(--color-text-primary) !important;
}
.quick-q:hover i { color: var(--color-accent) !important; }

/* ═══ 23. SCHEDULE / BOXES ═══════════════════════════════════════════════════ */

.box-card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.box-card .box-header { background: var(--color-bg-elevated); border-bottom: 1px solid var(--color-border); padding: var(--sp-2) var(--sp-4); font-size: var(--font-size-xs); font-weight: 500; text-transform: uppercase; letter-spacing: var(--letter-spacing-caps); color: var(--color-text-muted); }
.box-card .box-jobs { padding: var(--sp-3); }
.box-job-item { background: var(--color-accent-dim); border: 1px solid rgba(var(--color-accent-rgb), 0.12); border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); font-size: var(--font-size-md); margin-bottom: var(--sp-2); }
.box-job-item:last-child { margin-bottom: 0; }

/* ═══ 24. ANALYTICS ══════════════════════════════════════════════════════════ */

.insight-item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--color-border); }
.insight-item:last-child { border-bottom: none; }
.insight-icon { width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: var(--font-size-md); }
.confidence-bar { height: 3px; background: var(--color-bg-elevated); border-radius: var(--radius-full); margin-top: 6px; overflow: hidden; }
.confidence-bar-fill { height: 100%; background: var(--color-accent); border-radius: var(--radius-full); transition: width 0.6s ease; }
.ai-insight-card { border-radius: var(--radius-lg); padding: var(--sp-3); height: 100%; transition: border-color var(--transition); }
.trend-chart-wrap { position: relative; height: 240px; }

/* ═══ 25. CALENDAR ═══════════════════════════════════════════════════════════ */

.calendar-container { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--sp-2); }

.cal-day {
  margin-bottom: var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-surface);
}
.cal-scroll-wrap { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
.cal-day-header {
  padding: var(--sp-2) var(--sp-4);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-day-header--today { border-left: 3px solid var(--color-accent); }
.cal-day--today { border-color: rgba(var(--color-accent-rgb), 0.25); }
.cal-day--past { opacity: 0.7; }
.cal-day--past .cal-day-header { background: rgba(255,255,255,0.02); }
.cal-day-label { font-weight: 600; font-size: var(--font-size-md); display: flex; align-items: center; gap: 6px; }
.cal-day-today-badge {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-bg-base);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: var(--letter-spacing-caps);
}
.cal-day-count { font-size: var(--font-size-sm); color: var(--color-text-muted); }

.day-tab { font-size: var(--font-size-sm); padding: 3px var(--sp-2); border-radius: var(--radius); }
.day-tab--today { background: var(--color-accent) !important; color: var(--color-bg-base) !important; border-color: var(--color-accent) !important; font-weight: 600; }
.day-tab--past { opacity: 0.4; font-size: var(--font-size-xs); padding: 2px 6px; border: 1px solid rgba(255,255,255,0.04); color: var(--color-text-faint); }

.cal-timeline { display: flex; border-bottom: 1px solid var(--color-border); background: var(--color-bg-elevated); position: sticky; top: 0; z-index: 3; }
.cal-label-col { flex-shrink: 0; border-right: 1px solid var(--color-border); }
.cal-hour-hdr { flex-shrink: 0; text-align: center; font-size: var(--font-size-xs); color: var(--color-text-muted); padding: var(--sp-1) 0; border-left: 1px solid rgba(255,255,255,0.03); }

.cal-row { display: flex; border-bottom: 1px solid rgba(255,255,255,0.02); }
.cal-box-label {
  flex-shrink: 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  display: flex; align-items: center;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-surface);
}

.cal-cells { overflow: visible; }
.cal-grid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.03); pointer-events: none; }
.cal-drop-ready { background: rgba(var(--color-accent-rgb), 0.02); }
.cal-drop-active { background: rgba(var(--color-accent-rgb), 0.06) !important; outline: 1px dashed var(--color-accent); outline-offset: -1px; }
.cal-drop-hint {
  position: absolute; top: 2px; transform: translateX(-50%);
  background: var(--color-accent); color: var(--color-bg-base);
  font-size: var(--font-size-xs); font-weight: 600;
  padding: 1px 6px; border-radius: var(--radius-sm); z-index: 10; pointer-events: none; white-space: nowrap;
}
.cal-now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-error); z-index: 4; pointer-events: none; }
.cal-now-line::before { content: ''; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; background: var(--color-error); border-radius: 50%; }
.cal-empty-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: var(--font-size-sm); color: var(--color-text-faint); pointer-events: none; white-space: nowrap; }

.cal-job-block {
  position: absolute; top: 4px; bottom: 4px;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--sp-1) var(--sp-2);
  cursor: grab; overflow: hidden; z-index: 2;
  transition: transform var(--transition);
}
.cal-job-block:hover { z-index: 5; transform: translateY(-1px); }
.cal-job-block:active, .cal-job-block--dragging { cursor: grabbing; opacity: 0.5; }
.cal-job-inner { display: flex; align-items: center; gap: 6px; height: 100%; }
.cal-job-photo { width: 32px; height: 32px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.cal-job-photo--empty { background: var(--color-bg-elevated); display: flex; align-items: center; justify-content: center; color: var(--color-text-faint); font-size: var(--font-size-md); }
.cal-job-text { min-width: 0; flex: 1; overflow: hidden; }
.cal-job-title { font-size: var(--font-size-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-job-plate { color: var(--color-accent); font-family: var(--font-mono); font-size: var(--font-size-xs); margin-left: var(--sp-1); }
.cal-job-meta { font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: var(--sp-1); }
.cal-job-status { font-size: 8px; margin-right: 2px; flex-shrink: 0; }
.cal-job-time { font-size: var(--font-size-xs); font-weight: 600; margin-left: auto; flex-shrink: 0; }
.cal-job-time--warn { color: var(--color-warning); }

.cal-toast { position: fixed; bottom: var(--sp-6); right: var(--sp-6); padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-md); font-size: var(--font-size-md); font-weight: 500; z-index: 20000; transition: opacity 0.3s; }
.cal-toast--success { background: var(--color-success-dim); color: var(--color-success); border: 1px solid rgba(34,197,94,0.3); }
.cal-toast--danger { background: var(--color-error-dim); color: var(--color-error); border: 1px solid rgba(239,68,68,0.3); }

.cal-context-menu {
  position: fixed; z-index: 10000;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-1);
  min-width: 220px;
}
.cal-context-menu button {
  display: flex; align-items: center; width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: none; border: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.cal-context-menu button:hover { background: var(--color-bg-hover); }
.cal-context-menu hr { border: none; border-top: 1px solid var(--color-border); margin: var(--sp-1) 0; }

/* Unscheduled chips */
.unscheduled-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 6px var(--sp-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: all var(--transition);
}
.unscheduled-chip:hover { border-color: var(--color-accent); background: var(--color-accent-dim); }
.unscheduled-chip:active { cursor: grabbing; }
.unscheduled-chip__photo { width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.unscheduled-chip__photo-placeholder { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--color-bg-surface); display: flex; align-items: center; justify-content: center; color: var(--color-text-faint); font-size: var(--font-size-sm); flex-shrink: 0; }
.unscheduled-chip__text { min-width: 0; }
.unscheduled-chip__name { font-size: var(--font-size-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unscheduled-chip__meta { font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* Plate lookup spin */
@keyframes plate-spin { to { transform: rotate(360deg); } }
.plate-spin { display: inline-block; animation: plate-spin 0.6s linear infinite; }

/* ═══ 26. RESPONSIVE ═════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 250ms var(--ease);
  }
  .sidebar.sidebar--open { transform: translateX(0); }
  body.has-sidebar .main-wrapper { margin-left: 0; }
  .topbar-mobile { display: flex; }
  .page-content { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
  .page-content--full { padding: var(--sp-4); }
  .page-header h1 { font-size: var(--font-size-2xl); }
  .stat-card__value { font-size: var(--font-size-2xl); }
  .card-body { padding: var(--sp-4); }
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--sp-1); scrollbar-width: none; }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { white-space: nowrap; flex-shrink: 0; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .cal-hour-hdr { width: 60px !important; font-size: var(--font-size-xs); }
  .cal-box-label { width: 50px !important; font-size: var(--font-size-xs); padding: var(--sp-1) 6px; }
  .cal-label-col { width: 50px !important; }
  .cal-job-photo, .cal-job-photo--empty { display: none; }
  .cal-job-title { font-size: var(--font-size-xs); }
  .cal-job-meta { font-size: var(--font-size-xs); }
  .day-tab { font-size: var(--font-size-xs); padding: 2px 6px; }
}

@media (max-width: 767px) {
  .stat-card__label { font-size: 9px; letter-spacing: 0.03em; }
  .stat-card__sub   { font-size: var(--font-size-xs); }
  .active-job-thumb { width: 48px !important; height: 48px !important; }
  .active-job-title { flex-wrap: wrap; row-gap: 2px; }
  .active-job-title .fw-semibold { font-size: var(--font-size-md) !important; }
  .active-job-meta { flex-wrap: wrap; row-gap: 2px; }
  .active-job-timer { flex-wrap: wrap; gap: 3px var(--sp-2) !important; align-items: baseline !important; }
  .active-job-timer > .ms-auto { flex: 1 0 100%; text-align: right; margin-left: 0 !important; font-size: var(--font-size-md) !important; margin-top: 1px; }
  .employees-table th:nth-child(3), .employees-table td:nth-child(3) { display: none !important; }
  .employees-table th:nth-child(4), .employees-table td:nth-child(4) { display: none !important; }
  .employees-table th:nth-child(5), .employees-table td:nth-child(5) { display: none !important; }
  .employees-table th:nth-child(6), .employees-table td:nth-child(6) { display: none !important; }
  .employees-table td:nth-child(1) a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
  .employees-table tr { height: 48px; }
  .emp-profile-jobs-table th:nth-child(1), .emp-profile-jobs-table td:nth-child(1) { display: none !important; }
  .emp-profile-jobs-table th:nth-child(4), .emp-profile-jobs-table td:nth-child(4) { display: none !important; }
  .emp-profile-jobs-table th:nth-child(6), .emp-profile-jobs-table td:nth-child(6) { display: none !important; }
  .main-content { padding-bottom: env(safe-area-inset-bottom, 0); }
}

@media (max-width: 575px) {
  .page-header { flex-wrap: wrap; row-gap: var(--sp-2); }
  .page-header h1 { font-size: var(--font-size-xl); }
  .page-header .ms-auto { margin-left: 0 !important; width: 100%; }
  .page-header .ms-auto.d-flex .btn { flex: 1; justify-content: center; }
  .page-header .ms-auto:not(.d-flex) > .btn { display: block; width: 100%; text-align: center; }
  .date-nav input[type="date"] { display: none !important; }
  .date-nav .fw-bold { min-width: 0 !important; font-size: var(--font-size-md) !important; }
  .reports-top-table th:nth-child(5), .reports-top-table td:nth-child(5) { display: none !important; }
  .schedule-unassigned-table th:nth-child(3), .schedule-unassigned-table td:nth-child(3) { display: none !important; }
  .schedule-unassigned-table th:nth-child(1), .schedule-unassigned-table td:nth-child(1) { display: none !important; }
  .job-types-table th:nth-child(3), .job-types-table td:nth-child(3) { display: none !important; }
  .job-types-table th:nth-child(4), .job-types-table td:nth-child(4) { display: none !important; }
  .job-materials-table th:nth-child(2), .job-materials-table td:nth-child(2) { display: none !important; }
  .step-badge { flex-shrink: 0; }
  .card-header { flex-wrap: wrap; gap: var(--sp-2); }
  .card-header .btn { white-space: nowrap; }
  .period-filter { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap !important; padding-bottom: 2px; }
  .period-filter::-webkit-scrollbar { display: none; }
  .cash-page-header { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .cash-header-actions { width: 100%; }
  .cash-header-actions .btn { flex: 1; justify-content: center; padding-left: var(--sp-2); padding-right: var(--sp-2); font-size: var(--font-size-base); }

  /* Jobs table → card layout */
  .jobs-table-wrap .table-responsive { overflow-x: hidden; }
  .jobs-table, .jobs-table tbody { display: block !important; }
  .jobs-table thead { display: none !important; }
  .jobs-table tr.job-row {
    display: flex !important; flex-wrap: wrap; align-items: flex-start;
    padding: var(--sp-2) var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--color-border) !important;
    border-left: none !important; border-right: none !important; border-top: none !important; gap: 0;
  }
  .jobs-table tr.job-row:last-child { border-bottom: none !important; }
  .jobs-table tr.job-row td { display: block !important; border: none !important; padding: 0 !important; }
  .jobs-table tr.job-row td:nth-child(1) { display: none !important; }
  .jobs-table tr.job-row td:nth-child(2) { order: 1; flex: 0 0 auto; width: 48px; margin-right: var(--sp-2); display: flex !important; align-items: flex-start; padding-top: 2px !important; }
  .jobs-table tr.job-row td:nth-child(2) img, .jobs-table tr.job-row td:nth-child(2) > div { width: 44px !important; height: 33px !important; }
  .jobs-table tr.job-row td:nth-child(3) { order: 2; flex: 1 1 0; min-width: 0; }
  .jobs-table tr.job-row td:nth-child(3) .job-vehicle { font-size: var(--font-size-md); flex-wrap: wrap; gap: var(--sp-1); }
  .jobs-table tr.job-row td:nth-child(3) .job-client { font-size: var(--font-size-sm); }
  .jobs-table tr.job-row td:nth-child(4) { order: 3; width: 100%; margin-top: 6px; min-width: 0; }
  .jobs-table tr.job-row td:nth-child(4) .job-type { font-size: var(--font-size-base); }
  .jobs-table tr.job-row td:nth-child(4) .note-snippet { max-width: 100% !important; }
  .jobs-table tr.job-row td:nth-child(4) .elapsed-inline { font-size: var(--font-size-sm); }
  .jobs-table tr.job-row td:nth-child(5) { order: 4; flex: 1 1 auto; margin-top: 6px; display: flex !important; flex-direction: column; gap: var(--sp-1); align-items: flex-start; }
  .jobs-table tr.job-row td:nth-child(6) { order: 5; text-align: right !important; margin-top: 6px; flex-shrink: 0; padding-right: 0 !important; }
  .jobs-table tr.job-row td:nth-child(6) .price-main { font-size: var(--font-size-md); font-weight: 600; }
  .jobs-table tr.job-row td:nth-child(6) .price-pct { font-size: var(--font-size-sm); }
  .jobs-table tr.job-row td:last-child::after { display: none !important; }

  .active-job-thumb { width: 44px; height: 44px; }
  .active-job-title { font-size: var(--font-size-md) !important; }
  .active-job-meta  { font-size: var(--font-size-sm)  !important; }
}

@media (max-width: 374px) {
  .stat-card__value { font-size: var(--font-size-2xl) !important; }
  .stat-num { font-size: var(--font-size-2xl) !important; }
}

/* ── Queue card — text overflow ────────────────────────────────────────────── */
.job-card__header > .overflow-hidden { min-width: 0; white-space: nowrap; text-overflow: ellipsis; }
.job-card__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: inline; }

/* ── Cash page header ─────────────────────────────────────────────────────── */
.cash-page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

/* ═══ 27. WIP CARDS (Dashboard — In Progress) ═══════════════════════════════ */

.wip-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.wip-card:hover {
  border-color: rgba(var(--color-accent-rgb), 0.35);
  box-shadow: var(--shadow);
}
.wip-card--stuck {
  border-color: rgba(239, 68, 68, 0.35);
}

.wip-card__track {
  height: 4px;
  background: var(--color-bg-elevated);
}
.wip-card__track .eta-bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  transition: width 1s linear, background 0.4s;
  background: var(--color-accent);
}

.wip-card__body {
  padding: var(--sp-3) var(--sp-4) var(--sp-3);
}

.wip-card__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.wip-card__photo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}
.wip-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wip-card__photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--color-bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  font-size: 1.3rem;
}
.wip-card__info {
  flex: 1;
  min-width: 0;
}
.wip-card__vehicle {
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wip-card__year {
  font-weight: 400;
  font-size: var(--font-size-sm);
  color: var(--color-text-faint);
  margin-left: var(--sp-1);
}
.wip-card__plate {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.03em;
  margin-top: 2px;
}
.wip-card__price {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Tags row */
.wip-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: var(--sp-2);
}
.wip-tag {
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.wip-tag--work {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  font-weight: 600;
}
.wip-tag--box {
  background: var(--color-info-dim);
  color: var(--color-info);
}
.wip-tag--danger {
  background: var(--color-error-dim);
  color: var(--color-error);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Timer row */
.wip-card__timer {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.wip-timer__elapsed,
.wip-timer__plan,
.wip-timer__eta {
  flex: 1;
  padding: 6px;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}
.wip-timer__elapsed {
  border-right: 1px solid var(--color-border-subtle);
}
.wip-timer__plan {
  border-right: 1px solid var(--color-border-subtle);
}
.wip-timer__label {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  color: var(--color-text-faint);
  margin-bottom: 2px;
}
.wip-timer__value {
  display: block;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══ 28. QUEUE CARDS (Dashboard — Queue) ════════════════════════════════════ */

.queue-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.queue-card:hover {
  border-color: rgba(var(--color-accent-rgb), 0.25);
  box-shadow: var(--shadow);
}
.queue-card__track {
  height: 3px;
  background: var(--color-bg-elevated);
}
.queue-card__track .queue-bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  transition: width 2s linear, background 0.4s;
  background: var(--color-accent);
}
.queue-card__body {
  padding: var(--sp-3) var(--sp-4) var(--sp-3);
}
.queue-card__bottom {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.queue-bottom__wait,
.queue-bottom__plan {
  flex: 1;
  padding: 6px;
  text-align: center;
  min-width: 0;
  border-right: 1px solid var(--color-border-subtle);
}
.queue-bottom__start {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  padding: var(--sp-1) 6px;
}
.queue-wait-live {
  color: var(--color-accent);
  animation: waitPulse 2s ease-in-out infinite;
}
.btn-start-queue {
  height: 100%;
  min-height: 34px;
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

@keyframes waitPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ═══ 29. TIMER CARD (Job Detail) ═══════════════════════════════════════════ */

.timer-card {
  background: var(--color-bg-surface);
  border: 1px solid rgba(var(--color-accent-rgb), 0.25);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.timer-card__track {
  height: 5px;
  background: var(--color-bg-elevated);
}
.timer-card__track .eta-bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  transition: width 1s linear, background 0.4s;
  background: var(--color-accent);
}
.timer-card__body {
  padding: var(--sp-4) var(--sp-4);
}
.timer-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.timer-card__live-dot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  color: var(--color-accent);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
.timer-card__start-time {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.timer-card__start-time strong { color: var(--color-text-primary); }
.timer-card__main {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.timer-card__col { min-width: 0; }
.timer-card__col--right { text-align: right; margin-left: auto; }
.timer-card__col-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  color: var(--color-text-faint);
  margin-bottom: 3px;
}
.timer-card__col-value {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}
.timer-card__arrow {
  font-size: 1.5rem;
  color: var(--color-text-faint);
  flex-shrink: 0;
  margin-top: 18px;
}

/* ETA badge */
.eta-bar { background: var(--color-accent); }
.eta-badge { font-variant-numeric: tabular-nums; }
.eta-remaining { font-size: var(--font-size-sm); color: var(--color-text-muted); }

/* ═══ 30. TIMELINE (Vehicle History) ════════════════════════════════════════ */

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--color-border); border-radius: 1px; }
.timeline-item { position: relative; margin-bottom: var(--sp-4); }
.timeline-dot {
  position: absolute; left: -23px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-bg-elevated); border: 2px solid var(--color-border);
  transition: all 0.2s;
}
.timeline-closed .timeline-dot { background: var(--color-accent); border-color: var(--color-accent); }
.timeline-active .timeline-dot { background: var(--color-info); border-color: var(--color-info); }
.timeline-new .timeline-dot { background: var(--color-warning); border-color: var(--color-warning); }
.timeline-content {
  background: var(--color-bg-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-3);
  transition: border-color var(--transition);
}
.timeline-item:hover .timeline-content { border-color: var(--color-border-strong); }
.timeline-item:hover .timeline-dot { transform: scale(1.3); }

/* ═══ 31. JOBS LIST EXTRAS ══════════════════════════════════════════════════ */

.jobs-table-wrap { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.note-snippet {
  font-size: var(--font-size-sm);
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-block;
}
.elapsed-inline {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.waiting-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--font-size-sm);
}
.wi-text {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ═══ 32. DATE NAVIGATION ═══════════════════════════════════════════════════ */

.date-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.date-nav .btn { min-width: 36px; }
.date-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  min-width: 48px;
}
.date-btn:hover { border-color: var(--color-border-strong); color: var(--color-text-primary); }
.date-btn.active { border-color: var(--color-accent); background: var(--color-accent-dim); color: var(--color-accent); }
.day-wd {
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
}
.day-num {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

/* ═══ 33. PERIOD FILTER ═════════════════════════════════════════════════════ */

.period-filter {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.period-filter .btn-check + .btn {
  font-size: var(--font-size-sm);
  padding: var(--sp-1) var(--sp-3);
}

/* ═══ 34. RECEIPT (Cash daily report) ═══════════════════════════════════════ */

.receipt {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.receipt-header {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}
.receipt-header__org { font-size: var(--font-size-lg); font-weight: 600; margin-bottom: var(--sp-1); }
.receipt-header__num { font-size: var(--font-size-sm); color: var(--color-text-muted); }
.receipt-header__meta { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-top: var(--sp-1); }
.receipt-header__sub { font-size: var(--font-size-xs); color: var(--color-text-faint); }
.receipt-section { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--color-border); }
.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--sp-1) 0;
}
.receipt-row__label { color: var(--color-text-muted); font-size: var(--font-size-md); }
.receipt-row__value { font-weight: 600; font-size: var(--font-size-md); font-variant-numeric: tabular-nums; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.receipt-notes { padding: var(--sp-3) var(--sp-4); font-size: var(--font-size-sm); color: var(--color-text-muted); }
.receipt-footer { padding: var(--sp-3) var(--sp-4); text-align: center; font-size: var(--font-size-sm); color: var(--color-text-faint); border-top: 1px solid var(--color-border); }

/* ═══ 35. SUCCESS CARD ══════════════════════════════════════════════════════ */

.success-card {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
}
.success-icon {
  font-size: 3rem;
  color: var(--color-success);
  margin-bottom: var(--sp-4);
}
.success-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
.success-sub {
  font-size: var(--font-size-md);
  color: var(--color-text-muted);
}

/* ═══ 36. AI CHAT EXTRAS ════════════════════════════════════════════════════ */

.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: var(--sp-2) 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-faint);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Telegram template buttons */
.tg-tpl-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-surface);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.tg-tpl-btn:hover { border-color: var(--color-border-strong); color: var(--color-text-primary); }

/* ═══ 37. RESPONSIVE — WIP / QUEUE CARDS ═══════════════════════════════════ */

@media (max-width: 576px) {
  .wip-card__photo { width: 44px; height: 44px; }
  .wip-card__vehicle { font-size: var(--font-size-base); }
  .wip-card__price { font-size: var(--font-size-lg); }
  .wip-timer__value { font-size: var(--font-size-sm); }
  .queue-card__body { padding: var(--sp-3); }
  .btn-start-queue { font-size: var(--font-size-sm); padding: var(--sp-1) var(--sp-2); }
  .timer-card__col-value { font-size: 1.4rem; }
}

/* ═══ 38. BOTTOM NAVIGATION (Mobile) ═══════════════════════════════════════ */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-bg-base);
  border-top: 1px solid var(--color-border);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 56px;
  gap: 2px;
  text-decoration: none;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color var(--transition);
}
.bottom-nav__item i {
  font-size: 20px;
  line-height: 1;
}
.bottom-nav__item span {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}
.bottom-nav__item.active {
  color: var(--color-accent);
}
.bottom-nav__item:hover {
  color: var(--color-text-primary);
}
.bottom-nav__item.active:hover {
  color: var(--color-accent);
}

.bottom-nav__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #000;
  font-size: 22px;
  text-decoration: none;
  flex-shrink: 0;
  margin: 0 4px;
  box-shadow: 0 2px 8px rgba(195, 220, 1, 0.3);
  transition: transform var(--transition), box-shadow var(--transition);
}
.bottom-nav__fab:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(195, 220, 1, 0.4);
  color: #000;
}

@media (max-width: 768px) {
  .bottom-nav { display: flex; }

  /* ── Page content padding for bottom nav ─────────────────────────────────── */
  .page-content {
    padding-bottom: calc(56px + 16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .page-content--full {
    padding-bottom: calc(56px + 8px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ── AI Chat: fit within mobile viewport ─────────────────────────────────── */
  .ai-chat-wrapper {
    height: calc(100vh - var(--topbar-h) - 56px - 1.5rem - env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ── Touch Target Fixes ──────────────────────────────────────────────────── */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .btn-xs { min-height: 36px; padding: 6px 12px; }
  .form-control, .form-select { min-height: 44px; font-size: 16px !important; }
  .form-control-lg, .form-select-lg { min-height: 48px; }
  .filter-tab { padding: 8px 16px; min-height: 40px; }
  .topbar-toggle, .topbar-action { width: 44px; height: 44px; }

  /* ── iOS Fixes ───────────────────────────────────────────────────────────── */
  /* Prevent input zoom on iOS */
  input[type="text"], input[type="password"], input[type="email"],
  input[type="tel"], input[type="number"], input[type="search"],
  input[type="url"], textarea, select {
    font-size: 16px !important;
  }

  /* Tap highlight */
  a, button, .btn, .filter-tab, .job-row, .client-row {
    -webkit-tap-highlight-color: rgba(195, 220, 1, 0.08);
  }

  /* Disable bounce scroll on body */
  body { overscroll-behavior: none; }
  .page-content, .overflow-auto { overscroll-behavior: contain; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ═══ MOBILE TABLE → CARD TRANSFORMS (575px) ═════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 575px) {

  /* Mobile: clients table ──────────────────────────────────────────────── */
  .clients-table { display: block !important; }
  .clients-table tbody { display: block !important; }
  .clients-table thead { display: none !important; }
  #clients-table-wrap .table-responsive { overflow-x: hidden; }
  .clients-table tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border) !important;
    gap: 4px;
  }
  .clients-table tbody tr:last-child { border-bottom: none !important; }
  .clients-table tbody td {
    border: none !important;
    padding: 2px 0 !important;
    background: transparent !important;
  }
  /* col 1: name — top left */
  .clients-table tbody td:nth-child(1) {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
  }
  .clients-table tbody td:nth-child(1) .client-name { font-size: var(--font-size-md); font-weight: 600; }
  .clients-table tbody td:nth-child(1) .client-notes {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* col 2: phone — right aligned */
  .clients-table tbody td:nth-child(2) {
    order: 2;
    flex: 0 0 auto;
    text-align: right;
    font-size: var(--font-size-sm);
  }
  /* col 3: vehicles badge — bottom left */
  .clients-table tbody td:nth-child(3) {
    order: 3;
    flex: 1 1 auto;
    text-align: left !important;
    margin-top: 2px;
  }
  /* col 4: edit icon — bottom right */
  .clients-table tbody td:nth-child(4) {
    order: 4;
    flex: 0 0 auto;
    margin-top: 2px;
  }

  /* Mobile: cash transactions table ───────────────────────────────────── */
  .card-dark > .table-responsive > .table-dark { display: block !important; }
  .card-dark > .table-responsive > .table-dark tbody { display: block !important; }
  .card-dark > .table-responsive > .table-dark thead { display: none !important; }
  .card-dark > .table-responsive { overflow-x: hidden; }
  .card-dark > .table-responsive > .table-dark tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border) !important;
    border-left: 3px solid transparent;
    gap: 4px;
    position: relative;
  }
  .card-dark > .table-responsive > .table-dark tbody tr:last-child { border-bottom: none !important; }
  .card-dark > .table-responsive > .table-dark tbody td {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  /* Income row green left border */
  .card-dark > .table-responsive > .table-dark tbody tr:has(.bg-success) {
    border-left-color: rgba(74, 222, 128, 0.4);
  }
  /* Expense row red left border */
  .card-dark > .table-responsive > .table-dark tbody tr:has(.bg-danger) {
    border-left-color: rgba(248, 113, 113, 0.4);
  }
  /* col 1: date — small, top-left */
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(1) {
    order: 1;
    flex: 0 0 auto;
    font-size: var(--font-size-xs) !important;
    color: var(--color-text-muted);
  }
  /* col 2: type badge — next to date */
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(2) {
    order: 2;
    flex: 0 0 auto;
    margin-left: 8px;
  }
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(2) .badge { font-size: 0.65rem; }
  /* col 5: amount — right, top row, large */
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(5) {
    order: 3;
    flex: 1 1 auto;
    text-align: right !important;
    font-size: 1rem !important;
  }
  /* col 3: category — second row */
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(3) {
    order: 4;
    flex: 0 0 100%;
    font-size: var(--font-size-sm) !important;
    margin-top: 4px;
  }
  /* col 4: description — third row */
  .card-dark > .table-responsive > .table-dark tbody td:nth-child(4) {
    order: 5;
    flex: 0 0 100%;
    font-size: var(--font-size-xs) !important;
    color: var(--color-text-muted) !important;
  }

  /* Mobile: employees table ────────────────────────────────────────────── */
  .employees-table { display: block !important; }
  .employees-table tbody { display: block !important; }
  .employees-table thead { display: none !important; }
  .employees-table tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border) !important;
    gap: 4px;
  }
  .employees-table tbody tr:last-child { border-bottom: none !important; }
  .employees-table tbody td {
    border: none !important;
    padding: 2px 0 !important;
    background: transparent !important;
  }
  /* col 1: name — top left */
  .employees-table tbody td:nth-child(1) {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
  }
  /* col 2: role badge — next to name */
  .employees-table tbody td:nth-child(2) {
    order: 2;
    flex: 0 0 auto;
  }
  /* col 6: status — next to role */
  .employees-table tbody td:nth-child(6) {
    order: 3;
    flex: 0 0 auto;
    margin-left: 6px;
  }
  /* col 7: edit button — far right top */
  .employees-table tbody td:nth-child(7) {
    order: 4;
    flex: 0 0 auto;
    margin-left: auto;
  }
  /* col 3: phone — bottom row left */
  .employees-table tbody td:nth-child(3) {
    order: 5;
    flex: 1 1 auto;
    margin-top: 4px;
    font-size: var(--font-size-sm);
  }
  /* col 4: jobs count — bottom row */
  .employees-table tbody td:nth-child(4) {
    order: 6;
    flex: 0 0 auto;
    margin-top: 4px;
    text-align: right !important;
    font-size: var(--font-size-sm);
  }
  /* col 5: revenue — bottom row right */
  .employees-table tbody td:nth-child(5) {
    order: 7;
    flex: 0 0 auto;
    margin-top: 4px;
    text-align: right !important;
    font-size: var(--font-size-sm);
    margin-left: 8px;
  }

  /* Mobile: stock table ────────────────────────────────────────────────── */
  .table-sticky { display: block !important; }
  .table-sticky tbody { display: block !important; }
  .table-sticky thead { display: none !important; }
  .table-sticky tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border) !important;
    gap: 4px;
  }
  .table-sticky tbody tr:last-child { border-bottom: none !important; }
  .table-sticky tbody td {
    border: none !important;
    padding: 2px 0 !important;
    background: transparent !important;
  }
  /* col 1: item name — top row */
  .table-sticky tbody td:nth-child(1) {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    font-weight: 600;
  }
  /* col 2: quantity — prominent, right of name */
  .table-sticky tbody td:nth-child(2) {
    order: 2;
    flex: 0 0 auto;
    font-size: 1rem !important;
    text-align: right !important;
  }
  /* col 3: min quantity — second row left */
  .table-sticky tbody td:nth-child(3) {
    order: 3;
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: var(--font-size-xs) !important;
  }
  .table-sticky tbody td:nth-child(3)::before {
    content: "min: ";
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
  }
  /* col 4: avg price — second row */
  .table-sticky tbody td:nth-child(4) {
    order: 4;
    flex: 1 1 auto;
    margin-top: 2px;
    text-align: right !important;
  }
  /* col 5: actions — second row right */
  .table-sticky tbody td:nth-child(5) {
    order: 5;
    flex: 0 0 auto;
    margin-top: 2px;
    margin-left: 8px;
  }
  .table-sticky tbody td:nth-child(5) .d-flex { gap: 2px !important; }
  .table-sticky tbody td:nth-child(5) .btn-sm {
    padding: 2px 6px !important;
    font-size: var(--font-size-xs) !important;
  }

  /* Mobile: admin job types table ──────────────────────────────────────── */
  .job-types-table { display: block !important; }
  .job-types-table tbody { display: block !important; }
  .job-types-table thead { display: none !important; }
  .job-types-table tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border) !important;
    gap: 4px;
  }
  .job-types-table tbody tr:last-child { border-bottom: none !important; }
  .job-types-table tbody td {
    border: none !important;
    padding: 2px 0 !important;
    background: transparent !important;
    display: block !important;
  }
  /* col 1: name — top left */
  .job-types-table tbody td:nth-child(1) {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
  }
  /* col 4: status badge — next to name */
  .job-types-table tbody td:nth-child(4) {
    order: 2;
    flex: 0 0 auto;
  }
  /* col 5: edit icon — far right */
  .job-types-table tbody td:nth-child(5) {
    order: 3;
    flex: 0 0 auto;
    margin-left: 6px;
  }
  /* col 2: time — second row */
  .job-types-table tbody td:nth-child(2) {
    order: 4;
    flex: 0 0 auto;
    margin-top: 2px;
  }
  /* col 3: materials — second row, restore visibility */
  .job-types-table tbody td:nth-child(3) {
    order: 5;
    flex: 0 0 auto;
    margin-top: 2px;
    margin-left: 12px;
    display: block !important;
  }

  /* Mobile: daily cash summary ─────────────────────────────────────────── */
  .date-nav { flex-wrap: wrap; }
  .date-nav .fw-bold { flex: 0 0 100%; order: -1; text-align: center !important; margin-bottom: 4px; }

  /* Mobile: analytics stats table ──────────────────────────────────────── */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) {
    display: block !important;
  }
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody {
    display: block !important;
  }
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) thead {
    display: none !important;
  }
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border) !important;
    gap: 4px;
    cursor: pointer;
  }
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody tr:last-child {
    border-bottom: none !important;
  }
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td {
    border: none !important;
    padding: 2px 0 !important;
    background: transparent !important;
  }
  /* col 1: job type name — top left */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(1) {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
  }
  /* col 2: facts count — top right */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(2) {
    order: 2;
    flex: 0 0 auto;
    text-align: right !important;
  }
  /* col 5: profit % — next to facts */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(5) {
    order: 3;
    flex: 0 0 auto;
    margin-left: 8px;
  }
  /* col 7: chevron — far right */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(7) {
    order: 4;
    flex: 0 0 auto;
    margin-left: 4px;
  }
  /* col 3: time — second row */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(3) {
    order: 5;
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: var(--font-size-xs) !important;
  }
  /* col 4: materials — second row */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(4) {
    order: 6;
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: var(--font-size-xs) !important;
    margin-left: 12px;
  }
  /* col 6: time deviation — second row right */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td:nth-child(6) {
    order: 7;
    flex: 1 1 auto;
    margin-top: 2px;
    text-align: right !important;
    font-size: var(--font-size-xs) !important;
  }
  /* colspan cells (insufficient data) — full width second row */
  .card > .table-responsive > .table.table-hover.align-middle:not(.jobs-table):not(.clients-table):not(.employees-table):not(.table-sticky):not(.job-types-table):not(.table-dark) tbody td[colspan] {
    order: 5;
    flex: 1 1 100%;
    margin-top: 2px;
    font-size: var(--font-size-xs) !important;
  }

}
