:root {
  --primary: #0b2545;
  --primary-light: #133966;
  --primary-dark: #07162c;
  --secondary: #134074;
  --accent: #0284c7;
  --accent-light: #e0f2fe;
  --gold: #d97706;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}
.app-header {
  background: linear-gradient(135deg, #07162c 0%, #0b2545 100%);
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 4px 20px rgba(7, 22, 44, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand-logo {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.brand-titles h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.brand-titles span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #38bdf8;
}
.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-primary {
  background: #0284c7;
  color: white;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}
.btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-secondary {
  background: #ffffff1f;
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
}
.btn-secondary:hover { background: #ffffff33; }
.btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: #f1f5f9; }
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}
.btn-danger-light {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.btn-danger-light:hover { background: #fca5a5; }
.main-container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  width: fit-content;
}
.nav-tab {
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}
.nav-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 0.75rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}
.form-group input, .form-group select, .form-group textarea {
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
.form-group input[readonly] {
  background: #f8fafc;
  color: #64748b;
}
.badge-fixed {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  margin-left: 0.4rem;
}
.table-responsive {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}
.app-table th {
  background: #0b2545;
  color: white;
  padding: 0.75rem 0.6rem;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.app-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.app-table tr:nth-child(even) td { background: #f8fafc; }
.app-table tr:hover td { background: #f0fdf4; }
.app-table input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: inherit;
}
.app-table input.num { text-align: right; }
.table-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}
.presets-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.presets-box span {
  font-weight: 700;
  color: #166534;
  font-size: 0.85rem;
}
.preset-chip {
  background: white;
  border: 1px solid #86efac;
  color: #15803d;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.preset-chip:hover {
  background: #15803d;
  color: white;
}
.toeslag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.toeslag-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.toeslag-card-header {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#previewView { display: none; }
.a4-paper-wrapper {
  background: #525659;
  padding: 2.5rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.a4-floating-bar {
  background: white;
  padding: 0.85rem 1.5rem;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  gap: 1rem;
  align-items: center;
  position: sticky;
  top: 1rem;
  z-index: 1000;
}
.a4-sheet {
  background: white;
  width: 210mm;
  min-height: 297mm;
  padding: 11mm 15mm 11mm 15mm;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  box-sizing: border-box;
  position: relative;
  color: #1e293b;
  font-size: 9.5pt;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.a4-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2.5px solid #0b2545;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.a4-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.a4-logo {
  height: 50px;
  width: auto;
  object-fit: contain;
}
.a4-brand-name {
  font-size: 16pt;
  font-weight: 800;
  color: #0b2545;
  line-height: 1;
  letter-spacing: -0.5px;
}
.a4-brand-sub {
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 2px;
  color: #d97706;
}
.a4-header-right {
  text-align: right;
  font-size: 7.8pt;
  color: #475569;
  line-height: 1.4;
}
.a4-header-right strong { color: #0b2545; }
.a4-meta-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.a4-client-box, .a4-doc-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 8.5pt;
}
.a4-box-label {
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 3px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 2px;
}
.a4-client-box h3 {
  font-size: 10.5pt;
  color: #0b2545;
  font-weight: 800;
  margin-bottom: 2px;
}
.a4-doc-box table { width: 100%; font-size: 8pt; }
.a4-doc-box td { padding: 1.5px 0; }
.a4-doc-box td.label { color: #64748b; font-weight: 600; }
.a4-doc-box td.val { font-weight: 700; text-align: right; color: #0f172a; }
.a4-title-bar {
  background: #0b2545;
  color: white;
  padding: 4px 10px;
  font-size: 9pt;
  font-weight: 800;
  text-align: center;
  border: 1px solid #000;
  margin-bottom: 0;
  letter-spacing: 0.5px;
}
.a4-main-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7pt;
  margin-bottom: 6px;
  border: 1px solid #000;
}
.a4-main-table th, .a4-main-table td {
  border: 1px solid #000;
  padding: 2.5px 3px;
  line-height: 1.15;
}
.a4-main-table thead th {
  background: #d4d4d8;
  font-weight: 700;
  text-align: center;
  color: #000;
}
.a4-main-table td.col-desc { text-align: left; font-weight: 600; white-space: nowrap; }
.a4-main-table td.col-eenheid { text-align: center; white-space: nowrap; }
.a4-main-table td.col-rate { text-align: right; white-space: nowrap; font-weight: 600; }
.a4-main-table td.col-perc { text-align: center; font-weight: 600; }
.a4-main-table td.col-shaded { background: #e4e4e7; }
.a4-sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.2pt;
  margin-bottom: 6px;
  border: 1px solid #000;
}
.a4-sub-table td { border: 1px solid #000; padding: 2px 4px; }
.a4-sub-header { background: #e4e4e7; font-weight: 700; }
.a4-notes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.2pt;
  margin-bottom: 6px;
  border: 1px solid #000;
}
.a4-notes-table th {
  background: #d4d4d8;
  text-align: center;
  font-weight: 700;
  border: 1px solid #000;
  padding: 2px;
}
.a4-notes-table td { border: 1px solid #000; padding: 2.5px 5px; }
.a4-notes-table td.lbl { font-weight: 700; width: 25%; background: #f4f4f5; }
.a4-legal-box {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  padding: 6px 8px;
  font-size: 7.2pt;
  line-height: 1.25;
  margin-bottom: 6px;
}
.a4-legal-title {
  font-weight: 800;
  color: #0b2545;
  margin-bottom: 2px;
  text-transform: uppercase;
  font-size: 7.2pt;
}
.a4-legal-box p { margin-bottom: 3px; }
.a4-sign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 4px;
  font-size: 7.3pt;
}
.a4-sign-col { border-top: 1px solid #000; padding-top: 4px; }
.a4-sign-line {
  margin-top: 22px;
  border-bottom: 1px dashed #64748b;
  padding-bottom: 2px;
  color: #94a3b8;
  font-size: 6.8pt;
}
.a4-page-footer {
  border-top: 1px solid #cbd5e1;
  padding-top: 4px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 6.8pt;
  color: #64748b;
}
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm 8mm 10mm;
  }
  body {
    background: white !important;
    color: #000 !important;
    font-family: Arial, sans-serif !important;
  }
  .app-header, .nav-tabs, #editView, .a4-floating-bar {
    display: none !important;
  }
  #previewView {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .a4-paper-wrapper {
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
  }
  .a4-sheet {
    box-shadow: none !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }
}
