/* ============================================================
   קר — לוח מכשירים, לא דשבורד.
   הפסיקה היא הגיבור. הכל סביבה שקט.
   ============================================================ */

:root {
  --void:  #10161C;
  --slab:  #182129;
  --slab2: #1E2932;
  --edge:  #26333D;
  --bone:  #E6E9EA;
  --mute:  #7A8A96;
  --dim:   #4E606D;

  --stay:  #5B8FA8;
  --scale: #6DA57F;
  --reduce:#C9963F;
  --exit:  #C2564A;

  --up:    #6DA57F;
  --down:  #C2564A;

  --pad: 16px;
  --r: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: 'Assistant', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 48px; }

button { font-family: inherit; cursor: pointer; }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- שער כניסה ---------- */
.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: var(--pad);
}
.gate-mark {
  font-family: 'Heebo', sans-serif;
  font-weight: 900;
  font-size: 64px;
  letter-spacing: -2px;
  line-height: 1;
}
.gate-sub { color: var(--mute); margin: 0 0 18px; font-size: 14px; }
.gate input {
  width: min(320px, 100%);
  padding: 14px;
  background: var(--slab);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  color: var(--bone);
  font-size: 16px;
  text-align: center;
}
.gate button {
  width: min(320px, 100%);
  padding: 14px;
  background: var(--bone);
  color: var(--void);
  border: 0;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 16px;
}
.gate-err { color: var(--exit); font-size: 14px; min-height: 20px; margin: 0; }

/* ---------- כותרת ---------- */
.tape {
  padding: var(--pad);
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--slab), var(--void));
}
.tape-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mark {
  font-family: 'Heebo', sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -1px;
}
.worth { margin: 18px 0 12px; }
.worth-num {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -1.5px;
  line-height: 1;
}
.worth-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 1px;
}
.tape-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--mute);
}
.tape-stats b {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: var(--bone);
}

/* ---------- פעולות ---------- */
.act { padding: var(--pad); }

.primary {
  width: 100%;
  padding: 18px;
  background: var(--bone);
  color: var(--void);
  border: 0;
  border-radius: var(--r);
  text-align: center;
}
.primary:disabled { opacity: .5; }
.primary-label {
  display: block;
  font-family: 'Heebo', sans-serif;
  font-weight: 900;
  font-size: 19px;
}
.primary-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  opacity: .65;
}

.ghost {
  background: transparent;
  color: var(--mute);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 8px 14px;
  font-size: 13px;
}
.ghost.wide { width: 100%; margin-top: 10px; padding: 12px; }
.ghost:hover { color: var(--bone); border-color: var(--dim); }

/* ---------- סיכום תיק ---------- */
.summary {
  margin: 0 var(--pad) 4px;
  padding: 14px;
  background: var(--slab);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.6;
}
.summary .flag {
  display: block;
  margin-top: 8px;
  padding-inline-start: 10px;
  border-inline-start: 2px solid var(--reduce);
  color: var(--reduce);
  font-size: 13px;
}

/* ---------- כרטיס פוזיציה ---------- */
.positions { padding: 0 var(--pad); display: grid; gap: 12px; }

.card {
  background: var(--slab);
  border: 1px solid var(--edge);
  border-inline-start: 3px solid var(--dim);
  border-radius: var(--r);
  padding: 14px;
  animation: rise .35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.card[data-action="STAY"]     { border-inline-start-color: var(--stay); }
.card[data-action="EXIT"]     { border-inline-start-color: var(--exit); }
.card[data-action="REDUCE"]   { border-inline-start-color: var(--reduce); }
.card[data-action="SCALE_UP"] { border-inline-start-color: var(--scale); }

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.card-name { font-weight: 600; font-size: 15px; }
.card-ticker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .5px;
}
.card-pnl {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
}
.card-pnl.up   { color: var(--up); }
.card-pnl.down { color: var(--down); }

.card-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
}

/* קו מחיר — SVG טהור, בלי ספריות */
.spark { display: block; width: 100%; height: 34px; margin: 12px 0 4px; }

/* הפסיקה — הגיבור */
.verdict { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--edge); }
.verdict-word {
  font-family: 'Heebo', sans-serif;
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -1px;
}
.verdict-word[data-a="STAY"]     { color: var(--stay); }
.verdict-word[data-a="EXIT"]     { color: var(--exit); }
.verdict-word[data-a="REDUCE"]   { color: var(--reduce); }
.verdict-word[data-a="SCALE_UP"] { color: var(--scale); }

.verdict-line {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
}

/* מד ביטחון — מקטעים, כמו מכשיר. במכוון לא תג אחוזים. */
.gauge { margin-top: 12px; }
.gauge-ticks {
  display: flex;
  gap: 2px;
  height: 8px;
}
.gauge-ticks i {
  flex: 1;
  background: var(--edge);
  border-radius: 1px;
  transition: background .25s ease;
}
.gauge-ticks i.on { background: currentColor; }
.gauge-meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: .5px;
  padding: 3px 7px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  color: var(--mute);
}
.tag.warn { color: var(--reduce); border-color: var(--reduce); }
.tag.bad  { color: var(--exit);   border-color: var(--exit); }

.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card-actions button { flex: 1; min-width: 90px; }

.empty {
  padding: 40px var(--pad);
  text-align: center;
  color: var(--mute);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- לוח נשלף ---------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 15, .7);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.sheet-panel {
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--slab);
  border-top: 1px solid var(--edge);
  border-radius: 10px 10px 0 0;
  animation: slide .25s ease both;
}
@keyframes slide { from { transform: translateY(24px); opacity: .6 } to { transform: none; opacity: 1 } }

.sheet-head {
  position: sticky;
  top: 0;
  background: var(--slab);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pad);
  border-bottom: 1px solid var(--edge);
}
.sheet-head h2 { margin: 0; font-family: 'Heebo', sans-serif; font-size: 17px; font-weight: 700; }
.sheet-body { padding: var(--pad); }

.sheet-body label {
  display: block;
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--mute);
}
.sheet-body input,
.sheet-body select,
.sheet-body textarea {
  width: 100%;
  padding: 11px;
  background: var(--slab2);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  color: var(--bone);
  font-family: inherit;
  font-size: 15px;
}
.sheet-body textarea { min-height: 68px; resize: vertical; }
.sheet-body .hint { font-size: 11px; color: var(--dim); margin-top: 3px; }
.sheet-body .save {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: var(--bone);
  color: var(--void);
  border: 0;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 15px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.reason { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.kv {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--edge);
  font-size: 13px;
}
.kv span:last-child {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--mute);
}
.section-label {
  margin: 20px 0 8px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--dim);
}

/* ---------- הודעות ---------- */
.toast {
  position: fixed;
  bottom: 18px;
  inset-inline: var(--pad);
  padding: 13px;
  background: var(--slab2);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  font-size: 14px;
  text-align: center;
  z-index: 90;
}
.toast.bad { border-color: var(--exit); color: var(--exit); }

.foot {
  padding: 22px var(--pad);
  text-align: center;
  font-size: 11px;
  color: var(--dim);
  font-family: 'IBM Plex Mono', monospace;
}

.working { position: relative; overflow: hidden; }
.working::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { transform: translateX(-100%) } to { transform: translateX(100%) } }

@media (min-width: 720px) {
  .tape, .act, .positions, .summary { max-width: 640px; margin-inline: auto; }
  .summary { margin-inline: auto; }
  .sheet { align-items: center; justify-content: center; }
  .sheet-panel { max-width: 560px; border-radius: 8px; border: 1px solid var(--edge); }
}

:focus-visible { outline: 2px solid var(--stay); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
