:root {
  --bg: #d9d9d9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --dark: #2f2f2f;
  --ring-bg: #707070;
  --accent: #2563eb;
  --good: #16a34a;
  --warn: #dc2626;
  --purple: #7c3aed;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1480px;
  margin: 18px auto;
  padding: 16px;
}
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}
.app-logo {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  background: #111827;
  padding: 6px;
}
.brand-text { text-align: left; }
.brand-badge {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.brand-header h1 { text-align: left; }


h1 { margin: 0 0 6px; text-align: center; font-size: 30px; }
.subtitle { text-align: center; color: var(--muted); margin: 0 0 16px; }

.layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel h2 { margin-top: 0; font-size: 18px; }
.controls-grid { display: grid; gap: 12px; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

input, select, button {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
}

.buttons { display: grid; gap: 10px; }
.buttons-2 { grid-template-columns: repeat(2, 1fr); }

button {
  cursor: pointer;
  border: none;
  color: white;
  font-weight: 700;
  transition: 0.15s ease;
}
button:hover { transform: translateY(-1px); }

.btn-connect { background: var(--accent); }
.btn-disconnect { background: #111827; }
.btn-start { background: var(--good); }
.btn-stop { background: var(--warn); }
.btn-reset { background: var(--purple); }
.btn-trading-start { background: #059669; }
.btn-trading-stop { background: #b91c1c; }
.btn-small-dark { background: #374151; padding: 8px 10px; font-size: 12px; border-radius: 10px; }

.info-cards {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.info-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: center;
}
.info-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; font-weight: 700; }
.info-card strong { font-size: 20px; }

.panel-space { margin-bottom: 16px; }
.scanner-box { padding: 12px; border: 1px solid #e5e7eb; border-radius: 12px; background: #f9fafb; }
.status { margin-top: 4px; font-size: 13px; font-weight: 700; }
.ok { color: var(--good); }
.bad { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); margin-top: 4px; }

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 10px;
  max-height: 540px;
  overflow-y: auto;
}

.distribution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.distribution-select { min-width: 260px; }
.digit-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(85px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.digit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding-top: 4px;
}
.digit-card.highlight-most::after {
  content: "▲";
  position: absolute;
  bottom: -18px;
  font-size: 18px;
  color: var(--good);
}
.digit-card.highlight-second::after {
  content: "◆";
  position: absolute;
  bottom: -18px;
  font-size: 18px;
  color: var(--accent);
}
.digit-card.highlight-least::after {
  content: "▼";
  position: absolute;
  bottom: -18px;
  font-size: 18px;
  color: var(--warn);
}
.circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: conic-gradient(#00bcd4 0deg, var(--ring-bg) 0deg);
  box-shadow: var(--shadow);
}
.circle::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--dark);
}
.circle-content { z-index: 1; color: white; text-align: center; position: relative; }
.digit-number { font-size: 22px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.digit-percent { font-size: 12px; font-weight: 700; }
.digit-count { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.digit-card.highlight-most .circle { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.25), var(--shadow); }
.digit-card.highlight-second .circle { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25), var(--shadow); }
.digit-card.highlight-least .circle { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.25), var(--shadow); }

.table-wrap { overflow-x: auto; }
.scanner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.scanner-table th, .scanner-table td {
  padding: 11px 9px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}
.scanner-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.scanner-table tbody tr:hover { background: #f3f4f6; }
.market-name { font-weight: 700; }
.symbol-code { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.percent-text { font-size: 12px; line-height: 1.5; }
.odd-ok { color: var(--good); font-weight: 700; }
.odd-bad { color: var(--warn); font-weight: 700; }

.badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-ok { background: rgba(22,163,74,0.12); color: var(--good); }

.sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sections-3 { grid-template-columns: 1fr 1fr 1fr; }

.alerts {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow-y: auto;
}
.alert-item {
  border-left: 5px solid var(--accent);
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.alert-item.signal { border-left-color: var(--good); background: rgba(22,163,74,0.06); }
.alert-item.error { border-left-color: var(--warn); background: rgba(220,38,38,0.06); }
.alert-item small { display: block; color: var(--muted); margin-top: 3px; }

.empty-history { color: var(--muted); padding: 12px 0; text-align: center; }

.profit-box { background: #f3f4f6; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.profit-box strong { display: block; margin-top: 4px; font-size: 20px; }

.profit-positive { color: var(--good) !important; }
.profit-negative { color: var(--warn) !important; }

hr { border: none; border-top: 1px solid #d1d5db; }

.excluded-box { border: 1px solid #e5e7eb; background: #f9fafb; border-radius: 12px; padding: 10px; }
.excluded-markets-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}
.excluded-market-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 7px 8px;
  font-size: 12px;
  cursor: pointer;
}
.excluded-market-item input { width: auto; margin: 0; }
.excluded-market-item span { font-weight: 700; }

.trades-stacked { display: grid; gap: 14px; }
.trades-subpanel { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; }
.trades-subpanel h3 { margin: 0 0 10px; font-size: 15px; }
.trades-account-list { max-height: 260px; }

.signal-column-stack { display: flex; flex-direction: column; gap: 14px; }
.real-time-executions-block { margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 12px; }
.alert-item.real-win { border-left-color: #16a34a; background: rgba(22,163,74,0.1); }
.alert-item.real-loss { border-left-color: #dc2626; background: rgba(220,38,38,0.1); }
.alert-item.real-entry { border-left-color: #2563eb; background: rgba(37,99,235,0.1); }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .info-cards { grid-template-columns: repeat(2,1fr); }
  .sections, .sections-3 { grid-template-columns: 1fr; }
  .digit-grid { grid-template-columns: repeat(5,1fr); }
}
@media (max-width: 700px) {
  .brand-header { flex-direction: column; text-align: center; }
  .brand-text, .brand-header h1 { text-align: center; }
  .app-logo { width: 68px; height: 68px; }
  .buttons-2 { grid-template-columns: 1fr; }
  .info-cards { grid-template-columns: 1fr; }
  .distribution-header { flex-direction: column; align-items: stretch; }
  .digit-grid { grid-template-columns: repeat(2,1fr); }
}