/* AssetPilot v2 — 한 화면 트레이딩 터미널 (2026-09-29 사장님 지시로 재구성).
 *
 * 참고: Hyperliquid 거래 화면 — 차트가 가운데, 오른쪽에 종목 목록과 기록 패널,
 * 아래에 보유·할 일·기록 탭. 기존 6탭을 한 화면으로 줄이는 것이 목적이다.
 * 색은 Hyperliquid 의 무채 청록 계열을 따르되, 등락색은 한국 관례(오름=빨강 ·
 * 내림=파랑)를 그대로 둔다 — 기존 앱과 같은 뜻이어야 사장님이 헷갈리지 않는다.
 * 옛 styles.css(8,500줄)는 쓰지 않는다. 이 파일 하나로 끝낸다.
 */

:root {
  --bg: #1b2429;          /* 패널 사이 틈 */
  --panel: #0f1a1f;       /* 패널 */
  --panel-2: #131f25;     /* 패널 안의 한 단 들어간 칸 */
  --line: #273035;
  --line-2: #33403f;
  --text: #f4f6f6;
  --muted: #949e9c;
  --faint: #6b7573;
  --accent: #50d2c1;
  --accent-ink: #04211d;
  --accent-soft: #0e3333;
  --up: #ed7088;
  --up-soft: rgb(237 112 136 / .14);
  --down: #5b9fe0;
  --down-soft: rgb(91 159 224 / .14);
  --warn: #e3b45c;
  --warn-soft: rgb(227 180 92 / .14);

  /* 차트 엔진(src/ui/render/pro-chart.js)이 읽는 이름들. 선은 무채 계조로 가른다. */
  --surface: var(--panel);
  --plot-1: #eef2f1;
  --plot-2: #c3cbc9;
  --plot-3: #949e9c;
  --plot-4: #6b7573;
  --plot-5: #4a5452;
  --plot-6: #2a3437;
  --plot-line-alpha: .6;
  --study-rsi: #a78bfa;
  --study-signal: #f5a524;
  --chart-avg: #f2c14e;

  --r-1: 4px;
  --r-2: 8px;
  --gap: 4px;
  --fs-xs: 11px;
  --fs-s: 12px;
  --fs-m: 13px;
  --fs-l: 16px;
  --fs-xl: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-m)/1.45 "Pretendard Variable", Pretendard, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── 틀 ───────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 26px;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); }
.topbar .spacer { flex: 1; }
.equity { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; white-space: nowrap; }
.equity small { color: var(--muted); font-size: var(--fs-xs); }
.equity b { font-size: 15px; font-weight: 600; }

.pills { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pill.ok i { background: var(--accent); }
.pill.warn i { background: var(--warn); }
.pill.off i { background: var(--faint); }
.pill.bad i { background: var(--up); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: transparent; color: var(--muted);
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* 페이지 — 메뉴 하나에 한 장. 한 번에 한 장만 보인다(사장님 지시 2026-09-30). */
.pages { min-height: 0; overflow: auto; }
.page { display: flex; flex-direction: column; gap: var(--gap); padding: var(--gap); min-height: 100%; }
.page-panel { flex: 1; display: flex; flex-direction: column; }
.panel-body { flex: 1; overflow: auto; }

/* 차트 페이지만 격자 — 종목 줄 / 차트 · 목록 · 이 종목 */
.page-chart {
  display: grid;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) 260px 300px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "strip strip side"
    "chart list  side";
}
.panel { background: var(--panel); border-radius: var(--r-1); min-width: 0; min-height: 0; overflow: hidden; }
.strip  { grid-area: strip; }
.chart  { grid-area: chart; display: flex; flex-direction: column; min-height: 360px; }
.list   { grid-area: list; display: flex; flex-direction: column; }
.side   { grid-area: side; display: flex; flex-direction: column; overflow: auto; }

/* 윗줄 메뉴 */
.menu { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 11px;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color .15s var(--ease);
}
.menu a:hover { color: var(--text); }
.menu a[aria-current="page"] { color: var(--accent); }
.menu a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--accent); }
.menu .count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: var(--fs-xs); text-align: center; }
.menu .count.info { background: var(--accent-soft); color: var(--accent); }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; font-size: var(--fs-l); font-weight: 600; }
.page-head small { color: var(--muted); font-size: var(--fs-s); }
.cards-lg { padding: 0; }
.cards-lg .card { background: var(--panel); padding: 14px 16px; }
.cards-lg .card b { font-size: var(--fs-xl); }

.statusbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: var(--fs-xs);
  white-space: nowrap; overflow: hidden;
}
.statusbar .live { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.statusbar .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── 종목 줄 (Hyperliquid 의 마켓 헤더) ─────────────────────────── */

.strip { display: flex; align-items: center; gap: 26px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.sym-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; margin: -4px -6px;
  border: 0; border-radius: var(--r-1); background: transparent;
  font-size: 19px; font-weight: 600; white-space: nowrap;
}
.sym-btn:hover { background: var(--panel-2); }
.sym-btn small { color: var(--muted); font-size: var(--fs-s); font-weight: 400; }
.stat { display: flex; flex-direction: column; white-space: nowrap; line-height: 1.3; }
.stat small { color: var(--muted); font-size: var(--fs-xs); }
.stat b { font-weight: 500; }

/* ── 차트 ────────────────────────────────────────────────────────── */

.tabs { display: flex; align-items: stretch; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 6px; min-height: 36px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px;
  border: 0; background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: var(--accent); }
.tab .count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); text-align: center; }
.tab .count.hot { background: var(--warn-soft); color: var(--warn); }
.tabs .spacer { flex: 1; }
/* 글자가 음절로 쪼개지지 않게 — 좁으면 줄이 옆으로 밀린다(design 20260929-1438 판정). */
.seg { display: inline-flex; flex: none; align-items: center; gap: 2px; margin: 5px 0; }
.tab, .seg button { flex: none; white-space: nowrap; }
.seg button {
  height: 26px; padding: 0 8px;
  border: 0; border-radius: var(--r-1); background: transparent;
  color: var(--muted); font-size: var(--fs-s);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }

.chart-body { position: relative; flex: 1; min-height: 0; }
.chart-body > .pc-host { position: absolute; inset: 0; }
.pc-canvas { position: absolute; inset: 0; }
.pc-legend {
  position: absolute; top: 0; left: 0; right: 72px; z-index: 3;
  display: flex; flex-direction: column; gap: 3px;
  padding: 6px 8px 5px;
  background: var(--panel);
  color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.pc-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.pc-sym { color: var(--text); font-size: 12px; }
.pc-iv { margin-right: 6px; }
.pc-k { color: var(--faint); }
.pc-v { color: var(--muted); margin-right: 4px; }
.pc-up { color: var(--up); }
.pc-down { color: var(--down); }
.pc-flat { color: var(--muted); }
.pc-studies { gap: 2px 12px; }
.pc-study { display: inline-flex; align-items: center; gap: 5px; }
.pc-study i { width: 12px; height: 2px; border-radius: 1px; }
.pc-extra { display: contents; }
.pc-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--faint); font-size: 12px; pointer-events: none; }
@media (max-width: 560px) { .pc-extra, .pc-study .pc-v { display: none; } }

/* ── 종목 목록 (Hyperliquid 의 호가창 자리) ─────────────────────── */

