/* ===================================================================
   מחשבון תכנון פרישה — LK Finance
   נשען על הטוקנים של css/styles.css (--navy / --teal / --ink / ...)
   =================================================================== */

.p-wrap { max-width: 1180px; margin: 0 auto; }

/* גובר על display:flex/grid של רכיבים שמוסתרים דרך המאפיין hidden */
.p-wrap [hidden] { display: none !important; }

/* ---------- פס מצב הנתונים ---------- */
.pn-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 12px 18px; margin-bottom: 22px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px; box-shadow: var(--shadow-1);
  font-family: var(--font-body); font-size: .92rem; color: var(--muted);
}
.pn-bar strong { color: var(--ink); font-weight: 600; }
#pn-status { display: inline-flex; align-items: center; gap: 7px; }
#pn-status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex: none;
}
#pn-status.live::before { background: #16A34A; box-shadow: 0 0 0 4px rgba(22,163,74,.15); }

/* ---------- פריסה ---------- */
.p-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 26px; align-items: start; }
@media (max-width: 1000px) { .p-layout { grid-template-columns: 1fr; } }

/* ---------- אקורדיון שלבים ---------- */
.p-step {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px; box-shadow: var(--shadow-1);
  margin-bottom: 14px; overflow: hidden;
}
.p-step-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 18px 20px; background: none; border: 0; cursor: pointer;
  text-align: right; font-family: var(--font-display); font-weight: 700;
  font-size: 1.02rem; color: var(--ink);
}
.p-step-head:hover { background: var(--bg-tint); }
.p-step-num {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff; font-size: .82rem; font-weight: 800;
}
.p-step-sub { display: block; font-family: var(--font-body); font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.p-step-head::after {
  content: '⌄'; margin-inline-start: auto; font-size: 1.3rem; color: var(--muted);
  transition: transform .25s ease; line-height: 1;
}
.p-step.open .p-step-head::after { transform: rotate(180deg); }
.p-step-body { display: none; padding: 4px 20px 22px; }
.p-step.open .p-step-body { display: block; }

/* ---------- שדות ---------- */
.p-field { margin-bottom: 18px; }
.p-field-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.p-label { font-family: var(--font-body); font-size: .92rem; color: var(--ink-2); font-weight: 600; }
.p-hint { font-size: .78rem; color: var(--muted); font-weight: 400; display: block; margin-top: 3px; }

.p-num {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--hairline-2); border-radius: 10px;
  background: var(--bg); padding: 5px 10px; min-width: 116px;
}
.p-num:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(46,164,160,.15); }
.p-num input {
  border: 0; background: none; width: 100%; text-align: left; direction: ltr;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--ink);
  padding: 2px 0; -moz-appearance: textfield;
}
.p-num input:focus { outline: none; }
.p-num input::-webkit-outer-spin-button, .p-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.p-unit { font-size: .82rem; color: var(--muted); font-weight: 600; flex: none; }

.p-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  border-radius: 4px; background: var(--bg-tint-2); outline: none; margin-top: 4px;
}
.p-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--teal-2); cursor: pointer;
  box-shadow: 0 2px 8px rgba(10,22,40,.18);
}
.p-range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 2.5px solid var(--teal-2); cursor: pointer;
}

select.p-select, input.p-text {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--hairline-2); background: var(--bg);
  font-family: var(--font-body); font-size: .95rem; color: var(--ink);
}
select.p-select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(46,164,160,.15); }
select.p-select:disabled { opacity: .55; }

.p-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.p-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .p-grid2, .p-grid3 { grid-template-columns: 1fr; } }

