/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS — EVRT huisstijl
═══════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;

  --bg:          #f5f2ee;
  --bg-raised:   #ede9e3;
  --bg-card:     #e7e2db;
  --bg-elevated: #dedad2;
  --bg-input:    #f0ede8;

  --border:      rgba(0,0,0,0.08);
  --border-mid:  rgba(0,0,0,0.14);
  --border-hi:   rgba(0,0,0,0.22);

  --gold:        #8a6f40;
  --gold-dim:    #6b5530;
  --gold-bright: #6b4e22;
  --gold-glow:   rgba(138,111,64,0.12);

  --txt:         #1c1a17;
  --txt-2:       #3d3a35;
  --txt-3:       #6e6a63;
  --txt-4:       #a09890;
  --txt-label:   #524f49;

  --accent:      #8a6f40;
  --accent-dark: #6b5530;
  --accent-bg:   rgba(138,111,64,0.10);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --f-display: Georgia, 'Times New Roman', serif;
  --f-ui:      system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: 0.18s ease;

  /* legacy compat */
  --font: var(--f-ui);
  --radius: var(--r-sm);
  --radius-lg: var(--r-md);
  --input-height: 36px;
  --panel-pad: 20px;
}

::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }

/* ═══════════════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; font-size: 15px; }

body {
  font-family: var(--f-ui);
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--f-ui); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.topbar-brand { display: flex; align-items: center; gap: 6px; flex: 1; }
.topbar-logo  { font-size: 18px; font-weight: 700; letter-spacing: -.5px; color: var(--txt); }
.topbar-logo span { color: var(--gold); }
.topbar-sub   { font-size: 12px; color: var(--txt-3); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 32px; height: 32px; padding: 0;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--txt-label);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  text-decoration: none;
}
.icon-btn:hover { background: rgba(0,0,0,0.04); color: var(--txt); border-color: var(--border-hi); }

/* Tooltip via data-tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--txt);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform: translateX(-50%) translateY(3px);
  z-index: 9999;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR PDF BUTTON
═══════════════════════════════════════════════════════════ */
.topbar-new-btn {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
}
.topbar-pdf-btn {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--accent);
  border-color: var(--accent);
}
.topbar-pdf-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS PANEL
═══════════════════════════════════════════════════════════ */
.settings-wrap { position: relative; }
.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 900;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
  padding: 4px;
}
.settings-panel.open { opacity: 1; transform: none; pointer-events: all; }
.settings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--txt-label);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background var(--ease), color var(--ease);
}
.settings-item:hover { background: rgba(0,0,0,0.04); color: var(--txt); }

/* ═══════════════════════════════════════════════════════════
   APPS SWITCHER
═══════════════════════════════════════════════════════════ */
.apps-wrap { position: relative; }
.apps-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 224px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 900;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
}
.apps-panel.open { opacity: 1; transform: none; pointer-events: all; }

.apps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 8px;
}
.app-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--txt-2);
  transition: background 0.14s ease, color 0.14s ease;
  font-family: var(--f-ui);
}
.app-item:hover { background: var(--bg-elevated); color: var(--txt); }
.app-item.current { background: var(--gold-glow); }
.app-icon {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 20px; color: var(--gold);
}
.app-item.current .app-icon { background: var(--gold-glow); }
.app-item span { font-size: 11px; font-weight: 500; text-align: center; }

.apps-panel-footer {
  display: block; text-align: center; padding: 9px 12px;
  border-top: 1px solid var(--border); font-size: 11px;
  color: var(--txt-3); text-decoration: none; font-family: var(--f-ui);
  transition: color 0.14s ease, background 0.14s ease;
}
.apps-panel-footer:hover { color: var(--txt); background: var(--bg-elevated); }

.app-home-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--txt-2);
  font-family: var(--f-ui); font-size: 12px; font-weight: 500;
  transition: background 0.14s ease, color 0.14s ease;
}
.app-home-item:hover { background: var(--bg-elevated); color: var(--txt); }
.app-home-item svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════ */
.app-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  flex: 1;
  width: 100%;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════════
   PANELS
═══════════════════════════════════════════════════════════ */
.panel { overflow: hidden; }

