/* ==========================================================================
   style.css — העיצוב
   --------------------------------------------------------------------------
   שלושה חלקים:
     1. גופנים (מקומיים, מהתיקייה fonts)
     2. הדוח: שני עמודי A4 בדיוק (210×297 מ"מ)
     3. הפאנל, והחוקים להדפסה (בהדפסה רואים רק את הדוח)
   ========================================================================== */

/* ---------- 1. גופנים ---------- */
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-hebrew-400-normal.woff2"); font-weight: 400; unicode-range: U+0590-05FF, U+FB1D-FB4F; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-latin-400-normal.woff2"); font-weight: 400; unicode-range: U+0000-024F, U+2000-206F, U+20AA; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-hebrew-500-normal.woff2"); font-weight: 500; unicode-range: U+0590-05FF, U+FB1D-FB4F; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-latin-500-normal.woff2"); font-weight: 500; unicode-range: U+0000-024F, U+2000-206F, U+20AA; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-hebrew-600-normal.woff2"); font-weight: 600; unicode-range: U+0590-05FF, U+FB1D-FB4F; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-latin-600-normal.woff2"); font-weight: 600; unicode-range: U+0000-024F, U+2000-206F, U+20AA; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-hebrew-700-normal.woff2"); font-weight: 700; unicode-range: U+0590-05FF, U+FB1D-FB4F; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-hebrew-latin-700-normal.woff2"); font-weight: 700; unicode-range: U+0000-024F, U+2000-206F, U+20AA; }
@font-face { font-family: "Frank"; src: url("../fonts/frank-ruhl-libre-hebrew-700-normal.woff2"); font-weight: 700; unicode-range: U+0590-05FF, U+FB1D-FB4F; }
@font-face { font-family: "Frank"; src: url("../fonts/frank-ruhl-libre-latin-700-normal.woff2"); font-weight: 700; unicode-range: U+0000-024F, U+2000-206F, U+20AA; }

