/* dashboard/public/styles.css — ثيمٌ داكن احترافيّ، عربيّ RTL، يبدأ من الجوّال (DASHBOARD_PLAN §16). */
:root {
  --bg: #0b0e14;
  --card: #131823;
  --card-2: #1a2130;
  --line: #232c3d;
  --text: #e6ebf5;
  --muted: #8a96ac;
  --accent: #4da3ff;
  --green: #2ecc71;
  --red: #ff5470;
  --amber: #f5a623;
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  padding-bottom: 76px; /* مساحة شريط التنقّل */
  -webkit-tap-highlight-color: transparent;
}

/* شريط الحداثة — أبرز عنصر */
.freshness {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0)) 16px;
  font-weight: 600; font-size: 14px;
  background: var(--card-2); border-bottom: 1px solid var(--line);
}
.freshness .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.freshness.fresh   { background: #0f2a1c; color: #b8f2d0; } .freshness.fresh .dot { background: var(--green); }
.freshness.delayed { background: #2a2410; color: #ffe2a6; } .freshness.delayed .dot { background: var(--amber); }
.freshness.offline { background: #2a1018; color: #ffc2cf; } .freshness.offline .dot { background: var(--red); }
.freshness.offline { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.65; } }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand .logo { display: block; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.badge {
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
}
.badge.running { color: var(--green); border-color: #1c4a30; }
.badge.paused  { color: var(--amber); border-color: #4a3c10; }
.badge.halted  { color: var(--red); border-color: #4a1824; }
.install-btn {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-weight: 700; font-size: 13px;
}

main { padding: 4px 16px 16px; }
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }

.hero { text-align: center; padding: 22px 16px; }
.hero .big { font-size: 44px; font-weight: 800; letter-spacing: -1px; display: block; margin-top: 2px; }
.hero-sub { margin-top: 10px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.pnl { font-weight: 700; font-size: 16px; }
.pnl.up { color: var(--green); } .pnl.down { color: var(--red); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gauge .bar { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin: 4px 0 8px; }
.gauge .bar .fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.gauge.warn .fill { background: var(--amber); } .gauge.danger .fill { background: var(--red); }
.gauge .val { font-weight: 700; font-size: 15px; }
.stat .big2 { font-size: 30px; font-weight: 800; display: block; }

.positions { display: flex; flex-direction: column; gap: 10px; }
.pos {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 12px; background: var(--card-2); border-radius: 12px; border: 1px solid var(--line);
}
.pos .side { font-weight: 800; padding: 3px 9px; border-radius: 8px; font-size: 13px; }
.pos .side.BUY { color: var(--green); background: #0f2a1c; }
.pos .side.SELL { color: var(--red); background: #2a1018; }
.pos .meta { font-size: 13px; color: var(--muted); }
.pos .float { font-weight: 800; font-size: 16px; text-align: end; }
.pos .float.up { color: var(--green); } .pos .float.down { color: var(--red); }

.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card-2); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab {
  background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 14px 0; font-family: inherit;
}
.tab.active { color: var(--accent); }
.tab:disabled { opacity: .4; }

.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(5,7,12,.85);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; max-width: 320px; }
.overlay-box button, .ios-hint button {
  margin-top: 14px; padding: 10px 20px; border-radius: 10px; border: none;
  background: var(--accent); color: #04121f; font-weight: 800; font-family: inherit;
}
.ios-hint {
  position: fixed; inset-inline: 12px; bottom: 84px; z-index: 25;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px 14px; font-size: 13px; line-height: 1.6; text-align: center;
}

/* ===== شاشة الصفقات ===== */
#equityChart { width: 100%; display: block; }
.summary { margin-bottom: 10px; font-weight: 600; }
.trades-list { display: flex; flex-direction: column; gap: 8px; }
.trade {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 11px 12px; background: var(--card-2); border-radius: 10px; border: 1px solid var(--line);
}
.trade .rbig { font-weight: 800; font-size: 16px; }
.trade .rbig.up { color: var(--green); } .trade .rbig.down { color: var(--red); }
.trade .meta { font-size: 12px; color: var(--muted); }
.trade .t-time { font-size: 11px; }

/* ===== شاشة العقل ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600;
}
.chip.active { color: var(--accent); border-color: var(--accent); }
.decisions { display: flex; flex-direction: column; gap: 10px; }
.decision { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.d-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.d-head .d-time { margin-inline-start: auto; font-size: 11px; }
.mbadge { padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.mbadge.sonnet { color: #4da3ff; background: #0e2238; }
.mbadge.opus { color: #c08bff; background: #241433; }
.mbadge.fallback { color: var(--muted); background: #1a2130; }
.d-action { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.abadge { padding: 4px 12px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.abadge.enter { color: var(--green); background: #0f2a1c; }
.abadge.skip { color: var(--amber); background: #2a2410; }
.abadge.wait { color: var(--muted); background: #1a2130; }
.rchip { margin-inline-start: auto; padding: 3px 11px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.rchip.up { color: var(--green); background: #0f2a1c; }
.rchip.down { color: var(--red); background: #2a1018; }
.d-reason { font-size: 14px; line-height: 1.7; }
.d-why { margin-top: 9px; }
.d-why summary { color: var(--accent); font-size: 13px; cursor: pointer; }
.d-why pre {
  white-space: pre-wrap; word-break: break-word; background: var(--card-2);
  padding: 11px; border-radius: 8px; font-size: 12px; color: var(--muted);
  margin: 9px 0 0; font-family: ui-monospace, "SF Mono", monospace; line-height: 1.6;
}

/* ===== شاشة الحارس ===== */
.model-split { display: flex; flex-direction: column; gap: 8px; }
.ms-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--card-2); border-radius: 8px; font-size: 14px; font-weight: 600;
}
.rejections { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.rej {
  font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--muted);
  padding: 9px 11px; background: var(--card-2); border-radius: 8px; word-break: break-word; line-height: 1.5;
}
