/* מסוף כהה: צפוף ומהיר כמו מסך מסחר */
:root {
  --bg: #0B0E11; --bar: #11151A; --card: #151A21; --card2: #1B212A; --line: #232A33; --grid: #1A2028;
  --ink: #E8ECF1; --muted: #8A94A3; --acc: #F0B90B; --on-acc: #0B0E11;
  --up: #16C784; --down: #EA3943; --r: 8px;
  --fs: 15px;
  color-scheme: dark;
}
html[data-text="small"] { --fs: 13.5px; }
html[data-text="large"] { --fs: 17px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: Heebo, system-ui, sans-serif; font-size: var(--fs); line-height: 1.45; padding-bottom: 46px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .ltr { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.cs { stroke: none; display: block; }

/* ---------- סרגל עליון ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--bar); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 18px; white-space: nowrap; }
.logo i { font-style: normal; color: var(--acc); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs a { padding: 7px 11px; border-radius: 7px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); background: var(--card); }
.tabs a.on { background: var(--acc); color: var(--on-acc); font-weight: 700; }
.search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; width: 280px; }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { border: 0; background: none; outline: none; padding: 9px 0; width: 100%; min-width: 0; }
.results { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 20px 40px -10px #000c; max-height: 60vh; overflow-y: auto; z-index: 30; }
.results button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 10px 12px; background: none; border: 0; border-top: 1px solid var(--line); text-align: start; cursor: pointer; min-height: 48px; }
.results button:hover { background: var(--card); }
.results b { flex: 1; font-weight: 500; }
.results small { color: var(--muted); }

/* ---------- כללי ---------- */
.app { padding: 16px; max-width: 1600px; margin: 0 auto; }
h1 { font-size: 26px; margin: 4px 0 2px; font-weight: 800; }
h2 { font-size: 18px; margin: 0; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-body { padding: 12px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bar); }
.seg button { border: 0; background: none; padding: 6px 10px; color: var(--muted); cursor: pointer; min-height: 34px; white-space: nowrap; }
.seg button.on { background: var(--card2); color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--acc); }
.seg button:hover { color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card2); border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 40px; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn--acc { background: var(--acc); color: var(--on-acc); border-color: var(--acc); font-weight: 700; }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 0.93em; }
.btn--danger { color: var(--down); }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; min-width: 34px; min-height: 34px; }
.icon-btn:hover { color: var(--acc); background: var(--card2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.on { color: var(--acc); }
select, input[type=text], input[type=number], input[type=date], textarea, input:not([type]) { background: var(--bar); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--acc); }
label.f { display: grid; gap: 4px; font-size: 0.93em; color: var(--muted); }
label.f > * { color: var(--ink); font-size: var(--fs); width: 100%; min-width: 0; }
.form-row > * { min-width: 0; }
.form-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); align-items: end; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.1em; margin-bottom: 4px; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.loading::before { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-inline-end: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { font-size: 0.9em; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 0.85em; font-weight: 500; white-space: nowrap; }
.chip.pos { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
.chip.neg { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.chip.neu { background: var(--card2); color: var(--muted); }
.pill { display: inline-block; padding: 3px 8px; border-radius: 6px; font-weight: 700; }
.pill.up { background: color-mix(in srgb, var(--up) 16%, transparent); }
.pill.down { background: color-mix(in srgb, var(--down) 16%, transparent); }

/* ---------- טבלה ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-weight: 500; color: var(--muted); font-size: 0.86em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--card); }
.tbl th[data-sort] { cursor: pointer; }
.tbl th.sorted { color: var(--acc); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr.row { cursor: pointer; }
.tbl tr.row:hover td { background: var(--card2); }
.tbl tr.sel td { background: color-mix(in srgb, var(--acc) 9%, var(--card)); }
.nm b { display: block; font-weight: 700; }
.nm small { color: var(--muted); font-size: 0.8em; }
.tbl td.spark { width: 104px; padding-block: 4px; }
.tbl td.spark svg { width: 96px; height: 32px; }

/* ---------- עמדת עבודה ---------- */
.desk { display: grid; grid-template-columns: 330px 340px 1fr; gap: 10px; height: calc(100vh - 120px); min-height: 560px; }
.desk > .panel { display: flex; flex-direction: column; min-height: 0; }
.desk .scroll { overflow: auto; flex: 1; min-height: 0; }
.chart-box { position: relative; flex: 1; min-height: 360px; direction: ltr; }
.chart-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-top: 1px solid var(--line); align-items: center; }
.stock-head { padding: 12px; border-bottom: 1px solid var(--line); }
.stock-head h2 { font-size: 21px; }
.stock-head .price { font-size: 26px; font-weight: 700; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; margin: 10px 0; }
.kv > div { background: var(--card2); padding: 7px 8px; }
.kv small { display: block; color: var(--muted); font-size: 0.8em; }
.kv.c3 { grid-template-columns: repeat(3, 1fr); }
.sec-title { font-size: 0.85em; color: var(--acc); font-weight: 700; margin: 14px 0 6px; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; overflow-x: auto; }
.subtabs button { border: 0; background: none; padding: 9px 10px; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; min-height: 40px; }
.subtabs button.on { color: var(--ink); border-bottom-color: var(--acc); font-weight: 700; }
.streak-cell { display: grid; gap: 2px; }
.streak-cell b { font-weight: 700; }
.ev-list { display: grid; gap: 6px; }
.ev { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--card2); border-radius: 8px; border-inline-start: 3px solid var(--muted); }
.ev.pos { border-inline-start-color: var(--up); }
.ev.neg { border-inline-start-color: var(--down); }
.ev b { flex: 1; font-weight: 500; }

/* ---------- גלריה ---------- */
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(var(--gc, 3), minmax(0, 1fr)); }
.g-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.g-card:hover { border-color: var(--muted); }
.g-card .t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.g-card .t b { font-size: 1.05em; }
.g-card svg { width: 100%; height: 170px; margin-top: 6px; }
.gallery[style*="--gc:1"] .g-card svg { height: 300px; }

