:root {
  color-scheme: dark;
  --bg: #05060a;
  --panel: rgba(15, 18, 28, .92);
  --panel2: rgba(22, 27, 41, .88);
  --line: rgba(255,255,255,.09);
  --text: #f4f7fb;
  --muted: #9aa7b8;
  --muted2: #647084;
  --accent: #7df9c2;
  --accent2: #77a7ff;
  --danger: #ff5f6d;
  --warn: #f9c74f;
  --green: #41e58f;
  --red: #ff5964;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(0,0,0,.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 20% 0%, rgba(39,115,255,.18), transparent 34%), radial-gradient(circle at 85% 10%, rgba(125,249,194,.12), transparent 34%), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; padding: 22px; }
.header { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: 24px; background: rgba(10, 13, 21, .76); box-shadow: var(--shadow); position: sticky; top: 12px; z-index: 20; backdrop-filter: blur(14px); }
.logo { display:flex; align-items:center; gap: 14px; }
.logo img { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(125,249,194,.18)); }
.logo h1 { margin:0; font-size: 20px; letter-spacing: .08em; }
.logo p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.statusbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pill { display: inline-flex; align-items:center; gap: 7px; border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.045); padding: 8px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted2); display:inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 6px rgba(65,229,143,.08); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.header-actions { display:flex; gap: 10px; justify-content:flex-end; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); border-radius: 13px; padding: 10px 13px; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); border-color: rgba(125,249,194,.32); }
.btn.primary { background: linear-gradient(135deg, rgba(125,249,194,.95), rgba(119,167,255,.88)); color: #071016; border: 0; font-weight: 800; }
.btn.danger { background: rgba(255,95,109,.12); border-color: rgba(255,95,109,.28); color: #ffd1d5; }
.btn.small { padding: 8px 10px; font-size: 12px; border-radius: 11px; }
.layout { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items:start; }
.sidebar, .main, .history, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sidebar { padding: 16px; position: sticky; top: 116px; max-height: calc(100vh - 138px); overflow: auto; }
.section-title { display:flex; justify-content:space-between; gap: 12px; align-items:flex-start; margin-bottom: 14px; }
.section-title h2, .section-title h3 { margin:0; font-size: 15px; letter-spacing: .04em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.controls { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 14px; }
.control { display:flex; flex-direction: column; gap: 6px; }
.control label { font-size: 11px; color: var(--muted); }
select, input[type="search"] { background: rgba(0,0,0,.18); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 11px; outline: none; }
.searchbox { grid-column: 1 / -1; }
.switchline { display:flex; align-items:center; justify-content:space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.switchline input { transform: scale(1.1); }
.events { display:flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.event-card { border: 1px solid var(--line); background: rgba(255,255,255,.045); border-radius: 16px; padding: 13px; transition: .18s ease; }
.event-card:hover, .event-card.active { border-color: rgba(125,249,194,.42); background: rgba(125,249,194,.065); }
.event-card.active { box-shadow: inset 0 0 0 1px rgba(125,249,194,.25); }
.event-top { display:flex; justify-content:space-between; gap: 8px; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.event-match { font-weight: 800; font-size: 14px; line-height: 1.25; }
.event-meta { margin-top: 8px; display:flex; gap: 7px; flex-wrap:wrap; }
.main { padding: 18px; min-height: 620px; }
.hero { display:grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 14px; margin-bottom: 16px; }
.kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.kpi span { display:block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kpi strong { display:block; margin-top: 6px; font-size: 24px; }
.kpi small { display:block; color: var(--muted2); margin-top: 2px; }
.notice { border: 1px solid rgba(249,199,79,.22); background: rgba(249,199,79,.07); border-radius: 16px; padding: 13px; color: #ffe6a0; line-height:1.5; font-size: 13px; }
.context-panel { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.context-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.context-item { background: rgba(0,0,0,.15); border: 1px solid var(--line); border-radius: 13px; padding: 10px; }
.context-item span { color: var(--muted); font-size: 11px; display:block; }
.context-item strong { font-size: 16px; display:block; margin-top: 4px; }
.tabs { display:flex; gap: 8px; flex-wrap: wrap; padding: 10px; background: rgba(0,0,0,.15); border: 1px solid var(--line); border-radius: 16px; margin: 16px 0; }
.tab { border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.04); padding: 10px 11px; border-radius: 13px; }
.tab.active { color: #061016; background: var(--accent); border-color: transparent; font-weight: 800; }
.market-table-wrap { overflow:auto; border-radius: 16px; border: 1px solid var(--line); }
table { width:100%; border-collapse:collapse; min-width: 920px; background: rgba(255,255,255,.025); }
th, td { text-align:left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.035); position: sticky; top: 0; }
td { font-size: 13px; }
.prob { font-size: 18px; font-weight: 900; }
.badge { display:inline-flex; align-items:center; justify-content:center; gap: 6px; border-radius: 999px; padding: 5px 8px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.045); white-space: nowrap; }
.badge.A, .badge.GREEN { background: rgba(65,229,143,.14); color: #b7ffd8; border-color: rgba(65,229,143,.32); }
.badge.B { background: rgba(119,167,255,.13); color: #d3e2ff; border-color: rgba(119,167,255,.28); }
.badge.C, .badge.PENDING { background: rgba(249,199,79,.12); color: #ffe6a0; border-color: rgba(249,199,79,.25); }
.badge.RED { background: rgba(255,89,100,.15); color: #ffd5d8; border-color: rgba(255,89,100,.34); }
.badge.PUSH { background: rgba(255,255,255,.10); color: #e8edf7; }
.reason { color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 340px; }
.article-list { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.article { border: 1px solid var(--line); border-radius: 14px; padding: 11px; background: rgba(255,255,255,.035); }
.article a { color: var(--text); text-decoration: none; font-weight:700; line-height:1.35; }
.article a:hover { color: var(--accent); }
.article small { display:block; color: var(--muted2); margin-top: 7px; }
.history { margin-top: 18px; padding: 16px; }
.history-grid { display:grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.empty { min-height: 350px; display:grid; place-items:center; text-align:center; color: var(--muted); padding: 30px; }
.empty strong { color: var(--text); display:block; font-size: 20px; margin-bottom: 8px; }
.loader { display:inline-flex; align-items:center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 18px; bottom: 18px; background: rgba(10,13,21,.94); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; padding: 13px 15px; max-width: 380px; z-index: 100; color: var(--text); }
.error { background: rgba(255,95,109,.10); border: 1px solid rgba(255,95,109,.26); color: #ffd5d8; border-radius: 16px; padding: 13px; margin: 12px 0; }
.footer-note { color: var(--muted2); font-size: 12px; line-height: 1.5; margin-top: 14px; }
@media (max-width: 1180px) { .layout { grid-template-columns: 1fr; } .sidebar { position: static; max-height: none; } .hero { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app-shell { padding: 12px; } .header { grid-template-columns: 1fr; } .statusbar, .header-actions { justify-content:flex-start; } .kpi-grid, .context-grid, .history-grid, .article-list { grid-template-columns: 1fr 1fr; } .controls { grid-template-columns: 1fr; } .searchbox { grid-column: auto; } }
@media (max-width: 520px) { .kpi-grid, .context-grid, .history-grid, .article-list { grid-template-columns: 1fr; } .logo h1 { font-size: 17px; } }