/* בחירת מין / כפתורי רדיו כטאבים */
.p-seg { display: flex; gap: 0; border: 1px solid var(--hairline-2); border-radius: 11px; overflow: hidden; background: var(--bg); }
.p-seg label { flex: 1; }
.p-seg input { position: absolute; opacity: 0; pointer-events: none; }
.p-seg span {
  display: block; padding: 10px 6px; text-align: center; cursor: pointer;
  font-family: var(--font-body); font-size: .9rem; color: var(--muted); font-weight: 600;
  transition: background .18s, color .18s;
}
.p-seg input:checked + span { background: linear-gradient(135deg, var(--teal), var(--teal-2)); color: #fff; }

/* מתגים */
.p-toggle-card {
  border: 1px solid var(--hairline); border-radius: 13px; padding: 13px 15px;
  background: var(--bg); margin-bottom: 13px; transition: border-color .2s;
}
.p-toggle-card[data-on="true"] { border-color: rgba(46,164,160,.4); background: rgba(46,164,160,.05); }
.p-toggle-head { display: flex; align-items: center; gap: 11px; }
.p-toggle-title { font-family: var(--font-body); font-weight: 600; font-size: .92rem; color: var(--ink); }
.calc-switch {
  flex: none; width: 42px; height: 24px; border-radius: 999px; border: 0;
  background: var(--hairline-2); cursor: pointer; position: relative; padding: 0;
  transition: background .2s;
}
.calc-switch span {
  position: absolute; inset-inline-start: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.calc-switch[aria-checked="true"] { background: linear-gradient(135deg, var(--teal), var(--teal-2)); }
.calc-switch[aria-checked="true"] span { transform: translateX(-18px); }
.p-toggle-body { margin-top: 12px; }
.p-toggle-card[data-on="false"] .p-toggle-body { display: none; }

/* ---------- לוח התוצאות ---------- */
.p-results { position: sticky; top: 84px; }
@media (max-width: 1000px) { .p-results { position: static; } }

.p-headline {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 60%, #23305A 100%);
  border-radius: 20px; padding: 26px 24px; color: #fff;
  box-shadow: var(--glow); position: relative; overflow: hidden;
}
.p-headline::after {
  content: ''; position: absolute; inset-inline-end: -60px; top: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46,164,160,.35), transparent 70%);
}
.p-headline-label { font-family: var(--font-body); font-size: .88rem; color: var(--sky-soft); display: block; }
.p-headline-value {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(2.4rem, 7vw, 3.4rem);
  line-height: 1.05; display: block; margin: 6px 0 8px; letter-spacing: -.02em;
}
.p-headline-meta { font-family: var(--font-body); font-size: .86rem; color: rgba(255,255,255,.72); display: block; }

.p-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; position: relative; }
.p-stat {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px; padding: 11px 12px;
}
.p-stat-k { display: block; font-family: var(--font-body); font-size: .72rem; color: var(--sky-soft); }
.p-stat-v { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; margin-top: 3px; }
.p-stat-v small, .p-stat-note {
  font-family: var(--font-body); font-weight: 400; font-size: .68rem;
  color: rgba(255,255,255,.6); display: block; margin-top: 2px; line-height: 1.35;
}

/* קופסאות תוצאה */
.p-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px; box-shadow: var(--shadow-1); padding: 20px 22px; margin-top: 16px;
}
.p-card h3 {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 800;
  color: var(--ink); margin: 0 0 4px;
}
.p-card > p.p-card-sub { font-family: var(--font-body); font-size: .85rem; color: var(--muted); margin: 0 0 14px; }

