:root {
  --bg: #080b12;
  --panel: #101620;
  --panel-2: #151d2a;
  --line: #243044;
  --text: #f4f7fb;
  --muted: #8996aa;
  --green: #42d392;
  --red: #ff6b7a;
  --amber: #f4bf50;
  --blue: #6aa9ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(circle at 15% -10%, #16233a 0, transparent 34rem), var(--bg); font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-end; padding: 2.4rem clamp(1.2rem, 4vw, 4rem) 1.5rem; border-bottom: 1px solid rgba(255,255,255,.06); }
h1 { margin: .15rem 0 .35rem; font-size: clamp(1.8rem, 4vw, 3.2rem); letter-spacing: -.05em; }
h2 { margin: .1rem 0 0; font-size: 1.18rem; }
h3 { margin: 0 0 .8rem; font-size: 1rem; }
.eyebrow, .kicker { margin: 0; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.subtitle, .muted, .help { color: var(--muted); }
.subtitle { margin: 0; }
.top-actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.page { width: min(1520px, calc(100% - 2rem)); margin: 1.5rem auto 4rem; display: grid; gap: 1rem; }
.notice { padding: .8rem 1rem; border: 1px solid #3e4c63; border-radius: 12px; background: rgba(62,76,99,.15); color: #cbd4e1; font-size: .88rem; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .85rem; }
.metric, .panel { background: linear-gradient(180deg, rgba(21,29,42,.96), rgba(14,20,30,.96)); border: 1px solid rgba(255,255,255,.075); box-shadow: var(--shadow); }
.metric { padding: 1rem 1.05rem; border-radius: 14px; min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span, .metric small { color: var(--muted); font-size: .78rem; }
.metric strong { font-size: 1.5rem; letter-spacing: -.03em; }
.panel { padding: 1rem; border-radius: 16px; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.button { border: 1px solid transparent; border-radius: 10px; padding: .68rem .9rem; color: var(--text); background: var(--panel-2); }
.button.primary { background: #316fe7; }
.button.secondary { border-color: var(--line); background: #111927; }
.button.danger { border-color: rgba(255,107,122,.4); color: #ffd9dd; background: rgba(255,107,122,.12); }
.button.tiny { padding: .42rem .6rem; font-size: .8rem; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .68rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.active { color: var(--green); border-color: rgba(66,211,146,.35); background: rgba(66,211,146,.08); }
.badge.stopped { color: var(--red); border-color: rgba(255,107,122,.35); background: rgba(255,107,122,.08); }
.badge.neutral { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th, td { padding: .72rem .65rem; border-top: 1px solid rgba(255,255,255,.06); text-align: right; white-space: nowrap; font-size: .82rem; }
th { border-top: 0; color: var(--muted); font-size: .72rem; font-weight: 700; }
th:first-child, td:first-child { text-align: left; }
.empty { color: var(--muted); text-align: center !important; padding: 2rem !important; }
.long, .positive { color: var(--green); }
.short, .negative { color: var(--red); }
.neutral-text { color: var(--muted); }
.score { display: inline-flex; min-width: 2.6rem; justify-content: center; padding: .28rem .42rem; border: 1px solid var(--line); border-radius: 999px; }
.score.strong { border-color: rgba(66,211,146,.45); background: rgba(66,211,146,.1); color: var(--green); }
.chart-panel { min-height: 280px; }
.chart-placeholder { height: 210px; color: var(--muted); display: grid; place-items: center; }
.chart-placeholder svg { width: 100%; height: 100%; overflow: visible; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.feed { max-height: 430px; overflow: auto; display: grid; gap: .55rem; }
.feed-item { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: .7rem; padding: .7rem; border: 1px solid rgba(255,255,255,.055); border-radius: 11px; background: rgba(255,255,255,.018); }
.feed-item .time { color: var(--muted); font-size: .7rem; }
.feed-item strong { font-size: .82rem; }
.feed-item p { margin: .18rem 0 0; color: var(--muted); font-size: .77rem; }
.text-link { color: var(--blue); text-decoration: none; font-size: .82rem; }
dialog { width: min(760px, calc(100% - 1.5rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: #0d131d; color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(1,4,10,.76); backdrop-filter: blur(8px); }
.dialog-card { padding: 1.15rem; overflow: auto; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 1.7rem; }
.form-section { padding: 1rem 0; border-top: 1px solid rgba(255,255,255,.07); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: .35rem; }
.field span { color: var(--muted); font-size: .76rem; }
.field input, .field select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: .68rem .72rem; color: var(--text); background: #0a1018; }
.switch-field { display: flex; gap: .6rem; align-items: center; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.help { margin: .2rem 0 .8rem; font-size: .75rem; }
.watchlist-editor { display: grid; gap: .45rem; }
.watch-row { display: grid; grid-template-columns: auto 1fr 100px 42px; gap: .5rem; align-items: center; }
.watch-row input[type="text"], .watch-row input[type="number"] { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: .58rem; color: var(--text); background: #0a1018; }
.remove-symbol { border: 1px solid var(--line); border-radius: 8px; height: 36px; color: var(--red); background: transparent; }
.dialog-actions { position: sticky; bottom: -1.15rem; display: flex; align-items: center; justify-content: flex-end; gap: .6rem; padding: 1rem 0 0; background: linear-gradient(transparent, #0d131d 25%); }
.form-message { margin-right: auto; color: var(--muted); font-size: .78rem; }
.danger-zone { color: #ffd9dd; }
@media (max-width: 980px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } .two-column { grid-template-columns: 1fr; } .topbar { align-items: flex-start; flex-direction: column; } .top-actions { justify-content: flex-start; } }
@media (max-width: 560px) { .metric-grid { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } .watch-row { grid-template-columns: auto 1fr 72px 38px; } }

.realtime-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.realtime-strip > div {
  background: #111827;
  border: 1px solid #263247;
  border-radius: 14px;
  padding: 13px 15px;
  display: grid;
  gap: 4px;
}
.realtime-strip span { color: #8794a9; font-size: 12px; }
.realtime-strip strong { font-size: 15px; }
.realtime-strip small { color: #738198; font-size: 11px; }
.realtime-strip .connected { color: #51d69a; }
.realtime-strip .disconnected { color: #ff7b8b; }
.realtime-strip .waiting { color: #f2c66d; }

@media (max-width: 900px) {
  .realtime-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .realtime-strip { grid-template-columns: 1fr; }
}
.connection-error { color: var(--red); }
.connection-ok { color: var(--green); }
@media (min-width: 901px) { .realtime-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