.list-head, .list-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.2fr) minmax(0, 1fr) 60px;
  gap: 6px;
  padding: 0 12px;
  align-items: center;
}
.list-head { height: 30px; color: var(--muted); font-size: var(--fs-xs); }
/* 1열 별 · 2열 종목은 왼쪽, 값은 오른쪽 */
.list-head span:nth-child(n+3), .list-row > span:nth-child(n+3) { text-align: right; }
.list-body { flex: 1; overflow: auto; }
.list-row {
  width: 100%; min-height: 34px; padding-top: 3px; padding-bottom: 3px;
  border: 0; background: transparent; text-align: left;
  font-size: var(--fs-s);
}
.list-row:hover { background: var(--panel-2); }
.list-row[aria-current="true"] { background: var(--accent-soft); }
.list-row .sym { display: block; min-width: 0; overflow: hidden; text-align: left; }
.list-row .sym b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
.list-row .dot.watch { background: var(--faint); }
.list-group { padding: 8px 12px 4px; color: var(--faint); font-size: var(--fs-xs); }
.list-search { padding: 8px 10px 4px; }
.list-search input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-2); outline: none; font-size: var(--fs-s); }
.list-search input:focus { border-color: var(--accent); }
.list-tabs { padding: 0 4px; }
.list-tabs .tab { padding: 0 8px; font-size: var(--fs-s); }
.list-row { cursor: pointer; }
.star { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: -4px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--faint); font-size: 14px; line-height: 1; }
.star:hover { color: var(--text); background: var(--panel-2); }
.star[aria-pressed="true"] { color: var(--warn); }
.list-row .nm { display: block; color: var(--faint); font-size: var(--fs-xs); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 오른쪽 패널 ─────────────────────────────────────────────────── */

.side-sec { padding: 12px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.side-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; font-size: var(--fs-s); font-weight: 600; color: var(--text); }
.side-title small { color: var(--muted); font-weight: 400; }

.buysell { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; background: var(--panel-2); border-radius: var(--r-2); margin-bottom: 12px; }
.buysell button { height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500; }
.buysell button[aria-pressed="true"][data-side="BUY"] { background: var(--up); color: #fff; }
.buysell button[aria-pressed="true"][data-side="SELL"] { background: var(--down); color: #fff; }

.field { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-2); }
.field:focus-within { border-color: var(--accent); }
.field label { color: var(--muted); font-size: var(--fs-s); white-space: nowrap; }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; text-align: right; outline: none; }
.field .unit { color: var(--muted); font-size: var(--fs-s); }
.kv { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0; font-size: var(--fs-s); }
.kv span:first-child { color: var(--muted); }
.hint { margin: 8px 0 0; color: var(--faint); font-size: var(--fs-xs); line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: transparent; color: var(--text);
  font-weight: 500; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), opacity .15s;
}
.btn:hover { border-color: var(--line-2); background: var(--panel-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.buy { background: var(--up); border-color: var(--up); color: #fff; }
.btn.sell { background: var(--down); border-color: var(--down); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-s); }

/* 안전 상태 — 주문이 잠겨 있는지. 읽기 전용이다(스위치는 여기 없다). */
.safety { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.safety div { padding: 8px 10px; border-radius: var(--r-2); background: var(--panel-2); }
.safety small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.safety b { font-weight: 500; font-size: var(--fs-s); }

/* ── 아래 탭 ─────────────────────────────────────────────────────── */

.bottom-body { flex: 1; overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
table.grid th, table.grid td { padding: 0 12px; height: 30px; text-align: right; white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid th { position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--muted); font-weight: 400; font-size: var(--fs-xs); border-bottom: 1px solid var(--line); }
table.grid tbody tr:hover { background: var(--panel-2); }
table.grid tr.clickable { cursor: pointer; }
.empty { padding: 28px 16px; color: var(--faint); text-align: center; }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-1); font-size: var(--fs-xs); background: var(--panel-2); color: var(--muted); }
.tag.buy { background: var(--up-soft); color: var(--up); }
.tag.sell { background: var(--down-soft); color: var(--down); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--accent-soft); color: var(--accent); }

/* 할 일 — 앱이 스스로 찾아 올리는 목록. 한 줄에 단추 하나. */
.todo { display: flex; flex-direction: column; }
.todo-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.todo-row:last-child { border-bottom: 0; }
.todo-row .ico { width: 8px; height: 8px; margin: 0 auto; border-radius: 50%; background: var(--accent); }
.todo-row .ico.warn { background: var(--warn); }
.todo-row .ico.bad { background: var(--up); }
.todo-row p { margin: 0; }
.todo-row p small { display: block; color: var(--muted); font-size: var(--fs-xs); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 12px; }
.card { padding: 10px 12px; border-radius: var(--r-2); background: var(--panel-2); }
.card small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.card b { font-size: var(--fs-l); font-weight: 500; }

/* ── 종목 고르개 · 토스트 ────────────────────────────────────────── */

dialog.picker {
  width: min(460px, calc(100vw - 32px));
  max-height: min(560px, 80vh);
  padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--panel); color: var(--text);
}
dialog.picker::backdrop { background: rgb(0 0 0 / .55); }
.picker-head { padding: 10px; border-bottom: 1px solid var(--line); }
.picker-head input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-2); outline: none; }
.picker-head input:focus { border-color: var(--accent); }
.picker-body { max-height: 440px; overflow: auto; }

.toast {
  position: fixed; left: 50%; bottom: 40px; z-index: 50;
  transform: translate(-50%, 8px); opacity: 0;
  padding: 10px 16px; border-radius: var(--r-2);
  background: #22313a; border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgb(0 0 0 / .4);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 좁은 화면 ───────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .page-chart {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "strip side"
      "chart side";
  }
  .list { display: none; }
}

