/* ===== FIXOBOX LIGHT THEME — ZOMER EDITIE ===== */
:root {
  --bg:     #F7F5F0;
  --bg2:    #FFFFFF;
  --bg3:    #EEF1F5;
  --border: #D8DDE6;
  --gold:        #E8920A;
  --gold-dark:   #C97A06;
  --gold-light:  rgba(232,146,10,0.10);
  --text:   #0D1420;
  --text2:  #0D1420;
  --text3:  #6B7280;
  --danger: #DC2626;
  --success: #16A34A;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(26,34,53,0.07), 0 4px 16px rgba(26,34,53,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; width: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(26,34,53,0.05);
}

header .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

header .logo span { color: var(--gold); }

nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav a {
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

nav a:hover, nav a.active {
  background: var(--bg3);
  color: var(--text);
}

nav a.active {
  color: var(--gold);
  font-weight: 600;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 12px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2, .card h3 {
  color: var(--text);
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}

/* ===== INPUTS ===== */
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, background 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}

input::placeholder { color: var(--text3); }

select option {
  background: var(--bg2);
  color: var(--text);
}

/* ===== BUTTONS ===== */
.btn, button[type=submit] {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(232,146,10,0.25);
}

.btn:hover, button[type=submit]:hover {
  background: var(--gold-dark);
  box-shadow: 0 4px 14px rgba(232,146,10,0.30);
}

.btn-outline {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--bg3);
  color: var(--text);
  box-shadow: none;
}

.btn-gold-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  box-shadow: none;
}

.btn-gold-outline:hover {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232,146,10,0.25);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,0.18);
}

.btn-sm {
  width: auto;
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.alert-warning {
  background: rgba(232,146,10,0.08);
  border: 1px solid rgba(232,146,10,0.28);
  color: #92530A;
}

.alert-danger {
  background: rgba(220,38,38,0.07);
  border: 1px solid rgba(220,38,38,0.25);
  color: var(--danger);
}

.alert-success {
  background: rgba(22,163,74,0.08);
  border: 1px solid rgba(22,163,74,0.25);
  color: var(--success);
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 400px;
}

th {
  padding: 10px 10px;
  text-align: left;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}

tr:hover td { background: var(--bg3); }

.totaal-rij td {
  font-weight: 600;
  color: var(--gold);
  border-top: 1px solid rgba(232,146,10,0.3);
  border-bottom: none;
  background: rgba(232,146,10,0.04);
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-nr {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.stat-card .stat-nr.groen { color: var(--success); }
.stat-card .stat-nr.rood  { color: var(--danger); }
.stat-card .stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }

/* ===== FOTO UPLOAD ===== */
.foto-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 25px;
  text-align: center;
  margin-bottom: 12px;
  cursor: pointer;
  background: var(--bg3);
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.foto-upload:hover { border-color: var(--gold); background: var(--gold-light); }

.foto-upload input[type=file] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0; padding: 0; border: none;
}

.foto-upload p { color: var(--text3); font-size: 14px; margin: 0; pointer-events: none; }
.foto-preview { max-width: 100%; max-height: 200px; border-radius: 10px; margin-top: 10px; display: none; }

/* ===== AI SCAN STATUS ===== */
#scan-status {
  display: none;
  margin-top: 10px;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 14px;
  align-items: center;
  gap: 10px;
}

#scan-status.scanning { display: flex; background: rgba(232,146,10,0.08); color: #92530A; border: 1px solid rgba(232,146,10,0.28); }
#scan-status.success  { display: flex; background: rgba(22,163,74,0.08); color: var(--success); border: 1px solid rgba(22,163,74,0.25); }
#scan-status.error    { display: flex; background: rgba(220,38,38,0.07); color: var(--danger); border: 1px solid rgba(220,38,38,0.25); }

.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-filled { border-color: var(--gold) !important; background: var(--gold-light) !important; }

/* ===== BON KAARTJES MOBIEL ===== */
.bon-cards { display: none; }

