/* ────────────────────────────────────────────────────────────────
   hkbit — Linear/Cursor 풍 다크, 모던 미니멀
   ──────────────────────────────────────────────────────────────── */

:root {
  /* surfaces — slight cool tint */
  --bg-0: oklch(0.135 0.006 250);
  --bg-1: oklch(0.165 0.006 250);
  --bg-2: oklch(0.195 0.006 250);
  --surface: oklch(0.215 0.006 250);
  --surface-hi: oklch(0.255 0.007 250);
  --surface-active: oklch(0.295 0.008 250);

  /* hairlines */
  --line: oklch(0.27 0.006 250);
  --line-soft: oklch(0.22 0.005 250);
  --line-strong: oklch(0.36 0.008 250);

  /* text */
  --t0: oklch(0.965 0.005 250);
  --t1: oklch(0.82 0.005 250);
  --t2: oklch(0.62 0.005 250);
  --t3: oklch(0.46 0.005 250);
  --t4: oklch(0.34 0.005 250);

  /* trading + agent */
  --long: oklch(0.76 0.16 148);
  --long-soft: oklch(0.76 0.16 148 / 0.14);
  --short: oklch(0.69 0.20 25);
  --short-soft: oklch(0.69 0.20 25 / 0.14);
  --main: oklch(0.80 0.13 220);
  --main-soft: oklch(0.80 0.13 220 / 0.16);
  --warn: oklch(0.82 0.15 78);

  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 14px;

  --font-sans: "Geist", "Pretendard Variable", "Pretendard", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "Pretendard Variable", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--t0);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow: hidden;
}

button { font-family: inherit; cursor: default; }
input, textarea { font-family: inherit; }

/* ── tokens / utilities ───────────────────────────────────────── */

.mono { font-family: var(--font-mono); font-feature-settings: "zero", "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--t2); }
.muted-2 { color: var(--t3); }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font: 500 10px/1 var(--font-mono);
  color: var(--t1);
  background: var(--surface-hi);
  border: 0.5px solid var(--line);
  border-radius: 4px;
}

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--t3); display: inline-block; flex-shrink: 0;
}
.dot.on { background: var(--long); box-shadow: 0 0 0 3px oklch(0.76 0.16 148 / 0.18); }
.dot.off { background: var(--t4); }
.dot.warn { background: var(--warn); }
.dot.main { background: var(--main); box-shadow: 0 0 0 3px var(--main-soft); }

/* ── login ─────────────────────────────────────────────────────── */

.login-shell {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--bg-0);
  overflow: hidden;
}
.login-shell::before {
  content: ""; position: absolute; inset: -200px;
  background:
    radial-gradient(800px 500px at 30% 20%, oklch(0.30 0.025 220 / 0.35), transparent 60%),
    radial-gradient(600px 400px at 80% 85%, oklch(0.28 0.035 280 / 0.30), transparent 60%);
  filter: blur(20px);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 400px;
  padding: 28px;
  background: linear-gradient(180deg, oklch(0.20 0.006 250 / 0.85), oklch(0.18 0.006 250 / 0.9));
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 0.5px oklch(1 0 0 / 0.04) inset,
    0 30px 80px -20px rgb(0 0 0 / 0.6);
  backdrop-filter: blur(20px);
}

/* ── workspace shell ───────────────────────────────────────────── */

.workspace {
  height: 100%;
  display: grid;
  grid-template-rows: 44px 1fr 24px;
  background: var(--bg-0);
}

.topbar {
  display: flex; align-items: center;
  padding: 0 12px;
  border-bottom: 0.5px solid var(--line);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  gap: 14px;
  white-space: nowrap;
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; letter-spacing: -0.005em;
  font-size: 13px;
}
.brand-mark {
  width: 18px; height: 18px;
  border-radius: 5px;
  background:
    conic-gradient(from 220deg, var(--main) 0%, oklch(0.55 0.13 250) 60%, var(--main) 100%);
  box-shadow: 0 0 0 0.5px oklch(1 0 0 / 0.15) inset;
  flex-shrink: 0;
}
.topbar .sep { width: 1px; height: 18px; background: var(--line); }
.topbar .crumbs { color: var(--t2); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.topbar .crumbs strong { color: var(--t0); font-weight: 500; }
.topbar .crumb-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin: 0 -6px;
  color: var(--t2);
  font: inherit;
  font-size: 12px;
  border-radius: 4px;
  cursor: default;
  transition: color .12s, background .12s;
}
.topbar .crumb-link:hover { color: var(--t0); background: var(--surface); }

