:root {
  --bg-0: #05070d;
  --bg-1: #0b0f1a;
  --bg-2: #121828;
  --bg-3: #1a2136;
  --bg-4: #202942;
  --border: #232c45;
  --text-0: #e8ecf7;
  --text-1: #9aa5c4;
  --text-2: #667089;
  --gold: #ffd54a;
  --gold-2: #ffb300;
  --green: #16e08b;
  --green-2: #0ea968;
  --red: #ff4757;
  --red-2: #d63447;
  --orange: #ff9f43;
  --blue: #4aa3ff;
  --purple: #a06bff;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --radius: 14px;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: radial-gradient(circle at 20% 0%, #0e1424 0%, var(--bg-0) 55%);
  color: var(--text-0); min-height: 100vh; direction: rtl;
}
a { color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes flash-red { 0%,100% { box-shadow: inset 0 0 0 0 rgba(255,71,87,0); } 50% { box-shadow: inset 0 0 60px 12px rgba(255,71,87,.85); } }
@keyframes flash-green { 0%,100% { box-shadow: inset 0 0 0 0 rgba(22,224,139,0); } 50% { box-shadow: inset 0 0 60px 12px rgba(22,224,139,.85); } }
body.flash-border-buy::before, body.flash-border-sell::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9990;
}
body.flash-border-buy::before { animation: flash-green .6s infinite; }
body.flash-border-sell::before { animation: flash-red .6s infinite; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 420px; background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border); border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow); text-align: center;
}
.login-card .logo { font-size: 46px; margin-bottom: 6px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-1); font-size: 13px; margin-bottom: 26px; }
.login-card input {
  width: 100%; padding: 13px 14px; margin-bottom: 14px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text-0); font-size: 14px; outline: none; transition: .2s;
}
.login-card input:focus { border-color: var(--blue); }
.login-card button {
  width: 100%; padding: 13px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #14100a; font-weight: 800; font-size: 15px; margin-top: 6px;
}
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-hint { color: var(--text-2); font-size: 11px; margin-top: 18px; line-height: 1.7; }

.topbar {
  position: sticky; top: 0; z-index: 500; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 22px; background: rgba(11,15,26,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-2); }
.brand .dot.on { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse-dot 1.4s infinite; }
.brand .dot.off { background: var(--red); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }
.topbar .spacer { flex: 1; }
.pill {
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-3);
  border: 1px solid var(--border); color: var(--text-1); display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-3);
  color: var(--text-0); cursor: pointer; font-size: 13px; font-weight: 700; transition: .15s;
}
.btn:hover { border-color: var(--blue); background: var(--bg-2); }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #14100a; border: none; }
.btn.danger { background: linear-gradient(135deg, var(--red), var(--red-2)); color: #fff; border: none; }
.btn.small { padding: 6px 10px; font-size: 12px; }

.layout { padding: 18px 22px 60px; max-width: 1700px; margin: 0 auto; }
.hero-panel {
  display: grid; grid-template-columns: 1.8fr 1fr; gap: 16px; margin-bottom: 18px; align-items: stretch;
  background: linear-gradient(135deg, rgba(74,163,255,.14), rgba(160,107,255,.10));
  border: 1px solid rgba(74,163,255,.22); border-radius: 22px; padding: 22px;
}
.hero-panel h1 { margin: 4px 0 10px; font-size: 28px; }
.hero-panel p { margin: 0; color: var(--text-1); line-height: 1.8; }
.hero-kicker { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .4px; }
.hero-badges { display: grid; gap: 12px; }
.hero-badge {
  display: flex; align-items: center; gap: 12px; background: rgba(5,7,13,.35); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; font-size: 13px;
}
.hero-badge span { font-size: 20px; }

.grid-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px,1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-card .label { font-size: 11px; color: var(--text-1); margin-bottom: 6px; }
.stat-card .value { font-size: 22px; font-weight: 800; }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }
.stat-card .value.gold { color: var(--gold); }

