/*
 * smartpeak.css — SmartPeak brand layer on top of Bootstrap 5.3
 *
 * Loaded AFTER bootstrap.min.css in every backoffice HTML file
 * (dashboard.html, project-edit.html, producten.html).
 *
 * Sections:
 *   1. Bootstrap custom-property overrides (brand palette, radius, fonts)
 *   2. Component-level overrides that Bootstrap's SCSS derivatives don't
 *      expose via CSS variables (mainly .btn-primary hover/active states)
 *   3. App-specific components (kanban, lightbox, photo-grid, chat-pulse,
 *      status chip cursor, readonly-mode helpers, icon color utilities)
 */

/* ── 1. Brand tokens via Bootstrap custom properties ─────────────────── */

:root {
  --bs-primary: #2c7be5;
  --bs-primary-rgb: 44, 123, 229;
  --bs-link-color: #1e5fb8;
  --bs-link-hover-color: #1a3a6e;
  --bs-border-radius: 12px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: 16px;
  --bs-body-bg: #f0f4fb;
  --bs-body-color: #1e2a3a;
  --bs-border-color: #dce3f0;
  --bs-font-sans-serif: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* semantic brand tokens used by app-specific CSS below */
  --sp-muted: #6b7a99;
  --sp-success: #00b478;
  --sp-warning: #f6a623;
  --sp-danger: #e54545;
}

/* ── 2. Button states Bootstrap doesn't expose via CSS vars ──────────── */

.btn-primary {
  --bs-btn-hover-bg: #1a5fba;
  --bs-btn-hover-border-color: #1a5fba;
  --bs-btn-active-bg: #164d97;
  --bs-btn-active-border-color: #164d97;
}

/* ── 3. App-specific components ──────────────────────────────────────── */

