@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@300;400&display=swap');

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  color: #111;
  background: #f0f0ec;
}

/* ── Layout ── */
.app {
  display: grid;
  grid-template-columns: 620px 1fr;
  height: 100vh;
}

/* ── Form panel ── */
.form-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow: hidden;
}

.form-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.form-header-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 4px;
}

.form-header-sub {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.form-header-version {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #aaa;
  margin-top: 4px;
  letter-spacing: 0.08em;
}

.form-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.lang-toggle {
  display: flex;
  gap: 2px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 2px;
  background: #f5f5f5;
  margin-top: 4px;
}

.lang-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7pt;
  letter-spacing: 0.12em;
  padding: 4px 9px;
  border: none;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}

.lang-btn.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Client management bar */
.client-bar {
  padding: 12px 24px;
  border-bottom: 1px solid #e8e8e8;
  background: #fafafa;
  flex-shrink: 0;
}

.client-bar-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7pt;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 8px;
}

.client-bar-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.client-bar select {
  flex: 1;
  padding: 8px 24px 8px 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  background: #fff;
  color: #111;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.client-bar select:focus { outline: none; border-color: #888; }

/* ── Buttons ── */
.btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7.5pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.8; }

.btn-dark { background: #111; color: #fff; }
.btn-outline { background: transparent; color: #555; border-color: #ccc; }
.btn-outline:hover { border-color: #888; opacity: 1; }
.btn-save { background: #2a2a2a; color: #fff; }

/* ── Scrollable form body ── */
.form-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
}

/* ── Form sections ── */
.form-section {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 16px;
}

.field {
  margin-bottom: 8px;
}

.field label {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  color: #111;
  background: #fff;
  transition: border-color 0.15s;
}

.field input[type="text"]:focus,
.field textarea:focus {
  outline: none;
  border-color: #888;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── Dynamic rows (vervoerders, prijzen) ── */
.dynamic-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dynamic-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.dynamic-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dynamic-row select {
  flex: 1;
  padding: 8px 24px 8px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  color: #111;
  background: #fafafa;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  min-width: 0;
}

.dynamic-row select:focus {
  outline: none;
  border-color: #888;
  background-color: #fff;
}

.dynamic-row input {
  flex: 1;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  color: #111;
  background: #fafafa;
  min-width: 0;
}

.dynamic-row input:focus {
  outline: none;
  border-color: #888;
  background: #fff;
}

.dynamic-row input[data-field="volume"] { flex: 1.4; }
.dynamic-row input[data-field="verpakking"] { flex: 1.3; }
.dynamic-row input[data-field="productie"],
.dynamic-row input[data-field="verzending"],
.dynamic-row input[data-field="seal"] { flex: 0.9; }

.btn-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  line-height: 1;
}
.btn-remove:hover { color: #c00; background: #fff0f0; }

.drag-handle {
  cursor: grab;
  color: #ccc;
  font-size: 14px;
  flex-shrink: 0;
  padding: 0 2px;
  user-select: none;
  line-height: 1;
}
.drag-handle:hover { color: #888; }
.drag-handle:active { cursor: grabbing; }
.dynamic-row.dragging { opacity: 0.35; }
.dynamic-row.drag-over { box-shadow: 0 -2px 0 #555; }

.btn-duplicate {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  line-height: 1;
}
.btn-duplicate:hover { color: #555; background: #f0f0f0; }

.product-prijs-section {
  border-top: 1px solid #eeeeee;
  margin-top: 14px;
  padding-top: 12px;
}

.col-hints {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  padding-right: 32px;
}

.col-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 6.5pt;
  color: #ccc;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-hint-volume { flex: 1.4; }
.col-hint-verpakking { flex: 1.3; }
.col-hint-prijs { flex: 0.9; }

/* ── Footer actions ── */
.form-footer {
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-footer .btn {
  flex: 1;
  text-align: center;
  font-size: 7pt;
}

/* ── Preview panel ── */
.preview-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #d8d8d4;
}

.preview-tabs {
  display: flex;
  padding: 12px 20px 0;
  gap: 8px;
  background: #d8d8d4;
  flex-shrink: 0;
}

.tab-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7.5pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.06);
  color: #888;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover { background: rgba(0,0,0,0.10); color: #555; }
.tab-btn.active { background: #fff; color: #111; border-color: #e0e0e0; }
.tab-btn-markering { border-radius: 3px; }
.tab-btn-markering.active { background: rgba(255,200,0,0.25); color: #333; border: 1px solid rgba(255,160,0,0.5); }
.tab-btn-print { border-radius: 3px; background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.tab-btn-print:hover { background: #fff; color: #1a1a1a; border-color: #1a1a1a; }

.tab-btn-signed { border-radius: 3px; border: 1px solid #ccc; color: #555; margin-left: auto; }
.tab-btn-signed:hover:not(:disabled) { border-color: #999; color: #111; }
.tab-btn-signed:disabled { opacity: 0.35; cursor: default; }
.tab-btn-signed.has-signed { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.tab-btn-signed.has-signed:hover { background: #fff; color: #1a1a1a; border-color: #1a1a1a; }

.preview-frame-wrap {
  flex: 1;
  overflow: hidden;
  background: #d8d8d4;
}

.preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Scrollbar styling ── */
.form-body::-webkit-scrollbar { width: 4px; }
.form-body::-webkit-scrollbar-track { background: transparent; }
.form-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ── Product cards ── */
.product-card {
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 16px;
  margin-top: 10px;
  background: #fafafa;
}
.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eeeeee;
}
.product-card-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #aaa;
}