@media(max-width: 640px) {
  .table-wrap table { display: none; }
  .bon-cards { display: flex; flex-direction: column; gap: 10px; }

  .bon-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
    box-shadow: var(--shadow);
  }

  .bon-card-foto { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
  .bon-card-foto-placeholder { width: 54px; height: 54px; background: var(--bg3); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 22px; border: 1px solid var(--border); }
  .bon-card-info { flex: 1; }
  .bon-card-oms { font-weight: 600; font-size: 14px; margin-bottom: 3px; color: var(--text); }
  .bon-card-datum { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
  .bon-card-bedragen { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
  .bon-card-bedragen span { background: var(--bg3); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; color: var(--text2); }
  .incl-span { color: var(--gold) !important; border-color: rgba(232,146,10,0.3) !important; background: var(--gold-light) !important; }
  .bon-card-delete { position: absolute; top: 10px; right: 10px; color: var(--danger); font-size: 16px; text-decoration: none; }
}

/* ===== LIGHTBOX ===== */
#lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(26,34,53,0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 24px 60px rgba(26,34,53,0.3); }
#lightbox-close { position: absolute; top: 20px; right: 24px; color: #fff; font-size: 32px; cursor: pointer; background: none; border: none; }

/* ===== BON THUMB ===== */
.bon-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); transition: transform 0.15s; }
.bon-thumb:hover { transform: scale(1.1); }

/* ===== LINKS ===== */
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
.delete-btn { color: var(--danger); font-size: 13px; }

/* ===== FILTER FORM ===== */
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-form select { width: auto; margin-bottom: 0; }
.filter-form .btn { width: auto; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* ===== INVOICE PREVIEW ===== */
.invoice-preview {
  background: #fff;
  color: #2d2d2d;
  border-radius: var(--radius);
  padding: 20px;
  font-size: 11px;
  position: relative;
  border: 1px solid var(--border);
}

/* ===== PRINT ===== */
@media print {
  header, .filter-form, .btn, button, nav { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: none; background: #fff; }
}

button[type=button] {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(232,146,10,0.25);
}

button[type=button]:hover {
  background: var(--gold-dark);
  box-shadow: 0 4px 14px rgba(232,146,10,0.30);
}

/* ===== INVOICE PREVIEW RESPONSIVE ===== */
.invoice-preview {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.invoice-preview table {
  min-width: unset !important;
  width: 100% !important;
}

.invoice-preview td, .invoice-preview th {
  font-size: 10px !important;
  padding: 5px 4px !important;
}

@media(max-width: 480px) {
  .invoice-preview {
    font-size: 9px !important;
    padding: 12px !important;
  }
  .invoice-preview td, .invoice-preview th {
    font-size: 9px !important;
    padding: 4px 3px !important;
  }
}

/* ===== FACTUUR KAARTJES MOBIEL ===== */
.factuur-cards { display: none; }

@media(max-width: 640px) {
  .table-wrap table { display: none; }
  .factuur-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

  .factuur-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    transition: background 0.15s;
  }

  .factuur-card:hover { background: var(--border); }
  .factuur-card-nr { font-weight: 600; font-size: 15px; color: var(--gold); margin-bottom: 3px; }
  .factuur-card-datum { font-size: 12px; color: var(--text); opacity: 0.6; }
  .factuur-card-arrow { color: var(--text3); font-size: 18px; }
}

/* ===== BOTTOM NAVIGATIE MOBIEL ===== */
.bottom-nav {
  display: none;
}

@media(max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-top: 1px solid #D8DDE6;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(26,34,53,0.08);
  }

  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 8px;
    color: #7A8090;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    gap: 4px;
    transition: color 0.15s;
  }

  .bottom-nav a.active {
    color: #E8920A;
  }

  .bottom-nav a svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* Ruimte voor de bottom nav */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* Header nav verbergen op mobiel */
  header nav {
    display: none;
  }
}