:root {
  --bg: #090d14;
  --panel: #101722;
  --panel-2: #131d2b;
  --panel-3: #172334;
  --text: #f4f7fb;
  --muted: #8c9aad;
  --line: #233147;
  --accent: #7c9cff;
  --accent-2: #9cb2ff;
  --good: #3dd598;
  --warn: #ffbf69;
  --danger: #ff6b7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(124,156,255,.14), transparent 35%),
    radial-gradient(circle at -10% 30%, rgba(61,213,152,.06), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  width: min(620px, 100%);
  background: rgba(16,23,34,.92);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-large { margin-bottom: 38px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #8ba6ff, #5973d8);
  color: white; font-weight: 900; font-size: 21px;
  box-shadow: 0 12px 28px rgba(124,156,255,.28);
}
.brand strong { display: block; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.auth-panel h1 { margin: 8px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.auth-panel p { color: var(--muted); margin: 0 0 24px; line-height: 1.65; }
.eyebrow { color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 238px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(9,13,20,.86);
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column; z-index: 10;
}
.nav { display: grid; gap: 6px; margin-top: 38px; }
.nav-item {
  border: 0; background: transparent; color: var(--muted);
  text-align: left; padding: 12px 14px; border-radius: 12px;
  font-weight: 650;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: var(--text); background: var(--panel-3); box-shadow: inset 0 0 0 1px var(--line); }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 11px; line-height: 1.5; }
.read-only-chip {
  width: max-content; color: var(--good); border: 1px solid rgba(61,213,152,.25);
  background: rgba(61,213,152,.07); border-radius: 999px;
  padding: 5px 8px; font-weight: 900; letter-spacing: .08em; margin-bottom: 8px;
}
.link-btn { display: block; border: 0; background: none; color: var(--muted); padding: 12px 0 0; }
.link-btn:hover { color: var(--text); }
.main { margin-left: 238px; padding: 30px 34px 70px; max-width: 1720px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar h1 { font-size: 26px; margin: 5px 0 0; letter-spacing: -.035em; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.btn {
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 14px; color: var(--text); background: var(--panel-2); font-weight: 750;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { border-color: transparent; background: linear-gradient(145deg, #7797ff, #5f77dc); }
.btn.secondary:hover { background: var(--panel-3); }
.btn.full { width: 100%; }
.status-pill {
  display: flex; gap: 8px; align-items: center; min-height: 40px;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 700;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.good .dot { background: var(--good); box-shadow: 0 0 0 5px rgba(61,213,152,.08); }
.status-pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 5px rgba(255,191,105,.08); }
.status-pill.danger .dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,107,122,.08); }
.hero-card {
  border: 1px solid var(--line); border-radius: 24px; padding: 28px;
  background:
    linear-gradient(120deg, rgba(124,156,255,.10), transparent 50%),
    var(--panel);
  display: flex; justify-content: space-between; gap: 28px; align-items: flex-end;
  box-shadow: var(--shadow);
}
.hero-card.compact { align-items: center; }
.hero-card h2 { margin: 8px 0 8px; font-size: 28px; letter-spacing: -.04em; }
.hero-card p { margin: 0; color: var(--muted); max-width: 800px; line-height: 1.6; }
.hero-meta { text-align: right; min-width: 190px; }
.hero-meta span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.hero-meta strong { font-size: 15px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0 34px; }
.metric-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin: 8px 0 3px; font-size: 31px; letter-spacing: -.04em; }
.metric-card small { color: #64748b; }
.section-head, .panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
}
.section-head { margin: 30px 0 15px; }
.section-head h2, .panel-head h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.03em; }
.section-head p, .panel-head p { color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.text-btn { border: 0; background: none; color: var(--accent-2); font-weight: 750; }
.position-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.position-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.position-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; min-width: 0;
}
.position-card.exit { border-color: rgba(255,107,122,.42); box-shadow: inset 0 0 0 1px rgba(255,107,122,.06); }
.position-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.symbol { font-size: 21px; font-weight: 900; letter-spacing: -.035em; }
.subline { color: var(--muted); font-size: 12px; margin-top: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .05em;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.good { color: var(--good); border-color: rgba(61,213,152,.23); background: rgba(61,213,152,.06); }
.badge.danger { color: var(--danger); border-color: rgba(255,107,122,.24); background: rgba(255,107,122,.07); }
.badge.warn { color: var(--warn); border-color: rgba(255,191,105,.23); background: rgba(255,191,105,.06); }
.price-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
.kv { padding: 10px; border-radius: 11px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.035); min-width: 0; }
.kv span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.kv strong { font-size: 13px; word-break: break-all; }
.evidence-wrap { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.evidence-chip { font-size: 10px; padding: 5px 7px; border-radius: 8px; background: var(--panel-3); color: var(--muted); }
.evidence-chip.on { color: #ffd0d5; background: rgba(255,107,122,.10); border: 1px solid rgba(255,107,122,.18); }
.empty {
  grid-column: 1 / -1; padding: 34px; text-align: center;
  color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius);
}
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted); text-align: left; font-weight: 700; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid rgba(35,49,71,.65); }
.timeline { display: grid; gap: 12px; margin-top: 16px; }
.timeline-item { border-left: 2px solid var(--danger); padding-left: 13px; }
.timeline-item strong { display: block; margin-bottom: 3px; }
.timeline-item span, .timeline-item p { color: var(--muted); font-size: 11px; }
.timeline-item p { margin: 5px 0 0; line-height: 1.5; }
.research-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 16px 0; }
.research-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.research-card strong { display: block; line-height: 1.45; }
.research-card p { color: var(--muted); line-height: 1.55; font-size: 12px; }
.research-card a { color: var(--accent-2); font-size: 12px; text-decoration: none; }
.notice { padding: 13px 15px; border-radius: 12px; margin-top: 14px; font-size: 12px; line-height: 1.55; }
.notice.info { background: rgba(124,156,255,.07); border: 1px solid rgba(124,156,255,.20); color: #cbd7ff; }
.notice.danger { background: rgba(255,107,122,.07); border: 1px solid rgba(255,107,122,.22); color: #ffd0d5; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.settings-main { display: grid; gap: 16px; }
.settings-section { padding: 22px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); margin-top: 18px; }
.field { display: block; }
.field.full, .toggle-field.full { grid-column: 1 / -1; }
.field > span { display: block; color: #b7c1cf; font-size: 11px; font-weight: 750; margin-bottom: 7px; }
.field small { display: block; color: #627188; margin-top: 6px; font-size: 10px; }
input, select {
  width: 100%; background: #0c121c; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none;
}
input:focus, select:focus { border-color: #617bdc; box-shadow: 0 0 0 3px rgba(124,156,255,.08); }
.toggle-field {
  border: 1px solid var(--line); background: #0c121c; border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.toggle-field strong { display: block; font-size: 12px; }
.toggle-field small { color: var(--muted); font-size: 10px; }
.toggle-field input { width: 18px; height: 18px; }
.settings-side { position: sticky; top: 24px; display: grid; gap: 12px; }
.save-card, .safety-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.save-card h3 { margin: 6px 0; }
.save-card p, .safety-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.mini-status { color: var(--good); font-size: 10px; margin-top: 9px; min-height: 15px; }
.tab { display: none; }
.tab.active { display: block; }
.toast-stack { position: fixed; top: 20px; right: 24px; z-index: 50; display: grid; gap: 8px; }
.toast {
  min-width: 260px; max-width: 390px; border: 1px solid var(--line); background: #121a27;
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 12px;
}
.toast.good { border-color: rgba(61,213,152,.25); }
.toast.danger { border-color: rgba(255,107,122,.32); }
@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .position-grid, .position-grid.wide, .research-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-side { position: static; }
  .form-grid.three { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(5, minmax(0,1fr)); overflow-x: auto; margin-top: 20px; }
  .nav-item { white-space: nowrap; padding: 10px; text-align: center; font-size: 12px; }
  .sidebar-foot { display: none; }
  .main { margin-left: 0; padding: 22px 16px 50px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  .hero-meta { text-align: left; }
  .price-row { grid-template-columns: repeat(2, 1fr); }
}

.action-box {
  margin: 16px 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
}
.action-box.good {
  border-color: rgba(61,213,152,.28);
  background: rgba(61,213,152,.055);
}
.action-box.warn {
  border-color: rgba(255,191,105,.30);
  background: rgba(255,191,105,.055);
}
.action-box.danger {
  border-color: rgba(255,107,122,.38);
  background: rgba(255,107,122,.075);
}
.action-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: 5px;
}
.action-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.025em;
}
.close-answer {
  margin-top: 7px;
  font-size: 13px;
  font-weight: 850;
}
.action-box.good .close-answer { color: var(--good); }
.action-box.warn .close-answer { color: var(--warn); }
.action-box.danger .close-answer { color: var(--danger); }
.action-box p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.confirm-progress {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 11px;
}
.reason-list {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #0c121c;
  border: 1px solid var(--line);
}
.reason-list strong { display: block; font-size: 12px; margin-bottom: 7px; }
.reason-list ul { margin: 0; padding-left: 18px; }
.reason-list li { color: #c2cad6; font-size: 11px; line-height: 1.6; margin: 4px 0; }
.reason-list.quiet p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.evidence-title {
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
}
.position-card.action-danger { border-color: rgba(255,107,122,.45); }
.position-card.action-warn { border-color: rgba(255,191,105,.28); }
.position-card.action-good { border-color: rgba(61,213,152,.20); }