/* ---------- בית ---------- */
.home { display: grid; gap: 14px; grid-template-columns: 1.2fr 1fr; }
.idx-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 14px; }
.idx { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.idx small { display: block; color: var(--muted); }
.idx b { font-size: 1.15em; }
.idx svg { width: 100%; height: 34px; margin-top: 4px; }
.mover { display: grid; grid-template-columns: 1fr 96px 80px; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mover:hover { background: var(--card2); }
.mover svg { width: 96px; height: 30px; }
.mover > span:last-child { justify-self: end; }

/* ---------- תיק ---------- */
.stats { display: grid; gap: 1px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.stats > div { background: var(--card); padding: 10px 12px; }
.stats small { display: block; color: var(--muted); }
.stats b { font-size: 1.25em; }

/* ---------- מפת רצפים ---------- */
.smap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.smap .box { border-radius: 8px; padding: 10px; min-height: 92px; color: #fff; cursor: pointer; border: 2px solid transparent; }
.smap .box.on { border-color: var(--acc); }
.smap .box b { font-size: 26px; display: block; font-family: 'JetBrains Mono', monospace; }
.smap .box span { font-size: 0.9em; }
.u1 { background: #2f6b4f; } .u2 { background: #1f8f5f; } .u3 { background: #0fae6e; }
.d1 { background: #7a3a3d; } .d2 { background: #a5333a; } .d3 { background: #cf2a35; }
.bU { background: #145a3c; } .bD { background: #6d1b22; }
.pie { width: 150px; height: 150px; }

/* ---------- סורק ---------- */
.ev-groups { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ev-groups fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 0; }
.ev-groups legend { color: var(--acc); font-weight: 700; padding: 0 6px; font-size: 0.9em; }
.ev-groups label { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
input[type=checkbox] { accent-color: var(--acc); width: 18px; height: 18px; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--acc); transition: width .2s; }

/* ---------- פס מדדים ---------- */
.ticker { position: fixed; bottom: 0; inset-inline: 0; z-index: 15; display: flex; gap: 0; background: var(--bar); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; height: 44px; }
.ticker a { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-inline-end: 1px solid var(--line); white-space: nowrap; font-size: 0.9em; }
.ticker a b { font-weight: 500; color: var(--muted); }

.toast { position: fixed; bottom: 60px; left: 50%; transform: translate(-50%, 20px); background: var(--card2); border: 1px solid var(--line); color: var(--ink); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; box-shadow: 0 10px 30px #000a; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 10px; background: none; border: 0; color: var(--acc); font-weight: 700; cursor: pointer; }

.bottomnav { display: none; }
.only-mobile { display: none; }

/* ---------- מסכים בינוניים ---------- */
@media (max-width: 1250px) {
  .desk { grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr; height: auto; }
  .desk .p-list { grid-row: span 2; max-height: calc(100vh - 120px); }
  .desk .p-chart { min-height: 520px; }
  .search { width: 220px; }
}
@media (max-width: 1000px) {
  .home { grid-template-columns: 1fr; }
  .gallery { --gc: 2 !important; }
}

/* ---------- טלפון ---------- */
@media (max-width: 760px) {
  body { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .tabs { display: none; }
  .search { width: auto; flex: 1; }
  .app { padding: 12px 12px; }
  .desk { display: flex; flex-direction: column; }
  .desk .p-chart { order: 1; } .desk .p-card { order: 2; }
  .desk .p-card .scroll { overflow: visible; }
  .desk .p-list, .desk .p-card, .desk .p-chart { margin-bottom: 10px; }
  .desk .p-chart .chart-box { min-height: 380px; }
  .desk.has-stock .p-list { display: none; }
  .desk:not(.has-stock) .p-card, .desk:not(.has-stock) .p-chart { display: none; }
  .gallery { --gc: 1 !important; }
  .g-card svg { height: 200px; }
  .smap { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .ticker { bottom: calc(64px + env(safe-area-inset-bottom)); height: 40px; }
  .toast { bottom: 120px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 16; background: var(--bar); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { display: grid; justify-items: center; gap: 2px; font-size: 12px; color: var(--muted); min-width: 60px; min-height: 52px; padding-top: 4px; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--acc); font-weight: 700; }
  .only-mobile { display: initial; }
  .hide-mobile { display: none !important; }
  .tbl td, .tbl th { padding: 7px 6px; }
  .tbl td.spark { width: 72px; } .tbl td.spark svg { width: 66px; height: 28px; }
  .mover { grid-template-columns: 1fr 72px 76px; } .mover svg { width: 72px; }
}
