:root { --brand:#562923; --soft:#e4dccf; --border:#222; }

* { box-sizing:border-box; }

html, body {
  margin:0;
  padding:0;
  font-family:Arial, sans-serif;
  background:#f6f3ef;
  color:#111;
}

.container { width:1100px; max-width:95%; margin:24px auto; }
.card { background:#fff; border-radius:14px; padding:22px; box-shadow:0 8px 26px rgba(0,0,0,.08); margin-bottom:18px; }
h1,h2 { margin:0 0 16px; color:var(--brand); }
label { display:block; font-weight:700; margin-bottom:6px; }
input, textarea, select { width:100%; padding:10px; border:1px solid #ccc; border-radius:8px; }
textarea { min-height:75px; }
small { color:#666; }
.checkbox-label { display:flex; align-items:center; gap:8px; margin-top:28px; }
.checkbox-label input { width:auto; }
.totals-preview { display:flex; flex-wrap:wrap; gap:12px 24px; padding:14px; border-radius:8px; background:var(--soft); }
.totals-preview strong { width:100%; color:var(--brand); }
.form-error { padding:12px; margin-bottom:14px; border-radius:8px; background:#f8d7da; color:#842029; }
.grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.btn { display:inline-block; border:0; background:var(--brand); color:#fff; padding:11px 18px; border-radius:8px; text-decoration:none; cursor:pointer; font-weight:700; }
.btn.secondary { background:#777; }
.nav { margin-bottom:16px; display:flex; flex-wrap:wrap; gap:8px; }
.nav a { margin-right:0; }
.actions-print { text-align:center; margin:15px; }

.container table { width:100%; border-collapse:collapse; }
.container th, .container td { padding:10px; border-bottom:1px solid #ddd; text-align:left; }
.container th { background:var(--soft); }

.quote-page {
  background:#fff;
  width:210mm;
  height:297mm;
  margin:20px auto;
  padding:8mm 9mm;
  color:#111;
  position:relative;
  overflow:hidden;
}

.quote-header {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:10px;
}

.company-title { font-size:22px; font-weight:800; margin-bottom:8px; }
.quote-title { font-size:20px; font-weight:800; text-align:right; margin-bottom:6px; }

.small-table { width:auto; border-collapse:collapse; }
.small-table td { border:0; padding:2px 5px; font-size:12px; }

.customer-block {
  margin:10px 0 7px;
  font-size:14px;
  line-height:1.25;
}

.customer-address {
  margin-top:3px;
  font-weight:400;
  white-space:normal;
}

.quote-table {
  width:100%;
  height:190mm;
  table-layout:fixed;
  border-collapse:collapse;
  border-spacing:0;
}

.quote-table th {
  background:#b8b8b8;
  font-size:11px;
  border:1px solid var(--border);
  padding:7px 4px;
  text-align:center;
  font-weight:800;
}

.quote-table td {
  font-size:12px;
  vertical-align:top;
  padding:7px 6px;
  border:0;
}

.quote-table th:nth-child(1), .quote-table td:nth-child(1) { width:45px; text-align:center; }
.quote-table th:nth-child(2), .quote-table td:nth-child(2) { width:300px; text-align:left; }
.quote-table th:nth-child(3), .quote-table td:nth-child(3) { width:65px; text-align:right; }
.quote-table th:nth-child(4), .quote-table td:nth-child(4) { width:55px; text-align:center; }
.quote-table th:nth-child(5), .quote-table td:nth-child(5) { width:58px; text-align:right; }
.quote-table th:nth-child(6), .quote-table td:nth-child(6) { width:68px; text-align:right; }
.quote-table th:nth-child(7), .quote-table td:nth-child(7) { width:68px; text-align:right; }
.quote-table th:nth-child(8), .quote-table td:nth-child(8) { width:58px; text-align:right; }
.quote-table th:nth-child(9), .quote-table td:nth-child(9) { width:78px; text-align:right; }

.quote-table tbody tr td:first-child { border-left:1px solid var(--border); }

.quote-table tbody tr td:last-child {
  border-left:2px solid #111;
  border-right:2px solid #111;
}

.quote-table tbody tr.item-row td { border-bottom:0; }

.quote-table tbody tr.blank-row td {
  height:178mm;
  padding:0;
  border-bottom:1px solid #999;
}

.desc-cell { white-space:normal; line-height:1.2; font-weight:500; }
.center { text-align:center; }
.num { text-align:right; white-space:nowrap; }
.amount-cell { text-align:right; white-space:nowrap; }

.quote-footer {
  position:absolute;
  right:9mm;
  bottom:24mm;
  width:250px;
  background:#fff;
  z-index:10;
}

.summary {
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
  border:1px solid #111;
  background:#fff;
}

.summary td {
  padding:4px 6px;
  font-size:12px;
  border:0;
}

.summary td:first-child {
  width:56%;
  text-align:left;
}

.summary td:last-child {
  width:44%;
  text-align:right;
  border-left:1px solid #111;
}

.quotation-bottom-footer {
  position:absolute;
  left:9mm;
  right:9mm;
  bottom:11mm;
  font-size:8.5px;
  text-align:center;
  border-top:1px solid #222;
  padding-top:3px;
  background:#fff;
  white-space:nowrap;
}

.invoice-page { position:relative; width:210mm; height:297mm; margin:20px auto; padding:9mm 8mm; box-sizing:border-box; background:#fff; color:#111; overflow:hidden; }
.invoice-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:5mm; }
.invoice-brand { display:flex; align-items:flex-start; gap:4mm; font-size:12px; line-height:1.9; }
.invoice-logo { display:block; width:28mm; height:28mm; object-fit:contain; }
.invoice-company-title { font-size:19px; font-weight:800; line-height:1.4; }
.invoice-document { min-width:65mm; }
.invoice-title { margin-bottom:5mm; font-size:22px; font-weight:800; text-align:center; }
.invoice-customer { display:grid; grid-template-columns:2fr 1fr; gap:4mm; min-height:15mm; margin-bottom:4mm; padding:3mm 2mm; border:1px solid #444; box-shadow:1.5mm 1.5mm 0 #111; font-size:12px; }
.invoice-note { grid-column:1/-1; }
.invoice-note strong { display:inline-block; min-width:25mm; }
.invoice-items { width:100%; height:215mm; table-layout:fixed; border-collapse:collapse; border-spacing:0; }
.invoice-items th { padding:7px 6px; border:1px solid var(--border); background:#b8b8b8; font-size:11px; font-weight:800; text-align:center; }
.invoice-items td { padding:7px 6px; border:0; font-size:12px; vertical-align:top; }
.invoice-items th:nth-child(1), .invoice-items td:nth-child(1) { width:10mm; text-align:center; }
.invoice-items th:nth-child(2), .invoice-items td:nth-child(2) { width:auto; text-align:left; }
.invoice-items th:nth-child(3), .invoice-items td:nth-child(3) { width:18mm; }
.invoice-items th:nth-child(4), .invoice-items td:nth-child(4) { width:24mm; text-align:right; }
.invoice-items th:nth-child(5), .invoice-items td:nth-child(5) { width:18mm; text-align:right; }
.invoice-items th:nth-child(6), .invoice-items td:nth-child(6) { width:25mm; text-align:right; }
.invoice-items tbody td:first-child { border-left:1px solid var(--border); }
.invoice-items tbody td:last-child { border-left:2px solid #111; border-right:2px solid #111; }
.invoice-item-row td { border-bottom:0; }
.invoice-fill-row td { height:193mm; padding:0; border-bottom:1px solid #999; }
.invoice-summary { position:absolute; right:8mm; bottom:20mm; width:60mm; table-layout:fixed; border-collapse:collapse; border:1px solid #111; background:#fff; }
.invoice-summary td { padding:2.2mm 3mm; border:0; font-size:12px; }
.invoice-summary td:first-child { width:60%; text-align:left; }
.invoice-summary td:last-child { width:40%; border-left:1px solid #111; text-align:right; }
.customer-acknowledgment { position:absolute; left:8mm; bottom:20mm; width:115mm; min-height:34mm; padding:3mm; box-sizing:border-box; border:1px solid #444; background:#fff; }
.acknowledgment-title { margin-bottom:4mm; font-size:13px; font-weight:800; }
.acknowledgment-fields { display:grid; grid-template-columns:1fr 1fr; gap:5mm 7mm; }
.acknowledgment-fields div { display:flex; align-items:flex-end; gap:2mm; font-size:11px; }
.acknowledgment-fields span { white-space:nowrap; }
.acknowledgment-fields i { flex:1; min-width:15mm; height:4mm; border-bottom:1px solid #111; }
.invoice-bottom-footer { position:absolute; left:8mm; right:8mm; bottom:5mm; display:flex; justify-content:space-between; border-top:1px solid #111; padding-top:3mm; font-size:10px; }

@page {
  size:A4 portrait;
  margin:0;
}

@media print {
  html, body {
    width:210mm;
    height:297mm;
    margin:0 !important;
    padding:0 !important;
    background:#fff;
    overflow:hidden;
  }

  .actions-print, .nav, .btn, button {
    display:none !important;
  }

  .quote-page {
    margin:0 !important;
    width:210mm !important;
    height:297mm !important;
    padding:8mm 9mm !important;
    box-shadow:none !important;
    overflow:hidden !important;
    page-break-before:avoid !important;
    page-break-after:avoid !important;
    page-break-inside:avoid !important;
    break-inside:avoid !important;
    transform:none !important;
  }

  .invoice-page {
    margin:0 !important;
    width:210mm !important;
    height:297mm !important;
  }
}

@media(max-width:800px) {
  body {
    overflow-x:auto;
  }

  .container {
    width:100%;
    max-width:100%;
    margin:12px auto;
    padding:0 10px;
  }

  .card {
    border-radius:10px;
    padding:14px;
  }

  .grid {
    grid-template-columns:1fr;
    gap:10px;
  }

  .btn {
    width:100%;
    text-align:center;
    margin-bottom:8px;
  }

  .actions-print {
    padding:0 10px;
  }

  .nav {
    display:grid;
    grid-template-columns:1fr;
  }

  .container table {
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }

  .quote-page {
    width:210mm;
    height:297mm;
    min-height:297mm;
    margin:0;
    padding:8mm 9mm;
    transform:scale(0.42);
    transform-origin:top left;
  }

  .invoice-page {
    width:210mm;
    height:297mm;
    min-height:297mm;
    margin:0;
    transform:scale(0.42);
    transform-origin:top left;
  }
}

/*T3*/