.panel--input {
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  min-height: calc(100dvh - 52px);
  overflow-y: auto;
  position: sticky;
  top: 52px;
  max-height: calc(100dvh - 52px);
}

.panel--preview {
  background: var(--bg);
  padding: 40px 32px;
  min-height: calc(100dvh - 52px);
}

/* ═══════════════════════════════════════════════════════════
   PANEL SECTIONS
═══════════════════════════════════════════════════════════ */
.panel-section {
  padding: var(--panel-pad);
  border-bottom: 1px solid var(--border);
}
.panel-section--actions {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-title {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-label);
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════
   ACTION ROWS
═══════════════════════════════════════════════════════════ */
.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-row--secondary { gap: 6px; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border: none;
  border-radius: var(--r-sm);
  font-size: .85rem;
  font-weight: 500;
  font-family: var(--f-ui);
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
  cursor: pointer;
}
.btn--primary {
  background: linear-gradient(135deg, #c8a96e, #a8854a);
  color: #0d0b08;
  font-weight: 600;
  flex: 1;
}
.btn--primary:hover { background: linear-gradient(135deg, #d4b87a, #b89056); }

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--txt-2);
  border: 1px solid var(--border-mid);
}
.btn--secondary:hover { background: var(--bg-card); color: var(--txt); border-color: var(--border-hi); }

.btn--ghost {
  background: transparent;
  color: var(--txt-3);
  border: 1px solid var(--border);
  font-size: .8rem;
  height: 32px;
  padding: 0 10px;
}
.btn--ghost:hover { background: var(--bg-elevated); color: var(--txt-2); border-color: var(--border-mid); }

.btn--icon {
  background: var(--bg-elevated);
  color: var(--txt-2);
  padding: 0 10px;
  height: var(--input-height);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  border: 1px solid var(--border-mid);
  border-left: none;
  font-size: .8rem;
  font-weight: 700;
}
.btn--icon:hover { background: var(--bg-card); color: var(--txt); }

.btn--add-line {
  margin-top: 10px;
  width: 100%;
  border: 1px dashed var(--border-mid);
  color: var(--gold);
  font-size: .85rem;
  background: transparent;
}
.btn--add-line:hover { background: var(--gold-glow); border-color: var(--gold-dim); }

.btn--small { height: 28px; font-size: .78rem; padding: 0 8px; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 12px; }
.form-group:last-child { margin-bottom: 0; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-group--half {}
.form-group--quarter { grid-column: span 1; }
.form-group--threequarter { grid-column: span 1; }

.form-row:has(.form-group--quarter) {
  grid-template-columns: 1fr 3fr;
}

label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--txt-label);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0 10px;
  height: var(--input-height);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--txt);
  font-family: var(--f-ui);
  font-size: .88rem;
  transition: border-color var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--txt-4); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c7872' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.input-with-action { display: flex; }
.input-with-action input {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  flex: 1;
}

.file-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: var(--input-height);
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: .85rem;
  color: var(--txt-3);
  background: var(--bg-input);
  transition: border-color var(--ease);
}
.file-upload-label:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   LINE ITEMS
═══════════════════════════════════════════════════════════ */
.line-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  margin-bottom: 8px;
  position: relative;
}
.line-item__row1 { display: flex; gap: 8px; align-items: flex-end; }
.line-item__row2 { display: grid; grid-template-columns: 2fr 2fr 2fr auto; gap: 8px; margin-top: 8px; align-items: flex-end; }
.line-item__desc { flex: 1; }
.line-item__subtotal {
  font-size: .8rem;
  color: var(--txt-3);
  text-align: right;
  margin-top: 6px;
}

