:root {
  --brand-primary: #ae0531;
  --brand-secondary: #1b3359;
  --brand-accent: #868788;
  --bg: #f4f5f6;
  --border: #d8dadc;
  --radius: 5px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Barlow', Arial, sans-serif;
  background: var(--bg);
  color: #1d1d1b;
}

header {
  background: var(--brand-secondary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-family: 'Barlow Condensed', Arial, sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.02em;
}

header button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px;
}

.hidden { display: none !important; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 4px;
}

input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
}

button.primary {
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 14px;
}

button.secondary {
  background: transparent;
  color: var(--brand-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

button.link {
  background: none;
  border: none;
  color: var(--brand-secondary);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.error { color: var(--brand-primary); font-size: 13px; margin-top: 8px; }

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.search-row input { flex: 1; }

.scan-button {
  display: block;
  width: 100%;
  background: var(--brand-secondary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.tile {
  background: var(--brand-secondary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tile .count { font-size: 12px; font-weight: 400; opacity: 0.75; }
.tile:nth-child(3n+2) { background: var(--brand-primary); }
.tile:nth-child(3n) { background: var(--brand-accent); }

.product {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.product:last-child { border-bottom: none; }
.product img {
  width: 56px; height: 56px; object-fit: contain;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.product .info { flex: 1; min-width: 0; }
.product .name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.product .sku { font-size: 12px; color: var(--brand-accent); }
.product .price { font-size: 15px; font-weight: 700; color: var(--brand-secondary); white-space: nowrap; }
.product button.add {
  background: var(--brand-primary); color: #fff; border: none; border-radius: var(--radius);
  padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.product button.fav {
  background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1;
}
.product-tap {
  display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; cursor: pointer;
}
.variant-note { font-size: 12px; color: var(--brand-accent); font-style: italic; white-space: nowrap; }
.product-detail-actions .variant-note { white-space: normal; font-size: 14px; }

.stock-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
}
.stock-dot.in { background: #2e7d32; }
.stock-dot.out { background: #c62828; }

.product-detail-card { text-align: left; }
.product-detail-card img {
  width: 100%; max-width: 260px; height: 260px; object-fit: contain; display: block;
  margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.product-detail-card .sku { font-size: 13px; color: var(--brand-accent); }
.product-detail-card .price { font-size: 20px; font-weight: 700; color: var(--brand-secondary); margin-top: 6px; }
.product-detail-description { margin-top: 14px; font-size: 14px; line-height: 1.5; color: #1d1d1b; }
.product-detail-actions { margin-top: 18px; display: flex; align-items: center; gap: 14px; }
.product-detail-actions button.fav { font-size: 28px; background: none; border: none; cursor: pointer; padding: 4px; }
.product-detail-actions button.add { flex: 1; }

.cart-item { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding: 10px 0; }
.cart-item .name { flex: 1; font-size: 14px; }
.qty-stepper { display: flex; align-items: center; gap: 4px; }
.qty-stepper button {
  width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--border);
  background: #fff; font-size: 18px; font-weight: 700; color: var(--brand-secondary); cursor: pointer;
}
.cart-item input[type=number] {
  width: 44px; padding: 6px; text-align: center; font-size: 14px;
  transition: all 0.15s ease;
}
.cart-item input[type=number]:focus {
  width: 64px; font-size: 20px; padding: 10px 6px; font-weight: 700;
  border-color: var(--brand-primary); outline: none;
}
.cart-item .remove { background: none; border: none; color: var(--brand-primary); font-size: 18px; cursor: pointer; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 10px 10px 0 0;
  padding: 20px; width: 100%; max-width: 480px;
}

.totals-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals-row.grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }

nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex;
}
nav.tabbar button {
  flex: 1; background: none; border: none; padding: 12px 0; font-size: 13px; color: var(--brand-accent);
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
nav.tabbar button.active { color: var(--brand-primary); font-weight: 700; }
nav.tabbar .badge {
  background: var(--brand-primary); color: #fff; border-radius: 50%;
  font-size: 11px; min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  position: relative; top: -14px; left: 10px;
}

.option-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.option-row.selected { border-color: var(--brand-primary); background: #fdf4f6; }
.option-row .title { flex: 1; font-size: 14px; }
.option-row .amount { font-weight: 600; font-size: 14px; }

.checkbox-row {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.checkbox-row input { width: 18px; height: 18px; }

.empty { text-align: center; color: var(--brand-accent); padding: 30px 0; font-size: 14px; }

.scanner-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.scanner-overlay video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scanner-frame {
  position: relative;
  width: 78vw; max-width: 340px; height: 140px;
  border: 3px solid var(--brand-primary);
  border-radius: 10px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.45);
}
.scanner-hint {
  position: absolute; bottom: 90px; left: 0; right: 0;
  text-align: center; color: #fff; font-size: 15px; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.scanner-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  font-size: 20px; cursor: pointer;
}

.toggle-row { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); padding: 12px 0; }
.toggle-row .info { flex: 1; min-width: 0; }
.toggle-row .name { font-size: 14px; font-weight: 600; }
.toggle-row .sku { font-size: 12px; color: var(--brand-accent); }
.toggle-switch {
  position: relative; width: 44px; height: 26px; border-radius: 13px;
  background: var(--border); border: none; cursor: pointer; flex-shrink: 0;
}
.toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform 0.15s ease;
}
.toggle-switch.on { background: var(--brand-primary); }
.toggle-switch.on::after { transform: translateX(18px); }

/* Twee velden naast elkaar, maar op een smal scherm onder elkaar in plaats van
   platgedrukt (op 390px werd "Per raam" een kolom van twee regels). */
.veld-rij { display: flex; gap: 10px; flex-wrap: wrap; }
.veld-rij > * { flex: 1 1 150px; min-width: 140px; }

/* -- TiFa maatwerk: subtabbladen + hefschuif + cilinder ---------------------- */
.mw-subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mw-subnav button {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.mw-subnav button.on { background: var(--brand-secondary); color: #fff; border-color: var(--brand-secondary); }
.hs-schemas { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.hs-schema { border: 2px solid var(--border); border-radius: var(--radius); padding: 8px; cursor: pointer; background: #fff; text-align: left; }
.hs-schema.on { border-color: var(--brand-primary); background: #fdf5f7; }
.hs-schema img { width: 100%; height: auto; display: block; border-radius: 4px; }
.hs-schema b { display: block; font-size: 14px; margin-top: 4px; }
.hs-schema span { font-size: 12px; color: var(--brand-accent); }
.hs-hint { display: block; font-size: 12px; color: var(--brand-accent); margin-top: 3px; line-height: 1.35; }
.hs-hint.rood { color: var(--brand-primary); font-weight: 600; }
.hs-hint.groen { color: #2e7d32; font-weight: 600; }
.hs-greeprij { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.hs-greeprij select { flex: 1 1 140px; min-width: 120px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.hs-greeprij input { width: 64px !important; }
.hs-greeprij .weg { background: none; border: none; color: var(--brand-primary); font-size: 16px; cursor: pointer; }
.hs-tabel { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.hs-tabel th, .hs-tabel td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; }
.hs-tabel th { background: var(--brand-secondary); color: #fff; font-size: 11.5px; }
.hs-tabel td.n { text-align: right; white-space: nowrap; }
.hs-melding { border-radius: var(--radius); padding: 8px 11px; font-size: 13px; margin-top: 8px; }
.hs-melding.warn { background: #fff7e6; border: 1px solid #e6c26e; }
.hs-melding.err { background: #fdecee; border: 1px solid #e59aae; color: var(--brand-primary); }
.hs-melding.ok { background: #e9f6ec; border: 1px solid #93cba2; color: #2e7d32; }
.hs-totaal { font-weight: 700; font-size: 16px; margin-top: 8px; }
.cil-uitkomst { font-weight: 800; font-size: 24px; color: var(--brand-primary); margin-top: 10px; }

.raamtypes { background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; }
.raamtypes summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand-secondary); }
.raamtypes img { width: 100%; height: auto; display: block; margin: 10px 0 6px; }
.raamtypes p { font-size: 13px; line-height: 1.5; color: var(--brand-accent); }
