:root {
  --bg: #f7f8fb; --card: #fff; --ink: #14213d; --muted: #5b667a; --line: #e2e6ee;
  --brand: #2b59ff; --brand-ink: #fff; --ok: #0f9d58; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1220; --card: #171d30; --ink: #eef1f8; --muted: #9aa5bd; --line: #262e47; --brand: #6d8bff; --brand-ink: #0e1220; }
}
* { 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(--brand); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
header.site { border-bottom: 1px solid var(--line); background: var(--card); }
header.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
header.site nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
header.site nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
header.site nav a:hover, header.site nav a[aria-current] { color: var(--brand); }
main { padding: 24px 0 40px; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
button, .btn { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 11px 16px; min-height: 44px; background: var(--brand); color: var(--brand-ink); font-weight: 600; text-decoration: none; display: inline-block; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.result { display: grid; gap: 8px; }
.result .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.result .row:last-child { border-bottom: 0; }
.result .big { font-size: 2rem; font-weight: 800; color: var(--ok); }
.muted { color: var(--muted); font-size: .9rem; }
.tools { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .tools { grid-template-columns: 1fr 1fr; } }
.tools a { display: block; text-decoration: none; color: inherit; }
.tools .card { margin: 0; height: 100%; }
.tools .card:hover { border-color: var(--brand); }
.tools strong { display: block; margin-bottom: 4px; }
table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: .8rem; color: var(--muted); padding: 4px; }
table.items td { padding: 4px; }
table.items input { min-height: 40px; }
.right { text-align: right; }
.promo { border-left: 4px solid var(--brand); }
.ad { min-height: 0; margin: 16px 0; text-align: center; }
footer.site { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: .9rem; }
footer.site a { color: var(--muted); }
/* Print: show only the invoice */
#invoice-print { display: none; }
@media print {
  body { background: #fff; color: #000; }
  header.site, footer.site, .noprint, .ad, main > .wrap > :not(#invoice-print) { display: none !important; }
  #invoice-print { display: block !important; }
  .card { border: 0; }
}
.inv { font-size: 14px; color: #000; background: #fff; padding: 24px; }
.inv .inv-title { font-size: 26px; font-weight: 800; margin: 0 0 12px; }
.inv table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.inv th, .inv td { border-bottom: 1px solid #ccc; padding: 6px 4px; text-align: left; }
.inv .num { text-align: right; }
.inv .tot { margin-left: auto; width: 260px; }
.inv .tot div { display: flex; justify-content: space-between; padding: 3px 0; }
.inv .tot .grand { font-weight: 800; border-top: 2px solid #000; margin-top: 4px; padding-top: 6px; }
