:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #1a2233;
  --border: #263049;
  --text: #e6eaf2;
  --muted: #8b96ad;
  --accent: #4f8cff;
  --accent-2: #2f6de0;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.hidden { display: none !important; }

/* כפתורים וטפסים */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: 9px;
  padding: 9px 16px; background: var(--accent); color: #fff; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; transition: background .15s;
}
button:hover, .btn:hover { background: var(--accent-2); }
button.secondary { background: var(--panel-2); border-color: var(--border); color: var(--text); }
button.secondary:hover { background: #222c42; }
button.danger { background: transparent; border-color: #5b2330; color: #ff8a8a; }
button.danger:hover { background: #2a1219; }
button.sm { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border-radius: 9px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.grid-form .full { grid-column: 1 / -1; }
.error { color: #ff8a8a; font-size: 14px; min-height: 1.2em; }

/* מבנה */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.topbar { padding-top: max(12px, env(safe-area-inset-top)) !important;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand .brand-en { color: var(--accent); letter-spacing: .3px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--green)); display: grid; place-items: center; font-size: 16px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: none; padding: 8px 14px; }
.tabs button.active, .tabs button:hover { background: var(--panel-2); color: var(--text); }
.container { max-width: 1250px; margin: 0 auto; padding: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-bottom: 14px; }
.row.between h2 { margin: 0; }
.spacer { flex: 1; }
.section { margin-top: 20px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; direction: ltr; text-align: right; }
.kpi .sub { font-size: 12px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* טבלאות */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--panel-2); position: sticky; top: 0; }
tbody tr:hover { background: #161e2e; }
tbody tr:last-child td { border-bottom: none; }
td.num { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: #0f2e1c; color: #4ade80; }
.badge.red { background: #34121a; color: #ff8a8a; }
.badge.yellow { background: #33240a; color: #fbbf24; }
.badge.blue { background: #13254a; color: #8db4ff; }
.badge.gray { background: #1f2637; color: var(--muted); }

/* חלון קופץ */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: min(720px, 100%); max-height: 92vh; overflow-y: auto; }
.modal h3 { margin-bottom: 16px; }

.cred-box { background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 14px; margin: 12px 0; font-size: 16px; }
.cred-box b { direction: ltr; display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 17px; }

/* לוח שנה */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; color: var(--muted); font-size: 12px; }
.cal .day { min-height: 74px; border-radius: 9px; background: var(--panel-2); padding: 6px 8px; font-size: 12px; border: 1px solid transparent; }
.cal .day.empty { background: transparent; }
.cal .day.win { background: #0f2a1b; border-color: #1f5c38; }
.cal .day.loss { background: #2c1218; border-color: #6b2531; }
.cal .day .pnl { font-weight: 700; font-size: 14px; direction: ltr; text-align: right; margin-top: 6px; }

/* מסך התחברות / נחיתה */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); }
.toast { position: fixed; bottom: 20px; left: 20px; background: var(--panel-2); border: 1px solid var(--border); padding: 12px 18px; border-radius: 10px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.4); }

svg text { fill: var(--muted); font-size: 11px; font-family: inherit; }
@media (max-width: 640px) {
  .container { padding: 16px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 19px; }
}

/* ---------- נגישות ---------- */
/* ניגודיות: כפתורים ראשיים בכחול כהה יותר (יחס ניגודיות 4.5:1 לפחות לטקסט לבן) */
button, .btn { background: #1d4ed8; }
button:hover, .btn:hover { background: #1e40af; }
button.secondary { background: var(--panel-2); } button.secondary:hover { background: #222c42; }
button.danger { background: transparent; } button.danger:hover { background: #2a1219; }
.tabs button { background: transparent; }
/* סימון ברור של הרכיב שבפוקוס (ניווט במקלדת) */
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #f59e0b; outline-offset: 0; }
a { text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
/* מי שביקש במכשיר להפחית תנועה */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* קישורים בתוך טקסט מסומנים בקו תחתון (לא רק בצבע) */
a:not(.btn):not(.brand):not(.link):not(.skip-link):not(.wa-float) { text-decoration: underline; text-underline-offset: 3px; }
