/* Digitale Formulare — 1:1 nach den Original-PDFs (Poppins, A4-Blätter) */

.form-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 30;
}
.form-toolbar .sel { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; max-width: 230px; }

/* Durchsuchbare Auswahl (Fahrzeug/Kunde) */
.combo { position: relative; display: inline-flex; align-items: center; }
.combo input {
  padding: 8px 26px 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  width: 250px; outline: none; font-size: 13px;
}
.combo input:focus { border-color: var(--blue); }
.combo .combo-clear {
  position: absolute; right: 4px; border: 0; background: none; color: var(--ink-3);
  font-size: 12px; padding: 3px 5px; cursor: pointer;
}
.combo .combo-clear:hover { color: var(--red); }
.combo .combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; width: 340px; max-height: 320px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 44px -12px rgba(15,27,42,.35); z-index: 90;
}
.combo-item { padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; flex-direction: column; gap: 1px; }
.combo-item span { color: var(--ink-3); font-size: 12px; }
.combo-item:hover { background: #f0f6ff; }
.combo-empty { padding: 12px; color: var(--ink-3); font-size: 13px; }

/* Banner nach PDF-Auslesung */
.parse-banner {
  background: #fdefe4; border: 1px solid #f3c99f; color: #8a4b0f;
  border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; font-size: 13.5px;
}

.sheet {
  width: 210mm; min-height: 296mm; margin: 0 auto 26px;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 18px 50px -20px rgba(0,0,0,.25);
  padding: 14mm 14mm 12mm;
  font-family: 'Poppins', sans-serif; font-size: 8.6pt; color: #1a1a1a; line-height: 1.35;
  position: relative;
}
@media (max-width: 900px) { .sheet { width: 100%; padding: 5mm; min-height: 0; } }

.sheet input[type="text"], .sheet input[type="date"], .sheet input[type="number"], .sheet input[type="time"] {
  font-family: 'Poppins', sans-serif; font-size: 8.6pt; color: #111;
  border: 0; border-bottom: 1px solid #9a9a9a; background: transparent;
  outline: none; padding: 1px 2px; width: 100%;
}
.sheet input:focus { border-bottom-color: var(--blue-deep); background: #f0f6ff; }
.sheet textarea {
  font-family: 'Poppins', sans-serif; font-size: 8.6pt; border: 0; background: transparent;
  outline: none; width: 100%; resize: vertical;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 17px, #9a9a9a 17px, #9a9a9a 18px);
  line-height: 18px;
}

/* Kopf Übergabe/Rückgabe + Mietvertrag */
.sheet .head { display: flex; justify-content: flex-end; margin-bottom: 4mm; }
.sheet .head img { height: 13mm; }
.sheet h1.f-title { font-size: 15pt; font-weight: 700; letter-spacing: .06em; margin: 0 0 1mm; }
.sheet .f-sub { font-size: 8pt; color: #333; }

.f-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm 10mm; }
.f-line { display: flex; align-items: flex-end; gap: 2mm; margin-bottom: 3.2mm; }
.f-line .lbl { white-space: nowrap; font-size: 8.4pt; }

.f-note { font-size: 8.4pt; margin: 3mm 0; }

/* Abschnitts-Header */
.f-sec { border-top: 1.5px solid #222; margin-top: 4mm; padding-top: 2mm; }
.f-sec-title { font-weight: 700; font-size: 8.8pt; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2mm; }
.f-legend { font-size: 7.8pt; }
.f-legend b { font-weight: 700; }

/* Checkbox im PDF-Stil */
.cb { display: inline-flex; align-items: center; gap: 1.6mm; white-space: nowrap; font-size: 8.4pt; cursor: pointer; }
.cb input { appearance: none; width: 3.6mm; height: 3.6mm; border: 1px solid #444; border-radius: .6mm; background: #fff; cursor: pointer; margin: 0; flex: none; }
.cb input:checked { background: #1a1a1a; box-shadow: inset 0 0 0 .7mm #fff; }

/* Fahrzeugbild mit Kästchenreihen (eigene Reihen über/unter der Grafik, kein Overlay) */
.carbox2 { margin: 2mm 0 1mm; }
.carbox2 img { width: 100%; display: block; }
.carbox2 .boxrow { display: grid; grid-template-columns: repeat(20, 1fr); gap: 1.1mm; }
.carbox2 .boxrow input {
  width: 100%; aspect-ratio: 1 / 1; text-align: center; text-transform: uppercase;
  border: 1px solid #555 !important; border-bottom: 1px solid #555 !important; border-radius: 1.4mm; background: #fff;
  font-size: 8.5pt; font-weight: 700; padding: 0; box-sizing: border-box;
}
.carbox2 .boxrow input:focus { border-color: var(--blue-deep) !important; background: #f0f6ff; }

/* Tabellenzeilen (Technik, Bereifung, Innenraum, Dokumente) */
.f-row { display: flex; align-items: center; gap: 4mm; margin-bottom: 1.8mm; flex-wrap: wrap; }
.f-row .cap { min-width: 38mm; font-size: 8.4pt; }
.f-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8mm; }
.f-grid3 { display: grid; grid-template-columns: 1.2fr 1.2fr .6fr; gap: 0 6mm; }

/* Unterschriften */
.sig-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8mm; margin-top: 5mm; }
.sig-block .sig-cap { font-weight: 700; font-size: 8.6pt; margin-bottom: 2mm; }
.sig-line { border-bottom: 1px solid #444; margin-bottom: 1mm; }
.sig-sub { font-size: 7.6pt; color: #333; }
canvas.sig {
  width: 100%; height: 22mm; border-bottom: 1px solid #444;
  touch-action: none; cursor: crosshair; display: block; background: transparent;
}
.sig-clear { font-size: 7.5pt; color: #888; background: none; border: 0; padding: 0; cursor: pointer; }

/* ===== Schadenmeldung (Tabellen-Layout) ===== */
.sm-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4mm; }
.sm-addr { border: 1px solid #444; width: 88mm; height: 30mm; padding: 2mm; }
.sm-addr textarea { background-image: none; height: 100%; }
.sm-logo { width: 20mm; height: 20mm; }
.sm-title { font-weight: 700; font-size: 11pt; margin-bottom: 1mm; }
.sm-intro { font-size: 8.2pt; margin-bottom: 2mm; }

table.sm { width: 100%; border-collapse: collapse; }
table.sm td, table.sm th {
  border: 1px solid #555; padding: 1.6mm 2mm; font-size: 8.2pt; vertical-align: top;
  background: #f3f3f3;
}
table.sm td.side { width: 24mm; font-weight: 700; background: #e9e9e9; }
table.sm td.no { width: 7mm; font-weight: 400; background: #efefef; }
table.sm td input[type="text"] { border-bottom: 1px solid #999; background: transparent; }
table.sm .mini-lbl { font-size: 7.6pt; color: #333; display: block; margin-bottom: .6mm; }
.sm-flex { display: flex; gap: 4mm; }
.sm-flex > div { flex: 1; }

/* Skizze */
.skizze { position: relative; margin-top: 1mm; }
.skizze img { width: 100%; display: block; opacity: .9; }
.skizze canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.skizze-tools { display: flex; gap: 8px; margin-top: 1mm; align-items: center; }
.ab-badge { display: inline-flex; align-items: center; justify-content: center; width: 6mm; height: 6mm; border: 1.2px solid #222; font-weight: 700; margin-right: 1.5mm; }

/* ===== Mietvertrag ===== */
.mv-field { margin-bottom: 3mm; }
.mv-field .lbl { font-size: 8.2pt; margin-bottom: 1mm; display: block; }
.mv-field input, .mv-field textarea {
  background: #e9e9e9 !important; border: 0 !important; border-radius: 2.4mm;
  padding: 2mm 2.6mm !important; width: 100%; background-image: none !important;
}
.mv-field input:focus { background: #dbe9fb !important; }
.mv-sec { display: flex; align-items: center; gap: 2.4mm; margin: 4mm 0 2.5mm; }
.mv-sec .ic {
  width: 7mm; height: 7mm; border-radius: 50%; background: #6b7280; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 3.4mm; flex: none;
}
.mv-sec .t { font-size: 8.6pt; font-weight: 700; letter-spacing: .08em; color: #6b7280; text-transform: uppercase; }
.mv-foot { border-top: 1px solid #bbb; margin-top: 5mm; padding-top: 2.5mm; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm; font-size: 6.8pt; color: #555; }

/* AGB-Seiten */
.agb h2 { font-size: 12pt; text-align: center; margin: 4mm 0 1mm; }
.agb .agb-sub { text-align: center; font-size: 8pt; margin-bottom: 5mm; }
.agb h3 { font-size: 9.5pt; margin: 3.5mm 0 1mm; }
.agb p, .agb li { font-size: 8.2pt; margin-bottom: .8mm; }
.agb ul { margin: 1mm 0 1mm 6mm; }

/* ===== Angebot v2: Positionslogik, klassisch-klares Dokument mit Brand-Akzenten ===== */
.sheet.ag { padding: 13mm 16mm 10mm; font-family: 'Inter Tight', 'Poppins', sans-serif; color: #16212e; }
.sheet.ag textarea { background-image: none; font-family: inherit; }
.sheet.ag input[type="text"] { border-bottom-color: transparent; font-family: inherit; }
.sheet.ag input[type="text"]:hover { border-bottom-color: #d5e0ec; }
.sheet.ag input[type="text"]:focus { border-bottom-color: #4a7fc1; }

.ag-inp {
  font-family: inherit; font-size: 9.5pt; color: #16212e;
  border: 0; background: transparent; outline: none; padding: .4mm 0; width: 100%; display: block;
  border-bottom: 1px dashed transparent;
}
.ag-inp:hover { border-bottom-color: #d5e0ec; }
.ag-inp:focus { border-bottom-color: #4a7fc1; background: #f0f6ff; }
.ag-inp::placeholder { color: #a9b8c9; }
.ag-r { text-align: right; }
.ag-strong { font-weight: 700; }
.ag-muted { color: #8295aa; font-weight: 400; }
.ag-label { font-size: 7pt; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: #6b84a0; margin-bottom: 1.4mm; }

/* Kopf */
.ag-top { display: flex; justify-content: space-between; align-items: flex-start; }
.ag-logo { height: 10.5mm; margin-top: 1mm; }
.ag-head-right { text-align: right; }
.ag-doc { font-size: 21pt; font-weight: 800; letter-spacing: -.02em; line-height: 1; margin-bottom: 2.6mm; }
.ag-metatable { border-collapse: collapse; margin-left: auto; }
.ag-metatable td { font-size: 8.6pt; padding: .5mm 0 .5mm 6mm; }
.ag-metatable td:first-child { color: #6b84a0; }
.ag-metatable td:last-child { min-width: 30mm; }
.ag-metatable .ag-inp { font-size: 8.6pt; }
.ag-rule { height: 1.1mm; background: #89b4e3; border-radius: 999px; margin: 5mm 0 7mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Adresse + Kontakt */
.ag-addr-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10mm; }
.ag-absender { font-size: 6.6pt; color: #8295aa; border-bottom: .3mm solid #d5e0ec; padding-bottom: 1mm; margin-bottom: 2.4mm; }
.ag-addr .ag-inp { font-size: 10pt; }
.ag-contact { font-size: 8.6pt; line-height: 1.55; color: #46566a; text-align: right; }
.ag-contact b { color: #16212e; }

/* Betreff + Intro */
.ag-betreff { font-size: 12pt; font-weight: 800; margin: 8mm 0 2mm; }
.ag-intro { font-size: 9.5pt; line-height: 1.5; color: #2d3c4e; background-image: none; resize: vertical; }

/* Positionstabelle */
table.ag-postable { width: 100%; border-collapse: collapse; margin-top: 5mm; }
table.ag-postable th {
  font-size: 7pt; letter-spacing: .14em; text-transform: uppercase; color: #6b84a0; font-weight: 800;
  text-align: left; padding: 0 2mm 1.8mm; border-bottom: .5mm solid #16212e;
}
table.ag-postable th.ag-r { text-align: right; }
table.ag-postable td { padding: 3mm 2mm; border-bottom: .25mm solid #e3eaf2; vertical-align: top; font-size: 9.5pt; }
.ag-posnr { width: 8mm; color: #8295aa; font-weight: 600; }
td.ag-posnr { padding-top: 3.6mm; }
.ag-pos-titel { font-weight: 700; font-size: 9.8pt !important; }
.ag-pos-beschr { font-size: 8pt !important; color: #5c7288 !important; line-height: 1.45; background-image: none !important; resize: vertical; margin-top: .6mm; }
.ag-menge-wrap { display: flex; gap: 1.5mm; justify-content: flex-end; align-items: baseline; }
.ag-menge { width: 10mm !important; }
.ag-einheit { width: 16mm !important; font-size: 8pt !important; color: #5c7288 !important; }
table.ag-postable td:nth-child(3) { width: 30mm; }
table.ag-postable td:nth-child(4) { width: 25mm; }
table.ag-postable td:nth-child(5) { width: 13mm; }
table.ag-postable td:nth-child(6) { width: 27mm; }
select.ag-ust-sel { appearance: none; -webkit-appearance: none; text-align: right; cursor: pointer; }
.ag-pos-gesamt { font-weight: 700; white-space: nowrap; padding-top: 3.4mm !important; }
.ag-pos-del { width: 6mm; }
.ag-pos-del button { border: 0; background: none; color: #b3c2d1; cursor: pointer; font-size: 11px; padding: 1mm; }
.ag-pos-del button:hover { color: #b91c1c; }
.ag-empty { color: #8295aa; font-size: 13px; padding: 12px 4px; }
.ag-addrow { display: flex; gap: 8px; margin-top: 4mm; }

/* Summen + Monatsrate */
.ag-sums-row { display: grid; grid-template-columns: 1fr auto; gap: 10mm; margin-top: 7mm; align-items: end; }
.ag-monat {
  background: #f0f6fd; border-left: 1.2mm solid #89b4e3; border-radius: 0 3mm 3mm 0;
  padding: 4mm 6mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; max-width: 78mm;
}
.ag-monat-num { font-size: 16pt; font-weight: 800; letter-spacing: -.02em; margin: .8mm 0 .4mm; }
.ag-monat-sub { font-size: 7.6pt; color: #5c7288; }
table.ag-sums { border-collapse: collapse; min-width: 62mm; }
table.ag-sums td { font-size: 9.5pt; padding: 1.8mm 0 1.8mm 10mm; }
table.ag-sums td.ag-r { font-weight: 600; white-space: nowrap; }
table.ag-sums tr:first-child td { border-top: .25mm solid #e3eaf2; }
table.ag-sums tr.ag-total td {
  border-top: .5mm solid #16212e; font-weight: 800; font-size: 11.5pt; padding-top: 2.4mm;
}

/* Inklusivleistungen */
.ag-incl { margin-top: 8mm; background: #f7fafd; border-radius: 3mm; padding: 4mm 6mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ag-incl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6mm 8mm; }
.ag-check { display: flex; align-items: center; gap: 2.2mm; font-size: 8.6pt; color: #2d3c4e; }

.ag-schluss { font-size: 8.4pt; line-height: 1.5; color: #5c7288; background-image: none; resize: vertical; margin-top: 6mm; }
.sheet.ag .mv-foot { margin-top: 7mm; }

/* ===== Druck ===== */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .form-toolbar, .no-print { display: none !important; }
  .sheet {
    box-shadow: none; margin: 0; width: 210mm; min-height: 0;
    page-break-after: always;
  }
  .sheet:last-child { page-break-after: auto; }
  .sheet input, .sheet textarea { border-bottom-color: #777 !important; }
  .sig-clear, .skizze-tools { display: none !important; }
}
