/* Sąskaitos faktūros dokumentas: vardas kairėje, dokumento duomenys dešinėje, be spalvų */
.invoice {
  --d-ink: #1c1917;
  --d-text: #44403c;
  --d-muted: #8a837d;
  --d-line: #e7e5e4;
  --d-head: #f5f5f4;
  max-width: 800px; margin: 0 auto; padding: 56px 60px 48px;
  background: #fff; color: var(--d-text);
  font: 13.5px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 40px rgba(60,40,30,.08);
}

.doc-label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--d-muted); margin-bottom: 8px; }

/* Antraštė */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--d-ink); }
.doc-seller { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--d-ink); }
.doc-tagline { margin-top: 4px; font-size: 13px; color: var(--d-muted); letter-spacing: .02em; }
.doc-meta { text-align: right; }
.doc-title { margin: 0 0 6px; font: 600 12px/1.3 "Inter", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--d-ink); }
.doc-no { font-size: 17px; color: var(--d-text); }
.doc-no b { font-weight: 600; color: var(--d-ink); }
.doc-dates { margin-top: 10px; line-height: 1.7; color: var(--d-ink); }
.doc-dates span { color: var(--d-muted); }

/* Pardavėjas / pirkėjas: paprastos eilutės */
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-bottom: 36px; line-height: 1.65; }
.doc-parties > div > div { overflow-wrap: anywhere; }
.doc-parties span { color: var(--d-muted); }
.doc-name { font-size: 15px; font-weight: 600; color: var(--d-ink); margin-bottom: 4px; }

/* Lentelė */
.doc-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.doc-table th { background: var(--d-head); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--d-muted); text-align: left; padding: 10px 12px; white-space: nowrap; }
.doc-table th:first-child { border-radius: 6px 0 0 6px; }
.doc-table th:last-child { border-radius: 0 6px 6px 0; }
.doc-table td { padding: 13px 12px; border-bottom: 1px solid var(--d-line); vertical-align: top; }
.doc-table .r { text-align: right; white-space: nowrap; }
.doc-table .c-no { width: 34px; color: var(--d-muted); }
.doc-table .c-desc { color: var(--d-ink); font-weight: 500; }
.doc-table .c-unit { width: 80px; }
.doc-table td:last-child { color: var(--d-ink); font-weight: 500; }

/* Suma */
.doc-total { width: 400px; max-width: 100%; margin: 20px 0 0 auto; padding: 14px 12px 0; border-top: 1px solid var(--d-ink); }
.doc-sub-row { display: flex; justify-content: space-between; gap: 24px; color: var(--d-muted); margin-bottom: 4px; }
.doc-sub-row span:last-child { color: var(--d-ink); }
.doc-sub-row + .doc-total-row { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--d-line); }
.doc-total .doc-sub-row span { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.doc-table .c-disc { color: var(--d-muted); }
.doc-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; }
.doc-total span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--d-ink); }
.doc-total b { font-size: 22px; font-weight: 700; color: var(--d-ink); white-space: nowrap; letter-spacing: -.01em; }
.doc-novat { margin-top: 4px; font-size: 11.5px; color: var(--d-muted); text-align: right; }

.doc-facts { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-top: 36px; padding: 16px 20px; background: var(--d-head); border-radius: 8px; color: var(--d-ink); }
.doc-notes { margin: 24px 0 0; }
.doc-issuer { margin: 28px 0 0; color: var(--d-muted); }
.doc-issuer b { font-weight: 500; color: var(--d-ink); }

/* Telefonas */
@media (max-width: 700px) {
  .invoice { padding: 30px 18px; font-size: 13px; }
  .doc-head { flex-direction: column; gap: 18px; }
  .doc-meta { text-align: left; }
  .doc-parties { grid-template-columns: 1fr; gap: 24px; }
  .doc-facts { grid-template-columns: 1fr; gap: 14px; }
  .doc-table thead { display: none; }
  .doc-table tr { display: grid; grid-template-columns: 1fr auto; padding: 12px 0; border-bottom: 1px solid var(--d-line); }
  .doc-table td { border: 0; padding: 0; }
  .doc-table .c-no, .doc-table .c-unit, .doc-table td:nth-child(4) { display: none; }
  .doc-table .c-desc { grid-column: 1; }
  .doc-table td:nth-child(5) { grid-row: 2; color: var(--d-muted); text-align: left; }
  .doc-table td:nth-child(5)::after { content: " € / vnt."; }
  .doc-table td:last-child { grid-column: 2; grid-row: 1; }
  .doc-table .c-disc { grid-column: 2; grid-row: 2; }
  .doc-table .c-disc:not(:empty)::before { content: "nuolaida "; }
  .doc-table td:last-child::after { content: " €"; }
  .doc-total { width: 100%; }
}

/* PDF / spausdinimas: vienas A4 lapas */
@media print {
  .invoice { box-shadow: none; border-radius: 0; padding: 4mm 2mm 0; max-width: none; font-size: 12px; }
  .doc-head { flex-direction: row; }
  .doc-meta { text-align: right; }
  .doc-parties { grid-template-columns: 1fr 1fr; margin-bottom: 28px; }
  .doc-facts { grid-template-columns: 2fr 1fr; margin-top: 28px; }
  .doc-table td { padding: 10px 12px; }
  .doc-table tr, .doc-total, .doc-end { break-inside: avoid; }
}

/* Mokėjimo paskirtis – galima pataisyti tiesiai sąskaitoje */
.doc-purpose textarea { display: block; width: 100%; margin: 0; padding: 2px 6px; margin-left: -6px; border: 1px dashed transparent; border-radius: 6px; background: transparent; font: inherit; color: var(--d-ink); resize: none; overflow: hidden; line-height: 1.5; }
.doc-purpose textarea:hover { border-color: #d6d3d1; background: #fff; }
.doc-purpose textarea:focus { outline: none; border-color: var(--d-muted); background: #fff; box-shadow: none; }
.doc-purpose textarea::placeholder { color: var(--d-ink); opacity: 1; }
.purpose-hint { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0; transition: opacity .15s; }
.doc-purpose:hover .purpose-hint, .doc-purpose:focus-within .purpose-hint { opacity: 1; }
.purpose-status { display: block; font-size: 11px; color: var(--d-muted); min-height: 14px; }
@media print { .doc-purpose textarea { border: 0; padding: 0; margin: 0; } }