.btn--remove-line {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-4);
  border-radius: var(--r-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  padding: 0; line-height: 1;
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
  align-self: flex-end;
}
.btn--remove-line:hover { background: rgba(239,68,68,0.12); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* ═══════════════════════════════════════════════════════════
   PREVIEW WRAPPER
═══════════════════════════════════════════════════════════ */
.preview-wrapper {
  display: flex;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   A4 PREVIEW — papier-document stijl (altijd licht)
═══════════════════════════════════════════════════════════ */
.a4-preview {
  width: 794px;
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
  border-radius: 2px;
  padding: 64px 72px;
  font-size: 13px;
  line-height: 1.55;
  color: #111;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Doc header */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
}
.doc-header__logo img {
  max-height: 72px;
  max-width: 200px;
  object-fit: contain;
}
.doc-header__sender {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  font-size: 12.5px;
  color: #333;
  line-height: 1.5;
}
.doc-header__sender strong {
  font-size: 14px;
  color: #111;
}

/* Doc meta */
.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
  gap: 24px;
}
.doc-meta__recipient {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: #333;
  line-height: 1.5;
}
.doc-meta__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  margin-bottom: 4px;
}
.doc-meta__ref {
  font-size: 11.5px;
  color: #666;
}
.meta-table { border-collapse: collapse; font-size: 12.5px; }
.meta-table__key {
  color: #888;
  padding-right: 20px;
  padding-bottom: 3px;
  white-space: nowrap;
  vertical-align: top;
}
.meta-table__val {
  font-weight: 500;
  color: #111;
  padding-bottom: 3px;
  white-space: nowrap;
}

/* Doc title */
.doc-title {
  font-size: 22px;
  font-weight: 700;
  color: #8a6f40;
  margin-bottom: 24px;
  letter-spacing: -.02em;
}

/* Line table */
.line-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  font-size: 12.5px;
}
.line-table thead tr { border-bottom: 2px solid #111; }
.line-table th {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  text-align: left;
}
.line-table__qty, .line-table__price, .line-table__vat, .line-table__total { text-align: right; }
.line-table td {
  padding: 8px 8px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: top;
  color: #222;
}
.line-table td:is(.line-table__qty, .line-table__price, .line-table__vat, .line-table__total) {
  text-align: right;
  white-space: nowrap;
}
.line-table tbody tr:last-child td { border-bottom: none; }

/* Totals */
.doc-totals {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  border-top: 1px solid #e9ecef;
  padding-top: 16px;
}
.totals-table { border-collapse: collapse; font-size: 12.5px; min-width: 260px; }
.totals-table td { padding: 4px 8px; color: #333; }
.totals-table .tot-key { color: #555; text-align: left; padding-right: 24px; }
.totals-table .tot-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.totals-table .tot-total td {
  font-weight: 700;
  font-size: 14px;
  color: #111;
  border-top: 2px solid #111;
  padding-top: 8px;
}

/* Notes */
.doc-notes {
  margin-top: 40px;
  padding: 16px 20px;
  background: #f8f9fa;
  border-left: 3px solid #c8a96e;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: #444;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Doc footer */
.doc-footer {
  margin-top: auto;
  padding-top: 40px;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 24px;
  font-size: 11px;
  color: #888;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(5,5,7,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.backdrop.open { display: flex; opacity: 1; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%; max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(10px) scale(0.985);
  transition: transform 0.22s ease;
  position: relative;
}
.modal::before {
  content: '';
  position: absolute; top: 0; left: 14%; right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.45; border-radius: 1px;
}
.backdrop.open .modal { transform: none; }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: var(--f-display); font-size: 21px; font-weight: 400; color: var(--txt); letter-spacing: 0.02em; }
.modal-x {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--txt-label); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
}
.modal-x:hover { background: rgba(255,255,255,0.04); color: var(--txt); }

.doc-body { font-size: 13px; line-height: 1.7; color: var(--txt-2); }
.doc-meta-info { font-size: 11.5px; color: var(--txt-3); margin-bottom: 22px; }
.doc-body h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--txt-label); margin: 20px 0 8px; }
.doc-body h3:first-of-type { margin-top: 0; }
.doc-body p { margin-bottom: 10px; }
.doc-body p:last-child { margin-bottom: 0; }
.doc-body a { color: var(--gold-dim); }
.doc-body a:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   GEREED KNOP
═══════════════════════════════════════════════════════════ */
.panel-section--ready {
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.btn--ready {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #0d2010;
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--f-ui);
  cursor: pointer;
  transition: opacity var(--ease), background var(--ease);
}
.btn--ready:hover  { opacity: .88; }
.btn--ready-done   { background: var(--bg-elevated) !important; color: var(--txt-3) !important; }
.ready-hint {
  font-size: .75rem;
  color: var(--txt-4);
  text-align: center;
  line-height: 1.4;
}

