/* עיצוב משותף לאזורים המחוברים: /partner (שותפים) ו-/client (לקוחות).
   אותה שפה כמו עמוד הבית: נייבי, זהב, Heebo + Inter. */
/* אותה שפה כמו עמוד הבית (Trust & Authority): נייבי, זהב, Heebo + Inter.
   מצב Operate — לוח עבודה של שותף, לא עמוד שיווקי. */
:root {
  --navy: #1e3a8a;
  --navy-2: #1e40af;
  --ink: #0f172a;
  --ink-deep: #0b1329;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --blue-line: #bfdbfe;
  --gold: #b45309;
  --gold-hover: #92400e;
  --gold-soft: #fef3c7;
  --gold-on-dark: #fbbf24;
  --bg: #f8fafc;
  --surface: #ffffff;
  --subtle: #f1f5f9;
  --text: #0f172a;
  --text-2: #475569;   /* משני — עובר AA גם על רקעים צבעוניים */
  --muted: #64748b;    /* רק על לבן */
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --latin: 'Inter', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Heebo', system-ui, sans-serif; background: var(--bg); color: var(--text);
  line-height: 1.6; min-height: 100vh; accent-color: var(--navy); caret-color: var(--navy);
}
[hidden] { display: none !important; }
::selection { background: var(--gold-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
a { color: var(--navy); text-underline-offset: 3px; }
[dir="ltr"], .latin { font-family: var(--latin); }
.num { font-variant-numeric: tabular-nums; }
.money { unicode-bidi: isolate; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg); }

/* ---------- כותרת ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 4px 10px rgba(30, 58, 138, 0.22); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name, .brand-sub { display: block; }
.brand-name { font-size: 1.1rem; font-weight: 800; line-height: 1.2; }
.brand-sub { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.who { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text-2); min-width: 0; }
.who-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26ch; }
.btn-quiet { font: inherit; font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0 16px; min-height: 44px; cursor: pointer; transition: background 150ms, border-color 150ms, color 150ms; }
.btn-quiet:hover { background: var(--subtle); color: var(--ink); border-color: var(--muted); }
@media (max-width: 560px) { .brand-sub, .who-email { display: none; } }

main { max-width: 1040px; margin: 0 auto; padding: 32px 20px 72px; }

/* ---------- טפסים ---------- */
.field { margin-top: 16px; }
.field > label, .legend { display: block; font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--gold); }
input, textarea, select {
  width: 100%; font: inherit; font-size: 1rem; padding: 11px 14px; min-height: 48px;
  border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, textarea:hover { border-color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.14); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); background: var(--err-soft); }
textarea { resize: vertical; min-height: 96px; }
.hint { font-size: 0.84rem; color: var(--muted); margin-top: 6px; }
.field-err { font-size: 0.86rem; color: var(--err); font-weight: 600; margin-top: 6px; }
.field-err:empty { display: none; }
.btn {
  font: inherit; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff; border: 0; border-radius: 999px; padding: 0 26px; min-height: 48px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.22); transition: background 150ms, transform 150ms var(--ease-out), box-shadow 150ms;
}
.btn:hover { background: var(--navy-2); box-shadow: 0 6px 14px -2px rgba(30, 58, 138, 0.3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.btn.gold { background: var(--gold); box-shadow: 0 2px 6px rgba(180, 83, 9, 0.25); }
.btn.gold:hover { background: var(--gold-hover); }
.btn.full { width: 100%; }
.link-btn { font: inherit; font-weight: 600; background: none; border: 0; color: var(--navy); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 6px; }
.notice { margin-top: 14px; font-size: 0.94rem; border-radius: 10px; padding: 10px 14px; }
.notice:empty { display: none; }
.notice.err { color: var(--err); background: var(--err-soft); }
.notice.ok { color: var(--ok); background: var(--ok-soft); }
.notice.info { color: var(--text-2); background: var(--subtle); }
.trap { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- כניסה / הרשמה ---------- */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 220px); }
.auth-copy h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.auth-copy p { color: var(--text-2); font-size: 1.05rem; margin-top: 14px; max-width: 46ch; }
.auth-points { list-style: none; margin-top: 26px; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.auth-points svg { color: var(--gold); margin-top: 3px; }
.auth-points b { color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-md); }
.panel h2 { font-size: 1.3rem; font-weight: 800; }
.panel .lead { color: var(--text-2); margin-top: 4px; font-size: 0.95rem; }
.code-input { font-family: var(--latin); font-size: 1.7rem; font-weight: 600; letter-spacing: 0.45em; text-align: center; direction: ltr; padding-inline-start: 0.45em; }
.panel-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 0.94rem; color: var(--text-2); }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; gap: 28px; min-height: 0; } .auth-points { display: none; } }
@media (max-width: 480px) { .panel { padding: 22px; } }

