/* ── Crash Tab Panel ───────────────────────────────────────────────── */
#tab-panel-crash.active {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   EVENTS LIST VIEW  (outer split — same pattern as events tab)
══════════════════════════════════════════════════════════════════════ */
.cr-events-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left 1/3 — list */
.cr-events-list-col {
  width: 33.333%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1f2530;
  overflow: hidden;
}

.cr-events-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #1f2530;
  flex-shrink: 0;
}

.cr-events-list-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cr-events-list-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #5a6678;
}

.cr-event-add-btn {
  background: none;
  border: 1px solid #2d3748;
  color: #94a3b8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cr-event-add-btn:hover { color: #e2e8f0; border-color: #94a3b8; }

#cr-events-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cr-events-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: #4b5563;
}
.cr-events-loading .material-symbols-outlined {
  font-size: 22px;
  animation: spin 1.2s linear infinite;
}

.cr-events-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: #4b5563;
  text-align: center;
}
.cr-events-empty .material-symbols-outlined { font-size: 28px; }
.cr-events-empty p { margin: 0; font-size: 13px; }

/* ── Timeline spine on the events list ───────────────────────────── */
#cr-events-list {
  position: relative;
}
#cr-events-list::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, transparent 0%, #161d28 5%, #161d28 93%, transparent 100%);
  border-radius: 1px;
  z-index: 0;
}

/* Crash entry row (reuses tl-row/session-entry classes from detail.css) */
.cr-crash-entry { cursor: pointer; padding: 3px 0; }