.p-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--hairline);
  font-family: var(--font-body); font-size: .92rem;
}
.p-row:last-child { border-bottom: 0; }
.p-row-k { color: var(--muted); }
.p-row-k small { display: block; font-size: .74rem; opacity: .8; }
.p-row-v { font-family: var(--font-display); font-weight: 700; color: var(--ink); direction: ltr; }
.p-row.neg .p-row-v { color: #C2410C; }
.p-row.pos .p-row-v { color: #0F766E; }
.p-row.total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 6px; padding-top: 12px; }
.p-row.total .p-row-k { color: var(--ink); font-weight: 700; }
.p-row.total .p-row-v { font-size: 1.22rem; }

/* גרף */
.p-chart { width: 100%; margin-top: 8px; }
.p-chart svg { width: 100%; height: auto; display: block; }
.p-grid { stroke: var(--hairline); stroke-width: 1; }
.p-ytick, .p-xtick, .p-axis { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.p-band { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .65; }
.p-band-label { font-family: var(--font-body); font-size: 10px; fill: var(--gold); font-weight: 600; }

/* מטריצת מקדמים */
.p-matrix { width: 100%; border-collapse: collapse; font-family: var(--font-body); font-size: .82rem; }
.p-matrix th, .p-matrix td { padding: 8px 6px; text-align: center; border: 1px solid var(--hairline); }
.p-matrix thead th, .p-matrix tr > th:first-child { background: var(--bg-tint); color: var(--muted); font-weight: 600; font-size: .78rem; }
.p-matrix td b { font-family: var(--font-display); font-size: .95rem; color: var(--ink); display: block; }
.p-matrix td small { color: var(--muted); font-size: .72rem; direction: ltr; display: block; }
.p-matrix td.cur { background: rgba(46,164,160,.12); box-shadow: inset 0 0 0 2px var(--teal); }
.p-matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* מנופים */
.p-lever {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 11px; margin-bottom: 8px;
  background: var(--bg); border: 1px solid var(--hairline);
  font-family: var(--font-body); font-size: .89rem;
}
.p-lever.up { border-inline-start: 3px solid #0F766E; }
.p-lever.down { border-inline-start: 3px solid #C2410C; }
.p-lever-label { color: var(--ink-2); }
.p-lever-delta { font-family: var(--font-display); font-weight: 800; direction: ltr; white-space: nowrap; }
.p-lever.up .p-lever-delta { color: #0F766E; }
.p-lever.down .p-lever-delta { color: #C2410C; }
.p-lever-delta small { font-weight: 400; font-size: .7rem; color: var(--muted); }

/* תובנות */
.p-insight { padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.p-insight:last-child { border-bottom: 0; padding-bottom: 0; }
.p-insight h4 { font-family: var(--font-display); font-size: .95rem; font-weight: 800; color: var(--ink); margin: 0 0 5px; }
.p-insight p { font-family: var(--font-body); font-size: .89rem; color: var(--muted); line-height: 1.65; margin: 0; }

/* דגשי תכנון פרישה */
.p-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 22px; }
.p-tip {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow-1);
}
.p-tip-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: var(--bg-tint-2); color: var(--teal-2);
  font-family: var(--font-display); font-weight: 800; font-size: .78rem; margin-bottom: 10px;
}
.p-tip h4 { font-family: var(--font-display); font-size: .98rem; font-weight: 800; color: var(--ink); margin: 0 0 7px; }
.p-tip p { font-family: var(--font-body); font-size: .88rem; color: var(--muted); line-height: 1.68; margin: 0; }

/* צ׳יפים של תשואות מסלול */
.pn-tracks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.pn-track-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 11px;
  border-radius: 999px; background: var(--bg-tint); border: 1px solid var(--hairline);
  font-family: var(--font-body); font-size: .8rem;
}
.pn-track-chip-k { color: var(--muted); }
.pn-track-chip-v { font-family: var(--font-display); font-weight: 700; color: var(--ink); direction: ltr; }
.pn-load-btn {
  padding: 6px 13px; border-radius: 999px; border: 1px dashed var(--teal);
  background: none; color: var(--teal-2); cursor: pointer;
  font-family: var(--font-body); font-size: .8rem; font-weight: 600;
}
.pn-load-btn:hover { background: rgba(46,164,160,.08); }

/* הודעות */
.p-note, .p-warning {
  border-radius: 12px; padding: 12px 15px; margin: 12px 0;
  font-family: var(--font-body); font-size: .85rem; line-height: 1.6;
}
.p-note { background: var(--bg-tint); color: var(--ink-2); border: 1px solid var(--hairline); }
.p-warning { background: #FEF3C7; color: #78350F; border: 1px solid #FCD34D; }
.p-danger { background: #FEE2E2; color: #7F1D1D; border: 1px solid #FCA5A5; }
.p-muted { color: var(--muted); font-family: var(--font-body); font-size: .86rem; }

.p-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.p-btn {
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--hairline-2);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  font-family: var(--font-body); font-size: .88rem; font-weight: 600;
}
.p-btn:hover { border-color: var(--teal); color: var(--teal-2); }

/* נגישות + הדפסה */
@media print {
  .nav, .footer, .p-actions, .bg-mesh, .bg-grid, .orb, .p-step-head::after { display: none !important; }
  .p-step-body { display: block !important; }
  .p-layout { grid-template-columns: 1fr; }
  .p-results { position: static; }
  .p-headline { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 560px) {
  .p-stat-row { grid-template-columns: 1fr 1fr; }
  .p-stat-row > .p-stat:last-child { grid-column: 1 / -1; }
  .p-card { padding: 17px 15px; }
  .p-headline { padding: 22px 18px; }
  .p-step-head { padding: 15px 15px; font-size: .96rem; }
  .p-step-body { padding: 2px 15px 18px; }
}
