@font-face {
  font-family: "Heebo";
  src: url("fonts/Heebo-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #10243A;
  --ink-muted: #4F5D6B;
  --bg: #FBFAF7;
  --surface: #FFFFFF;
  --line: #E7E4DC;
  --action: #1E7564;
  --action-hover: #185F51;
  --warning-text: #9A6114;
  --warning-tint: rgba(208, 138, 42, 0.12);
  --radius-btn: 10px;
  --radius-card: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Heebo, "Segoe UI", "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 56px;
}

h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; margin-block-end: 12px; }

.muted { color: var(--ink-muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* States */
.state { padding-block: 64px; text-align: center; }
.state-title { font-size: 24px; margin-block-end: 8px; }

/* Outdated notice */
.notice {
  background: var(--warning-tint);
  color: var(--warning-text);
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  margin-block-end: 24px;
  display: grid;
  gap: 2px;
}

/* Header */
.head { padding-block-end: 24px; border-block-end: 1px solid var(--line); }
.producer { margin: 0 0 6px; color: var(--ink-muted); font-weight: 500; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 24px;
  margin: 20px 0 0;
}
.facts div { min-width: 0; }
.facts dt { font-size: 14px; color: var(--ink-muted); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Lines */
.lines { padding-block: 24px; }
.line-list { list-style: none; margin: 0; padding: 0; }
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding-block: 14px;
  border-block-end: 1px solid var(--line);
}
.line:last-child { border-block-end: 0; }
.line-name { font-weight: 500; overflow-wrap: anywhere; }
.line-type, .line-calc { grid-column: 1; font-size: 14px; color: var(--ink-muted); }
.line-amount { grid-column: 2; grid-row: 1; font-weight: 500; }

/* Totals */
.totals {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 8px 20px 16px;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  border-block-end: 1px solid var(--line);
}
.row.grand span:first-child { white-space: nowrap; }
.row.grand {
  border-block-end: 0;
  font-size: 22px;
  font-weight: 700;
  padding-block-start: 14px;
}
.vat-note { margin: 4px 0 0; font-size: 14px; color: var(--ink-muted); }

/* Footer */
.foot { padding-block-start: 28px; display: grid; gap: 12px; justify-items: start; }
.foot p { margin: 0; }

.btn {
  font: inherit;
  font-weight: 500;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--action);
  color: #fff;
  cursor: pointer;
  transition: background-color 120ms ease;
}
@media (hover: hover) { .btn:hover { background: var(--action-hover); } }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
.state .btn { margin-block-start: 16px; }

@media (min-width: 720px) {
  .page { padding-block-start: 56px; }
  h1 { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

@media print {
  body { background: #fff; font-size: 12pt; }
  .page { max-width: none; padding: 0; }
  #print { display: none !important; }
  .notice { border: 1px solid #999; }
  .totals { border-color: #999; }
  .line, .row { break-inside: avoid; }
}