/* The event-card inside crash entries — override to 3-col (no actions col) */
.cr-crash-card {
  grid-template-columns: 56px 1fr auto !important;
}
.cr-crash-entry-active .event-card,
.cr-crash-entry-active .cr-crash-card {
  border-color: var(--accent, #84cc16) !important;
  background: #0d1220;
}

/* Cost line on crash card */
.cr-card-cost {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.cr-card-no-price-warn {
  color: #f59e0b;
  font-style: normal;
}

/* Status badge inside the status column */
.cr-crash-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  margin: auto 10px auto 0;
}

/* ev-circuit and ev-sessions reuse existing detail.css styles */
.ev-circuit {
  font-size: 11px;
  color: #4a5a6e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-sessions {
  font-size: 10px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right 2/3 — detail */
.cr-events-detail-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.cr-events-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #374151;
}
.cr-events-detail-empty span { font-size: 13px; }

/* Event detail panel (right side) */
.cr-event-detail-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cr-evp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cr-evp-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.cr-evp-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.cr-evp-header-actions .act-btn {
  flex: none;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid #2a3545;
  font-size: 10px;
  letter-spacing: 0.6px;
}
.cr-evp-header-actions .act-secondary { border-color: #2a3545; color: #64748b; }
.cr-evp-header-actions .act-secondary:hover { background: #1f2530; color: #94a3b8; border-color: #374151; }
.cr-evp-header-actions .act-danger { border-color: rgba(239,68,68,0.2); color: #7a3030; }
.cr-evp-header-actions .act-danger:hover { background: rgba(239,68,68,0.08); color: #ef4444; border-color: rgba(239,68,68,0.4); }
body.light-mode .cr-evp-header-actions .act-secondary { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .cr-evp-header-actions .act-secondary:hover { background: #e8edf5; color: #1a2030; }
body.light-mode .cr-evp-header-actions .act-danger { border-color: rgba(239,68,68,0.2); color: #c03030; }
body.light-mode .cr-evp-header-actions .act-danger:hover { background: rgba(239,68,68,0.08); color: #dc2626; }

.cr-evp-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
}
.cr-evp-date .material-symbols-outlined { font-size: 15px; }

.cr-evp-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  white-space: pre-wrap;
}

.cr-evp-stats {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #141920;
  border-radius: 10px;
  border: 1px solid #1f2530;
}

.cr-evp-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.cr-evp-stat-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}

.cr-evp-stat-label {
  font-size: 10px;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cr-evp-progress { display: flex; flex-direction: column; gap: 5px; }
.cr-evp-progress-label { font-size: 12px; color: #64748b; }
.cr-evp-progress-bar {
  height: 6px;
  background: #1f2530;
  border-radius: 4px;
  overflow: hidden;
}
.cr-evp-progress-fill {
  height: 100%;
  background: var(--accent, #84cc16);
  border-radius: 4px;
  transition: width 0.4s;
}

.cr-evp-open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent, #84cc16);
  color: #0a0d0f;
  border: none;
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 8px;
}
.cr-evp-open-btn:hover { opacity: 0.9; }
.cr-evp-open-btn .material-symbols-outlined { font-size: 18px; }

/* ── Event card — new structure ─────────────────────────────────── */
.cr-event-card-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.cr-event-card-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1f2530;
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 36px;
  flex-shrink: 0;
}
.cr-event-card-day {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}
.cr-event-card-month {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cr-event-card-body { flex: 1; min-width: 0; }

.cr-event-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.cr-event-card-type {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.cr-type-race      { background: rgba(239,68,68,0.15);  color: #f87171; }
.cr-type-test      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cr-type-endurance { background: rgba(168,85,247,0.15); color: #c084fc; }
.cr-type-trackday  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.cr-type-meeting   { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.cr-type-other     { background: rgba(100,116,139,0.15);color: #94a3b8; }

.cr-event-card-track {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-event-card-track .material-symbols-outlined { font-size: 12px; flex-shrink: 0; }

.cr-event-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cr-event-card-session,
.cr-event-card-turn {
  font-size: 10px;
  color: #64748b;
  background: #1f2530;
  padding: 1px 5px;
  border-radius: 3px;
}
.cr-event-card-status {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: auto;
}
.cr-status-step-0 { background: rgba(100,116,139,0.12); color: #94a3b8; }
.cr-status-step-1 { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.cr-status-step-2 { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.cr-status-step-3 { background: rgba(249,115,22,0.12);  color: #fb923c; }
.cr-status-step-4 { background: rgba(168,85,247,0.12);  color: #c084fc; }
.cr-status-step-5 { background: rgba(34,197,94,0.12);   color: #4ade80; }

/* ── Detail panel — type tag + title ─────────────────────────────── */
.cr-evp-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cr-evp-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  align-self: flex-start;
}

/* ── Info grid ───────────────────────────────────────────────────── */
.cr-evp-info-grid {
  display: grid;
  /* auto-fit packs as many cards per row as fit — on the wide detail pane
     the five items land in ~2 rows instead of 3, which matters most at
     large accessibility text sizes. min track keeps values readable. */
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}
.cr-evp-info-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  background: #141920;
  border-radius: 7px;
  border: 1px solid #1f2530;
}
.cr-evp-info-icon {
  font-size: 15px;
  color: #4b5563;
  flex-shrink: 0;
}
.cr-evp-info-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cr-evp-info-label {
  font-size: 10px;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.cr-evp-info-val {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Status stepper ─────────────────────────────────────────────── */
/* Step colors — one per status */
.cr-step-idx-0 { --sc: #64748b; }
.cr-step-idx-1 { --sc: #3b82f6; }
.cr-step-idx-2 { --sc: #f59e0b; }
.cr-step-idx-3 { --sc: #f97316; }
.cr-step-idx-4 { --sc: #a855f7; }
.cr-step-idx-5 { --sc: #22c55e; }

.cr-status-stepper {
  display: flex;
  align-items: flex-start;
  background: #141920;
  border-radius: 8px;
  border: 1px solid #1f2530;
  padding: 12px 8px;
  gap: 0;
}
.cr-status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 4px;
  border-radius: 5px;
  transition: background 0.15s;
  min-width: 48px;
}
.cr-status-step:hover { background: #1f2530; }
.cr-step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid color-mix(in srgb, var(--sc) 45%, transparent);
  transition: background 0.25s ease, border-color 0.25s ease,
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease, opacity 0.25s ease;
  flex-shrink: 0;
}
.cr-step-arrow {
  flex-shrink: 0;
  width: 16px;
  color: #2d3748;
  font-size: 16px;
  font-weight: 700;
  pointer-events: none;
  padding-top: 6px; /* align with dot center */
  text-align: center;
  line-height: 1;
}
.cr-step-label {
  font-size: 9px;
  color: #374151;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: color 0.2s;
  font-family: 'Barlow', sans-serif;
}

/* Done: colored dot at reduced opacity, colored arrow */
.cr-status-step-done .cr-step-dot  { background: var(--sc); border-color: var(--sc); opacity: 0.55; }
.cr-status-step-done .cr-step-label { color: #64748b; }
.cr-arrow-done { color: var(--sc, #64748b) !important; opacity: 0.55; }

/* Active: full color, larger dot, glow ring */
.cr-status-step-active .cr-step-dot {
  background: var(--sc);
  border-color: var(--sc);
  transform: scale(1.6);
  opacity: 1;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 22%, transparent);
}
.cr-status-step-active .cr-step-label { color: var(--sc); font-weight: 700; font-size: 10px; }

/* ── Detail tabs (Parts / Photos / Files) ───────────────────────── */
.cr-detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #1f2530;
  padding-bottom: 0;
  flex-shrink: 0;
}
.cr-detail-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s;
  margin-bottom: -1px;
}
.cr-detail-tab:hover { color: #94a3b8; }
.cr-detail-tab-active {
  color: var(--accent, #84cc16);
  border-bottom-color: var(--accent, #84cc16);
}
.cr-detail-tab .material-symbols-outlined { font-size: 16px; }
.cr-detail-tab-badge {
  font-size: 10px;
  background: #1f2530;
  color: #64748b;
  border-radius: 8px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
}
.cr-detail-tab-active .cr-detail-tab-badge {
  background: rgba(132,204,22,0.15);
  color: var(--accent, #84cc16);
}
/* No inner scroll — let the whole detail panel scroll as one column.
   flex-grow fills leftover space when content is short; default
   min-height:auto means it never shrinks below its content, so tall
   content (e.g. large accessibility text) overflows into the panel's
   own scroll instead of a cramped nested scrollbar. */
.cr-detail-tab-content { flex: 1 0 auto; }

/* ── Parts tab ───────────────────────────────────────────────────── */
.cr-parts-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 0;
}
.cr-parts-tab-summary {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: #141920;
  border-radius: 8px;
  border: 1px solid #1f2530;
}
.cr-pts-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.cr-pts-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}
.cr-pts-vat-note {
  font-size: 9px; color: #374151;
  letter-spacing: 0.3px; margin-top: 2px;
}
.cr-pts-lbl {
  font-size: 10px;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.cr-pts-no-price-note {
  display: flex; align-items: center; gap: 5px;
  margin: 8px 0 0;
  padding: 6px 8px;
  background: rgba(220, 150, 30, 0.12);
  border: 1px solid rgba(220, 150, 30, 0.35);
  border-radius: 5px;
  font-size: 11px; color: #e0a030; font-weight: 500;
}
.cr-pts-no-price-note .material-symbols-outlined { font-size: 14px; }
body.light-mode .cr-pts-no-price-note { background: rgba(180,120,0,.08); border-color: rgba(180,120,0,.25); color: #8a5c00; }

/* ── Cost breakdown card (parts tab) ─────────────────────────────── */
.cr-cost-breakdown {
  background: #141920;
  border: 1px solid #1f2530;
  border-radius: 10px;
  overflow: hidden;
}
.cr-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1a2030;
  gap: 8px;
}
.cr-cost-row:last-child { border-bottom: none; }
.cr-cost-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}
.cr-cost-row-label .material-symbols-outlined { font-size: 15px; }
.cr-cost-row-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.2px;
}
.cr-cost-row-extra { cursor: pointer; transition: background 0.12s; }
.cr-cost-row-extra:hover { background: #191f2c; }
.cr-cost-row-extra .cr-cost-row-label { color: #94a3b8; }
.cr-cost-saving { color: #4ade80; font-size: 14px; }
.cr-cost-row-vat .cr-cost-row-label { color: #64748b; }
.cr-cost-row-vat .cr-cost-row-val { color: #94a3b8; font-size: 15px; }
.cr-cost-row-total { background: #111620; }
.cr-cost-row-total .cr-cost-row-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #94a3b8;
}
.cr-cost-total-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #e2e8f0;
}
.cr-cost-vat-note {
  font-size: 10px;
  color: #374151;
  text-align: right;
  padding: 4px 14px 8px;
  letter-spacing: 0.2px;
}
.cr-cost-warn { color: #f59e0b; }

/* Discount toggle */
.cr-discount-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #2a3545;
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 11px;
  font-family: 'Barlow', sans-serif;
  color: #4b5563;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  align-self: flex-start;
}
.cr-discount-toggle .material-symbols-outlined { font-size: 20px; }
.cr-discount-toggle:hover { border-color: #374151; color: #64748b; }
.cr-discount-on { border-color: rgba(74,222,128,0.3); color: #4ade80; background: rgba(74,222,128,0.06); }
.cr-discount-on:hover { background: rgba(74,222,128,0.10); border-color: rgba(74,222,128,0.5); }
body.light-mode .cr-discount-toggle { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .cr-discount-on { border-color: rgba(22,163,74,.3); color: #16a34a; background: rgba(22,163,74,.06); }

/* ── Extra Costs tab ─────────────────────────────────────────────── */
.cr-extra-costs-tab {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 0 0;
}
.cr-ec-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 36px 20px;
  color: #374151;
  text-align: center;
}
.cr-ec-empty .material-symbols-outlined { font-size: 28px; opacity: 0.5; }
.cr-ec-empty p { margin: 0; font-size: 13px; color: #4b5563; }
.cr-ec-empty-sub { font-size: 11px !important; color: #374151 !important; max-width: 280px; line-height: 1.5; }
.cr-ec-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #1f2530;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  background: #141920;
}
.cr-ec-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #1a2030;
  transition: background 0.12s;
}
.cr-ec-row:last-child { border-bottom: none; }
.cr-ec-row:hover { background: #191f2c; }
.cr-ec-type-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cr-ec-external { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.cr-ec-internal { background: rgba(168,85,247,0.12); color: #c084fc; border: 1px solid rgba(168,85,247,0.2); }
body.light-mode .cr-ec-external { background: rgba(59,130,246,0.08); color: #2563eb; }
body.light-mode .cr-ec-internal { background: rgba(168,85,247,0.08); color: #7c3aed; }
.cr-ec-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cr-ec-desc { font-size: 12px; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-ec-supplier { font-size: 10px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-ec-amount {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.cr-ec-vat { font-size: 9px; color: #4b5563; font-family: 'Barlow', sans-serif; font-weight: 400; }
.cr-ec-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; flex-shrink: 0; }
.cr-ec-row:hover .cr-ec-actions { opacity: 1; }
.cr-ec-btn {
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.12s, background 0.12s;
}
.cr-ec-btn .material-symbols-outlined { font-size: 14px; }
.cr-ec-btn:hover { color: #94a3b8; background: #1f2530; }
.cr-ec-btn-del:hover { color: #f87171; background: rgba(239,68,68,0.1); }
.cr-ec-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #111620;
  border: 1px solid #1f2530;
  border-top: none;
  border-radius: 0 0 10px 10px;
}
.cr-ec-total-label { font-size: 10px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: #64748b; }
.cr-ec-total-val { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 700; color: #e2e8f0; }
/* Subtotal + VAT lines stacked above the grand total bar */
.cr-ec-total-bar-sub { padding: 7px 14px; background: #0e131c; border-radius: 0; }
.cr-ec-total-bar-sub .cr-ec-total-val { font-size: 15px; font-weight: 600; color: #94a3b8; }
body.light-mode .cr-ec-total-bar-sub { background: #eef2f8; }
.cr-ec-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  background: none;
  border: 1px dashed #2a3545;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  color: #4b5563;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.cr-ec-add-btn .material-symbols-outlined { font-size: 16px; }
.cr-ec-add-btn:hover { color: #94a3b8; border-color: #374151; background: #141920; }

/* Add/Edit form */
.cr-ec-form {
  background: #141920;
  border: 1px solid #2a3545;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.cr-ec-form-header { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: #64748b; }
.cr-ec-type-toggle { display: flex; gap: 6px; }
.cr-ec-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #0d1117;
  border: 1px solid #2a3545;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  color: #4b5563;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.cr-ec-type-btn .material-symbols-outlined { font-size: 15px; }
.cr-ec-type-btn:hover { border-color: #374151; color: #94a3b8; }
.cr-ec-type-btn:first-child.active { border-color: rgba(59,130,246,0.4); color: #60a5fa; background: rgba(59,130,246,0.08); }
.cr-ec-type-btn:last-child.active  { border-color: rgba(168,85,247,0.4); color: #c084fc; background: rgba(168,85,247,0.08); }
.cr-ec-form-row { display: flex; flex-direction: column; gap: 4px; }
.cr-ec-form-label { font-size: 10px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: #4b5563; }
.cr-ec-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: #374151; }
.cr-ec-form-input {
  background: #0d1117;
  border: 1px solid #2a3545;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  color: #e2e8f0;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.cr-ec-form-input:focus { border-color: var(--accent, #84cc16); }
.cr-ec-form-input::placeholder { color: #374151; }
.cr-ec-form-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cr-ec-amount-wrap { position: relative; display: flex; align-items: center; }
.cr-ec-currency { position: absolute; left: 10px; font-size: 13px; color: #4b5563; pointer-events: none; }
.cr-ec-pct { left: auto; right: 10px; }
.cr-ec-amount-input { padding-left: 22px !important; }
.cr-ec-vat-input { padding-right: 26px !important; }
.cr-ec-form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.cr-ec-badge { font-family: 'Barlow', sans-serif; font-size: 9px; letter-spacing: 0; padding: 0 6px; }

body.light-mode .cr-ec-form { background: #f0f4fb; border-color: #dde2ec; }
body.light-mode .cr-ec-form-input { background: #fff; border-color: #dde2ec; color: #1a2030; }
body.light-mode .cr-ec-type-btn { background: #e8edf5; border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .cr-ec-list { background: #f0f4fb; border-color: #dde2ec; }
body.light-mode .cr-ec-row:hover { background: #e8edf5; }
body.light-mode .cr-ec-total-bar { background: #e4e9f2; border-color: #dde2ec; }
body.light-mode .cr-ec-add-btn { color: #6b7a8d; border-color: #c8d0de; }
body.light-mode .cr-ec-add-btn:hover { background: #e8edf5; border-color: #94a3b8; color: #1a2030; }
body.light-mode .cr-cost-breakdown { background: #f0f4fb; border-color: #dde2ec; }
body.light-mode .cr-cost-row { border-color: #dde2ec; }
body.light-mode .cr-cost-row-total { background: #e4e9f2; }
body.light-mode .cr-cost-total-val { color: #1a2030; }
body.light-mode .cr-cost-row-extra:hover { background: #e8edf5; }

/* ── Photos tab ──────────────────────────────────────────────────── */
.cr-photos-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 0;
}
.cr-photos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cr-photos-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cr-photos-select-btn.active { border-color: #3b82f6; color: #3b82f6; }
.cr-photos-select-btn.active:hover { border-color: #2563eb; color: #2563eb; }
.cr-photo-slot.cr-selected { outline: 2px solid #3b82f6; outline-offset: -2px; }
.cr-photo-check {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.65);
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 11px; font-weight: 700;
  transition: all 0.12s; pointer-events: none;
}
.cr-photo-check.checked { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.cr-select-mode .cr-photo-has { cursor: pointer; }
.cr-photo-del-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; margin-top: 6px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 6px;
}
.cr-del-bar-count { font-size: 11px; color: #94a3b8; }
.cr-del-bar-btn {
  font-size: 10px; font-weight: 700; font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.5px; text-transform: uppercase;
  background: transparent; border: 1px solid rgba(239,68,68,0.5);
  color: #ef4444; padding: 4px 10px; border-radius: 5px; cursor: pointer;
  transition: all 0.12s;
}
.cr-del-bar-btn:hover { background: rgba(239,68,68,0.15); }
.cr-del-bar-cancel { color: #64748b; border-color: rgba(100,116,139,0.35); }
.cr-del-bar-cancel:hover { background: rgba(100,116,139,0.1); }
.cr-photos-count {
  font-size: 12px;
  color: #64748b;
}
.cr-photos-empty {
  font-size: 12px;
  color: #64748b;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(100,116,139,0.08);
  border: 1px dashed rgba(100,116,139,0.3);
  border-radius: 6px;
}
body.light-mode .cr-photos-empty { color: #64748b; background: #f3f5f9; border-color: #d6dbe4; }

/* Undo-delete toast (bottom-left, with action button) */
.cr-undo-toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: 14px;
  background: #1a2030; border: 1px solid #2a3040; border-radius: 10px;
  padding: 10px 14px 10px 22px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: #cbd5e1; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; z-index: 10000;
  transition: opacity 0.2s, transform 0.2s;
}
.cr-undo-toast.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
/* Lift above the 60px mobile bottom nav */
@media (max-width: 767px) {
  .cr-undo-toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}
.cr-undo-btn {
  font: inherit; cursor: pointer;
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 4px 12px; border-radius: 6px;
  transition: background 0.12s;
}
.cr-undo-btn:hover { background: rgba(212,245,66,0.12); }
body.light-mode .cr-undo-toast { background: #ffffff; border-color: #dde2ec; color: #475569; box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
body.light-mode .cr-undo-btn:hover { background: rgba(90,122,0,0.1); }
.cr-photos-hint {
  font-size: 11px;
  color: #374151;
  text-align: right;
}
.cr-photos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cr-photo-slot {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.cr-photo-has {
  background: #141920;
  border: 1px solid #1f2530;
  cursor: pointer;
}
.cr-photo-has img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.cr-photo-has:hover img { opacity: 0.8; }
.cr-photo-empty {
  background: #141920;
  border: 1px dashed #2d3748;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2d3748;
  transition: border-color 0.15s, color 0.15s;
}
.cr-photo-empty:hover { border-color: #64748b; color: #64748b; }
.cr-photo-empty .material-symbols-outlined { font-size: 22px; }
.cr-photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0;
}
.cr-photo-has:hover .cr-photo-del { opacity: 1; }
.cr-photo-del .material-symbols-outlined { font-size: 14px; }
.cr-photo-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Files tab ───────────────────────────────────────────────────── */
.cr-files-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 0;
}
.cr-docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cr-docs-meta {
  font-size: 12px;
  color: #64748b;
}
.cr-docs-upload-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  color: var(--accent, #84cc16);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(132,204,22,0.3);
  transition: background 0.15s;
}
.cr-docs-upload-btn:hover { background: rgba(132,204,22,0.08); }
.cr-docs-upload-btn .material-symbols-outlined { font-size: 16px; }
.cr-docs-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.cr-docs-uploading { opacity: 0.6; pointer-events: none; }

.cr-docs-list { display: flex; flex-direction: column; gap: 6px; }
.cr-docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: #374151;
  font-size: 12px;
}
.cr-docs-empty .material-symbols-outlined { font-size: 28px; }

.cr-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #141920;
  border-radius: 7px;
  border: 1px solid #1f2530;
}
.cr-doc-icon { font-size: 18px; flex-shrink: 0; }
.cr-doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cr-doc-name {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-doc-name:hover { color: var(--accent, #84cc16); text-decoration: underline; }
.cr-doc-meta { font-size: 10px; color: #4b5563; }
.cr-doc-del {
  background: none;
  border: none;
  color: #374151;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.cr-doc-del:hover { color: #ef4444; }
.cr-doc-del .material-symbols-outlined { font-size: 16px; }
.cr-docs-error {
  font-size: 12px;
  color: #f87171;
  padding: 8px 12px;
  background: rgba(239,68,68,0.08);
  border-radius: 6px;
  border: 1px solid rgba(239,68,68,0.2);
}

/* ── Disambig modal list ─────────────────────────────────────────── */
.cr-disambig-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cr-disambig-btn  { width: 100%; text-align: left; justify-content: flex-start; }
.cr-disambig-cat  { font-weight: 400; opacity: 0.6; }

/* ── Light-mode overrides — new sections ────────────────────────── */
body.light-mode #cr-events-list::before { background: linear-gradient(to bottom, transparent 0%, #dde2ec 5%, #dde2ec 93%, transparent 100%); }
body.light-mode .cr-crash-entry-active .cr-crash-card { border-color: #5a7a00 !important; background: #f5f7fb; }
body.light-mode .ev-circuit  { color: #8899aa; }
body.light-mode .ev-sessions { color: #b0b8c4; }

body.light-mode .cr-evp-info-item { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-evp-info-icon { color: #b0b8c4; }
body.light-mode .cr-evp-info-label { color: #b0b8c4; }
body.light-mode .cr-evp-info-val { color: #4a5a6b; }

body.light-mode .cr-status-stepper { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-status-step:hover { background: #e4e8f0; }
body.light-mode .cr-step-dot {
  background: color-mix(in srgb, var(--sc) 8%, #f0f3f8);
  border-color: color-mix(in srgb, var(--sc) 55%, #dde2ec);
}
body.light-mode .cr-step-label { color: #b0b8c4; }
body.light-mode .cr-step-arrow { color: #c8d0dc; }
/* Done/active: inherit --sc (per-step color var), same in dark/light */
body.light-mode .cr-status-step-done .cr-step-label  { color: #8899aa; }
body.light-mode .cr-status-step-active .cr-step-label { color: var(--sc); }
body.light-mode .cr-status-step-active .cr-step-dot {
  background: var(--sc);
  border-color: var(--sc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 18%, transparent);
}

body.light-mode .cr-detail-tab { color: #8899aa; }
body.light-mode .cr-detail-tab:hover { color: #4a5a6b; }
body.light-mode .cr-detail-tabs { border-bottom-color: #dde2ec; }
body.light-mode .cr-detail-tab-badge { background: #dde2ec; color: #6b7a8d; }

body.light-mode .cr-parts-tab-summary { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-pts-val { color: #1a2030; }
body.light-mode .cr-pts-lbl { color: #b0b8c4; }
body.light-mode .cr-pts-vat-note { color: #b0b8c4; }

body.light-mode .cr-photo-has { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-photo-empty { background: #f0f3f8; border-color: #c8d0dc; color: #c8d0dc; }
body.light-mode .cr-photo-empty:hover { border-color: #8899aa; color: #8899aa; }

body.light-mode .cr-doc-row { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-doc-name { color: #4a5a6b; }
body.light-mode .cr-doc-meta { color: #b0b8c4; }
body.light-mode .cr-doc-del { color: #c8d0dc; }
body.light-mode .cr-doc-del:hover { color: #ef4444; }
body.light-mode .cr-docs-empty { color: #c8d0dc; }
body.light-mode .cr-docs-meta { color: #8899aa; }
body.light-mode .cr-docs-upload-btn { border-color: rgba(90,122,0,0.3); color: #5a7a00; }
body.light-mode .cr-docs-upload-btn:hover { background: rgba(90,122,0,0.08); }

/* ── Files drop zone ─────────────────────────────────────────────── */
.cr-drop-zone {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 18px; margin: 6px 0;
  border: 1.5px dashed #2a3545; border-radius: 10px;
  flex-shrink: 0; pointer-events: none;
  transition: all 0.15s;
}
.cr-drop-icon { font-size: 22px !important; color: #3a4a5b; }
.cr-drop-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: #3a4a5b;
}
.cr-files-tab.drag-over .cr-docs-list { opacity: 0.4; }
.cr-files-tab.drag-over .cr-drop-zone {
  display: flex;
  border-color: #3b82f6; background: rgba(59,130,246,0.04);
}
.cr-files-tab.drag-over .cr-drop-icon,
.cr-files-tab.drag-over .cr-drop-text { color: #3b82f6; }
.cr-files-tab.uploading .cr-docs-upload-btn { opacity: 0.5; pointer-events: none; }

body.light-mode .cr-drop-zone { border-color: #c8d0dc; }
body.light-mode .cr-drop-icon,
body.light-mode .cr-drop-text { color: #b0b8c4; }
body.light-mode .cr-files-tab.drag-over .cr-drop-zone { border-color: #3b82f6; background: rgba(59,130,246,0.04); }
body.light-mode .cr-files-tab.drag-over .cr-drop-icon,
body.light-mode .cr-files-tab.drag-over .cr-drop-text { color: #3b82f6; }

/* ── Add/Edit crash event modal ─────────────────────────────────── */
.cr-event-modal-wide { max-width: 520px !important; }

.pit-field { display: flex; flex-direction: column; gap: 4px; }
.pit-field-input {
  background: #0f141a;
  border: 1px solid #2a3545;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  color: #e2e8f0;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
  outline: none;
}
.pit-field-input:focus { border-color: var(--accent, #84cc16); }
.pit-field-input::placeholder { color: #374151; }
textarea.pit-field-input { resize: vertical; min-height: 60px; }
input[type="time"].pit-field-input { color-scheme: dark; }

.cr-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.6fr;
  gap: 10px;
}
.cr-modal-optional { font-weight: 400; color: #374151; font-size: 10px; text-transform: none; letter-spacing: 0; }

.cr-cal-picker-loading { font-size: 12px; color: #4b5563; padding: 8px 0; }
.cr-cal-none           { font-size: 12px; color: #4b5563; line-height: 1.5; padding: 6px 0; }
.cr-cal-none small     { color: #374151; }

.cr-cal-year-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.cr-cal-year-tab {
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid #2a3545;
  background: none;
  color: #4b5563;
  font-size: 11px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.cr-cal-year-tab:hover { border-color: #3a4555; color: #94a3b8; }
.cr-cal-year-active    { background: rgba(132,204,22,0.12); border-color: rgba(132,204,22,0.35); color: var(--accent, #84cc16); }

.cr-cal-select {
  width: 100%;
  background: #0f141a;
  border: 1px solid #2a3545;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  color: #e2e8f0;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
  color-scheme: dark;
}
.cr-cal-select:focus { border-color: var(--accent, #84cc16); }
.cr-cal-select option      { background: #1a2030; color: #e2e8f0; }
.cr-cal-select optgroup    { background: #141920; color: #64748b; font-style: normal; font-size: 11px; }

/* Light-mode modal */
body.light-mode .pit-field-input {
  background: #ffffff; border-color: #dde2ec; color: #1a2030;
}
body.light-mode .pit-field-input:focus { border-color: #5a7a00; }
body.light-mode .pit-field-input::placeholder { color: #c8d0dc; }
body.light-mode input[type="time"].pit-field-input { color-scheme: light; }
body.light-mode .cr-cal-select {
  background: #ffffff; border-color: #dde2ec; color: #1a2030; color-scheme: light;
}
body.light-mode .cr-cal-select:focus { border-color: #5a7a00; }
body.light-mode .cr-cal-select option   { background: #ffffff; color: #1a2030; }
body.light-mode .cr-cal-select optgroup { background: #f0f3f8; color: #8899aa; }
body.light-mode .cr-cal-none,
body.light-mode .cr-cal-picker-loading { color: #b0b8c4; }
body.light-mode .cr-cal-none small { color: #c8d0dc; }
body.light-mode .cr-cal-year-tab { border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-cal-year-tab:hover { border-color: #b0b8c4; color: #4a5a6b; }
body.light-mode .cr-cal-year-active { background: rgba(90,122,0,0.1); border-color: rgba(90,122,0,0.35); color: #5a7a00; }
body.light-mode .cr-modal-optional { color: #b0b8c4; }

/* ══════════════════════════════════════════════════════════════════════
   CATALOG VIEW  (full-panel replacement list + parts catalog)
══════════════════════════════════════════════════════════════════════ */
.cr-catalog-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.cr-catalog-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #1f2530;
  flex-shrink: 0;
}

.cr-catalog-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.cr-catalog-back-btn:hover { color: #e2e8f0; background: #1a2130; }
.cr-catalog-back-btn .material-symbols-outlined { font-size: 18px; }

.cr-catalog-view-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The horizontal split inside the catalog view */
.cr-catalog-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Cart (left panel — resizable) ───────────────────────────────── */
.cr-cart {
  width: var(--cr-left-w, 33.333%);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cr-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #1f2530;
  flex-shrink: 0;
}

.cr-cart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #e2e8f0;
}

.cr-cart-title .material-symbols-outlined {
  font-size: 20px;
  color: var(--accent);
}

.cr-cart-count {
  background: var(--accent);
  color: #0a0d0f;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.cr-cart-clear {
  background: none;
  border: 1px solid #2d3748;
  color: #64748b;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cr-cart-clear:hover { color: #ef4444; border-color: #ef4444; }

.cr-cart-import-btn {
  background: none; border: 1px solid #2d3748; color: #64748b;
  border-radius: 6px; padding: 4px 8px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center;
}
.cr-cart-import-btn:hover { color: var(--accent); border-color: var(--accent); }
.cr-cart-import-btn .material-symbols-outlined { font-size: 16px; }

/* Import modal */
.cr-import-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 600;
}
.cr-import-modal {
  background: #101318; border: 1px solid #2a3040; border-radius: 14px;
  padding: 24px 28px; width: min(400px, calc(100vw - 40px));
  display: flex; flex-direction: column; gap: 16px;
}
.cr-import-modal-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 17px;
  font-weight: 700; color: #e2e8f0; letter-spacing: 0.3px;
}
.cr-import-progress-bar {
  height: 4px; background: #1f2530; border-radius: 2px; overflow: hidden;
}
.cr-import-progress-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width 0.2s ease;
}
.cr-import-status { font-size: 12px; color: #64748b; font-family: 'Barlow', sans-serif; }
.cr-import-summary { display: flex; flex-direction: column; gap: 8px; }
.cr-import-stat {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 600;
}
.cr-import-stat .material-symbols-outlined { font-size: 18px; }
.cr-import-ok   { color: #4ade80; }
.cr-import-skip { color: #94a3b8; }
.cr-import-fail { color: #f59e0b; }
.cr-import-unmatched {
  background: #0a0d10; border: 1px solid #1f2530; border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
  max-height: 160px; overflow-y: auto;
}
.cr-import-unmatched::-webkit-scrollbar { width: 3px; }
.cr-import-unmatched::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 2px; }
.cr-import-unmatched-lbl { font-size: 10px; color: #4b5563; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.cr-import-unmatched-row { font-size: 12px; color: #64748b; font-family: 'Barlow', sans-serif; }
.cr-import-unmatched-sup { color: #4b5563; font-size: 11px; }
.cr-import-close-btn {
  align-self: flex-end; background: var(--accent); border: none; border-radius: 8px;
  color: #0a0d0f; font-family: 'Barlow Condensed', sans-serif; font-size: 14px;
  font-weight: 700; padding: 8px 20px; cursor: pointer; transition: opacity 0.15s;
}
.cr-import-close-btn:hover { opacity: 0.85; }

.cr-imp-sup-select {
  width: 100%; background: #0d1218; border: 1px solid #2a3040;
  border-radius: 8px; color: #e2e8f0; padding: 9px 12px;
  font-family: 'Barlow', sans-serif; font-size: 14px;
  outline: none; cursor: pointer;
}
.cr-imp-sup-select:focus { border-color: var(--accent); }
.cr-imp-sup-select option { background: #141820; }
.cr-import-col-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center;
}
.cr-import-lbl {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 600;
  color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
}

.cr-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cr-cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #2d3748;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
}
.cr-cart-empty .material-symbols-outlined { font-size: 40px; }
.cr-cart-empty p {
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  color: #3a4a5b;
  max-width: 140px;
  line-height: 1.5;
}

/* Collapse-all bar */
.cr-cart-collapse-bar {
  display: flex;
  justify-content: flex-end;
  padding: 2px 4px 0;
  flex-shrink: 0;
}
.cr-cart-collapse-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid #1f2530;
  color: #64748b;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cr-cart-collapse-all:hover {
  border-color: #2d3748;
  color: var(--accent);
  background: #131820;
}
.cr-cart-collapse-all .material-symbols-outlined { font-size: 14px; }

/* Category group header inside cart — explicit button affordance */
.cr-cart-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #94a3b8;
  background: #131820;
  border: 1px solid #1f2530;
  padding: 7px 10px;
  margin-top: 4px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-align: left;
}
.cr-cart-group-label:first-child { margin-top: 2px; }
.cr-cart-group-label:hover {
  color: var(--accent);
  border-color: #2d3748;
  background: #161c25;
}
.cr-cart-group-label.cr-group-collapsed {
  color: #64748b;
  background: #0f1218;
}

.cr-group-chevron {
  font-size: 18px !important;
  color: #cbd5e1;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.cr-cart-group-label:hover .cr-group-chevron { color: var(--accent); }
.cr-group-collapsed .cr-group-chevron { transform: rotate(-90deg); color: #64748b; }

.cr-group-label-text { flex: 1; }

.cr-group-count {
  background: #1a2030;
  color: #94a3b8;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
}
.cr-cart-group-label:hover .cr-group-count {
  color: var(--accent);
  background: #1f2530;
}

/* Cart item card */
.cr-cart-item {
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cr-cart-item-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cr-cart-item-name {
  flex: 1;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
}

.cr-cart-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.cr-cart-item-num {
  font-size: 11px;
  color: #3a4a5b;
  font-family: 'Barlow Condensed', sans-serif;
}

.cr-cart-pcs {
  display: inline-flex;
  align-items: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--accent);
  background: rgba(var(--accent-rgb),0.1);
  border: 1px solid rgba(var(--accent-rgb),0.25);
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
}

.cr-cart-item-remove {
  background: none;
  border: none;
  color: #3a4a5b;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
}
.cr-cart-item-remove:hover { color: #ef4444; }
.cr-cart-item-remove .material-symbols-outlined { font-size: 16px; }

.cr-cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Per-line price */
.cr-cart-item-price {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding: 4px 0; font-size: 12px;
}
.cr-cart-unit { color: #94a3b8; font-weight: 500; }
.cr-cart-strike { color: #5a6678; }
.cr-cart-line-total { color: #e0e8f0; font-weight: 600; }
.cr-cart-supplier {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb),.08);
  border: 1px solid rgba(var(--accent-rgb),.2);
  border-radius: 3px;
  padding: 0 4px;
}

/* Cart totals summary */
.cr-cart-totals {
  margin-top: 12px; padding: 12px;
  background: #0d1218; border: 1px solid #1f2530; border-radius: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.cr-cart-total-toggle {
  display: flex; justify-content: flex-end;
  padding-bottom: 6px; margin-bottom: 2px;
  border-bottom: 1px dashed #1f2530;
}
.cr-cart-total-toggle label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: #94a3b8; cursor: pointer; user-select: none;
}
.cr-cart-total-toggle input[type="checkbox"] { accent-color: var(--accent); }
.cr-cart-total-row {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #94a3b8;
}
.cr-cart-total-disc { color: var(--accent); }
.cr-cart-total-grand {
  font-size: 15px; font-weight: 700; color: #e0e8f0;
  padding-top: 6px; margin-top: 4px;
  border-top: 1px solid #1f2530;
}
.cr-cart-total-note {
  display: flex; align-items: center; gap: 5px;
  margin-top: 8px; padding: 6px 8px;
  background: rgba(220, 150, 30, 0.12);
  border: 1px solid rgba(220, 150, 30, 0.35);
  border-radius: 5px;
  font-size: 11px; color: #e0a030; font-weight: 500;
}
.cr-cart-total-note .material-symbols-outlined { font-size: 14px; }

.cr-cart-total-vat-note {
  font-size: 10px; color: #4b5563; text-align: right;
  letter-spacing: 0.3px; margin-top: -2px;
}

/* Supplier filter bar */
.cr-supplier-filter {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 8px 10px 4px;
  border-bottom: 1px solid #1a2030;
  flex-shrink: 0;
}
.cr-sf-chip {
  background: #131820; border: 1px solid #2a3448;
  color: #64748b; border-radius: 20px;
  font-family: 'Barlow', sans-serif; font-size: 11px; font-weight: 600;
  padding: 3px 10px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.cr-sf-chip:hover { border-color: #3a4a5b; color: #94a3b8; }
.cr-sf-chip-active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: var(--accent); color: var(--accent);
}

body.light-mode .cr-cart-unit { color: #6a7890; }
body.light-mode .cr-cart-strike { color: #aab4c0; }
body.light-mode .cr-cart-line-total { color: #1a2030; }
body.light-mode .cr-cart-supplier { color: #4a6a00; background: rgba(184,217,42,.12); border-color: rgba(184,217,42,.3); }
body.light-mode .cr-cart-totals { background: #f8f9fc; border-color: #dde2ec; }
body.light-mode .cr-cart-total-vat-note { color: #b0b8c4; }
body.light-mode .cr-supplier-filter { border-bottom-color: #dde2ec; }
body.light-mode .cr-sf-chip { background: #f0f3f8; border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-sf-chip:hover { border-color: #b0b8c4; color: #4a5568; }
body.light-mode .cr-sf-chip-active { background: rgba(90,122,0,0.08); border-color: #5a7a00; color: #5a7a00; }
body.light-mode .cr-cart-total-toggle { border-bottom-color: #eef0f5; }
body.light-mode .cr-cart-total-toggle label { color: #6a7890; }
body.light-mode .cr-cart-total-row { color: #6a7890; }
body.light-mode .cr-cart-total-disc { color: #4a6a00; }
body.light-mode .cr-cart-total-grand { color: #1a2030; border-top-color: #eef0f5; }

/* Quantity control */
.cr-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #1f2530;
  border-radius: 6px;
  overflow: hidden;
}
.cr-qty-btn {
  background: #1a2030;
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.cr-qty-btn:hover { background: #232b3a; color: var(--accent); }
.cr-qty-val {
  min-width: 28px;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  background: #101318;
  padding: 0 4px;
}

/* Status badge — tappable */
.cr-status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  user-select: none;
}
.cr-status-badge:active { transform: scale(0.96); }
.cr-status-badge .material-symbols-outlined { font-size: 12px; }

.cr-status-badge.cr-status-pending  { background: rgba(100,116,139,0.15); color: #64748b; }
.cr-status-badge.cr-status-ordered  { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.cr-status-badge.cr-status-replaced { background: rgba(34,197,94,0.15);   color: #4ade80; }

.cr-cart-footer {
  border-top: 1px solid #1f2530;
  padding: 12px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cr-export-btn {
  width: 100%;
  background: var(--accent);
  color: #0a0d0f;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
}
.cr-export-btn:hover { opacity: 0.9; }
.cr-export-btn:disabled { opacity: 0.3; cursor: default; }
.cr-export-btn .material-symbols-outlined { font-size: 18px; }

.cr-savecart-btn {
  width: 100%;
  background: rgba(var(--accent-rgb),0.08);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb),0.3);
  border-radius: 8px;
  padding: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.cr-savecart-btn:hover { background: rgba(var(--accent-rgb),0.15); border-color: rgba(var(--accent-rgb),0.6); }
.cr-savecart-btn:disabled { opacity: 0.3; cursor: default; }
.cr-savecart-btn .material-symbols-outlined { font-size: 18px; }

.cr-disambig-list { display: flex; flex-direction: column; gap: 8px; }
.cr-disambig-btn { width: 100%; justify-content: flex-start; font-size: 13px; }
.cr-disambig-cat { font-weight: 400; color: #8a9aab; margin-left: 4px; }

/* ── Catalog (right 2/3) ──────────────────────────────────────────── */
.cr-catalog {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #090b0e;
}

.cr-catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #1f2530;
  flex-shrink: 0;
}

.cr-search-wrap { flex: 1; }

.cr-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.cr-search-icon {
  position: absolute;
  left: 12px;
  color: #3a4a5b;
  pointer-events: none;
  font-size: 18px;
}
.cr-search-input {
  width: 100%;
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 8px;
  padding: 9px 12px 9px 38px;
  color: #e2e8f0;
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.cr-search-input:focus { border-color: var(--accent); }
.cr-search-input::placeholder { color: #3a4a5b; }

/* Category dropdown toggle */
.cr-cat-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cr-cat-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 8px;
  padding: 8px 12px;
  color: #64748b;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: left;
}
.cr-cat-toggle .material-symbols-outlined { font-size: 17px; flex-shrink: 0; }
.cr-cat-toggle:hover { border-color: #2d3748; color: #94a3b8; }
.cr-cat-toggle-open { border-color: var(--accent) !important; color: var(--accent) !important; }

.cr-cat-clear-btn {
  background: none; border: 1px solid #2d3748; color: #64748b;
  border-radius: 6px; padding: 6px 7px; cursor: pointer;
  display: flex; align-items: center; flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.cr-cat-clear-btn:hover { color: #ef4444; border-color: #ef4444; }
.cr-cat-clear-btn .material-symbols-outlined { font-size: 15px; }

#cr-cat-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cr-cat-chevron {
  transition: transform 0.2s ease;
}
.cr-cat-toggle-open .cr-cat-chevron { transform: rotate(180deg); }

/* Dropdown panel */
.cr-cat-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  max-height: 65vh;
  overflow: hidden;
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 10px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.cr-cat-dropdown.cr-cat-open { display: block; }

.cr-cat-grid {
  display: flex;
  flex-direction: row;
  height: 65vh;
  overflow: hidden;
}

/* Left column — main group numbers */
.cr-cat-groups {
  width: 54px;
  flex-shrink: 0;
  border-right: 1px solid #1a2030;
  overflow-y: auto;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cr-cat-groups::-webkit-scrollbar { width: 3px; }
.cr-cat-groups::-webkit-scrollbar-thumb { background: #1f2530; border-radius: 2px; }

.cr-cat-group-item {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #4a5568;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 800;
  padding: 7px 0;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.3px;
}
.cr-cat-group-item:hover { background: #131820; color: #94a3b8; }
.cr-cat-group-active { background: rgba(var(--accent-rgb),0.1); color: var(--accent); }

/* Right column — subcategories */
.cr-cat-subs {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cr-cat-subs::-webkit-scrollbar { width: 3px; }
.cr-cat-subs::-webkit-scrollbar-thumb { background: #1f2530; border-radius: 2px; }

.cr-cat-hint {
  color: #2d3748;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-style: italic;
  padding: 20px 10px;
  text-align: center;
}

.cr-cat-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.cr-cat-chip:hover { background: #131820; }
.cr-cat-chip:hover .cr-cat-chip-code { color: #94a3b8; }
.cr-cat-chip:hover .cr-cat-chip-name { color: #64748b; }

.cr-cat-chip-code {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #5a6a7b;
  flex-shrink: 0;
  transition: color 0.12s;
}
.cr-cat-chip-name {
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  color: #3a4a5b;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}

.cr-cat-chip-active {
  background: rgba(var(--accent-rgb),0.1);
  border-color: rgba(var(--accent-rgb),0.25);
}
.cr-cat-chip-active .cr-cat-chip-code { color: var(--accent); }
.cr-cat-chip-active .cr-cat-chip-name { color: #b0c830; }

/* Parts grid */
.cr-parts-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  align-content: start;
}

.cr-catalog-loading,
.cr-catalog-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #3a4a5b;
  gap: 10px;
  padding: 60px 20px;
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
}
.cr-catalog-loading .material-symbols-outlined,
.cr-catalog-empty .material-symbols-outlined { font-size: 36px; }

/* Part card */
.cr-part-card {
  position: relative;
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 10px;
  padding: 12px 50px 54px 12px; /* right+bottom reserve space for abs + button */
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}
.cr-part-card:hover { border-color: #2d3748; }
.cr-part-card.cr-in-cart { border-color: var(--accent); }
.cr-part-card.cr-in-cart::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.cr-part-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.cr-part-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cr-part-cat {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #3a4a5b;
}

/* PDF page button */
.cr-pdf-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #ef4444;
  opacity: 0.6;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
  transition: opacity 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}
.cr-pdf-btn:hover { opacity: 1; }
.cr-pdf-btn .material-symbols-outlined { font-size: 14px; }
.cr-cart-pdf-btn { margin-left: 0; opacity: 0.5; }
.cr-cart-pdf-btn:hover { opacity: 1; }
.cr-cart-item-top-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.cr-part-name {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
}

.cr-part-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.cr-part-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

.cr-part-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}

.cr-part-pcs {
  display: inline-flex;
  align-items: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--accent);
  background: rgba(var(--accent-rgb),0.1);
  border: 1px solid rgba(var(--accent-rgb),0.25);
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
}

/* Add button — always visible on touch, hover-reveal on non-touch */
.cr-part-add {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #0a0d0f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.cr-part-add .material-symbols-outlined { font-size: 20px; }
.cr-part-add:active { transform: scale(0.9) !important; }

/* Non-touch: hide by default, spring-animate in on card hover */
.cr-notouch .cr-part-card .cr-part-add {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}
.cr-notouch .cr-part-card:hover .cr-part-add {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* When already in cart, show a checkmark tint */
.cr-part-card.cr-in-cart .cr-part-add {
  background: #4ade80;
}

/* Load more */
.cr-load-more-wrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}
.cr-load-more-btn {
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 8px;
  color: #64748b;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 20px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.cr-load-more-btn:hover { border-color: #2d3748; color: #94a3b8; }
.cr-load-more-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Cart header right-side grouping ─────────────────────────────── */
.cr-cart-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mobile-only back button (hidden on desktop) */
.cr-mobile-back-btn {
  display: none;
}

/* Mobile queue toggle button (hidden on desktop) */
.cr-mobile-queue-btn {
  display: none;
}

/* ── Responsive: stack on tablet ──────────────────────────────────── */
@media (max-width: 1023px) {
  .cr-catalog-layout {
    flex-direction: column;
  }
  .cr-cart {
    width: 100% !important;
    border-bottom: 1px solid #1f2530;
    max-height: 45vh;
  }
  .cr-resize-handle { display: none; }
  .cr-catalog {
    flex: 1;
    min-height: 0;
  }
  .cr-parts-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  /* Events list stacks on tablet */
  .cr-events-list-col {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid #1f2530;
  }
  .cr-events-split { flex-direction: column; }
}

/* ── Mobile: single-panel toggle layout ───────────────────────────── */
@media (max-width: 767px) {
  #tab-panel-crash.active {
    /* height handled by flex chain; no calc needed */
  }
  /* Anchor dropdown to full-width toolbar so it can't overflow left/right */
  .cr-catalog-toolbar { position: relative; }
  .cr-cat-bar { position: static; }
  .cr-cat-dropdown {
    position: absolute;
    left: 12px;
    right: 12px;
    width: auto;
    top: calc(100% + 4px);
    max-height: 55vh;
  }

  /* Always show + button on mobile regardless of touch detection */
  .cr-notouch .cr-part-card .cr-part-add {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }

  /* Parts grid: smaller cards */
  .cr-parts-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  /* Show one panel at a time */
  .cr-catalog-view .cr-cart {
    display: none;
    max-height: none;
    border-bottom: none;
  }
  .cr-catalog-view .cr-catalog {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  /* Queue view: show cart, hide catalog */
  .cr-catalog-view.cr-show-cart .cr-cart {
    display: flex;
    flex: 1;
    min-height: 0;
  }
  .cr-catalog-view.cr-show-cart .cr-catalog {
    display: none;
  }

  /* Events list: mobile slide-in detail */
  .cr-events-detail-col {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-panel, #101318);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 10;
  }
  .cr-events-detail-col.mobile-detail-active {
    transform: translateX(0);
  }

  /* Mobile queue icon in catalog toolbar */
  .cr-mobile-queue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #101318;
    border: 1px solid #1f2530;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    cursor: pointer;
    color: #64748b;
    transition: border-color 0.15s, color 0.15s;
  }
  .cr-mobile-queue-btn:hover { border-color: #2d3748; color: #94a3b8; }
  .cr-mobile-queue-btn.cr-mobile-queue-has-items {
    border-color: rgba(var(--accent-rgb),0.4);
    color: var(--accent);
  }
  .cr-mobile-queue-btn .material-symbols-outlined { font-size: 20px; }

  .cr-mobile-queue-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--accent);
    color: #0a0d0f;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 9px;
    font-weight: 800;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    padding: 0 3px;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  /* Back-to-parts button inside cart header */
  .cr-mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid #1f2530;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
  }
  .cr-mobile-back-btn:hover { border-color: #2d3748; color: #94a3b8; }
  .cr-mobile-back-btn .material-symbols-outlined { font-size: 18px; }
}

/* ── Resize handle ────────────────────────────────────────────────── */
.cr-resize-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: #1f2530;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.cr-resize-handle:hover,
.cr-resize-handle.cr-dragging {
  background: var(--accent);
}

/* ── Left-panel view tabs ─────────────────────────────────────────── */
.cr-left-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #0d1017;
  border: 1px solid #1f2530;
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}

.cr-left-tab {
  background: transparent;
  border: none;
  color: #4a5568;
  border-radius: 6px;
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cr-left-tab .material-symbols-outlined { font-size: 17px; }
.cr-left-tab:hover { color: #94a3b8; background: #131820; }
.cr-left-tab-active {
  background: #1a2030;
  color: var(--accent);
}

/* ── PDF pane (left panel) ────────────────────────────────────────── */
.cr-pdf-pane {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.cr-pdf-pane-hint {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #2d3748;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
.cr-pdf-pane-hint .material-symbols-outlined { font-size: 36px; }

.cr-pdf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #1f2530;
  flex-shrink: 0;
}
.cr-pdf-nav-btn {
  background: #101318;
  border: 1px solid #1f2530;
  border-radius: 6px;
  color: #64748b;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.cr-pdf-nav-btn:hover:not(:disabled) { border-color: #2d3748; color: #94a3b8; }
.cr-pdf-nav-btn:disabled { opacity: 0.3; cursor: default; }
.cr-pdf-nav-btn .material-symbols-outlined { font-size: 18px; }
.cr-pdf-nav-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.3px;
}

.cr-pdf-canvas-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cr-pdf-loading {
  color: #3a4a5b;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  padding: 20px 0;
}
.cr-pdf-canvas {
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: zoom-in;
}

/* ══ Light mode overrides ══════════════════════════════════════════════ */

/* Events list view */
body.light-mode .cr-events-list-col  { border-right-color: #dde2ec; }
body.light-mode .cr-events-list-header { border-bottom-color: #dde2ec; }
body.light-mode .cr-events-list-title { color: #1a2030; }
body.light-mode .cr-event-add-btn { border-color: #dde2ec; color: #4b5a70; }
body.light-mode .cr-event-card { background: #f0f3f8; border-color: transparent; }
body.light-mode .cr-event-card:hover { background: #e8edf5; border-color: #dde2ec; }
body.light-mode .cr-event-card-active { background: #e8edf5 !important; border-color: #5a7a00 !important; }
body.light-mode .cr-event-card-title { color: #1a2030; }
body.light-mode .cr-event-card-date  { color: #8899aa; }
body.light-mode .cr-event-progress-bar { background: #dde2ec; }
body.light-mode .cr-events-detail-empty { color: #b0bcd0; }
body.light-mode .cr-evp-title { color: #1a2030; }
body.light-mode .cr-evp-desc  { color: #4b5a70; }
body.light-mode .cr-evp-stats { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-evp-stat-val { color: #1a2030; }
body.light-mode .cr-catalog-view-header { border-bottom-color: #dde2ec; }
body.light-mode .cr-catalog-back-btn { color: #8899aa; }
body.light-mode .cr-catalog-back-btn:hover { color: #1a2030; background: #e8edf5; }
body.light-mode .cr-catalog-view-title { color: #1a2030; }

/* Cart panel */
body.light-mode .cr-cart-header { border-bottom-color: #dde2ec; }
body.light-mode .cr-cart-title { color: #1a2030; }
body.light-mode .cr-cart-title .material-symbols-outlined { color: #5a7a00; }
body.light-mode .cr-cart-count { background: #5a7a00; color: #fff; }
body.light-mode .cr-cart-clear { border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-cart-clear:hover { color: #ef4444; border-color: #ef4444; }
body.light-mode .cr-cart-import-btn { border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-import-modal { background: #f8f9fc; border-color: #dde2ec; }
body.light-mode .cr-import-modal-title { color: #1a2030; }
body.light-mode .cr-import-progress-bar { background: #e8ecf2; }
body.light-mode .cr-import-unmatched { background: #f0f3f8; border-color: #dde2ec; }

body.light-mode .cr-cart-collapse-all {
  border-color: #dde2ec;
  color: #8899aa;
}
body.light-mode .cr-cart-collapse-all:hover {
  border-color: #b0b8c4;
  color: #5a7a00;
  background: #eef0f5;
}

body.light-mode .cr-cart-empty { color: #c0c8d4; }
body.light-mode .cr-cart-empty p { color: #8899aa; }

/* Category group labels */
body.light-mode .cr-cart-group-label {
  background: #f5f7fb;
  border-color: #dde2ec;
  color: #6b7a8d;
}
body.light-mode .cr-cart-group-label:hover {
  color: #5a7a00;
  border-color: #b0b8c4;
  background: #eef0f5;
}
body.light-mode .cr-cart-group-label.cr-group-collapsed {
  background: #f0f3f8;
  color: #9aaabb;
}
body.light-mode .cr-group-chevron { color: #8899aa; }
body.light-mode .cr-cart-group-label:hover .cr-group-chevron { color: #5a7a00; }
body.light-mode .cr-group-collapsed .cr-group-chevron { color: #b0b8c4; }
body.light-mode .cr-group-count { background: #eef0f5; color: #8899aa; }
body.light-mode .cr-cart-group-label:hover .cr-group-count { color: #5a7a00; background: #e4e8f0; }

/* Cart item cards */
body.light-mode .cr-cart-item { background: #ffffff; border-color: #dde2ec; }
body.light-mode .cr-cart-item-name { color: #1a2030; }
body.light-mode .cr-cart-item-num { color: #b0b8c4; }
body.light-mode .cr-cart-pcs {
  color: #5a7a00;
  background: rgba(90,122,0,0.08);
  border-color: rgba(90,122,0,0.2);
}
body.light-mode .cr-cart-item-remove { color: #c0c8d4; }
body.light-mode .cr-cart-item-remove:hover { color: #ef4444; }

/* Qty control */
body.light-mode .cr-qty { border-color: #dde2ec; }
body.light-mode .cr-qty-btn { background: #eef0f5; color: #6b7a8d; }
body.light-mode .cr-qty-btn:hover { background: #e4e8f0; color: #5a7a00; }
body.light-mode .cr-qty-val { background: #ffffff; color: #1a2030; }

/* Status badges */
body.light-mode .cr-status-badge.cr-status-pending  { background: rgba(100,116,139,0.1); color: #6b7a8d; }
body.light-mode .cr-status-badge.cr-status-ordered  { background: rgba(59,130,246,0.1);  color: #3b82f6; }
body.light-mode .cr-status-badge.cr-status-replaced { background: rgba(34,197,94,0.1);   color: #16a34a; }

/* Footer */
body.light-mode .cr-cart-footer { border-top-color: #dde2ec; }
body.light-mode .cr-export-btn { background: #5a7a00; color: #fff; }
body.light-mode .cr-savecart-btn {
  background: rgba(90,122,0,0.08);
  color: #5a7a00;
  border-color: rgba(90,122,0,0.3);
}
body.light-mode .cr-savecart-btn:hover {
  background: rgba(90,122,0,0.15);
  border-color: rgba(90,122,0,0.6);
}

/* Unsaved-changes modal */
.cr-unsaved-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
}
.cr-unsaved-dialog {
  background: #1a2030; border: 1px solid #2a3244;
  border-radius: 12px; padding: 28px 32px; max-width: 360px; width: 90%;
  display: flex; flex-direction: column; gap: 20px;
}
.cr-unsaved-msg {
  margin: 0; font-size: 15px; color: #c8d6e5; line-height: 1.5;
}
.cr-unsaved-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.cr-unsaved-btn {
  width: 100%; padding: 10px; border-radius: 8px; border: none; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif; font-size: 14px;
  font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  transition: opacity 0.15s;
}
.cr-unsaved-save {
  background: var(--accent); color: #0a0d0f;
}
.cr-unsaved-discard {
  background: rgba(220,60,60,0.12); color: #e05555;
  border: 1px solid rgba(220,60,60,0.3) !important;
}
.cr-unsaved-cancel {
  background: rgba(255,255,255,0.05); color: #8a9aab;
  border: 1px solid rgba(255,255,255,0.1) !important;
}
.cr-unsaved-btn:hover { opacity: 0.85; }

body.light-mode .cr-unsaved-dialog {
  background: #fff; border-color: #dde2ec;
}
body.light-mode .cr-unsaved-msg { color: #2d3748; }
body.light-mode .cr-unsaved-cancel {
  background: #f0f3f8; color: #5a6a7a; border-color: #c0cad8 !important;
}

/* Catalog panel */
body.light-mode .cr-catalog { background: #f0f3f8; }
body.light-mode .cr-catalog-toolbar { border-bottom-color: #dde2ec; }

body.light-mode .cr-search-input {
  background: #ffffff;
  border-color: #dde2ec;
  color: #1a2030;
}
body.light-mode .cr-search-input:focus { border-color: #5a7a00; }
body.light-mode .cr-search-input::placeholder { color: #b0b8c4; }
body.light-mode .cr-search-icon { color: #b0b8c4; }

body.light-mode .cr-cat-toggle {
  background: #ffffff;
  border-color: #dde2ec;
  color: #8899aa;
}
body.light-mode .cr-cat-toggle:hover { border-color: #b0b8c4; color: #4a5a6b; }
body.light-mode .cr-cat-toggle-open { border-color: #5a7a00 !important; color: #5a7a00 !important; }

/* Category dropdown */
body.light-mode .cr-cat-dropdown {
  background: #ffffff;
  border-color: #dde2ec;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
body.light-mode .cr-cat-groups { border-right-color: #eef0f5; }
body.light-mode .cr-cat-groups::-webkit-scrollbar-thumb { background: #dde2ec; }
body.light-mode .cr-cat-subs::-webkit-scrollbar-thumb { background: #dde2ec; }
body.light-mode .cr-cat-group-item { color: #b0b8c4; }
body.light-mode .cr-cat-group-item:hover { background: #f5f7fb; color: #4a5a6b; }
body.light-mode .cr-cat-group-active { background: rgba(90,122,0,0.1); color: #5a7a00; }
body.light-mode .cr-cat-hint { color: #c0c8d4; }
body.light-mode .cr-cat-chip:hover { background: #f5f7fb; }
body.light-mode .cr-cat-chip:hover .cr-cat-chip-code { color: #4a5a6b; }
body.light-mode .cr-cat-chip:hover .cr-cat-chip-name { color: #8899aa; }
body.light-mode .cr-cat-chip-code { color: #8899aa; }
body.light-mode .cr-cat-chip-name { color: #b0b8c4; }
body.light-mode .cr-cat-chip-active {
  background: rgba(90,122,0,0.08);
  border-color: rgba(90,122,0,0.25);
}
body.light-mode .cr-cat-chip-active .cr-cat-chip-code { color: #5a7a00; }
body.light-mode .cr-cat-chip-active .cr-cat-chip-name { color: #7a9a20; }

/* Parts grid */
body.light-mode .cr-catalog-loading,
body.light-mode .cr-catalog-empty { color: #b0b8c4; }

body.light-mode .cr-part-card { background: #ffffff; border-color: #dde2ec; }
body.light-mode .cr-part-card:hover { border-color: #b0b8c4; }
body.light-mode .cr-part-card.cr-in-cart { border-color: #5a7a00; }
body.light-mode .cr-part-card.cr-in-cart::before { background: #5a7a00; }
body.light-mode .cr-part-cat { color: #b0b8c4; }
body.light-mode .cr-part-name { color: #1a2030; }
body.light-mode .cr-part-num { color: #6b7a8d; }
body.light-mode .cr-part-price { color: #6b7a8d; }
body.light-mode .cr-part-pcs {
  color: #5a7a00;
  background: rgba(90,122,0,0.08);
  border-color: rgba(90,122,0,0.2);
}
body.light-mode .cr-part-add { background: #5a7a00; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
body.light-mode .cr-part-card.cr-in-cart .cr-part-add { background: #16a34a; }

/* Load more */
body.light-mode .cr-load-more-btn {
  background: #ffffff;
  border-color: #dde2ec;
  color: #8899aa;
}
body.light-mode .cr-load-more-btn:hover { border-color: #b0b8c4; color: #4a5a6b; }

/* Resize handle */
body.light-mode .cr-resize-handle { background: #dde2ec; }
body.light-mode .cr-resize-handle:hover,
body.light-mode .cr-resize-handle.cr-dragging { background: #5a7a00; }

/* Left-panel tabs */
body.light-mode .cr-left-tabs { background: #eef0f5; border-color: #dde2ec; }
body.light-mode .cr-left-tab { color: #b0b8c4; }
body.light-mode .cr-left-tab:hover { color: #4a5a6b; background: #e4e8f0; }
body.light-mode .cr-left-tab-active { background: #dde2ec; color: #5a7a00; }

/* PDF pane */
body.light-mode .cr-pdf-pane-hint { color: #c0c8d4; }
body.light-mode .cr-pdf-nav { border-bottom-color: #dde2ec; }
body.light-mode .cr-pdf-nav-btn { background: #ffffff; border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-pdf-nav-btn:hover:not(:disabled) { border-color: #b0b8c4; color: #4a5a6b; }
body.light-mode .cr-pdf-nav-label { color: #8899aa; }
body.light-mode .cr-pdf-loading { color: #b0b8c4; }

/* Responsive borders */
@media (max-width: 1023px) {
  body.light-mode .cr-cart { border-bottom-color: #dde2ec; }
}
@media (max-width: 767px) {
  body.light-mode .cr-mobile-queue-btn { background: #ffffff; border-color: #dde2ec; color: #8899aa; }
  body.light-mode .cr-mobile-queue-btn:hover { border-color: #b0b8c4; color: #4a5a6b; }
  body.light-mode .cr-mobile-queue-btn.cr-mobile-queue-has-items { border-color: rgba(90,122,0,0.4); color: #5a7a00; }
  body.light-mode .cr-mobile-queue-badge { background: #5a7a00; color: #fff; }
  body.light-mode .cr-mobile-back-btn { border-color: #dde2ec; color: #8899aa; }
  body.light-mode .cr-mobile-back-btn:hover { border-color: #b0b8c4; color: #4a5a6b; }
}

/* ══════════════════════════════════════════════════════════════════════
   VIDEO TAB
══════════════════════════════════════════════════════════════════════ */
.cr-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.cr-video-card {
  position: relative;
  background: #141820;
  border: 1px solid #1f2530;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.cr-video-card:hover { border-color: #84cc16; transform: translateY(-2px); }
.cr-video-thumb { position: relative; aspect-ratio: 16/9; background: #000; }
.cr-video-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-video-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 44px; text-shadow: 0 2px 12px rgba(0,0,0,0.6); pointer-events: none;
}
.cr-video-info { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.cr-video-name {
  font-size: 13px; font-weight: 500; color: #dce3ed; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cr-video-size { font-size: 11px; color: #5a6678; }
.cr-video-del {
  position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.55);
  border: none; color: #fff; border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
.cr-video-card:hover .cr-video-del { opacity: 1; }
.cr-video-del .material-symbols-outlined { font-size: 16px; }

.cr-video-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.93);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.cr-video-overlay-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 96vw; }
.cr-video-overlay-player { max-width: 94vw; max-height: calc(86vh / var(--zoom-scale, 1)); border-radius: 8px; background: #000; }
.cr-video-overlay-name { color: #cbd5e1; font-size: 13px; }
.cr-video-dl {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: #f5b942; color: #1a1206; text-decoration: none;
  padding: 9px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.cr-video-dl:hover { filter: brightness(1.06); }
.cr-video-dl .material-symbols-outlined { font-size: 20px; }
.cr-vidfix {
  color: #f5b942; font-size: 12px; max-width: 520px; text-align: center; margin-top: 12px;
}
.cr-vidfix summary { cursor: pointer; color: #f5b942; opacity: .85; }
.cr-vidfix summary:hover { opacity: 1; }
.cr-vidfix-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.cr-vidfix-tab {
  font: inherit; font-size: 12px; color: #f5b942; cursor: pointer;
  background: rgba(245,185,66,0.10); border: 1px solid rgba(245,185,66,0.30);
  border-radius: 6px; padding: 4px 10px;
}
.cr-vidfix-tab:hover { background: rgba(245,185,66,0.18); }
.cr-vidfix-tab.active { background: #f5b942; color: #1a1206; border-color: #f5b942; font-weight: 600; }
.cr-vidfix-sol { margin-top: 9px; line-height: 1.5; }
.cr-vidfix-sol:empty { display: none; }
.cr-vidfix code {
  background: rgba(245,185,66,0.16); padding: 1px 5px; border-radius: 4px; font-size: 11px;
}
.cr-flaglink {
  color: #ffd784; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
  background: rgba(245,185,66,0.16); padding: 1px 5px; border-radius: 4px;
}
.cr-flaglink:hover { color: #fff; }
.cr-video-overlay-close {
  position: absolute; top: 18px; right: 22px; background: none; border: none;
  color: #fff; cursor: pointer;
}
.cr-video-overlay-close .material-symbols-outlined { font-size: 32px; }

/* ══════════════════════════════════════════════════════════════════════
   SHARE MODAL
══════════════════════════════════════════════════════════════════════ */
.cr-share-overlay, .cr-linkpick-overlay {
  position: fixed; inset: 0; z-index: 2100; background: rgba(4,6,9,0.7);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cr-share-modal, .cr-linkpick {
  /* Divide vh by the root font-zoom so the modal still fits — see jobs.css .jl-add-modal. */
  width: 540px; max-width: 96vw; max-height: calc(90vh / var(--zoom-scale, 1)); display: flex; flex-direction: column;
  background: #0f1318; border: 1px solid #2a3040; border-radius: 14px; overflow: hidden;
}
.cr-share-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid #1f2530; }
.cr-share-head h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin: 0; }
.cr-share-head h3 .material-symbols-outlined { font-size: 20px; color: #84cc16; }
.cr-share-close { margin-left: auto; background: none; border: none; color: #64748b; cursor: pointer; }
.cr-share-close .material-symbols-outlined { font-size: 22px; }
.cr-share-body { padding: 16px 18px; overflow-y: auto; }
.cr-share-section { margin-bottom: 18px; }
.cr-share-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: #7c889b; margin-bottom: 8px; }
.cr-share-sub-label { font-size: 12px; color: #7c889b; margin: 12px 0 6px; }
.cr-share-cats { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.cr-share-cat, .cr-share-exp label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cr-share-exp { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.cr-share-date {
  background: #141820; border: 1px solid #2a3040; color: #dce3ed; border-radius: 6px;
  padding: 5px 8px; font-family: 'Barlow', sans-serif; font-size: 13px;
}
.cr-share-advanced summary { cursor: pointer; color: #84cc16; font-size: 13px; user-select: none; }
.cr-share-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-share-thumb {
  position: relative; width: 64px; height: 48px; border-radius: 6px; overflow: hidden;
  cursor: pointer; border: 2px solid transparent;
}
.cr-share-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-share-thumb-x {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 22px;
}
.cr-share-thumb.cr-share-hidden { border-color: #e10600; opacity: 0.6; }
.cr-share-thumb.cr-share-hidden .cr-share-thumb-x { display: flex; }
.cr-share-doc { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.cr-share-doc .material-symbols-outlined { font-size: 18px; color: #7c889b; }
.cr-share-doc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-share-none { color: #5a6678; font-size: 13px; }
.cr-share-gen { width: 100%; justify-content: center; margin-bottom: 14px; }
.cr-share-result { margin-bottom: 16px; }
.cr-share-url-row { display: flex; gap: 8px; }
.cr-share-url {
  flex: 1; background: #141820; border: 1px solid #2a3040; color: #84cc16; border-radius: 7px;
  padding: 8px 10px; font-size: 12px; font-family: monospace;
}
.cr-share-list { display: flex; flex-direction: column; gap: 8px; }
.cr-share-link-row {
  display: flex; flex-direction: column; background: #141820; border: 1px solid #1f2530;
  border-radius: 8px; padding: 8px 12px;
}
.cr-share-link-main { display: flex; align-items: center; gap: 10px; }
.cr-share-edit { margin-top: 10px; padding-top: 10px; border-top: 1px solid #1f2530; }
.cr-share-edit .cr-share-cats { gap: 8px 14px; }
.cr-share-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.cr-share-edit-actions .act-btn { padding: 5px 12px; font-size: 13px; }
.cr-share-link-row.cr-share-dead { opacity: 0.55; }
.cr-share-link-info { flex: 1; min-width: 0; }
.cr-share-link-status { display: block; font-size: 12px; color: #84cc16; }
.cr-share-link-row.cr-share-dead .cr-share-link-status { color: #e10600; }
.cr-share-link-url { display: block; font-size: 11px; color: #5a6678; font-family: monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-share-link-actions { display: flex; gap: 4px; }
.cr-share-link-actions button {
  background: none; border: none; color: #64748b; cursor: pointer; padding: 4px; border-radius: 5px;
}
.cr-share-link-actions button:hover { color: #dce3ed; background: #1a2130; }
.cr-share-link-actions .material-symbols-outlined { font-size: 18px; }

/* Share modal — light mode */
body.light-mode .cr-share-modal, body.light-mode .cr-linkpick {
  background: #fff; border-color: #dde2ec; color: #1a2030;
}
body.light-mode .cr-share-head { border-bottom-color: #e4e9f2; }
body.light-mode .cr-share-close { color: #94a3b8; }
body.light-mode .cr-share-close:hover { color: #1a2030; }
body.light-mode .cr-share-label,
body.light-mode .cr-share-sub-label { color: #6b7a8d; }
body.light-mode .cr-share-date,
body.light-mode .cr-share-url {
  background: #fff; border-color: #dde2ec; color: #1a2030;
}
body.light-mode .cr-share-url { color: #5a7a00; }
body.light-mode .cr-share-doc .material-symbols-outlined { color: #b0b8c4; }
body.light-mode .cr-share-none { color: #94a3b8; }
body.light-mode .cr-share-link-row {
  background: #f0f4fb; border-color: #dde2ec;
}
body.light-mode .cr-share-edit { border-top-color: #dde2ec; }
body.light-mode .cr-share-link-url { color: #94a3b8; }
body.light-mode .cr-share-link-actions button { color: #94a3b8; }
body.light-mode .cr-share-link-actions button:hover { color: #1a2030; background: #e8edf5; }

/* ══════════════════════════════════════════════════════════════════════
   REPORT BUILDER
══════════════════════════════════════════════════════════════════════ */
.cr-report-view { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.cr-report-loading { padding: 40px; text-align: center; color: #5a6678; }
.cr-report-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 60px; max-width: 860px; width: 100%; margin: 0 auto; }
.cr-report-titlebar { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.cr-report-title {
  flex: 1; background: none; border: none; border-bottom: 2px solid transparent;
  color: #f1f5f9; font-size: 22px; font-weight: 700; font-family: 'Barlow', sans-serif; padding: 4px 2px;
}
.cr-report-title:focus { outline: none; border-bottom-color: #84cc16; }
.cr-report-subtitle { color: #7c889b; font-size: 14px; margin-bottom: 16px; }
.cr-report-car {
  display: flex; gap: 14px; align-items: center; background: #141820; border: 1px solid #1f2530;
  border-radius: 12px; padding: 14px; margin-bottom: 22px;
}
.cr-report-car-photo { width: 110px; height: 74px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.cr-report-car-noimg { display: flex; align-items: center; justify-content: center; background: #1a2130; color: #475569; }
.cr-report-car-noimg .material-symbols-outlined { font-size: 32px; }
.cr-report-car-name { font-size: 16px; font-weight: 600; }
.cr-report-car-meta { color: #7c889b; font-size: 13px; margin-top: 3px; }
.cr-report-tpl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.cr-report-tpl-sel {
  background: #141820; border: 1px solid #2a3040; color: #dce3ed; border-radius: 7px;
  padding: 7px 10px; font-family: 'Barlow', sans-serif; font-size: 13px; min-width: 180px;
}
.cr-report-sections { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cr-report-sec-row {
  display: flex; align-items: center; background: #141820; border: 1px solid #1f2530;
  border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color 0.15s;
}
.cr-report-sec-row:hover { border-color: #84cc16; }
.cr-report-sec-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cr-report-sec-title { font-size: 15px; font-weight: 600; }
.cr-report-sec-count { font-size: 12px; color: #5a6678; }
.cr-report-sec-actions { display: flex; align-items: center; gap: 4px; color: #64748b; }
.cr-report-sec-actions button { background: none; border: none; color: #64748b; cursor: pointer; padding: 4px; border-radius: 5px; }
.cr-report-sec-actions button:hover { color: #e10600; background: #1a2130; }
.cr-report-sec-actions .material-symbols-outlined { font-size: 20px; }
.cr-report-empty { color: #5a6678; font-size: 14px; padding: 10px 2px; }
.cr-report-addsec { display: flex; gap: 8px; margin-bottom: 22px; }
.cr-report-newsec, .cr-report-sec-titlebar {
  flex: 1; background: #141820; border: 1px solid #2a3040; color: #dce3ed; border-radius: 8px;
  padding: 9px 12px; font-family: 'Barlow', sans-serif; font-size: 14px;
}
.cr-report-sec-titlebar { font-size: 18px; font-weight: 700; margin-bottom: 16px; width: 100%; }
.cr-report-lastpdf a { color: #84cc16; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.cr-report-lastpdf .material-symbols-outlined { font-size: 18px; }

.cr-rep-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.cr-rep-step { display: flex; gap: 12px; background: #141820; border: 1px solid #1f2530; border-radius: 10px; padding: 12px 14px; }
.cr-rep-step-num {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: #1a2130; color: #84cc16;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.cr-rep-step-body { flex: 1; min-width: 0; }
.cr-rep-step-text {
  width: 100%; background: #0f1318; border: 1px solid #2a3040; color: #dce3ed; border-radius: 8px;
  padding: 10px 12px; font-family: 'Barlow', sans-serif; font-size: 14px; line-height: 1.5;
  resize: vertical; min-height: 70px;
}
.cr-rep-step-text:focus { outline: none; border-color: #84cc16; }
.cr-step-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cr-step-att { position: relative; width: 72px; }
.cr-step-att-media {
  width: 72px; height: 56px; border-radius: 7px; overflow: hidden; background: #1a2130; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #7c889b; border: 1px solid #2a3040;
}
.cr-step-att-media img { width: 100%; height: 100%; object-fit: cover; }
.cr-step-att-media .material-symbols-outlined { font-size: 26px; }
.cr-step-att-x {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: #e10600; border: none; color: #fff; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.cr-step-att-x .material-symbols-outlined { font-size: 14px; }
.cr-rep-step-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cr-step-action {
  display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px solid #2a3040;
  color: #94a3b8; border-radius: 7px; padding: 6px 10px; font-size: 12px; cursor: pointer;
  font-family: 'Barlow', sans-serif;
}
.cr-step-action:hover { border-color: #84cc16; color: #dce3ed; }
.cr-step-action .material-symbols-outlined { font-size: 16px; }
.cr-step-del:hover { border-color: #e10600; color: #e10600; }
.cr-rep-addstep { margin-bottom: 30px; }

.cr-linkpick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
  padding: 16px 18px; overflow-y: auto;
}
.cr-linkpick-item {
  display: flex; flex-direction: column; gap: 6px; align-items: center; background: #141820;
  border: 1px solid #1f2530; border-radius: 9px; padding: 10px; cursor: pointer; text-align: center;
}
.cr-linkpick-item:hover { border-color: #84cc16; }
.cr-linkpick-item img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; }
.cr-linkpick-item > .material-symbols-outlined { font-size: 40px; color: #7c889b; }
.cr-linkpick-label { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cr-busy { opacity: 0.6; pointer-events: none; }

/* ── Light mode: incident report builder ──────────────────────────────── */
body.light-mode .cr-report-loading { color: #8899aa; }
body.light-mode .cr-report-title { color: #1a2030; }
body.light-mode .cr-report-subtitle { color: #8899aa; }
body.light-mode .cr-report-car { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-report-car-noimg { background: #e4e8f0; color: #b0b8c4; }
body.light-mode .cr-report-car-name { color: #1a2030; }
body.light-mode .cr-report-car-meta { color: #6b7a8d; }
body.light-mode .cr-report-tpl-sel { background: #fff; border-color: #dde2ec; color: #1a2030; }
body.light-mode .cr-report-sec-row { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-report-sec-title { color: #1a2030; }
body.light-mode .cr-report-sec-count { color: #8899aa; }
body.light-mode .cr-report-sec-actions,
body.light-mode .cr-report-sec-actions button { color: #8899aa; }
body.light-mode .cr-report-sec-actions button:hover { background: #e8edf5; }
body.light-mode .cr-report-empty { color: #8899aa; }
body.light-mode .cr-report-newsec,
body.light-mode .cr-report-sec-titlebar { background: #fff; border-color: #dde2ec; color: #1a2030; }

body.light-mode .cr-rep-step { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-rep-step-num { background: #e8edf5; color: #5a7a00; }
body.light-mode .cr-rep-step-text { background: #fff; border-color: #dde2ec; color: #1a2030; }
body.light-mode .cr-step-att-media { background: #e8edf5; border-color: #dde2ec; color: #8899aa; }
body.light-mode .cr-step-action { border-color: #c8d0de; color: #6b7a8d; }
body.light-mode .cr-step-action:hover { border-color: #5a7a00; color: #1a2030; }

body.light-mode .cr-linkpick-item { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .cr-linkpick-item > .material-symbols-outlined { color: #b0b8c4; }
body.light-mode .cr-linkpick-label { color: #6b7a8d; }
