/* ==========================================================
   SALEFLOW — STYLESHEET
   Fonts: Nunito (UI tekst) + Outfit (koppen)
   Beide fonts zijn extreem goed leesbaar op elk scherm
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700&display=swap');

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

:root {
  /* Kleuren */
  --blauw:        #1e40af;
  --blauw-licht:  #3b82f6;
  --blauw-bg:     #eff6ff;
  --oranje:       #ea580c;
  --oranje-bg:    #fff7ed;
  --groen:        #16a34a;
  --groen-bg:     #f0fdf4;
  --rood:         #dc2626;
  --rood-bg:      #fef2f2;
  --geel:         #d97706;
  --geel-bg:      #fffbeb;

  /* Neutrale kleuren */
  --wit:          #ffffff;
  --achtergrond:  #f1f5f9;
  --kaart:        #ffffff;
  --rand:         #e2e8f0;
  --rand-donker:  #cbd5e1;
  --tekst:        #0f172a;      /* Bijna zwart — maximale leesbaarheid */
  --tekst-zacht:  #475569;      /* Grijs voor bijschriften */
  --tekst-licht:  #94a3b8;      /* Placeholders */

  /* Sidebar */
  --sidebar-bg:   #0f172a;
  --sidebar-w:    230px;

  /* Typografie */
  --font-ui:      'Nunito', sans-serif;
  --font-kop:     'Outfit', sans-serif;

  /* Schalen */
  --radius:       10px;
  --radius-lg:    14px;
  --schaduw:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --schaduw-md:   0 4px 16px rgba(0,0,0,0.08);
  --schaduw-lg:   0 10px 40px rgba(0,0,0,0.12);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--achtergrond);
  color: var(--tekst);
  line-height: 1.6;
  font-size: 0.9375rem; /* 15px */
}

/* ==========================================================
   LAYOUT
   ========================================================== */