/* Icon color helpers (already used in FA 6 iconen) */
.icon-ok     { color: #16a34a; }
.icon-warn   { color: #f59e0b; }
.icon-danger { color: #dc2626; }

.sp-pre-wrap { white-space: pre-wrap; }
.sp-text-body-sm {
  font-size: 0.92rem;
  line-height: 1.4;
}
.sp-text-body-xs {
  font-size: 0.82rem;
}

/* Status chip — Bootstrap .badge with pointer cursor + custom runtime color */
.badge.status-chip {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge.status-chip.readonly { cursor: default; }
.badge.status-chip:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

/* Product category color coding */
.sp-category-dot {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--sp-cat-color, #64748b);
  vertical-align: -0.05em;
}
.sp-category-dot-xs {
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.35em;
}
.sp-category-filter {
  border-left: 4px solid var(--sp-cat-color, #64748b);
}
.sp-product-card {
  border-left: 6px solid var(--sp-cat-color, #64748b);
}
.sp-product-card.active {
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.18);
}

/* Offcanvas drawer: wider on large screens so the config grid (1/2/3 cols) fits. */
@media (max-width: 767.98px) { #drawer { --bs-offcanvas-width: 100vw; } }
@media (min-width: 768px)    { #drawer { --bs-offcanvas-width: 420px; } }
@media (min-width: 992px)    { #drawer { --bs-offcanvas-width: 560px; } }
@media (min-width: 1200px)   { #drawer { --bs-offcanvas-width: 840px; } }

/* ── Project list (dashboard table view) ──────────────────────────────── */
/* Replaces .table-responsive to avoid overflow-x:auto clipping dropdowns.
   Adds min-height so the list fills the viewport like the kanban board. */

.sp-project-list {
  min-height: calc(100vh - 240px);
  overflow: visible;          /* dropdowns must NOT be clipped               */
}
@media (max-width: 575.98px) {
  .sp-project-list {
    overflow-x: auto;         /* small screens still get horizontal scroll   */
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Kanban board ────────────────────────────────────────────────────── */

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  /* Fill the viewport so columns feel grounded and dropdowns near the bottom
     of a column have visual room even when the column content is short. */
  min-height: calc(100vh - 240px);
}
.kanban-col {
  flex: 1 1 0;
  min-width: 220px;
  max-width: 320px;
  background: #eef2f8;
  border-radius: var(--bs-border-radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--bs-body-color);
  padding: 2px 4px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.kanban-col-header .phase-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}
.kanban-col-header .count {
  background: rgba(0,0,0,0.08);
  color: var(--bs-body-color);
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 10px;
}
.kanban-col-body { display: flex; flex-direction: column; gap: 6px; min-height: 20px; }
.kanban-col.drag-over { background: #dce8fa; }
.kanban-card {
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.kanban-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kanban-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--bs-link-color);
  cursor: pointer;
  margin-bottom: 2px;
}
.kanban-card-customer { font-size: 0.8rem; color: var(--sp-muted); margin-bottom: 4px; }
.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

/* ── Chat indicator pulse ────────────────────────────────────────────── */

.chat-indicator {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.95rem;
  opacity: 0.55;
}
.chat-indicator.unread {
  opacity: 1;
  animation: sp-chat-pulse 1.6s ease-in-out infinite;
}
@keyframes sp-chat-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%      { transform: scale(1.15); opacity: 0.6; }
}

/* ── Row-warning (ground-fault / offerte-missing triangles) ──────────── */

.row-warning {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.95rem;
  cursor: help;
}

/* ── Photo grid (drawer + project-edit) ──────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.photo-tile {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bs-body-bg);
  cursor: zoom-in;
  position: relative;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile.broken {
  display: flex; align-items: center; justify-content: center;
  color: var(--sp-muted); font-size: 0.72rem; text-align: center;
  padding: 4px; cursor: help;
}

/* ── Lightbox (shared pattern across producten.html + dashboard drawer) */

.sp-lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1080; /* above BS offcanvas (1045) + modal (1055) */
  padding: 24px;
}
.sp-lightbox.open { display: flex; }
.sp-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.sp-lightbox-btn {
  position: absolute;
  z-index: 3;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sp-lightbox-btn:hover { background: rgba(255, 255, 255, 0.25); }
.sp-lightbox .close { top: 14px; right: 14px; }
.sp-lightbox .prev  { left: 14px;  top: 50%; transform: translateY(-50%); }
.sp-lightbox .next  { right: 14px; top: 50%; transform: translateY(-50%); }
.sp-lightbox .del   { bottom: 14px; right: 14px; background: rgba(229,69,69,0.85); }
.sp-lightbox .del:hover { background: rgba(229,69,69,1); }
.sp-lightbox .annotate { bottom: 68px; right: 14px; }
.sp-lightbox .annotate.active { background: rgba(var(--bs-primary-rgb), 0.95); }
.sp-lightbox .retag { bottom: 122px; right: 14px; }
.sp-lightbox .zoom { bottom: 176px; right: 14px; }
.sp-lightbox .zoom.active { background: rgba(var(--bs-primary-rgb), 0.95); }
.pu-annotation-stage {
  position: relative;
  z-index: 1;
  display: block;
  max-width: calc(100vw - 96px);
  max-height: calc(100vh - 96px);
  transform-origin: 0 0;
  touch-action: none;
  user-select: none;
  will-change: transform;
}
.pu-annotation-stage img,
.pu-annotation-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pu-annotation-stage img {
  object-fit: contain;
  border-radius: 6px;
}
.pu-annotation-stage canvas {
  pointer-events: none;
  touch-action: none;
}
.sp-lightbox.annotation-mode .pu-annotation-stage canvas {
  pointer-events: auto;
  cursor: crosshair;
}
.pu-lightbox-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  max-width: min(620px, calc(100vw - 120px));
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.42);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.78);
  font-size: 0.82rem;
  text-align: center;
  pointer-events: none;
}
.pu-lightbox-meta {
  position: absolute;
  z-index: 2;
  left: 14px;
  top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: column;
  max-width: min(360px, calc(100vw - 96px));
  color: #fff;
  pointer-events: none;
}
.pu-lightbox-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(var(--bs-primary-rgb), 0.92);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}
.pu-lightbox-name {
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,0.48);
  color: rgba(255,255,255,0.78);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-lightbox.is-zoomed .pu-lightbox-hint,
.sp-lightbox.annotation-mode .pu-lightbox-hint {
  display: none;
}
.pu-annotation-toolbar {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 112px);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  border: 1px solid rgba(255,255,255,0.16);
}
.pu-annotation-tools {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.pu-annotation-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.45);
  background: var(--swatch);
}
.pu-annotation-swatch.active {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.sp-lightbox .counter {
  position: absolute; bottom: 14px; left: 14px;
  z-index: 2;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.3);
  padding: 4px 10px;
  border-radius: 12px;
}
@media (max-width: 575.98px) {
  .sp-lightbox {
    padding: 16px;
  }
  .sp-lightbox .annotate { bottom: 64px; right: 10px; }
  .sp-lightbox .retag { bottom: 118px; right: 10px; }
  .sp-lightbox .zoom { bottom: 172px; right: 10px; }
  .pu-lightbox-meta {
    left: 10px;
    top: 10px;
    max-width: calc(100vw - 74px);
  }
  .pu-lightbox-tag { font-size: 0.78rem; }
  .pu-lightbox-name { display: none; }
  .pu-lightbox-hint {
    top: auto;
    bottom: 10px;
    max-width: calc(100vw - 24px);
    border-radius: 16px;
    font-size: 0.76rem;
  }
  .pu-annotation-toolbar {
    bottom: 10px;
    max-width: calc(100vw - 20px);
    border-radius: 16px;
  }
}

/* ── Drag-drop zone (foto-upload + offerte-upload) ───────────────────── */

.sp-drop-zone {
  border: 2px dashed #c4cadb;
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  background: #f7f9fd;
  font-size: 0.9rem;
  user-select: none;
}
.sp-drop-zone:hover { background: #eef4ff; border-color: var(--bs-primary); }
.sp-drop-zone.drag-over { background: #dcebff; border-color: var(--bs-primary); border-style: solid; }
.sp-drop-zone.uploading { cursor: progress; }
.sp-drop-zone input[type=file] { display: none; }

/* ── Readonly mode (share-link viewers) ──────────────────────────────── */
/* Only referenced by index.html but lives here so all backoffice files   */
/* can safely share snippets that become embedded in share-links later.   */

body.readonly-mode .btn-primary,
body.readonly-mode .btn-outline-primary,
body.readonly-mode #btnNewProject,
body.readonly-mode .no-readonly { display: none !important; }
body.readonly-mode input, body.readonly-mode textarea, body.readonly-mode select {
  pointer-events: none;
  background: #f4f7fc !important;
}

/* ── Misc ────────────────────────────────────────────────────────────── */

.sp-empty-state {
  color: var(--sp-muted);
  font-style: italic;
  padding: 24px 8px;
  text-align: center;
}

/* ── Sticky action bar (project-edit footer) ──────────────────────────────── */

.sticky-action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--bs-border-color);
  padding: 0.75rem 1rem;
  margin: 0 -1rem;  /* negative margin so bar extends beyond container padding */
  z-index: 1020;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
@media (max-width: 575.98px) {
  .sticky-action-bar { padding: 0.5rem 0.75rem; }
  .sticky-action-bar .btn { flex: 1 1 auto; min-width: 0; }
}

/* ── Collapsible cards (blok B en C in project-edit) ─────────────────────── */

.collapsible-card > .card-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bs-body-bg);
}
.collapsible-card > .card-header .chev {
  transition: transform 0.2s ease;
}
.collapsible-card > .card-header[aria-expanded="false"] .chev {
  transform: rotate(-90deg);
}

/* ── Camera + file picker buttons (mobile) ──────────────────────────────── */

.upload-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.upload-buttons .btn {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 0;
}
@media (min-width: 768px) {
  /* on desktop camera button is de facto a file picker too — still show both */
  .upload-buttons .btn { flex: 0 0 auto; }
}

/* ── Serial number list rows ────────────────────────────────────────────── */

.serial-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.serial-row > input[type="text"] { flex: 1 1 auto; min-width: 0; }
.serial-row > .serial-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.serial-row .serial-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ─── Offerte upload modal + config rows (shared by dashboard + project-edit) ── */
.offerte-cfg-header { margin-bottom: 10px; }
.offerte-existing { padding: 10px; background: #f8fafc; border-radius: 6px; margin-bottom: 12px; font-size: 0.9rem; }
.offerte-row {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.offerte-row.dismissed { opacity: 0.6; }
.offerte-row-head { display: flex; align-items: center; gap: 8px; }
.offerte-row-title { font-weight: 600; font-size: 0.92rem; }
.offerte-row-desc { font-size: 0.85rem; color: var(--sp-muted); margin-top: 2px; }
.offerte-row-meta, .offerte-row-pdf { font-size: 0.82rem; color: var(--sp-muted); margin-top: 4px; word-break: break-all; }
.offerte-row-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.offerte-divider { text-align: center; color: var(--sp-muted); font-size: 0.82rem; margin: 14px 0 6px; }

/* Utility: hidden via JS state toggles (used by all three HTML files) */
.hide { display: none !important; }

/* ─── Photo-uploader component ─────────────────────────────────────── */
.photo-tile { position: relative; }
.pu-tag-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  pointer-events: none;
}
.pu-progress .progress-bar { transition: width 0.15s ease; }
#pu-tag-modal {
  z-index: 1095; /* above .sp-lightbox (1080) so retag dialog stays clickable */
}

/* ── Global spinner overlay ───────────────────────────────────────────── */

.sp-spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999; /* above everything including lightbox (1080) + modals (1055) */
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.sp-spinner-overlay.active { display: flex; }

.sp-spinner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 40px;
  background: #fff;
  border-radius: var(--bs-border-radius-lg, 16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  min-width: 200px;
  max-width: 320px;
}

.sp-spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid #e0e5ee;
  border-top-color: var(--bs-primary, #2c7be5);
  border-radius: 50%;
  animation: sp-spin 0.8s linear infinite;
}

@keyframes sp-spin {
  to { transform: rotate(360deg); }
}

.sp-spinner-message {
  font-size: 0.92rem;
  color: var(--bs-body-color, #1e2a3a);
  text-align: center;
  display: none;
}
.sp-spinner-message:not(:empty) { display: block; }

.sp-spinner-progress {
  width: 100%;
  display: none;
}
.sp-spinner-progress.active { display: block; }

.sp-spinner-progress .progress {
  height: 6px;
  border-radius: 3px;
}
.sp-spinner-progress .progress-bar {
  transition: width 0.15s ease;
}

.sp-spinner-count {
  text-align: center;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--sp-muted, #6b7a99);
}

/* ── 4. Focus-visible styles for keyboard accessibility ──────────────── */

.projectNameBtn:focus-visible,
.kanban-card-title:focus-visible,
.offerte-download-btn:focus-visible,
.offerte-replace-btn:focus-visible,
.offerte-deletepdf-btn:focus-visible,
.offerte-upload-btn:focus-visible,
.offerte-trash-btn:focus-visible {
  outline: 2px solid var(--bs-primary, #2c7be5);
  outline-offset: 2px;
}

.sp-lightbox-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.status-chip:focus-visible {
  outline: 2px solid var(--bs-primary, #2c7be5);
  outline-offset: 2px;
}

/* ── Shared serial rows (dashboard drawer + project-edit) ─────────────── */

.serial-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.serial-row .serial-cat-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 12px; color: #fff; font-weight: 500;
  min-width: 96px; text-align: center;
}
.serial-row .serial-cat-batterij        { background: #2c7be5; }
.serial-row .serial-cat-omvormer        { background: #7e57c2; }
.serial-row .serial-cat-omvormer_batterij { background: #16a34a; }
.serial-row .serial-cat-null            { background: #9ca3af; }
.serial-row .serial-status-icon { width: 18px; text-align: center; }
.serial-row input.serial-value { flex: 1; }
.serial-row .serial-action-btn { background: none; border: 0; color: #64748b; padding: 4px 6px; cursor: pointer; }
.serial-row .serial-action-btn:hover { color: #1e293b; }

/* ── 5. Pagination bar for project list ──────────────────────────────────── */

.sp-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.sp-pagination-info {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.sp-pagination .btn:focus-visible {
  outline: 2px solid var(--bs-primary, #2c7be5);
  outline-offset: 2px;
}

/* ── 6. Lead wizard ─────────────────────────────────────────────────────── */

.sp-wizard-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.sp-wizard-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c4cadb;
  transition: background 0.2s, transform 0.2s;
}
.sp-wizard-dot.active {
  background: var(--bs-primary, #2c7be5);
  transform: scale(1.25);
}
.sp-wizard-dot.done {
  background: #16a34a;
}

.sp-wizard-step {
  display: none;
  animation: sp-fade-in 0.25s ease;
}
.sp-wizard-step.active { display: block; }

@keyframes sp-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sp-wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.sp-csv-feedback {
  margin-top: 12px;
  font-size: 0.9rem;
}
.sp-csv-feedback.success { color: #16a34a; }
.sp-csv-feedback.error { color: #dc2626; }
.sp-csv-feedback.warning { color: #f59e0b; }

/* ── 7. Lead result page ────────────────────────────────────────────────── */

.sp-lead-result {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Page-specific extracted rules ─────────────────────────────────────── */

/* dashboard.html: desktop layout keeps leads pinned below the project list. */
@media (min-width: 992px) {
  .sp-dashboard-page #stateAuthorized {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  .sp-dashboard-page #stateAuthorized > nav { flex-shrink: 0; }
  .sp-dashboard-page #stateAuthorized > main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0 !important;
  }
  .sp-dashboard-page #stateAuthorized > main > .card.mb-3 { flex-shrink: 0; }
  .sp-dashboard-page #stateAuthorized > main > .card:not(.mb-3):not(#leadsCard) {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  .sp-dashboard-page #leadsCard {
    flex-shrink: 0;
    max-height: 33vh;
    overflow-y: auto;
    margin-top: 0.75rem !important;
    margin-bottom: 0 !important;
  }
}

/* producten-beheer.html */
.product-section-nav {
  position: sticky;
  top: 64px;
  z-index: 1010;
}
.product-section-nav .nav-link {
  color: #495057;
  text-align: left;
  font-weight: 600;
}
.product-section-nav .nav-link.active {
  color: #fff;
}

.cat-row {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.5rem;
}
.cat-row.is-default { background: #e7f3ff; }
.product-card { cursor: pointer; transition: border-color 0.15s; }
.product-card:hover { border-color: var(--bs-primary); }
.product-card.active { border-color: var(--bs-primary); border-width: 2px; }
.product-card.inactive { opacity: 0.5; }
#productDetailCard { position: sticky; top: 80px; }
.product-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.product-photo-grid .photo-thumb {
  width: 80px; height: 80px; object-fit: cover; border-radius: 6px;
  cursor: pointer; border: 1px solid #dee2e6;
}
.product-photo-grid .photo-thumb:hover { border-color: var(--bs-primary); }
.product-photo-grid .photo-item { position: relative; }
.product-photo-grid .photo-delete-btn {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #dc2626; color: #fff; border: 2px solid #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.product-photo-grid .photo-item:hover .photo-delete-btn { opacity: 1; }
.ds-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ds-row .ds-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-row .ds-size { color: #6c757d; font-size: 0.85rem; white-space: nowrap; }
.media-drop-zone {
  border: 2px dashed #dee2e6; border-radius: 8px; padding: 12px;
  text-align: center; color: #6c757d; cursor: pointer; transition: border-color 0.2s;
}
.media-drop-zone.drag-over { border-color: var(--bs-primary); background: #f0f7ff; }
.media-drop-zone input[type="file"] { display: none; }
.product-lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.product-lightbox-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* producten.html */
.carousel-inner .carousel-item img { max-height: 380px; object-fit: contain; width: 100%; background: #f7f9fd; }

/* Hero card — big euro savings number above the fold */
.sp-hero-card {
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 60%);
  border: 1px solid #d9e6f7;
  padding: 36px 24px 28px;
}
.sp-hero-eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7a8d;
  margin-bottom: 8px;
}
.sp-hero-amount {
  font-size: 3rem;
  font-weight: 800;
  color: var(--bs-primary, #2c7be5);
  line-height: 1.05;
  margin-bottom: 4px;
}
.sp-hero-amount-unit {
  font-size: 1.4rem;
  font-weight: 600;
  color: #4a5a70;
}
.sp-hero-subtitle {
  font-size: 1.05rem;
  color: #4a5a70;
  margin-bottom: 18px;
}
.sp-hero-roi {
  font-size: 0.95rem;
  color: #2c3e50;
  background: rgba(44, 123, 229, 0.08);
  border-radius: 999px;
  padding: 8px 16px;
  display: inline-block;
}
.sp-hero-roi i { margin-right: 6px; color: var(--bs-primary, #2c7be5); }

/* Metric tile micro-uitleg */
.sp-metric-tile {
  flex: 1;
  min-width: 0;
}
.sp-metric-detail {
  font-size: 0.78rem;
  color: #6b7a8d;
  margin-top: 6px;
  line-height: 1.35;
}

/* Self-consumption stacked bar */
.sp-self-bar {
  display: flex;
  height: 36px;
  border-radius: 999px;
  overflow: hidden;
  background: #e9ecef;
  margin-bottom: 10px;
}
.sp-self-bar-fill {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.6s ease;
  min-width: 0;
}
.sp-self-bar-fill.injection { background: linear-gradient(90deg, #16a34a, #15803d); }
.sp-self-bar-fill.battery   { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.sp-self-bar-fill.grid      { background: #adb5bd; }
.sp-self-bar-label {
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}
.sp-self-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  font-size: 0.85rem;
  color: #495057;
  margin-bottom: 12px;
}
.sp-self-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.sp-self-dot.injection { background: #16a34a; }
.sp-self-dot.battery   { background: #0ea5e9; }
.sp-self-dot.grid      { background: #adb5bd; }
.sp-self-summary {
  text-align: center;
  font-size: 0.95rem;
  color: #2c3e50;
  margin: 0;
}

/* Eigen-data line chart */
.sp-chart-wrap {
  position: relative;
  height: 280px;
  margin-bottom: 10px;
}
.sp-chart-caption {
  font-size: 0.85rem;
  color: #495057;
  text-align: center;
  margin: 0;
}
.sp-chart-caption-injection {
  color: #16a34a;
  font-weight: 600;
}
.sp-chart-caption-battery {
  color: #0ea5e9;
  font-weight: 600;
}
.sp-chart-caption-grid {
  color: #dc2626;
  font-weight: 600;
}

/* Final CTA card */
.sp-cta-card {
  background: linear-gradient(135deg, #fff 0%, #f0f7ff 100%);
  border: 1px solid #d9e6f7;
  padding: 28px 24px;
}
.sp-cta-eyebrow {
  font-size: 0.95rem;
  color: #4a5a70;
  margin-bottom: 14px;
  font-weight: 500;
}
.sp-cta-button {
  font-size: 1.1rem;
  padding: 14px 36px;
  font-weight: 600;
}
.sp-cta-sub {
  font-size: 0.85rem;
  color: #6b7a8d;
  margin: 14px 0 0;
}

/* "Wat zit erbij" lijst */
.sp-package-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.sp-package-list li {
  padding: 8px 0;
  font-size: 0.95rem;
  color: #2c3e50;
  border-bottom: 1px solid #f0f2f5;
}
.sp-package-list li:last-child { border-bottom: none; }
.sp-package-list i { margin-right: 10px; }

/* Mobile: stack metric tiles, shrink hero number */
@media (max-width: 575px) {
  .sp-result-metrics {
    flex-direction: column;
    gap: 0;
  }
  .sp-metric-tile {
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
  }
  .sp-metric-tile:last-child { border-bottom: none; }
  .sp-hero-amount { font-size: 2.4rem; }
  .sp-hero-amount-unit { font-size: 1.1rem; }
  .sp-hero-card { padding: 28px 18px 22px; }
  .sp-chart-wrap { height: 240px; }
}

.sp-result-card {
  background: #fff;
  border-radius: var(--bs-border-radius-lg, 16px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 28px 24px;
  margin-bottom: 20px;
}

.sp-result-metrics {
  display: flex;
  justify-content: space-around;
  text-align: center;
  margin-bottom: 20px;
  gap: 12px;
}

.sp-result-metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--bs-primary, #2c7be5);
  line-height: 1.1;
}

.sp-result-metric-label {
  font-size: 0.82rem;
  color: #6b7a8d;
  margin-top: 2px;
}

.sp-result-bars {
  margin-top: 16px;
}

.sp-result-bar-label {
  font-size: 0.85rem;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.sp-result-bar {
  height: 10px;
  border-radius: 5px;
  background: #e9ecef;
  margin-bottom: 12px;
  overflow: hidden;
}

.sp-result-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}
.sp-result-bar-fill.full    { background: #16a34a; }
.sp-result-bar-fill.partial { background: #2c7be5; }

.sp-lead-disclaimer {
  background: #f8f9fa;
  border-radius: var(--bs-border-radius, 12px);
  padding: 16px;
  font-size: 0.85rem;
  color: #495057;
  margin-bottom: 20px;
}

.sp-lead-disclaimer ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.sp-lead-cta {
  text-align: center;
}

.sp-lead-cta .btn {
  font-size: 1.05rem;
  padding: 12px 32px;
}

.sp-lead-cta-done {
  color: #16a34a;
  font-weight: 600;
  font-size: 1.05rem;
}

/* Project documents explorer */
.sp-doc-tree {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sp-doc-row {
  --doc-indent: calc(var(--doc-level, 0) * 1.15rem);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: .55rem .6rem .55rem calc(.6rem + var(--doc-indent));
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-sm);
  background: #fff;
}
.sp-doc-main {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  flex: 1 1 auto;
}
.sp-doc-toggle,
.sp-doc-toggle-spacer {
  flex: 0 0 1.6rem;
  width: 1.6rem;
  min-height: 1.6rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.sp-doc-toggle:hover {
  background: var(--bs-light);
}
.sp-doc-toggle-spacer {
  pointer-events: none;
}
.sp-doc-content {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  overflow: hidden;
}
.sp-doc-title,
.sp-doc-meta,
.sp-doc-row .sp-pre-wrap {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sp-doc-meta {
  line-height: 1.35;
}
.sp-doc-actions {
  display: flex;
  gap: .25rem;
  flex: 0 0 auto;
}
.sp-doc-children {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
@media (max-width: 575.98px) {
  .sp-doc-row {
    flex-direction: column;
    align-items: stretch;
  }
  .sp-doc-main {
    width: 100%;
  }
  .sp-doc-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}