.dev-login { margin-top: 16px; border: 1.5px dashed var(--gold); background: var(--gold-soft); border-radius: var(--radius); padding: 14px 16px; }
.dev-title { font-weight: 800; color: var(--gold-hover); font-size: 0.92rem; }
.dev-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dev-note { font-size: 0.8rem; color: var(--gold-hover); margin-top: 8px; }

/* ---------- טעינה ---------- */
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); gap: 12px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--navy); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- לוח ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.dash-head p { color: var(--text-2); margin-top: 4px; }

/* דף חשבון: היתרה ואיך היא מחושבת */
.ledger { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 28px 32px; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: center; box-shadow: var(--shadow-md); position: relative; overflow: hidden; }
.ledger::after { content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold-on-dark), transparent); opacity: 0.8; }
.ledger-k { font-size: 0.95rem; color: #cbd5e1; font-weight: 500; }
.ledger-v { display: block; font-family: var(--latin); font-size: clamp(2.3rem, 5vw, 3.2rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 4px; }
.ledger-note { font-size: 0.86rem; color: #cbd5e1; margin-top: 8px; }
.ledger-lines { display: grid; gap: 0; }
.ledger-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.ledger-lines > div:last-child { border-bottom: 0; }
.ledger-lines dt { color: #e2e8f0; font-size: 0.95rem; }
.ledger-lines dd { font-family: var(--latin); font-weight: 600; font-size: 1.05rem; }
.ledger-lines .sum dt { color: #fff; font-weight: 700; }
.ledger-lines .sum dd { color: var(--gold-on-dark); font-weight: 700; }
.ledger-lines .sum { border-bottom-color: rgba(251, 191, 36, 0.35); }
.ledger-lines .aside dt, .ledger-lines .aside dd { color: #cbd5e1; font-weight: 500; font-size: 0.9rem; }
@media (max-width: 760px) { .ledger { grid-template-columns: 1fr; gap: 16px; padding: 24px; } }

.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 1.25rem; font-weight: 800; }
.count { font-family: var(--latin); font-size: 0.85rem; font-weight: 600; color: var(--text-2); background: var(--subtle); border-radius: 999px; padding: 2px 10px; margin-inline-start: 6px; }

.reflink { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-top: 16px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.reflink-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; }
.reflink-title { font-weight: 700; }
.reflink-url { font-family: var(--latin); font-size: 0.95rem; color: var(--navy); direction: ltr; text-align: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reflink-hint { font-size: 0.84rem; color: var(--muted); }
@media (max-width: 640px) { .reflink { grid-template-columns: auto minmax(0, 1fr); } .reflink .btn-quiet { grid-column: 1 / -1; justify-content: center; } }

/* לקוחות */
.clients { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.client { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.client:last-child { border-bottom: 0; }
.client-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.client-brand { font-size: 1.15rem; font-weight: 800; unicode-bidi: plaintext; letter-spacing: -0.01em; }
.client-brand.pending { color: var(--muted); font-weight: 600; font-style: normal; }
.client-meta { font-size: 0.88rem; color: var(--muted); margin-top: 2px; }
.client-stage { margin-top: 10px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.client-stage .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); flex: none; }
.client-stage.closed .dot { background: var(--muted); box-shadow: 0 0 0 4px var(--subtle); }
.client-stage.complete .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.comm { text-align: end; }
.comm-v { font-family: var(--latin); font-weight: 700; font-size: 1.15rem; }
.comm-s { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; margin-top: 2px; }
.comm-s.earned { background: var(--ok-soft); color: var(--ok); }
.comm-s.pending { background: var(--gold-soft); color: var(--gold-hover); }
.comm-s.not_set { background: var(--subtle); color: var(--text-2); }

/* פס התקדמות */
.track { list-style: none; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin-top: 16px; }
.track li { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.track li::before { content: ''; position: absolute; top: 11px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.track li:last-child::before { display: none; }
.track li.done:has(+ li.done)::before { background: var(--ok); }
.track li.done:has(+ li.current)::before { background: linear-gradient(to left, var(--ok), var(--gold)); }
.track .node { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); display: grid; place-items: center; }
.track .node svg { width: 13px; height: 13px; stroke-width: 3; }
.track li.done { color: var(--text-2); }
.track li.done .node { background: var(--ok); border-color: var(--ok); color: #fff; }
.track li.current { color: var(--ink); font-weight: 700; }
.track li.current .node { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.track li.current .node::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.track.closed li { opacity: 0.55; }
.track .lbl-long { display: none; }
.track li.current.alert .node { border-color: #c2410c; box-shadow: 0 0 0 4px #ffedd5; }
.track li.current.alert .node::after { background: #c2410c; }
.track li.done:has(+ li.current.alert)::before { background: linear-gradient(to left, var(--ok), #c2410c); }
.track-notice { margin-top: 12px; padding: 8px 12px; border-radius: 10px; font-size: 0.92rem; background: var(--gold-soft); color: var(--ink); border: 1px solid #fcd34d; }
.track-notice.alert { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.track-goal { margin-top: 12px; font-size: 0.9rem; color: var(--text-2); }
/* טלפון: המסלול המלא כרשימה אנכית, כל שלב עם שם מלא */
@media (max-width: 560px) {
  .track { grid-template-columns: 1fr; gap: 0; }
  .track li { flex-direction: row; align-items: center; text-align: start; gap: 12px; padding: 7px 0; font-size: 0.95rem; }
  .track li::before { top: 50%; inset-inline-start: 11px; width: 2px; height: 100%; }
  .track li.done:has(+ li.current)::before { background: linear-gradient(to bottom, var(--ok), var(--gold)); }
  .track li.done:has(+ li.current.alert)::before { background: linear-gradient(to bottom, var(--ok), #c2410c); }
  .track li:has(.lbl-long) .lbl { display: none; }
  .track .lbl-long { display: inline; }
}

.empty { padding: 32px 24px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

/* לקוח חדש */
.new-client { background: var(--surface); border: 1px solid var(--blue-line); border-radius: var(--radius-lg); padding: 26px; margin-top: 16px; box-shadow: var(--shadow-md);
  animation: reveal 380ms var(--ease-out); }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } }
.new-client h3 { font-size: 1.15rem; font-weight: 800; }
fieldset { border: 0; margin-top: 18px; min-width: 0; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .choice { grid-template-columns: 1fr; } }
.choice label { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; min-height: 44px; transition: border-color 150ms, background 150ms; }
.choice label:hover { border-color: var(--muted); }
.choice input { width: 20px; height: 20px; min-height: 0; margin-top: 3px; flex: none; }
.choice label:has(input:checked) { border-color: var(--navy); background: var(--blue-soft); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.choice b { display: block; color: var(--ink); }
.choice small { display: block; color: var(--text-2); font-size: 0.86rem; line-height: 1.5; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-weight: 500; transition: border-color 150ms, background 150ms; }
.chips label:hover { border-color: var(--muted); }
.chips input { width: 18px; height: 18px; min-height: 0; }
.chips label:has(input:checked) { border-color: var(--navy); background: var(--blue-soft); color: var(--navy); font-weight: 600; }
.chips label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload input[type="file"] { padding: 10px; min-height: 48px; background: var(--subtle); border-style: dashed; cursor: pointer; }

/* העברות */
.payouts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 14px 20px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-size: 0.84rem; font-weight: 600; color: var(--text-2); background: var(--subtle); }
td.amt { font-family: var(--latin); font-weight: 700; }
td.date { font-family: var(--latin); color: var(--text-2); white-space: nowrap; }
@media (max-width: 480px) { th, td { padding: 12px 14px; } }

@media (prefers-reduced-motion: reduce) {
  .new-client { animation: none; }
  .spinner { animation-duration: 2.4s; }
  .btn:active { transform: none; }
}

/* פרטי בעל הסימן אצל השותף */
.owner-need { margin-top: 10px; background: var(--gold-soft); border: 1px solid #fcd34d; border-radius: 10px; padding: 8px 12px; }
.owner-need > summary { cursor: pointer; font-weight: 700; color: var(--gold-hover); min-height: 40px; display: flex; align-items: center; }