@media (max-width: 860px) {
  .app { grid-template-rows: auto auto 26px; height: auto; min-height: 100dvh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 6px 12px; row-gap: 0; }
  .menu { order: 3; flex-basis: 100%; height: 42px; }
  .pages { overflow: visible; }
  .page-chart {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 360px auto;
    grid-template-areas: "strip" "chart" "side";
  }
  .side { overflow: visible; }
  .pills .pill:not(.keep) { display: none; }
  .equity small { display: none; }
  .strip { gap: 18px; }
  .btn, .tab, .list-row, .seg button, .menu a { min-height: 40px; }
}

/* 고르개 — 윗줄 투자자 · 폼 안 선택 */
.owner-select, .field-select {
  border: 0; background: transparent; color: var(--muted);
  font-size: var(--fs-xs); outline: none; cursor: pointer;
}
.field-select { flex: 1; min-width: 0; color: var(--text); font-size: var(--fs-m); text-align: right; }
.owner-select option, .field-select option { background: var(--panel); color: var(--text); }
/* `hidden` 을 켜도 위의 display:grid 가 이겨 안내문이 봉 위에 남았다. */
.pc-empty[hidden], [hidden] { display: none !important; }
a.btn { text-decoration: none; }


/* 계획 편집(차트 페이지 오른쪽) */
.tranche { margin: 0 0 8px; padding: 8px 10px 4px; border: 1px solid var(--line); border-radius: var(--r-2); }
.tranche legend { padding: 0 4px; color: var(--muted); font-size: var(--fs-xs); }
.range-row { display: grid; grid-template-columns: 34px 1fr 12px 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.range-row label { color: var(--muted); font-size: var(--fs-s); }
.range-row input { min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--panel-2); text-align: right; outline: none; }
.range-row input:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 6px; margin-top: 8px; }
.plan-table td { height: auto; padding-top: 6px; padding-bottom: 6px; line-height: 1.6; }

/* ── 리밸런싱 페이지(2026-09-30 두 번째 다시 그림 · 읽기 쉬움이 먼저) ─────
   막대를 해석하게 하지 않는다. 종목 카드 하나를 위에서 아래로 글로 읽는다. */