.intel-grid, .log-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 22px; }
.intel-card {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; min-height: 100px;
}
.intel-card.wide { min-height: 180px; }
.intel-meta-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 12px; }
.mini-panel {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.mini-panel span { color: var(--text-1); font-size: 11px; }
.mini-panel b { font-size: 14px; }
.intel-summary {
  background: rgba(255,255,255,.03); border: 1px dashed var(--border); border-radius: 12px; padding: 14px; color: var(--text-1); line-height: 1.8; font-size: 13px;
}
.scanner-table { display: flex; flex-direction: column; gap: 8px; }
.scanner-row {
  display: grid; grid-template-columns: 1.4fr .8fr .6fr .9fr; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--border); font-size: 12px;
}
.scanner-row.gold { border-color: rgba(255,213,74,.5); }
.scanner-row.excellent { border-color: rgba(22,224,139,.5); }
.scanner-row.good { border-color: rgba(74,163,255,.5); }
.scanner-row.medium { border-color: rgba(255,159,67,.5); }
.scanner-rank {
  display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%;
  background: rgba(255,255,255,.05); margin-left: 8px; font-weight: 900;
}

.symbol-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.symbol-tab {
  padding: 8px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-1); position: relative;
}
.symbol-tab.active { color: var(--text-0); border-color: var(--blue); background: var(--bg-3); }
.symbol-tab .badge { position: absolute; top: -6px; left: -6px; width: 10px; height: 10px; border-radius: 50%; }
.symbol-tab .badge.gold { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.symbol-tab .badge.buy { background: var(--green); }
.symbol-tab .badge.sell { background: var(--red); }

.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; font-size: 16px; font-weight: 800; }
.section-title.compact { margin-top: 0; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }

.signals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px,1fr)); gap: 16px; margin-bottom: 24px; }
.signal-card {
  position: relative; overflow: hidden; background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: transform .15s, border-color .2s;
}
.signal-card:hover { transform: translateY(-3px); }
.signal-card.zone-gold { border-color: var(--gold); box-shadow: 0 0 22px rgba(255,213,74,.25); }
.signal-card.zone-excellent { border-color: var(--green); }
.signal-card.zone-good { border-color: var(--blue); }
.signal-card.zone-medium { border-color: var(--orange); }
.signal-card.zone-weak { border-color: var(--text-2); opacity: .86; }
@keyframes card-pulse { 0%,100% { box-shadow: 0 0 0 rgba(255,213,74,0); } 50% { box-shadow: 0 0 30px rgba(255,213,74,.55); } }
.signal-card.pulsing { animation: card-pulse 1s infinite; }
.signal-card .sc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.signal-card .sc-sym { font-weight: 800; font-size: 15px; }
.signal-card .sc-price { font-size: 13px; color: var(--text-1); font-variant-numeric: tabular-nums; }
.signal-subline { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.signal-mode, .signal-ai, .drivers-wrap span, .log-tags span, .spotlight-reasons span, .engine-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
}
.signal-mode { background: rgba(160,107,255,.14); color: #d5c1ff; }
.signal-ai { background: rgba(74,163,255,.14); color: #9bcdff; }
.zone-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.zone-tag.gold { background: rgba(255,213,74,.15); color: var(--gold); }
.zone-tag.excellent { background: rgba(22,224,139,.15); color: var(--green); }
.zone-tag.good { background: rgba(74,163,255,.15); color: var(--blue); }
.zone-tag.medium { background: rgba(255,159,67,.15); color: var(--orange); }
.zone-tag.weak { background: rgba(102,112,137,.15); color: var(--text-2); }
.direction-badge { font-size: 12px; font-weight: 900; padding: 4px 10px; border-radius: 8px; }
.direction-badge.buy { background: rgba(22,224,139,.18); color: var(--green); }
.direction-badge.sell { background: rgba(255,71,87,.18); color: var(--red); }
.confidence-bar-wrap { background: var(--bg-3); height: 8px; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.confidence-bar { height: 100%; border-radius: 6px; transition: width .3s; }
.sc-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-1); margin: 4px 0; gap: 8px; }
.sc-row b { color: var(--text-0); text-align: left; }
.sc-spike { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; display:flex; align-items:center; gap:6px; }
.sc-spike.buy { background: rgba(22,224,139,.12); color: var(--green); }
.sc-spike.sell { background: rgba(255,71,87,.12); color: var(--red); }
.drivers-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.drivers-wrap span, .log-tags span, .spotlight-reasons span { background: rgba(255,255,255,.04); color: var(--text-1); border: 1px solid rgba(255,255,255,.04); }
.sc-mtf { display: flex; gap: 6px; margin-top: 12px; }
.mtf-chip { flex: 1; text-align: center; padding: 5px 0; border-radius: 8px; font-size: 11px; font-weight: 800; background: var(--bg-3); color: var(--text-2); }
.mtf-chip.buy { background: rgba(22,224,139,.15); color: var(--green); }
.mtf-chip.sell { background: rgba(255,71,87,.15); color: var(--red); }

.indicator-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.indicator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 12px; }
.ind-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s;
}
.ind-card:hover { border-color: var(--blue); }
.ind-card .ind-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ind-card .ind-name { font-size: 12px; font-weight: 800; color: var(--text-1); }
.ind-card .ind-dot { width: 9px; height: 9px; border-radius: 50%; }
.ind-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ind-dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.ind-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.ind-card .ind-value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ind-card .ind-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; line-height: 1.6; }
.ind-card canvas { width: 100%; height: 34px; margin-top: 6px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,6,12,.75); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  width: 100%; max-width: 680px; max-height: 88vh; overflow-y: auto; background: linear-gradient(165deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.modal-box h2 { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.modal-close { float: left; cursor: pointer; font-size: 20px; color: var(--text-1); }
.tabs-row { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.tab-btn { padding: 7px 14px; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--border); cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-1); }
.tab-btn.active { color: var(--text-0); border-color: var(--gold); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.field-row { margin-bottom: 14px; }
.field-row label { display: block; font-size: 12px; color: var(--text-1); margin-bottom: 6px; font-weight: 700; }
.field-row input[type=text], .field-row input[type=password], .field-row input[type=number], .field-row select {
  width: 100%; padding: 10px 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; color: var(--text-0); font-size: 13px;
}
.field-row input[type=range] { width: 100%; }
.field-inline { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); gap: 10px; }
.field-inline label { font-size: 13px; font-weight: 600; color: var(--text-0); }
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--bg-3); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: var(--text-2); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: rgba(22,224,139,.25); border-color: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--green); }
.symbol-check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; }
.symbol-check { display: flex; align-items: center; gap: 8px; background: var(--bg-3); padding: 8px 10px; border-radius: 8px; font-size: 12px; border: 1px solid var(--border); }
.save-bar { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.emergency-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(5,3,3,.92); animation: emergency-bg 1s infinite;
}
.emergency-overlay.hidden { display: none; }
@keyframes emergency-bg { 0%,100% { background: rgba(30,3,3,.92); } 50% { background: rgba(5,3,3,.96); } }
.emergency-box {
  max-width: 560px; width: 92%; text-align: center; padding: 40px 30px; background: linear-gradient(165deg,#1c0d0d,#0d0606);
  border: 3px solid var(--red); border-radius: 24px; box-shadow: 0 0 80px rgba(255,71,87,.6); animation: shake 0.4s infinite;
}
.emergency-box.buy { border-color: var(--green); box-shadow: 0 0 80px rgba(22,224,139,.6); background: linear-gradient(165deg,#0d1c14,#060d09); }
@keyframes shake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(-2px,1px); } 50% { transform: translate(2px,-1px); } 75% { transform: translate(-1px,-2px); } }
.emergency-box .siren { font-size: 60px; margin-bottom: 10px; }
.emergency-box h1 { font-size: 26px; margin: 6px 0; color: #fff; }
.emergency-box .sym-big { font-size: 34px; font-weight: 900; color: var(--gold); margin: 10px 0; }
.emergency-box .direction { font-size: 22px; font-weight: 900; margin-bottom: 14px; }
.emergency-box .direction.buy { color: var(--green); }
.emergency-box .direction.sell { color: var(--red); }
.emergency-box .details { text-align: right; background: rgba(255,255,255,.05); border-radius: 12px; padding: 14px 18px; margin: 16px 0; font-size: 13px; line-height: 2; }
.emergency-box button { margin-top: 10px; padding: 14px 30px; font-size: 15px; font-weight: 900; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #14100a; cursor: pointer; }

.signal-spotlight {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 8000; pointer-events: none;
}
.signal-spotlight.hidden { display: none; }
.signal-spotlight.visible { animation: fade-spot .2s ease-in; }
@keyframes fade-spot { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.spotlight-box {
  width: min(92vw, 560px); padding: 20px; border-radius: 22px; border: 1px solid var(--border);
  box-shadow: 0 20px 90px rgba(0,0,0,.55); background: rgba(8,12,24,.95); backdrop-filter: blur(12px); pointer-events: auto;
}
.spotlight-box.buy { border-color: rgba(22,224,139,.55); }
.spotlight-box.sell { border-color: rgba(255,71,87,.55); }
.spotlight-box.level-2 { box-shadow: 0 20px 90px rgba(74,163,255,.18); }
.spotlight-box.level-3 { box-shadow: 0 24px 110px rgba(255,71,87,.25); }
.spotlight-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.spotlight-chip { background: rgba(255,213,74,.12); color: var(--gold); padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.spotlight-chip.alt { background: rgba(74,163,255,.14); color: #a8d1ff; }
.spotlight-box h3 { margin: 10px 0 16px; font-size: 24px; }
.spotlight-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.spotlight-grid div { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.04); border-radius: 12px; padding: 10px 12px; }
.spotlight-grid span { display: block; color: var(--text-1); font-size: 11px; margin-bottom: 4px; }
.spotlight-grid b { font-size: 14px; }
.spotlight-reasons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.toast-wrap { position: fixed; bottom: 20px; left: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 13px; box-shadow: var(--shadow); animation: toast-in .2s; }
@keyframes toast-in { from { opacity:0; transform: translateY(10px);} to { opacity:1; transform: translateY(0);} }

.alert-log-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow: auto; }
.log-item { background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.log-item.gold { border-color: rgba(255,213,74,.5); }
.log-item.excellent { border-color: rgba(22,224,139,.5); }
.log-item.good { border-color: rgba(74,163,255,.5); }
.log-item.medium { border-color: rgba(255,159,67,.5); }
.log-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.log-meta { color: var(--text-1); font-size: 12px; margin-bottom: 8px; }
.log-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.log-empty { color: var(--text-2); font-size: 13px; padding: 16px 0; }

.engine-chip-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.engine-chip { background: rgba(74,163,255,.14); color: #a6d0ff; border: 1px solid rgba(74,163,255,.16); }
.engine-chip.alt { background: rgba(160,107,255,.14); color: #dacaff; border-color: rgba(160,107,255,.16); }

.footer-note { text-align: center; color: var(--text-2); font-size: 11px; margin-top: 40px; line-height: 1.8; }
.left-note { text-align: right; margin-top: 18px; }

@media (max-width: 980px) {
  .hero-panel, .intel-grid, .log-grid { grid-template-columns: 1fr; }
  .intel-meta-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .layout { padding: 12px; }
  .spotlight-grid, .intel-meta-grid, .scanner-row { grid-template-columns: 1fr; }
  .hero-panel h1 { font-size: 23px; }
  .signals-grid { grid-template-columns: 1fr; }
}