.topbar .ws-edit-btn {
  width: 22px; height: 22px;
  margin-left: 2px;
  color: var(--t3);
}
.topbar .ws-edit-btn:hover { color: var(--t0); }
.topbar .spacer { flex: 1; }

.exch-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px;
  font-size: 11.5px;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: 999px;
  color: var(--t1);
}

.icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent; color: var(--t2);
  border: 0; border-radius: 6px;
}
.icon-btn:hover { background: var(--surface); color: var(--t0); }

/* ── main split ─────────────────────────────────────────────────── */

.main {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  overflow: hidden;
  min-height: 0;
}
.main.compact { grid-template-columns: 240px 1fr 320px; }
.main.spacious { grid-template-columns: 320px 1fr 400px; }

.pane {
  background: var(--bg-0);
  border-right: 0.5px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pane:last-child { border-right: 0; border-left: 0.5px solid var(--line); }

.pane-hdr {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-bottom: 0.5px solid var(--line);
  font-size: 11px; font-weight: 500;
  color: var(--t1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  white-space: nowrap;
}
.pane-hdr .grow { flex: 1; }

.pane-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.pane-body::-webkit-scrollbar { width: 8px; }
.pane-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }

/* ── status bar ─────────────────────────────────────────────────── */
.statusbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px;
  border-top: 0.5px solid var(--line);
  background: var(--bg-0);
  font: 500 10.5px/1 var(--font-mono);
  color: var(--t3);
  letter-spacing: 0.02em;
}
.statusbar .seg { display: inline-flex; align-items: center; gap: 6px; }
.statusbar .seg b { color: var(--t1); font-weight: 500; }

/* ── form ───────────────────────────────────────────────────────── */

.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-2);
  color: var(--t0);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus {
  border-color: var(--main);
  background: oklch(0.21 0.008 250);
  box-shadow: 0 0 0 3px var(--main-soft);
}
.input.mono { font: 500 12.5px/1 var(--font-mono); letter-spacing: 0.01em; }

.btn {
  height: 36px;
  padding: 0 14px;
  border: 0.5px solid transparent;
  border-radius: var(--radius);
  font: 500 13px/1 var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn.primary {
  background: var(--t0); color: var(--bg-0);
  border-color: var(--t0);
}
.btn.primary:hover { background: oklch(1 0 0); }
.btn.primary:disabled { opacity: 0.4; }
.btn.ghost { background: transparent; color: var(--t1); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface); color: var(--t0); }
.btn.tiny { height: 22px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }

/* ── card primitive ─────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

/* ── badges ─────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.02em;
  border-radius: 4px;
  color: var(--t1);
  background: var(--surface-hi);
  border: 0.5px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge.long { color: var(--long); background: var(--long-soft); border-color: oklch(0.76 0.16 148 / 0.3); }
.badge.short { color: var(--short); background: var(--short-soft); border-color: oklch(0.69 0.20 25 / 0.3); }
.badge.main { color: var(--main); background: var(--main-soft); border-color: oklch(0.80 0.13 220 / 0.3); }
.badge.warn { color: var(--warn); background: oklch(0.82 0.15 78 / 0.15); border-color: oklch(0.82 0.15 78 / 0.3); }
.badge.off { color: var(--t3); }

/* ── selection ──────────────────────────────────────────────────── */
::selection { background: var(--main-soft); color: var(--t0); }

/* Service integration state */
.service-error,
.service-banner,
.service-toast {
  border: 0.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--t1);
  font-size: 12px;
}
.service-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 12px 14px;
  border-color: oklch(0.69 0.20 25 / 0.45);
  background: oklch(0.69 0.20 25 / 0.08);
}
.service-banner {
  padding: 10px 12px;
  color: var(--t2);
}
.service-toast {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-color: oklch(0.82 0.15 78 / 0.45);
  background: oklch(0.82 0.15 78 / 0.10);
  box-shadow: 0 12px 36px oklch(0 0 0 / 0.28);
}
select.input {
  color-scheme: dark;
}