.rb-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 16px 16px 4px; }
.rb-stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--panel-2); }
.rb-stat small { color: var(--muted); font-size: var(--fs-s); }
.rb-stat b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.rb-stat b.warn { color: var(--warn); }
.rb-orders { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--up-soft); }
.rb-orders h2 { margin: 0 0 6px; font-size: var(--fs-m); }
.rb-orders h2 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.rb-order { display: grid; grid-template-columns: 70px 120px 1fr auto; gap: 10px; align-items: center; width: 100%; min-height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; transition: background .2s cubic-bezier(.32,.72,0,1); }
.rb-order:hover { background: rgb(0 0 0 / .18); }
.rb-toolbar { display: flex; align-items: center; gap: 10px; padding: 18px 16px 6px; font-size: var(--fs-s); }
.rb-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px; align-items: start; padding: 8px 16px 8px; }
.rb-table { border-radius: 16px; background: var(--panel-2); overflow-x: auto; }
.rb-table table.grid th { background: var(--panel-2); height: 36px; }
.rb-table table.grid td { height: 48px; border-top: 1px solid var(--line); }
.rb-table tr.on { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.rb-table tr.hit .rb-tk b { color: var(--up); }
.rb-tk { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.rb-tk b { font-size: var(--fs-m); font-weight: 700; }
.rb-tk span { color: var(--muted); font-size: var(--fs-xs); }
.rb-st { text-align: left !important; }
.rb-st.hit { color: var(--up); font-weight: 700; }
.rb-st.near { color: var(--warn); }
/* 넓은 화면: 카드 왼쪽 · 표 오른쪽(사장님 지시). 좁은 화면은 표가 위 */
.rb-split .rb-card { position: sticky; top: 8px; order: -1; }
.rb-split.one { grid-template-columns: minmax(0, 560px); }
.rb-add { margin-left: auto; border-radius: 999px; }
/* 종목 추가 · 가격 편집 — 카드 자리에 그대로 뜬다 */
.rb-edit { box-shadow: inset 0 0 0 1px var(--accent); }
.rb-edit form { display: flex; flex-direction: column; gap: 12px; }
.rb-search { height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: var(--fs-m); outline: none; }
.rb-search:focus, .rb-alloc input:focus, .rb-rng input:focus { border-color: var(--accent); }
.rb-results { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.rb-result { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; transition: background .2s cubic-bezier(.32,.72,0,1); }
.rb-result:hover { background: var(--panel); }
.rb-result span { color: var(--muted); font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-result em { font-style: normal; font-size: var(--fs-s); color: var(--accent); }
.rb-alloc { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; }
.rb-alloc span { color: var(--muted); font-size: var(--fs-s); }
.rb-alloc input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: right; font-size: var(--fs-m); font-weight: 600; outline: none; }
.rb-alloc em { font-style: normal; color: var(--muted); font-size: var(--fs-s); }
.rb-tr { margin: 0; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.rb-tr legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; font-weight: 600; }
.rb-tr legend small { margin-left: 6px; color: var(--muted); font-weight: 400; }
.rb-rng { display: grid; grid-template-columns: 80px 1fr 14px 1fr; gap: 6px; align-items: center; }
.rb-rng span { font-size: var(--fs-s); }
.rb-rng.dn span { color: var(--down); }
.rb-rng.up span { color: var(--up); }
.rb-rng i { font-style: normal; color: var(--muted); text-align: center; }
.rb-rng input { min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); text-align: right; outline: none; }
.rb-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border-radius: 16px; background: var(--panel-2); box-shadow: inset 0 1px 0 rgb(255 255 255 / .04); }
.rb-card.hit { box-shadow: inset 0 0 0 1px var(--up); }
.rb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rb-id { display: flex; flex-direction: column; gap: 2px; }
.rb-id b { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.rb-id span { color: var(--muted); font-size: var(--fs-s); }
.rb-now { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rb-now small { color: var(--muted); font-size: var(--fs-xs); }
.rb-now b { font-size: 20px; font-weight: 600; }
.rb-status { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--panel); font-size: 15px; font-weight: 500; }
.rb-status.near { color: var(--warn); }
.rb-status.hit { background: var(--up-soft); color: var(--up); font-weight: 700; }
.wt { display: flex; flex-direction: column; gap: 6px; }
.wt-row { display: grid; grid-template-columns: 64px 1fr 56px; gap: 10px; align-items: center; font-size: var(--fs-s); }
.wt-lab { color: var(--muted); }
.wt-row b { text-align: right; font-weight: 600; }
.wt-bar { height: 6px; border-radius: 3px; overflow: hidden; }
.wt-bar i { display: block; height: 100%; border-radius: 3px; background: var(--faint); }
.wt-bar.now i { background: var(--accent); }
.wt > b { font-size: var(--fs-m); }
.wt-diff { align-self: flex-end; font-size: var(--fs-s); font-weight: 600; }
.wt-diff.down { color: var(--down); }
.wt-diff.up { color: var(--up); }
.wt-diff.flat { color: var(--muted); }
.stairs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.stairs li { display: grid; grid-template-columns: 92px 1fr 84px 64px; gap: 10px; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: var(--fs-s); }
.st-name { font-weight: 500; }
.st.up .st-name { color: var(--up); }
.st.dn .st-name { color: var(--down); }
.st-amt, .st-gap { text-align: right; color: var(--muted); }
.st.hit { background: var(--up-soft); }
.st.hit .st-gap { color: var(--up); font-weight: 700; }
.st-now { margin: 4px 0; background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.st-now .st-name { color: var(--accent); font-weight: 700; }
.st-now .st-range { font-weight: 700; }
.rb-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--fs-s); }
.rb-actions { display: flex; gap: 6px; }
.rb-actions .btn { border-radius: 999px; transition: transform .2s cubic-bezier(.32,.72,0,1), background .2s cubic-bezier(.32,.72,0,1); }
.rb-actions .btn:active { transform: scale(.98); }
@media (max-width: 1180px) {
  .rb-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rb-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-split { grid-template-columns: minmax(0, 1fr); }
  .rb-split .rb-card { position: static; order: 0; }
  .rb-order { grid-template-columns: 60px 1fr auto; }
  .rb-order .num:first-of-type { display: none; }
  .stairs li { grid-template-columns: 78px 1fr 64px; }
  .st-amt { display: none; }
}
