:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --teal: #0f8b82;
  --teal-2: #13b5a6;
  --amber: #f2a900;
  --paper: #f7f5ef;
  --white: #ffffff;
  --ink: #172033;
  --muted: #5b6475;
  --line: #dfe3ea;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(11, 37, 69, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--navy); }
h1, h2, h3 { color: var(--navy); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.02em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.9rem); margin-top: 1.6em; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25rem; }
li { margin-bottom: 0.35em; }
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 1rem; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 0.6rem 1rem; z-index: 100; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--teal-2), #7ee0d3); display: grid; place-items: center; color: var(--navy); font-weight: 800; font-size: 0.95rem; }
.nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,0.82); text-decoration: none; font-size: 0.92rem; font-weight: 550; }
.nav a:hover { color: #fff; }
.header-cta { background: var(--teal-2); color: var(--navy) !important; padding: 0.55rem 0.9rem; border-radius: 999px; font-weight: 700; }

.hero { padding: 3.2rem 0 1.8rem; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 0.45rem; background: rgba(15,139,130,0.12); color: #0a6b64; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 1rem; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }
.hero-points { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; padding: 0; list-style: none; margin: 1.1rem 0 0; }
.hero-points li { display: flex; gap: 0.4rem; align-items: center; color: var(--navy-2); font-weight: 550; font-size: 0.92rem; }
.hero-points li::before { content: "✓"; color: var(--teal); font-weight: 800; }

.app-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1.25rem; align-items: start; padding-bottom: 2rem; }
.form-panel, .preview-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; max-width: 100%; }
.form-panel { padding: 1.2rem; }
.preview-panel { padding: 1rem; position: sticky; top: 80px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.panel-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; }
legend, .fieldset-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--teal); padding: 0; margin-bottom: 0.55rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.field { display: flex; flex-direction: column; gap: 0.28rem; min-width: 0; }
.field label { font-size: 0.78rem; font-weight: 650; color: var(--navy-2); }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid #c9d1dd;
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(19,181,166,0.25); border-color: var(--teal); }
.field textarea { resize: vertical; min-height: 74px; }
.field small { color: var(--muted); font-size: 0.72rem; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.items-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.items-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0.35rem 0.25rem; border-bottom: 1px solid var(--line); }
.items-table td { padding: 0.35rem 0.25rem; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.items-table th:nth-child(1) { width: 36%; }
.items-table th:nth-child(2) { width: 13%; }
.items-table th:nth-child(3) { width: 18%; }
.items-table th:nth-child(4) { width: 12%; }
.items-table th:nth-child(5) { width: 15%; }
.items-table th:nth-child(6) { width: 6%; }
.items-table input, .items-table select { width: 100%; min-width: 0; padding: 0.4rem 0.3rem; border: 1px solid #d5dce6; border-radius: 7px; font: inherit; font-size: 0.82rem; background: #fff; }
.items-table .item-total { text-align: right; white-space: nowrap; font-weight: 650; color: var(--navy-2); font-size: 0.8rem; }
.items-table .num { text-align: right; }
.item-qty, .item-price, .item-vat { max-width: none; }
.icon-button { border: 0; background: #f1f3f7; color: #6b7484; border-radius: 7px; width: 28px; height: 28px; cursor: pointer; font-size: 1rem; line-height: 1; }
.icon-button:hover { background: #ffe4e1; color: var(--danger); }

.button { border: 0; cursor: pointer; border-radius: 9px; padding: 0.62rem 0.95rem; font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: #0a6f68; color: #fff; }
.button-dark { background: var(--navy); color: #fff; }
.button-dark:hover { background: var(--navy-2); color: #fff; }
.button-light { background: #eef2f7; color: var(--navy); }
.button-light:hover { background: #e2e8f0; color: var(--navy); }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.form-errors { background: #fff4f2; border: 1px solid #f5c2bc; color: var(--danger); border-radius: 9px; padding: 0.7rem 0.8rem; margin: 0.8rem 0; font-size: 0.88rem; }
.form-errors ul { margin: 0.3rem 0 0; }
.save-status { min-height: 1.2em; color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }

.invoice-document { background: #fff; color: #111827; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1.2rem; font-size: 0.82rem; }
.invoice-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--navy); padding-bottom: 0.8rem; }
.invoice-brand { display: flex; gap: 0.7rem; align-items: flex-start; }
.invoice-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 6px; }
.invoice-brand h2 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.invoice-brand p { margin: 0; color: #374151; }
.invoice-meta { text-align: right; min-width: 150px; }
.invoice-meta p { margin: 0.15rem 0; }
.invoice-meta .doc-type { letter-spacing: 0.12em; font-weight: 800; color: var(--teal); }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 0.9rem 0; }
.invoice-parties p { margin: 0.15rem 0; }
.label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #6b7280; font-weight: 800; margin-bottom: 0.2rem; }
.invoice-table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.9rem; table-layout: fixed; }
.invoice-table th { background: #f3f6fa; color: #374151; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.4rem; text-align: left; }
.invoice-table td { padding: 0.4rem; border-bottom: 1px solid #eef1f5; vertical-align: top; overflow-wrap: anywhere; }
.invoice-table th:nth-child(1) { width: 46%; }
.invoice-table th:nth-child(2) { width: 10%; }
.invoice-table th:nth-child(3) { width: 16%; }
.invoice-table th:nth-child(4) { width: 10%; }
.invoice-table th:nth-child(5) { width: 18%; }
.invoice-table .num { text-align: right; white-space: nowrap; }
.invoice-totals { margin-left: auto; width: min(280px, 100%); }
.total-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.24rem 0; }
.total-row.grand { border-top: 2px solid var(--navy); margin-top: 0.35rem; padding-top: 0.5rem; font-weight: 800; font-size: 1rem; }
.invoice-notes { margin-top: 0.9rem; }
.invoice-notes p { margin: 0.15rem 0; }
.invoice-footer { margin-top: 1rem; padding-top: 0.6rem; border-top: 1px solid #e5e7eb; color: #6b7280; font-size: 0.68rem; }

.page-content { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2.2rem); margin: 1.5rem 0; box-shadow: var(--shadow); }
.page-content .meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 1rem; }
.breadcrumbs { font-size: 0.8rem; color: var(--muted); margin: 1.2rem 0 0; }
.breadcrumbs a { color: var(--muted); }
.callout { background: #f0faf8; border-left: 4px solid var(--teal); padding: 0.9rem 1rem; border-radius: 0 8px 8px 0; margin: 1.2rem 0; }
.callout p:last-child { margin-bottom: 0; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 1.5rem; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 800; }
.faq details { border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.faq p { margin-top: 0.5rem; color: #374151; }
.cta-band { background: var(--navy); color: #fff; border-radius: var(--radius); padding: clamp(1.4rem, 4vw, 2.2rem); margin: 1.5rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 0.25rem; }
.cta-band p { color: rgba(255,255,255,0.82); margin: 0; max-width: 60ch; }
.cta-band .button-primary { background: var(--teal-2); color: var(--navy); }
.ad-slot { min-height: 90px; display: grid; place-items: center; border: 1px dashed #c9d1dd; border-radius: 8px; color: #98a2b3; font-size: 0.75rem; margin: 1.2rem 0; background: #fbfcfe; }

.site-footer { background: var(--navy); color: rgba(255,255,255,0.72); padding: 2rem 0; margin-top: 2rem; }
.site-footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.2rem; }
.site-footer h3 { color: #fff; font-size: 0.95rem; margin: 0 0 0.5rem; }
.site-footer a { color: rgba(255,255,255,0.78); text-decoration: none; display: block; margin: 0.25rem 0; font-size: 0.88rem; }
.site-footer a:hover { color: #fff; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 1rem; font-size: 0.78rem; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .site-footer .container { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .nav { gap: 0.6rem; }
  .nav a:not(.header-cta) { display: none; }
  .hero { padding-top: 2rem; }
  .invoice-head { flex-direction: column; }
  .invoice-meta { text-align: left; }
  .site-footer .container { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .site-header, .site-footer, .hero, .page-content, .cta-band, .ad-slot, .breadcrumbs,
  .form-panel, .panel-head, .preview-head, .preview-actions, .trust-row, .skip-link,
  #preview-status, .save-status, main > .container > section { display: none !important; }
  .app-shell { display: block; padding: 0; }
  .preview-panel { border: 0; box-shadow: none; padding: 0; position: static; }
  .invoice-document { border: 0; border-radius: 0; padding: 0; font-size: 10.5pt; }
  .invoice-footer { display: none; }
  @page { size: A4; margin: 14mm; }
}
