:root {
  --bg: #f6f4ef; --surface: #ffffff; --ink: #1d232b; --muted: #66707c; --line: #e3e0d8;
  --accent: #0e6b5c; --accent-ink: #ffffff; --good: #1d7a46; --warn: #a86a00; --bad: #b3261e;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111417; --surface: #1a1f24; --ink: #e8eaed; --muted: #9aa3ad; --line: #2b3239;
    --accent: #3fb79f; --accent-ink: #06201b; --good: #57c98a; --warn: #e2a53a; --bad: #ff8a80; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.site-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo img { width: 32px; height: 32px; }
.lang { display: flex; gap: 4px; }
.lang a { padding: 4px 10px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.lang a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.15; margin: 12px 0 10px; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 0 22px; max-width: 640px; }
.drop { display: block; border: 2px dashed var(--line); background: var(--surface); border-radius: var(--radius); padding: 44px 20px; text-align: center; cursor: pointer; transition: border-color .15s, transform .15s; box-shadow: var(--shadow); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { transform: scale(1.01); }
.drop .big { font-size: 1.25rem; font-weight: 600; display: block; margin-bottom: 8px; }
.drop .icon { font-size: 2.4rem; display: block; margin-bottom: 6px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.small { padding: 5px 12px; font-size: .9rem; }
.privacy { text-align: center; color: var(--muted); font-size: .92rem; margin: 14px 0 0; }
.error { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); padding: 12px 16px; border-radius: 10px; margin-top: 16px; }
.toolbar { display: flex; gap: 10px; margin: 8px 0 16px; flex-wrap: wrap; }
.invoice, .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin-bottom: 18px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.doc-type { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--accent); font-weight: 700; }
.inv-head h2 { margin: 4px 0 0; font-size: 1.5rem; }
.meta { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin: 0; align-content: start; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; text-align: right; }
.meta.left dd { text-align: left; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 18px 0; }
.party h3, .card h3, .bottom h3, .notes h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.lines th, .lines td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.lines tr.sub td:first-child { padding-left: 28px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bottom { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 28px; padding-top: 20px; }
.bottom-left h3 { margin-top: 0; }
.bottom-left dl { margin-bottom: 0; }
.mini td, .mini th { padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.mini th { text-align: left; color: var(--muted); font-weight: 500; }
.mini + h3 { margin-top: 18px; }
.totals { align-self: start; }
.totals th { text-align: left; font-weight: 400; color: var(--muted); padding: 5px 0; }
.totals td { padding: 5px 0; }
.totals .grand th, .totals .grand td { color: var(--ink); font-weight: 700; font-size: 1.2rem; border-top: 2px solid var(--ink); padding-top: 10px; }
.notes { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
.notes p { margin: 4px 0; white-space: pre-line; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 600; }
.pill.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.checks, .atts { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks .ico { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; font-size: .85rem; }
.checks .ok .ico { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.checks .warn .ico { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.checks .fail .ico { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.checks .detail { word-break: break-all; }
.atts li { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.atts li span { flex: 1; min-width: 180px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 40px 0; }
.how div { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.how b { display: block; margin-bottom: 4px; }
.faq h2 { font-size: 1.4rem; }
.faq details { background: var(--surface); border-radius: 10px; padding: 14px 18px; margin-bottom: 8px; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.support { text-align: center; margin: 36px 0 0; }
.slot:empty { display: none; }
.slot { margin: 24px 0; text-align: center; }
.site-foot { color: var(--muted); font-size: .88rem; padding: 36px 0 48px; text-align: center; }
@media (max-width: 680px) {
  .parties, .bottom, .how { grid-template-columns: 1fr; }
  .invoice, .card { padding: 18px; }
  .lines th:nth-child(3), .lines td:nth-child(3), .lines th:nth-child(4), .lines td:nth-child(4) { display: none; }
}
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; }
  .no-print, .site-head, .site-foot, .faq, .how, .support, .slot, #intro { display: none !important; }
  .invoice { box-shadow: none; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .lines th:nth-child(3), .lines td:nth-child(3), .lines th:nth-child(4), .lines td:nth-child(4) { display: table-cell !important; }
  .parties, .bottom { grid-template-columns: 1fr 1fr !important; }
}