.app {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================
   SIDEBAR
   ========================================================== */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.4rem 1.25rem 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--blauw-licht);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-logo-tekst {
  font-family: var(--font-kop);
  font-weight: 800;
  font-size: 1.2rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-logo-tekst span {
  color: var(--blauw-licht);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  overflow-y: auto;
}

.nav-sectie {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0.9rem 0.6rem 0.3rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #ffffff;
}

.nav-link.actief {
  background: var(--blauw-licht);
  color: #ffffff;
}

.nav-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-voet {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-gebruiker-naam {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-gebruiker-bedrijf {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  display: block;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================
   HOOFD INHOUD
   ========================================================== */

.hoofd {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbalk {
  background: var(--wit);
  border-bottom: 1px solid var(--rand);
  padding: 0 1.75rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbalk-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbalk-titel {
  font-family: var(--font-kop);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tekst);
}

.topbalk-rechts {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pagina-inhoud {
  padding: 1.75rem;
  flex: 1;
}

/* ==========================================================
   KNOPPEN
   ========================================================== */

.knop {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.knop-primair {
  background: var(--blauw);
  color: #ffffff;
  border-color: var(--blauw);
}
.knop-primair:hover {
  background: #1d3a9e;
  border-color: #1d3a9e;
}

.knop-oranje {
  background: var(--oranje);
  color: #ffffff;
  border-color: var(--oranje);
}
.knop-oranje:hover { background: #c2410c; border-color: #c2410c; }

.knop-groen {
  background: var(--groen);
  color: #ffffff;
  border-color: var(--groen);
}
.knop-groen:hover { background: #15803d; border-color: #15803d; }

.knop-lijn {
  background: transparent;
  color: var(--tekst);
  border-color: var(--rand-donker);
}
.knop-lijn:hover {
  border-color: var(--tekst);
  background: var(--achtergrond);
}

.knop-donker {
  background: var(--tekst);
  color: #ffffff;
  border-color: var(--tekst);
}
.knop-donker:hover { background: #1e293b; }

.knop-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
}

.knop-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.knop-blok {
  width: 100%;
  justify-content: center;
}

/* ==========================================================
   KAARTEN
   ========================================================== */

.kaart {
  background: var(--kaart);
  border: 1px solid var(--rand);
  border-radius: var(--radius-lg);
  box-shadow: var(--schaduw);
}

.kaart-hoofd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--rand);
}

.kaart-titel {
  font-family: var(--font-kop);
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--tekst);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kaart-lichaam {
  padding: 1.25rem 1.4rem;
}

/* ==========================================================
   STATISTIEKEN
   ========================================================== */

.stat-raster {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat {
  background: var(--kaart);
  border: 1px solid var(--rand);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--schaduw);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tekst-zacht);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-waarde {
  font-family: var(--font-kop);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--tekst);
  line-height: 1;
}

.stat-waarde.groen { color: var(--groen); }
.stat-waarde.oranje { color: var(--geel); }
.stat-waarde.rood { color: var(--rood); }
.stat-waarde.blauw { color: var(--blauw); }

.stat-sub {
  font-size: 0.78rem;
  color: var(--tekst-licht);
  margin-top: 0.35rem;
}

/* ==========================================================
   TABELLEN
   ========================================================== */

.tabel-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tekst-zacht);
  background: var(--achtergrond);
  border-bottom: 2px solid var(--rand);
  white-space: nowrap;
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rand);
  color: var(--tekst);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.tabel-acties {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* ==========================================================
   LABELS / BADGES
   ========================================================== */

.label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.label-groen  { background: var(--groen-bg);  color: #14532d; }
.label-blauw  { background: var(--blauw-bg);  color: #1e3a8a; }
.label-oranje { background: var(--oranje-bg); color: #7c2d12; }
.label-geel   { background: var(--geel-bg);   color: #78350f; }
.label-rood   { background: var(--rood-bg);   color: #7f1d1d; }
.label-grijs  { background: #f1f5f9;          color: #475569; }

/* ==========================================================
   FORMULIEREN
   ========================================================== */

.formulier-rij {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.formulier-rij-2 { grid-template-columns: 1fr 1fr; }
.formulier-rij-3 { grid-template-columns: 1fr 1fr 1fr; }

.veld label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tekst);
  margin-bottom: 0.4rem;
}

.veld input,
.veld select,
.veld textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--rand);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--tekst);
  background: var(--wit);
  transition: border-color 0.15s;
  outline: none;
  line-height: 1.5;
}

.veld input:focus,
.veld select:focus,
.veld textarea:focus {
  border-color: var(--blauw-licht);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.veld input::placeholder,
.veld textarea::placeholder {
  color: var(--tekst-licht);
}

.veld textarea {
  resize: vertical;
  min-height: 90px;
}

.veld-hint {
  font-size: 0.78rem;
  color: var(--tekst-zacht);
  margin-top: 0.3rem;
}

/* ==========================================================
   AI SCHRIJFHULP BOX
   ========================================================== */

.ai-box {
  margin-top: 0.75rem;
  border: 2px solid #bfdbfe;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  overflow: hidden;
}

.ai-box-hoofd {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-titel {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--blauw);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-badge {
  background: var(--blauw);
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.ai-stijlen {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0 1.1rem 0.9rem;
}

.ai-stijl {
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  border: 2px solid var(--rand-donker);
  background: var(--wit);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
  color: var(--tekst-zacht);
}

.ai-stijl:hover,
.ai-stijl.actief {
  border-color: var(--blauw-licht);
  background: var(--blauw-bg);
  color: var(--blauw);
}

.ai-knop-rij {
  padding: 0 1.1rem 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-laden {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--blauw);
  font-weight: 600;
}

.ai-laden.zichtbaar { display: flex; }

.draaier {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--blauw);
  border-radius: 50%;
  animation: draai 0.6s linear infinite;
}

@keyframes draai { to { transform: rotate(360deg); } }

.ai-resultaat {
  display: none;
  margin: 0 1.1rem 1rem;
  background: var(--wit);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--tekst);
  white-space: pre-wrap;
}

.ai-resultaat.zichtbaar { display: block; }

.ai-gebruik-rij {
  display: none;
  padding: 0 1.1rem 1rem;
  gap: 0.5rem;
}

.ai-gebruik-rij.zichtbaar { display: flex; }

/* ==========================================================
   HANDTEKENING
   ========================================================== */

.handtekening-kader {
  border: 2px solid var(--rand);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

#handtekeningCanvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
  background: white;
}

.handtekening-balk {
  padding: 0.5rem 0.8rem;
  background: var(--achtergrond);
  border-top: 1px solid var(--rand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--tekst-zacht);
  font-weight: 600;
}

/* ==========================================================
   FOTO UPLOAD
   ========================================================== */

.upload-zone {
  border: 2px dashed var(--rand-donker);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--achtergrond);
}

.upload-zone:hover,
.upload-zone.sleep {
  border-color: var(--blauw-licht);
  background: var(--blauw-bg);
}

.upload-icoon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.upload-tekst { font-size: 0.875rem; color: var(--tekst-zacht); }
.upload-tekst strong { color: var(--blauw); }

.foto-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.foto-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--rand);
  background: var(--achtergrond);
}

.foto-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.foto-verwijder {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================
   WERKBON REGELS
   ========================================================== */

.regel-rij {
  display: grid;
  grid-template-columns: 2fr 80px 65px 110px 100px 38px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.regel-rij input,
.regel-rij select {
  padding: 0.5rem 0.65rem;
  border: 2px solid var(--rand);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--tekst);
  background: var(--wit);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.regel-rij input:focus,
.regel-rij select:focus {
  border-color: var(--blauw-licht);
}

.totaal-blok {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rand);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.totaal-rij {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.88rem;
}

.totaal-rij span:first-child { color: var(--tekst-zacht); font-weight: 600; }
.totaal-rij span:last-child { font-weight: 700; color: var(--tekst); min-width: 90px; text-align: right; }
.totaal-rij.groot span { font-family: var(--font-kop); font-size: 1.1rem; font-weight: 800; }

/* ==========================================================
   MODALS
   ========================================================== */

.modal-achtergrond {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-achtergrond.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--wit);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--schaduw-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.2s;
}

.modal-achtergrond.open .modal {
  transform: translateY(0) scale(1);
}

.modal-hoofd {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--rand);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-titel {
  font-family: var(--font-kop);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--tekst);
}

.modal-sluiten {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--achtergrond);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tekst-zacht);
  transition: background 0.15s;
}

.modal-sluiten:hover { background: var(--rand); }

.modal-lichaam { padding: 1.5rem; }
.modal-voet {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--rand);
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* ==========================================================
   MELDINGEN
   ========================================================== */

.melding {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: 1px solid;
}

.melding-succes { background: var(--groen-bg); color: #14532d; border-color: #bbf7d0; }
.melding-fout   { background: var(--rood-bg);  color: #7f1d1d; border-color: #fecaca; }
.melding-info   { background: var(--blauw-bg); color: #1e3a8a; border-color: #bfdbfe; }
.melding-geel   { background: var(--geel-bg);  color: #78350f; border-color: #fde68a; }

/* ==========================================================
   LEGE STAAT
   ========================================================== */

.leeg {
  text-align: center;
  padding: 3.5rem 2rem;
}

.leeg-icoon {
  font-size: 2.75rem;
  display: block;
  margin-bottom: 0.9rem;
}

.leeg h3 {
  font-family: var(--font-kop);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--tekst);
}

.leeg p {
  color: var(--tekst-zacht);
  max-width: 300px;
  margin: 0 auto 1.25rem;
  font-size: 0.9rem;
}

/* ==========================================================
   MOBIEL
   ========================================================== */

.menu-knop {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--tekst);
  padding: 0.25rem;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .hoofd { margin-left: 0; }
  .menu-knop { display: flex; }
  .stat-raster { grid-template-columns: 1fr 1fr; }
  .formulier-rij-2,
  .formulier-rij-3 { grid-template-columns: 1fr; }
  .pagina-inhoud { padding: 1.25rem; }
}

@media (max-width: 600px) {
  .stat-raster { grid-template-columns: 1fr; }
  .regel-rij { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================
   HULPKLASSEN
   ========================================================== */

.tekst-zacht { color: var(--tekst-zacht); }
.tekst-klein { font-size: 0.82rem; }
.vetgedrukt { font-weight: 700; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.rij { display: flex; gap: 0.75rem; align-items: center; }
.rij-tussen { display: flex; justify-content: space-between; align-items: center; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

@media (max-width: 768px) {
  .raster-2 { grid-template-columns: 1fr; }
}
