:root {
  --bg: #0b1017;
  --panel: #121a24;
  --panel2: #172231;
  --line: #243244;
  --text: #e6edf5;
  --muted: #8a9bb0;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --red: #f05252;
  --red-soft: rgba(240, 82, 82, 0.14);
  --amber: #f5a524;
  --blue: #5b9dff;
  --violet: #a78bfa;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 10% -10%, #11283a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 24px; border-bottom: 1px solid var(--line); background: rgba(11, 16, 23, 0.8);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 19px; font-weight: 800; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }
.logo svg { width: 36px; height: 36px; display: block; }
.logo rect { fill: var(--green); }
.logo path { stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px;
  border-radius: 9px; cursor: pointer;
}
.tabs button.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

main { max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }
footer { text-align: center; padding: 0 16px 28px; }

.search { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1 1 260px; }
.field span { font-size: 12px; color: var(--muted); font-weight: 600; }
input, select {
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font: inherit;
  padding: 11px 13px; border-radius: 10px; outline: none; min-width: 0;
}
#symbol { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); font: inherit; font-weight: 700;
  padding: 11px 18px; border-radius: 10px; cursor: pointer;
}
.btn:hover { border-color: #3a4d66; }
.btn.primary { background: var(--green); border-color: var(--green); color: #04130d; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 18px; }
.quick button {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  padding: 4px 11px; font: 600 12px var(--mono); cursor: pointer;
}
.quick button:hover { color: var(--text); border-color: var(--green); }

.status { padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; }
.status.error { border-color: rgba(240, 82, 82, 0.5); background: var(--red-soft); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 16px; }

.hero { display: grid; grid-template-columns: 1fr auto auto auto; gap: 24px; align-items: center; }
.ticker-line { display: flex; align-items: center; gap: 10px; }
.hero h2 { font-size: 28px; font-weight: 800; }
.price { font-size: 28px; font-weight: 600; text-align: right; }
.up { color: var(--green); }
.down { color: var(--red); }
#r-change { text-align: right; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.pill.live { color: var(--green); border-color: rgba(16, 185, 129, 0.4); background: var(--green-soft); }
.grade-box { text-align: center; }
.grade { font-size: 30px; font-weight: 800; width: 56px; height: 56px; line-height: 56px; border-radius: 14px; margin: 0 auto 2px; }
.grade.A { background: var(--green-soft); color: var(--green); }
.grade.B { background: rgba(91, 157, 255, 0.15); color: var(--blue); }
.grade.C { background: rgba(245, 165, 36, 0.15); color: var(--amber); }
.grade.D { background: var(--red-soft); color: var(--red); }
.refresh { text-align: right; }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 600; font-size: 13px; }
.switch input { accent-color: var(--green); width: 16px; height: 16px; }

.verdict { border-left: 4px solid var(--green); }
.verdict-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--green); margin-bottom: 6px; }
.verdict p { margin: 0; font-size: 15px; }

.profiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.profile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer;
  text-align: left; color: inherit; font: inherit; transition: border-color 0.15s, transform 0.15s;
}
.profile:hover { border-color: #3a4d66; transform: translateY(-1px); }
.profile.sel { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.profile .p-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.profile .p-name { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.profile.conservative .p-name { color: var(--blue); }
.profile.balanced .p-name { color: var(--green); }
.profile.aggressive .p-name { color: var(--amber); }
.profile .p-title { font: 600 17px var(--mono); margin-bottom: 10px; }
.profile dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0; }
.profile dt { font-size: 11px; color: var(--muted); }
.profile dd { margin: 0; font: 600 13px var(--mono); }
.score { font: 700 12px var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--panel2); }
.over { font-size: 11px; color: var(--amber); margin-top: 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.kpi .k { font-size: 11px; color: var(--muted); font-weight: 600; }
.kpi .v { font: 600 16px var(--mono); margin-top: 2px; white-space: nowrap; }
.kpi .s { font-size: 11px; color: var(--muted); }

.chart { width: 100%; height: 300px; position: relative; }
.chart.short { height: 220px; margin-bottom: 12px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; touch-action: pan-y; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.axis text { fill: var(--muted); font: 11px var(--mono); }
.axis line, .grid line { stroke: var(--line); }
.grid line { stroke-dasharray: 2 4; }
.tooltip {
  position: fixed; pointer-events: none; z-index: 50; background: #0e1520; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font: 12px var(--mono); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: right; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid rgba(36, 50, 68, 0.6); font-family: var(--mono); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table.click tbody tr { cursor: pointer; }
.table.click tbody tr:hover { background: var(--panel2); }
.table tr.sel td { background: var(--green-soft); }
.table tr.dim td { opacity: 0.45; }
.table .sym { font-weight: 700; color: var(--text); }
.table .nm { font-family: Inter, sans-serif; color: var(--muted); font-size: 12px; }
.tag { font: 700 10px Inter, sans-serif; padding: 2px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }
.tag.earn { background: rgba(245, 165, 36, 0.15); color: var(--amber); }
.tag.stale { background: var(--panel2); color: var(--muted); }
.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--green); vertical-align: middle; margin-right: 6px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 10px;
  font: 600 12px var(--mono); cursor: pointer;
}
.chips button.active { color: #04130d; background: var(--green); border-color: var(--green); }

.notes { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.notes li { padding: 8px 10px 8px 34px; border-radius: 10px; background: var(--panel2); position: relative; font-size: 13px; }
.notes li::before { position: absolute; left: 11px; top: 8px; font-weight: 800; }
.notes li.good::before { content: '✓'; color: var(--green); }
.notes li.warn::before { content: '!'; color: var(--amber); left: 14px; }
.notes li.bad::before { content: '✕'; color: var(--red); }
.notes li.info::before { content: 'i'; color: var(--blue); left: 14px; font-style: italic; font-family: Georgia, serif; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font: 600 14px var(--mono); }

.pos { color: var(--green); }
.neg { color: var(--red); }

.ideas-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ideas-bar h2 { font-size: 20px; }
.ideas-bar p { margin: 4px 0 0; }
.ideas-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.rank { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.foot { margin-top: 10px; }

.prose { max-width: 860px; }
.prose h2 { font-size: 20px; margin-bottom: 8px; }
.prose h3 { font-size: 16px; margin: 20px 0 6px; }
.prose p, .prose li { color: #c8d3df; }
.warn-box { border: 1px solid rgba(245, 165, 36, 0.4); background: rgba(245, 165, 36, 0.08); padding: 12px 14px; border-radius: 10px; margin-top: 20px; }

@media (max-width: 960px) {
  .grid2 { grid-template-columns: 1fr; }
  .profiles { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr auto; }
  .refresh { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 600px) {
  .top { padding: 12px 16px; }
  main { padding: 16px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 8px 6px; font-size: 12px; }
  .hero { grid-template-columns: 1fr; gap: 12px; }
  .price, #r-change { text-align: left; }
  .grade-box { text-align: left; display: flex; align-items: center; gap: 10px; }
  .grade { margin: 0; }
  .chart { height: 250px; }
}