/* Badges in geschiedenis */
.hist-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hist-badge--gereed { background: rgba(74,222,128,.15); color: #4ade80; }
.hist-badge--pdf    { background: rgba(138,111,64,.15);  color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   INSTELLINGEN MODAL
═══════════════════════════════════════════════════════════ */
.settings-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}
.settings-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.settings-section__title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--txt-label); margin-bottom: 6px;
}
.settings-section__desc { font-size: 12.5px; color: var(--txt-3); margin-bottom: 14px; line-height: 1.5; }
.settings-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.settings-action-btn {
  flex: 1; min-width: 140px; gap: 7px; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-align: center;
}
.settings-key-block { display: flex; flex-direction: column; gap: 6px; }
.settings-key-area {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-input); color: var(--txt);
  font-family: monospace; font-size: 11px; line-height: 1.5; resize: none;
  word-break: break-all;
}
.settings-key-area:focus { outline: none; border-color: var(--gold-dim); }
.settings-key-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings-msg { font-size: 12px; }
.settings-msg--ok  { color: #4ade80; }
.settings-msg--err { color: #f87171; }

/* ═══════════════════════════════════════════════════════════
   GESCHIEDENIS MODAL + TABEL
═══════════════════════════════════════════════════════════ */
.modal--history { max-width: 700px; }
.hist-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.hist-intro { font-size: 12.5px; color: var(--txt-3); line-height: 1.55; flex: 1; }
.hist-intro strong { color: var(--txt-2); }
.hist-export-btn { white-space: nowrap; flex-shrink: 0; font-size: 12px; height: 32px; padding: 0 10px; gap: 6px; }
.hist-empty { font-size: 13px; color: var(--txt-4); text-align: center; padding: 24px 0; }
.hist-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.hist-table th {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--txt-label);
  padding: 6px 10px; border-bottom: 1px solid var(--border-mid);
  text-align: left; white-space: nowrap;
}
.hist-table td {
  padding: 10px 10px; border-bottom: 1px solid var(--border);
  color: var(--txt-2); vertical-align: middle;
}
.hist-table tbody tr:last-child td { border-bottom: none; }
.hist-table tbody tr:hover td { background: rgba(0,0,0,0.025); }
.hist-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-del    { text-align: right; width: 32px; }
.btn-hist-del {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--txt-4); cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.btn-hist-del:hover { background: rgba(239,68,68,0.12); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* ═══════════════════════════════════════════════════════════
   PAGE FOOTER
═══════════════════════════════════════════════════════════ */
#page-footer {
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--txt-4);
  flex-shrink: 0; background: var(--bg);
  flex-wrap: wrap;
}
#page-footer a { color: var(--txt-3); text-decoration: none; transition: color var(--ease); }
#page-footer a:hover { color: var(--txt-2); }
.footer-sep { color: var(--txt-4); user-select: none; }
.footer-link {
  background: none; border: none; cursor: pointer;
  font-family: var(--f-ui); font-size: 11px;
  color: var(--txt-3); padding: 0; transition: color var(--ease);
}
.footer-link:hover { color: var(--txt-2); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .app-layout { grid-template-columns: 360px 1fr; }
  .a4-preview { width: 680px; padding: 48px 52px; }
}

@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .panel--input {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .panel--preview { padding: 24px 16px; }
  .a4-preview { width: 100%; min-height: unset; padding: 32px 24px; }
  .doc-header { flex-direction: column; gap: 16px; }
  .doc-header__sender { text-align: left; }
  .doc-meta { flex-direction: column; gap: 20px; }
  .topbar-sub { display: none; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .line-item__row2 { grid-template-columns: 1fr 1fr; }
  .line-table th:is(.line-table__vat),
  .line-table td:is(.line-table__vat) { display: none; }
}

@media (max-width: 700px) {
  .backdrop { padding: 12px; align-items: flex-end; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; }
}

/* ── Print / PDF export ────────────────────────────────── */
@media print {
  .topbar, .panel--input, #page-footer { display: none !important; }
  .panel--preview { padding: 0; }
  .a4-preview { box-shadow: none; }
}