/* ---------- 2. הדוח ---------- */
@page { size: A4; margin: 0; }
:root {
  --ink: #16202b; --ink-2: #4a5663; --ink-3: #7a8591; --line: #dde2e8; --line-2: #eef1f4;
  --accent: #2b3a67; --soft: #eef1f8; --good: #1d7a46; --bad: #b3362d; --bad-bg: #fbecea; --warm: #f6efe3;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--ink); font-family: "Plex", "DejaVu Sans", sans-serif; font-size: 8.2pt; line-height: 1.35; }
.page { background: #fff; width: 210mm; height: 297mm; padding: 10mm 11mm 8mm; display: flex; flex-direction: column; gap: 2.8mm; overflow: hidden; page-break-after: always; break-after: page; }
.page:last-child { page-break-after: auto; break-after: auto; }
.page > * { flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.4pt solid var(--accent); padding-bottom: 2mm; }
h1 { font-family: "Frank", serif; font-size: 19pt; margin: 0; line-height: 1.1; color: var(--accent); }
.sub { color: var(--ink-2); font-size: 8.6pt; margin-top: 1mm; }
.meta { text-align: left; color: var(--ink-3); font-size: 7.6pt; line-height: 1.5; }
h2 { font-family: "Frank", serif; font-size: 12pt; margin: 0; color: var(--ink); }
h3 { font-size: 9pt; margin: 0; font-weight: 700; }
.lead { color: var(--ink-2); font-size: 7.9pt; margin: 0.6mm 0 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border: 0.6pt solid var(--line); border-radius: 2mm; overflow: hidden; }
.fact { padding: 2mm 2.6mm; border-inline-start: 0.6pt solid var(--line); }
.fact:first-child { border-inline-start: 0; }
.fact span { display: block; color: var(--ink-2); font-size: 7.2pt; }
.fact b { display: block; font-size: 12pt; font-weight: 700; line-height: 1.25; }
.fact small { display: block; color: var(--ink-3); font-size: 6.9pt; }
.fact.hl { background: var(--bad-bg); }
.fact.hl b { color: var(--bad); }
.netnote { background: var(--soft); border-radius: 2mm; padding: 2mm 3mm; font-size: 8pt; display: grid; grid-template-columns: 1fr 70mm; gap: 4mm; align-items: center; }
.netnote p { margin: 0; }
.netnote p + p { margin-top: 0.8mm; }
.legend { display: flex; flex-direction: column; gap: 1mm; font-size: 7.4pt; color: var(--ink-2); }
.legend div { display: flex; align-items: center; gap: 1.6mm; }
.legend svg { flex: none; }
.opts { display: flex; flex-direction: column; border: 0.6pt solid var(--line); border-radius: 2mm; overflow: hidden; }
.opt { display: grid; grid-template-columns: 43mm 1fr 68mm; gap: 3mm; padding: 2mm 2.6mm; border-top: 0.6pt solid var(--line); align-items: center; }
.opt.head { border-top: 0; }
.opt.head { background: var(--soft); padding-block: 1mm; font-size: 7.2pt; color: var(--ink-2); font-weight: 600; align-items: end; }
.name { display: flex; gap: 2mm; align-items: flex-start; align-self: start; }
.n { flex: none; width: 5.4mm; height: 5.4mm; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 8.4pt; display: flex; align-items: center; justify-content: center; margin-top: 0.2mm; }
.name b { display: block; font-size: 9.8pt; font-weight: 700; line-height: 1.25; }
.name p { margin: 0.5mm 0 0; color: var(--ink-2); font-size: 7.4pt; }
.pc { display: flex; flex-direction: column; gap: 0.8mm; font-size: 7.5pt; align-self: start; }
.pc .pro, .pc .con { padding-inline-start: 2.4mm; border-inline-start: 0.9mm solid; }
.pc .pro { border-color: var(--good); }
.pc .con { border-color: var(--bad); }
.pc b { font-weight: 600; }
.rng .later { color: var(--ink-3); font-size: 6.9pt; text-align: center; }
.rng svg { width: 68mm; height: auto; display: block; }
.head svg { width: 68mm; height: auto; display: block; }
.below { font-size: 7.1pt; color: var(--ink-2); text-align: center; margin-top: 0.3mm; }
.below b { color: var(--ink); font-weight: 700; }
.red, .below b.red { color: var(--bad); }
.take { border: 0.6pt solid var(--line); border-inline-start: 1.2mm solid var(--accent); border-radius: 2mm; padding: 2.2mm 3mm; }
.take ul { margin: 1mm 0 0; padding-inline-start: 4.5mm; display: flex; flex-direction: column; gap: 0.9mm; }
.foot { margin-top: auto; color: var(--ink-3); font-size: 6.8pt; border-top: 0.6pt solid var(--line); padding-top: 1.6mm; }
.sec { display: flex; flex-direction: column; gap: 1.6mm; }
.simgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; align-items: start; }
.simgrid svg { width: 100%; height: auto; display: block; }
table { border-collapse: collapse; width: 100%; font-size: 7.6pt; }
th { text-align: start; font-weight: 600; color: var(--ink-2); font-size: 7pt; border-bottom: 0.8pt solid var(--line); padding: 0.8mm 1.2mm; vertical-align: bottom; }
td { padding: 0.9mm 1.2mm; border-bottom: 0.5pt solid var(--line-2); }
td.num, th.num { text-align: center; }
.chip { display: inline-block; width: 2.6mm; height: 2.6mm; border-radius: 0.6mm; margin-inline-end: 1.4mm; vertical-align: -0.3mm; }
.kv { font-size: 7.6pt; color: var(--ink-2); }
.kv b { color: var(--ink); }
.pe svg { width: 100%; height: auto; display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.box { border: 0.6pt solid var(--line); border-radius: 2mm; padding: 2mm 2.8mm; display: flex; flex-direction: column; gap: 1.2mm; }
.box ul { margin: 0; padding-inline-start: 4.5mm; display: flex; flex-direction: column; gap: 0.8mm; font-size: 7.6pt; }
.small { font-size: 7pt; color: var(--ink-3); }
.assume { columns: 2; column-gap: 6mm; font-size: 7.2pt; color: var(--ink-2); margin: 0; padding-inline-start: 4mm; }
.assume li { break-inside: avoid; margin-bottom: 0.7mm; }
.assume b { color: var(--ink); font-weight: 600; }
.legend-icon { width: 44px; text-align: center; flex: none; }
.simgrid .small { margin: 1.2mm 0 0; }
.kv { margin-top: 1mm; }
.box > .small { margin: 0; }

/* ---------- 3. הפאנל ---------- */
body { background: #e9ecf0; display: flex; flex-wrap: wrap; align-items: flex-start; }
body > .rsu-alpha, body > .rsu-bar, body > .rsu-foot, body > .rsu-mobile-note { flex: 0 0 100%; }
.rsu-foot { margin-top: 0; }
#panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none;
  width: 480px; background: #fff; border-inline-end: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.4;
}
.panel-head { position: sticky; top: 0; z-index: 1; background: #fff; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.panel-head h1 { font-size: 18px; margin-bottom: 8px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 6px; }
button, .button {
  font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #f6f7f9; color: var(--ink);
}
button:hover, .button:hover { background: #eceff3; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.status { margin-top: 8px; font-size: 12px; color: var(--ink-3); min-height: 1.4em; }
.status.warn { color: var(--bad); font-weight: 600; }
#panel-body section { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
#panel-body h2 { font-family: "Plex", sans-serif; font-size: 14px; margin-bottom: 6px; color: var(--accent); }
.hint { margin: 0 0 6px; color: var(--ink-3); font-size: 11.5px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field span { font-weight: 500; }
.field small { color: var(--ink-3); font-size: 10.5px; line-height: 1.25; }
.field input { margin-top: auto; }
.field.check { flex-direction: row; align-items: center; gap: 6px; }
.field.check input { width: auto; margin: 0; }
input { font: inherit; padding: 4px 6px; border: 1px solid #cfd5dc; border-radius: 5px; width: 100%; background: #fff; }
input:focus { outline: 2px solid #b8c3e0; border-color: var(--accent); }
table.edit { font-size: 11.5px; }
table.edit th { font-size: 10.5px; padding: 3px 2px; }
table.edit td { padding: 2px; border: 0; }
table.edit input { padding: 3px 4px; font-size: 11.5px; }
table.edit input[type=month] { min-width: 118px; }
table.edit input[type=number] { min-width: 52px; }
button.x { padding: 0 6px; line-height: 20px; color: var(--ink-3); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; }
.muted { color: var(--ink-3); }
.calibrate { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.field.inline { width: 70px; }
.field.inline span { display: none; }

/* הדוח על המסך: עמודים על רקע אפור */
#report { flex: none; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
#report .page { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12); }

/* ---------- הדפסה: רק שני העמודים, בלי רקע ובלי מרווחים ---------- */
@media print {
  html, body { background: #fff; display: block; }
  .no-print { display: none !important; }
  #report { padding: 0; gap: 0; display: block; }
  #report .page { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- טלפון וטאבלט: הפאנל מעל הדוח, והדוח מוקטן לרוחב המסך (רק במסך, לא בהדפסה) ---------- */
@media screen and (max-width: 900px) {
  body { display: block; }
  #panel { position: static; height: auto; width: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .panel-head { position: static; }
  #panel-body table { display: block; overflow-x: auto; }
  #report { padding: 10px; gap: 10px; align-items: center; }
  #report .page { zoom: .95; }
}
@media screen and (max-width: 780px) { #report .page { zoom: .78; } }
@media screen and (max-width: 640px) { #report .page { zoom: .6; } }
@media screen and (max-width: 500px) { #report .page { zoom: .46; } }
@media screen and (max-width: 370px) { #report .page { zoom: .4; } }
