/* 색상은 dataviz 검증 통과한 팔레트 (light/dark 양쪽 PASS).
   series-1 blue = spot, series-2 orange = usdm */
:root {
  color-scheme: light;
  /* 중성색은 순회색이 아니라 강조색(파랑) 쪽으로 살짝 기울인다 */
  --surface-0: #f3f4f7;      /* 페이지 바닥 */
  --surface-1: #ffffff;      /* 패널 */
  --surface-2: #eaedf2;      /* 패널 안의 인셋(입력, 레일) */
  --border: #dde1e8;
  --border-strong: #c7cdd8;
  --text-primary: #0f1420;
  --text-secondary: #4a5266;
  --text-muted: #7c8496;

  /* 타입 시스템 — 이 여섯 개 밖의 크기는 쓰지 않는다 */
  --fs-xs: 12px;   /* eyebrow, 태그 */
  --fs-sm: 14px;   /* 표 본문, 보조 */
  --fs-md: 15px;   /* 본문 */
  --fs-lg: 18px;   /* 카드 제목, 강조값 */
  --fs-xl: 26px;   /* 페이지 제목 */
  --fs-2xl: 44px;  /* 히어로 숫자 */

  --font-ui: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", var(--font-ui);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* 반경 — 셋만 */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --good: #008300;
  --critical: #e34948;
  --warning: #eda100;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0e1117;
    --surface-1: #151a23;
    --surface-2: #1c2230;
    --border: #262d3b;
    --border-strong: #354055;
    --text-primary: #eef1f6;
    --text-secondary: #aab3c5;
    --text-muted: #6f7a90;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --good: #4caf50;
    --critical: #e66767;
    --warning: #c98500;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0e1117;
  --surface-1: #151a23;
  --surface-2: #1c2230;
  --border: #262d3b;
  --border-strong: #354055;
  --text-primary: #eef1f6;
  --text-secondary: #aab3c5;
  --text-muted: #6f7a90;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --good: #4caf50;
  --critical: #e66767;
  --warning: #c98500;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}



.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(15, 20, 32, 0.04);
}

.card h2 {
  margin: 0 0 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.card h2 .sub { color: var(--text-muted); font-weight: 400; margin-left: 6px; }

.hero { font-size: 52px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }

.as-of { color: var(--text-muted); font-size: 15px; margin-top: 10px; }

.deltas { display: flex; gap: 42px; flex-wrap: wrap; margin-top: 28px; }
.delta-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.delta-value { font-size: 22px; font-weight: 600; }
.delta-pct { font-size: 15px; font-weight: 500; }

.up { color: var(--good); }
.down { color: var(--critical); }
.muted { color: var(--text-muted); }
.ok { color: var(--good); font-weight: 600; }
.warn { color: var(--warning); font-weight: 600; }

.chart-box { height: 340px; position: relative; }

.range-row { display: flex; gap: 8px; margin-bottom: 22px; }
.range-row a {
  padding: 8px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: 15px;
  text-decoration: none;
  color: var(--text-secondary);
}
.range-row a.active {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
}

.legend { display: flex; gap: 24px; flex-wrap: wrap; font-size: 14px;
  color: var(--text-secondary); margin-bottom: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: var(--r-sm); display: inline-block; }
.sw-spot { background: var(--series-1); }
.sw-usdm { background: var(--series-2); }

/* 인접 세그먼트 사이 2px 서피스 갭 (dataviz mark spec) */
.bar { display: flex; height: 36px; border-radius: var(--r-md); overflow: hidden; gap: 2px; }
.seg { height: 100%; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.5; }
/* 숫자 열은 모노스페이스 — 소수점이 열마다 정렬돼 표가 "금융 도구"처럼 읽힌다 */
td { font-family: var(--font-mono); font-size: 13.5px; }
td:first-child, td.sym, td.asset { font-family: var(--font-ui); font-size: var(--fs-sm); }
th {
  text-align: right; font-weight: 500; color: var(--text-muted);
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
  white-space: nowrap;
}
th:nth-child(1), td:nth-child(1) { text-align: left; }
/* 잔고 표는 자산명만 왼쪽, 나머지 숫자는 오른쪽 */
table:not(.dep-table) th:nth-child(2),
table:not(.dep-table) td:nth-child(2) { text-align: left; }
td {
  padding: 14px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); text-align: right; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
td.asset { color: var(--text-primary); font-weight: 500; }
td.value { color: var(--text-primary); }

.chip { display: inline-block; padding: 4px 10px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500; }
.chip-spot { background: color-mix(in srgb, var(--series-1) 16%, transparent);
  color: var(--series-1); }
.chip-usdm { background: color-mix(in srgb, var(--series-2) 16%, transparent);
  color: var(--series-2); }

.banner {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: var(--r-lg); padding: 16px 20px; font-size: 15px;
  margin-bottom: 22px; line-height: 1.6;
}

.status-line { font-size: 15px; color: var(--text-secondary); }
.fail-head { color: var(--text-muted); font-size: 15px; margin: 12px 0 6px; }
.fail-list { margin: 0; padding-left: 20px; line-height: 2;
  font-size: 15px; color: var(--text-secondary); }

.empty { color: var(--text-muted); font-size: 15px; padding: 44px 0; text-align: center; }

@media (max-width: 640px) {
  .hero { font-size: 38px; }
  .deltas { gap: 18px; }
  .wrap { padding: 20px 16px 48px; }
}

/* ── CMS 셸: 고정 사이드바 + 콘텐츠 ─────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  /* 요청: 기존(408) 의 1.3배. 접으면 로고만 남는 레일(64px)이 된다 */
  --side-w: 530px;
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  transition: width 160ms ease, flex-basis 160ms ease;
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 18px;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
}

.side-nav { flex: 1; overflow-y: auto; padding: 0 14px 14px; }

.side-label {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 20px 16px 10px;
}

.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.35;
}
.side-item:hover { background: var(--surface-0); }
.side-item.active {
  background: color-mix(in srgb, var(--series-1) 14%, transparent);
  color: var(--text-primary);
  font-weight: 500;
}
.side-item.off { opacity: 0.45; }
.side-all { margin-bottom: 2px; }

.side-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  /* 계정명이 길어도 두 줄까지 보여준다 (이메일·지갑주소) */
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}
.side-sub {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dot-ok   { background: var(--good); }
.dot-warn { background: var(--warning); }
.dot-off  { background: var(--text-muted); opacity: 0.5; }

.side-add {
  display: block;
  margin: 0 18px 22px;
  padding: 13px 16px;
  font-size: 15px;
  text-align: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
}
.side-add:hover { color: var(--text-primary); }

/* 콘텐츠 */
.content { flex: 1; min-width: 0; }

.content-head {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  padding: 26px 40px 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.content-head h1 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0;
}

.head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 20px;
}
.head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.head-note { font-style: italic; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 2px; }
.tabs a {
  padding: 13px 20px;
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--series-1);
}

.content-body { padding: 32px 40px 80px; max-width: 1120px; }

/* 공통 컨트롤 */
.btn, .btn-sm, .btn-xs, .btn-ghost {
  display: inline-block;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn { padding: 11px 24px; font-size: 16px; font-weight: 500;
       background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-xs { padding: 6px 13px; font-size: 13px; }
.btn-ghost { padding: 8px 16px; font-size: 16px; }
.btn:hover, .btn-sm:hover, .btn-xs:hover { filter: brightness(1.1); }
form.inline { display: inline; }

.acct-id {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
}

.flash {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 40%, transparent);
  color: var(--text-primary);
  border-radius: var(--r-lg);
  padding: 15px 20px;
  font-size: 15px;
  margin-bottom: 22px;
}

.warn-banner {
  background: color-mix(in srgb, var(--critical) 12%, transparent);
  border-color: color-mix(in srgb, var(--critical) 40%, transparent);
}
.warn-banner a { color: var(--text-primary); }

.hint { font-size: 13px; color: var(--text-muted); margin: 10px 0 0; line-height: 1.6; }

table.accounts td { vertical-align: middle; }
.acct-link { color: var(--text-primary); font-weight: 500;
             text-decoration: none; margin-right: 8px; }
.acct-link:hover { text-decoration: underline; }
.row-off { opacity: 0.5; }
.dim { color: var(--text-muted); }
.actions { white-space: nowrap; }

.chip-ok   { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.chip-warn { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.chip-off  { background: var(--surface-0); color: var(--text-muted);
             border: 1px solid var(--border); }

/* 폼 */
.form label { display: block; margin-bottom: 22px; }
.form label > span { display: block; font-size: 15px;
                     color: var(--text-secondary); margin-bottom: 6px; }
.form input[type="text"], .form input[type="password"] {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-0);
  color: var(--text-primary); font-family: inherit; font-size: 16px;
}
.form input:focus {
  outline: 2px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  outline-offset: -1px;
}
.form input:disabled { color: var(--text-muted); }
.form small { display: block; font-size: 13px; color: var(--text-muted); margin-top: 5px; }
.form fieldset { border: 1px solid var(--border); border-radius: var(--r-lg);
                 padding: 24px; margin: 0 0 22px; }
.form legend { font-size: 14px; color: var(--text-secondary); padding: 0 10px;
               display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form fieldset .hint { margin: 0 0 20px; max-width: 62ch; }
.form fieldset label:last-of-type { margin-bottom: 0; }
.form-actions { display: flex; align-items: center; gap: 10px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static;
             border-right: none; border-bottom: 1px solid var(--border); }
  .side-nav { max-height: 210px; }
  .content-head { padding: 16px 16px 0; position: static; }
  .content-body { padding: 18px 16px 48px; }
}

/* Portfolio Margin 지갑 */
.sw-pm { background: var(--series-3, #1baf7a); }
.chip-pm { background: color-mix(in srgb, var(--series-3, #1baf7a) 16%, transparent);
           color: var(--series-3, #1baf7a); }


/* ═══ 개요: 3단 위계 ═══════════════════════════════════════════════════════
   1단 메인 — 테두리 없음, 배경만. 큰 숫자가 주인공
   2단 보조 — 구분선만
   3단 목록 — 카드 (테두리 있음)
   ────────────────────────────────────────────────────────────────────── */

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  margin-left: 5px;
  white-space: nowrap;
}

.dim { color: var(--text-muted); }

/* ── 1단 ── */
.primary {
  background: var(--surface-1);
  border-radius: var(--r-lg);
  padding: 30px 32px 26px;
  margin-bottom: 20px;
}
.primary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.primary-value {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 640;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-top: 10px;
  color: var(--text-primary);
}
.primary-meta { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

.primary-deltas { display: flex; gap: 36px; margin-top: 20px; flex-wrap: wrap; }
.pd { display: flex; flex-direction: column; gap: 6px; }
.pd-label { font-size: 12px; color: var(--text-muted); }
.pd-value { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.pd-pct {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  margin-left: 3px;
}

.primary-chartrow {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}
.ranges { display: flex; gap: 2px; background: var(--surface-2);
          border-radius: var(--r-md); padding: 3px; }
.ranges a {
  padding: 6px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
}
.ranges a.on { background: var(--surface-1); color: var(--text-primary); }
.ranges a:hover:not(.on) { color: var(--text-secondary); }

.primary-chart { height: 240px; margin-top: 24px; }

/* 총자산 — 맨 위 한 줄. 가로로 눕혀서 높이를 덜 쓴다 */
.totalbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 0 4px 20px;
  margin-bottom: 18px;
}
.tb-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
}
.tb-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 640;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-top: 8px;
}
.tb-asof {
  font-size: 13px;
  color: var(--text-muted);
  padding-bottom: 6px;
  white-space: nowrap;
}

/* 담보 자산 — USDT 아래 나란히 */
.collateral {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.col-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px 16px;
}
.col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.col-asset {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.col-usd { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.col-qty {
  font-family: var(--font-display);
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 28px;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 12px;
  line-height: 1.1;
}
.col-chg { font-size: 14px; font-weight: 600; }
.col-chart { height: 96px; margin-top: 14px; }

/* ── 3단 ── */
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0 !important; }
.count { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

table.lean th {
  font-size: 12px;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--border);
}
table.lean td { padding: 15px 14px; }
table.lean tbody tr:hover { background: var(--surface-0); }
td.sym { color: var(--text-primary); font-weight: 600; letter-spacing: -0.01em; }

.side {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-sm);
}
.side.long  { background: color-mix(in srgb, var(--good) 16%, transparent);
              color: var(--good); }
.side.short { background: color-mix(in srgb, var(--critical) 16%, transparent);
              color: var(--critical); }
.lev { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

.fill {
  display: inline-block;
  width: 46px;
  height: 5px;
  border-radius: var(--r-sm);
  background: var(--surface-0);
  border: 1px solid var(--border);
  overflow: hidden;
  vertical-align: middle;
  margin-right: 7px;
}
.fill i { display: block; height: 100%; background: var(--series-1); }

.empty-line {
  font-size: 14px;
  color: var(--text-muted);
  padding: 14px 0 6px;
}

@media (max-width: 720px) {
  .primary { padding: 24px 20px 20px; }
  .primary-value { font-size: 40px; }
  .primary-deltas { gap: 22px; }
  .primary-chart { height: 210px; }
}

/* ── 로그인 ────────────────────────────────────────────────────────────── */
/* ── 로그인 — 왼쪽 브랜드 패널 + 오른쪽 폼 ─────────────────────────────── */
.login-body { margin: 0; background: var(--surface-1); }
.login-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }

/* 브랜드 패널 — 배경 이미지 한 장. 위쪽만 살짝 어둡게 해서 로고가 읽히게 한다 */
.login-hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 56px 36px;
  color: #eef3fb;
  background:
    linear-gradient(180deg, rgba(6, 10, 24, 0.55) 0%, rgba(6, 10, 24, 0) 28%),
    url("/static/login-bg.jpg") center / cover no-repeat,
    #0b1530;
}
.lh-brand, .lf-brand-sm {
  position: relative; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 18px; font-weight: 650; letter-spacing: -0.01em;
}
.lh-mark {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px;
  background: linear-gradient(135deg, #3987e5, #8cc0ff);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 6px 18px rgba(57,135,229,0.35);
}

/* 폼 */
.login-pane { display: flex; align-items: center; justify-content: center; padding: 48px 28px; }
.login-form { width: 100%; max-width: 380px; }
.lf-brand-sm { display: none; color: var(--text-primary); margin-bottom: 28px; }
.lf-title { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 650; letter-spacing: -0.02em; color: var(--text-primary); }
.lf-sub { margin: 8px 0 30px; font-size: 15px; color: var(--text-muted); }
.lf-field { display: block; margin-bottom: 18px; }
.lf-field > span:first-child { display: block; font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.lf-field input {
  width: 100%; height: 50px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-0); color: var(--text-primary);
  font-family: inherit; font-size: 16px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.lf-field input:focus {
  outline: none; border-color: var(--series-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--series-1) 18%, transparent);
}
.lf-pw { position: relative; display: block; }
.lf-pw input { padding-right: 72px; }
.lf-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  height: 34px; padding: 0 12px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.lf-eye:hover { color: var(--text-primary); background: var(--surface-2); }
.lf-submit {
  width: 100%; height: 52px; margin-top: 10px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(180deg, #4a93ea, #2a78d6);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 8px 20px rgba(42, 120, 214, 0.28);
  transition: filter 120ms ease, transform 120ms ease;
}
.lf-submit:hover { filter: brightness(1.06); }
.lf-submit:active { transform: translateY(1px); }
.lf-help { margin: 22px 0 0; font-size: 13px; color: var(--text-muted); text-align: center; line-height: 1.6; }
.login-error {
  margin: -8px 0 20px; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  color: var(--critical); background: color-mix(in srgb, var(--critical) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .lf-brand-sm { display: flex; }
  .login-pane { align-items: flex-start; padding: 56px 20px 40px; }
}
.side-logout { margin: 0 18px 20px; }
.side-logout button { width: 100%; cursor: pointer; font-family: inherit;
                      background: transparent; }
.logout {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.logout:hover { color: var(--text-primary); }

/* 실시간 조회 표시 — 정각 스냅샷이 아니라 지금 값이라는 신호 */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 7px;
  vertical-align: middle;
}

/* 초기 입금액 입력 — 자산별 한 줄 */
.dep-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px !important;
}
.dep-row > span {
  margin-bottom: 0 !important;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
.dep-row:last-of-type { margin-bottom: 0 !important; }

/* 셀 입력 (입출금 폼) */
.cell-input {
  width: 100%;
  max-width: 220px;
  padding: 8px 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.cell-input:focus {
  outline: 2px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  outline-offset: -1px;
}
.del-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0 !important;
}
.del-box input { cursor: pointer; }
.add-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.add-row .cell-input { max-width: 180px; }

/* 개요 머리 — 총 잔고(왼쪽) + 기준 시각(오른쪽). 카드 아님.
   글자 크기는 페이지에 있는 것만 쓴다:
   라벨 = .eyebrow(12px), 숫자 = .pnl-delta-value 와 동일(32px), 시각 = .count(13px) */
.overview-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.overview-head .eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.overview-total {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.overview-head .count { padding-bottom: 4px; }

/* 입출금 원장 */
.flow-sums { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-top: 18px; }
.flow-sum { display: grid; gap: 2px; }
.flow-sum-asset {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.flow-sum-amt {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.flow-sum .dim { font-size: var(--fs-xs); }
.flow-add {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.flow-field {
  display: grid;
  gap: 6px;
  margin: 0 !important;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.flow-field small { font-weight: 400; margin-left: 4px; }
.flow-field .cell-input { max-width: 200px; }
.flow-note { flex: 1 1 200px; }
.flow-note .cell-input { max-width: none; }
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  height: 38px;
}
.seg label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  margin: 0 !important;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}
.seg label + label { border-left: 1px solid var(--border); }
.seg label:has(input:checked) { background: var(--surface-2); }
.seg input { margin: 0; }
.flow-kind {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-sm);
}
.flow-kind.in  { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.flow-kind.out { color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, transparent); }
td.value.up { color: var(--good); }
td.value.down { color: var(--critical); }

/* 기간별 손익 — 기간 버튼과 연동 */
.range-pnl {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 600;
}
.range-pnl .dim { font-size: 13px; font-weight: 500; }

/* 구분선 — 담보 카드와 손익 차트 사이 */
hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 26px 0 22px;
}
.pnl-box { height: 340px; min-height: 340px; }
@media (max-width: 720px) {
  .pnl-box { height: 240px; min-height: 240px; }
  .pnl-delta-value { font-size: 26px; }
}

/* 손익 차트 위 기간 델타 */
.pnl-delta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: -4px 0 20px;
}
.pnl-delta-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.pnl-delta-pct { font-size: 17px; font-weight: 600; }
.pnl-delta .dim { font-size: 14px; }

.form select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
}
.exch-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: var(--surface-0);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 6px;
}

/* Hyperliquid 지갑 */
.sw-hl-spot { background: var(--series-3, #1baf7a); }
.sw-hl-perp { background: var(--series-2); }
.chip-hl-spot { background: color-mix(in srgb, var(--series-3, #1baf7a) 16%, transparent);
                color: var(--series-3, #1baf7a); }
.chip-hl-perp { background: color-mix(in srgb, var(--series-2) 16%, transparent);
                color: var(--series-2); }

/* ── 자산별 추이 (잔고 탭) ─────────────────────────────────────────────
   자산마다 수량 단위가 달라(BTC 5 vs USDT 348,170) 축을 따로 잡는다.
   한 줄에 하나씩, 구분선으로 나눈다.
   ──────────────────────────────────────────────────────────────────── */
.asset-rows { display: flex; flex-direction: column; }

/* 잔고(수량)를 위에, 차트를 그 아래에 둔다 */
.asset-card {
  display: block;
  padding: 26px 4px 30px;
}
.asset-card + .asset-card { border-top: 1px solid var(--border); }
.asset-card:first-child { padding-top: 8px; }
.asset-card:last-child { padding-bottom: 8px; }

/* 차트가 눌려 보이지 않게 충분히 준다 */
.asset-chart {
  height: 260px;
  min-height: 260px;
  position: relative;
  min-width: 0;
  margin-top: 16px;
}

.col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.col-asset {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.col-usd { font-size: 13px; color: var(--text-muted); }
.col-qty {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 26px;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 10px;
  line-height: 1.15;
}
.col-chg { font-size: 14px; font-weight: 600; }

@media (max-width: 720px) {
  .asset-card { padding: 20px 4px 24px; }
  .asset-chart { height: 200px; min-height: 200px; }
}

/* ── 유저 대시보드: 계정 카드 ─────────────────────────────────────────── */
.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.acct-card {
  display: block;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px 18px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 120ms ease;
}
.acct-card:hover { border-color: color-mix(in srgb, var(--series-1) 55%, var(--border)); }
.acct-card.off { opacity: 0.55; }

.acct-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.acct-card-name {
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.acct-card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.acct-card-qty {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-top: 6px;
}
.acct-card-pnl {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 17px;
  font-weight: 600;
}
.acct-card-pct { font-size: 14px; }
.acct-card-pnl .dim { font-size: 13px; font-weight: 500; }

.acct-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.acct-card-foot .dot { margin-left: auto; }

/* 사이드바 '관리' 항목 */
.side-admin { margin-top: 6px; }

/* 수집 실패 원문은 접어둔다 — 유저 화면에서 JSON 이 쏟아지지 않게 */
.fail-detail { display: inline; margin-left: 8px; }
.fail-detail summary {
  display: inline;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: underline dotted;
}
.fail-detail code {
  font-family: var(--font-mono);
  display: block;
  margin: 8px 0 4px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-0);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
}

/* ── 거래소 로고 (사이드바 등) ─────────────────────────────────────────── */
.exch-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sz, 22px);
  height: var(--sz, 22px);
  flex: 0 0 var(--sz, 22px);
  border-radius: var(--r-md);
  color: #fff;
}
.exch-logo svg { width: 70%; height: 70%; display: block; }
.exch-logo img { width: 68%; height: 68%; display: block; object-fit: contain; }
/* 공식 브랜드 색 위에 마크를 얹는다 */
.exch-binance     { background: #f0b90b; }
.exch-binance img { filter: brightness(0) saturate(100%); }  /* 노란 배경 위 검정 마크 */
.exch-hyperliquid { background: #072723; }                    /* HL 민트는 짙은 바탕에서 산다 */
.exch-hyperliquid img { width: 84%; height: 84%; }
/* 거래소 없음 — 이미지 자체가 검은 둥근 사각형 + 주황 점이라 배경 없이 꽉 채운다 */
.exch-non-exchange { background: transparent; overflow: hidden; }
.exch-non-exchange img { width: 100%; height: 100%; }
/* 로고 모서리의 상태 점 — 정보를 버리지 않고 자리만 옮긴다 */
.exch-status {
  position: absolute;
  right: -3px; bottom: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--surface-1);
  box-sizing: content-box;
}
.exch-status.dot-ok   { background: var(--good); }
.exch-status.dot-warn { background: var(--warning); }
.exch-status.dot-off  { background: var(--text-muted); }
.side-item.active .exch-status { border-color: color-mix(in srgb, var(--series-1) 14%, var(--surface-1)); }
.side-acct { min-width: 0; overflow-wrap: anywhere; }


/* ── 사이드바 접기 ─────────────────────────────────────────────────────
   접힌 상태는 <html data-side="collapsed"> 로 표시한다.
   body 가 아니라 html 에 두는 이유: 첫 페인트 전에 <head> 스크립트가
   저장값을 읽어 붙이므로, 펼친 채 깜빡이고 접히는 일이 없다.
   ──────────────────────────────────────────────────────────────────── */
.side-toggle {
  position: absolute;
  top: 18px; right: 12px;
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.side-toggle:hover { color: var(--text-primary); }
.side-toggle svg { width: 14px; height: 14px; }
.sidebar { position: sticky; }   /* absolute 토글의 기준 */

html[data-side="collapsed"] .sidebar { --side-w: 64px; }
html[data-side="collapsed"] .brand,
html[data-side="collapsed"] .side-acct,
html[data-side="collapsed"] .side-sub,
html[data-side="collapsed"] .side-all .side-name,
html[data-side="collapsed"] .side-admin .side-name,
html[data-side="collapsed"] .side-add,
html[data-side="collapsed"] .side-logout { display: none; }
html[data-side="collapsed"] .side-toggle { right: 18px; }
/* 접히면 그룹 라벨은 짧은 가로선으로 — 묶음 경계만 남긴다 */
html[data-side="collapsed"] .side-label {
  font-size: 0; padding: 0; height: 1px; width: 24px;
  margin: 10px auto; background: var(--border);
}
html[data-side="collapsed"] .side-nav { padding: 56px 8px 8px; }
html[data-side="collapsed"] .side-item { justify-content: center; padding: 10px 0; }
/* 접힌 레일에서는 "전체" 항목을 홈 아이콘처럼 보이게 */
html[data-side="collapsed"] .side-all::before,
html[data-side="collapsed"] .side-admin::before {
  content: ""; display: block; width: 22px; height: 22px; border-radius: var(--r-md);
  border: 1.5px solid var(--text-muted);
}
html[data-side="collapsed"] .side-toggle svg { transform: rotate(180deg); }

/* 브랜드 앞의 마크 — 로고 자리 */
.brand::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--series-1), color-mix(in srgb, var(--series-1) 55%, #fff));
  flex: 0 0 22px;
}
html[data-side="collapsed"] .brand { display: none; }


/* 페이지 제목 옆 거래소 로고 — 태그 대신 */
.head-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.head-title h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }



/* ── 이자 지급 ─────────────────────────────────────────────────────────── */
/* 원금 열도 숫자라 오른쪽 정렬 (기본 표는 2열이 자산명이라 왼쪽) */
table.yield-table th:nth-child(2),
table.yield-table td:nth-child(2) { text-align: right; }
.row-pending td { color: var(--text-muted); }
.row-pending .chip { margin-left: 6px; }
.pd-label small { font-size: 11px; opacity: 0.8; margin-left: 4px; }

.yield-mismatch { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* 개요 — 총잔고 vs 거래소 잔고 */
.hero { padding: 32px 36px 30px; }
.hero-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.hero-hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.hero-asof { font-size: 13px; color: var(--text-muted); }
.hero-value {
  font-family: var(--font-display); font-size: 56px; font-weight: 640;
  letter-spacing: -0.03em; line-height: 1.05; margin-top: 14px; overflow-wrap: anywhere;
}
.unit { font-size: 0.38em; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-left: 0.35em; }

/* 총잔고 — 자산이 둘이면 나란히 */
.hero-owed { display: flex; flex-wrap: wrap; gap: 8px 56px; align-items: flex-end; }
.hero-owed.multi { display: grid; grid-template-columns: repeat(2, max-content); gap: 18px 56px; }
.hero-value { white-space: nowrap; }
.hero-owed.multi .hero-value { font-size: 40px; }
.owed-apr { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.asset-pills a { min-width: 3.5em; text-align: center; }
.owed-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; }
.owed-line + .owed-line { margin-top: 2px; }
.owed-line .unit { font-size: 13px; }
.owed-line .owed-apr { margin: 0 0 0 auto; font-size: 12px; font-family: var(--font-ui); font-weight: 500; }

/* 총잔고 아래 한 줄 — 거래소 잔고는 살짝만 */
.hero-note {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.hero-note b { font-weight: 600; color: var(--text-primary); }
.hero-note .dim { margin-left: auto; font-size: 12px; }

/* 차트 카드 */
.chart-card .card-head { flex-wrap: wrap; gap: 12px 24px; }
.chart-card .card-head h2 { white-space: nowrap; }
.chart-tools { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.chart-card .legend { margin: 0; font-size: 13px; color: var(--text-secondary); }
.chart-card .chart-box { height: 320px; }
.sw-target { background: transparent; border: 1.5px dashed var(--text-secondary); }

/* 지급 기록 — 세 칸 */
.payout-table td, .payout-table th { width: 33%; }
table.payout-table th:nth-child(2), table.payout-table td:nth-child(2) { text-align: right; }
.payout-table td:first-child { color: var(--text-secondary); }
.payout-more { margin-top: 4px; }
.payout-more summary {
  cursor: pointer; list-style: none; padding: 14px 14px 4px;
  font-size: 14px; color: var(--text-secondary);
}
.payout-more summary::-webkit-details-marker { display: none; }
.payout-more summary::before { content: "▸ "; color: var(--text-muted); }
.payout-more[open] summary::before { content: "▾ "; }
.payout-more summary:hover { color: var(--text-primary); }

@media (max-width: 600px) {
  .hero { padding: 24px 20px; }
  .hero-value { font-size: 40px; }
  .hero-stats { gap: 18px 32px; }
  .hs-value { font-size: 22px; }
  .cover { flex-wrap: wrap; }
  .cover-label { width: 100%; }
}

/* 대시보드 카드 */
.acct-card-yield { display: grid; gap: 4px; margin-top: 14px; font-size: 13px;
                   font-variant-numeric: tabular-nums; }
.acct-card-yield b { font-weight: 600; color: var(--text-primary); }

/* ── 글자 크기 — 작은 글씨(12px 안팎)는 읽기 어려워 최소 14px 로 올린다 ── */
.hero .eyebrow { font-size: 16px; letter-spacing: 0.02em; color: var(--text-secondary); }
.hero-hint { font-size: 14px; color: var(--text-muted); }
.hero-asof { font-size: 14px; }
.owed-apr { font-size: 16px; margin-top: 8px; color: var(--text-secondary); }
.unit { font-size: 0.42em; }
.hero-note { font-size: 16px; gap: 8px 24px; }
.hero-note .dim { font-size: 14px; }

.card h2 { font-size: 18px; }
.count { font-size: 14px; }
.ranges a { font-size: 14px; padding: 7px 16px; }
th { font-size: 14px; }
.payout-table td { font-size: 15px; padding-top: 16px; padding-bottom: 16px; }
.payout-more summary { font-size: 15px; }
.chip { font-size: 13px; }

.acct-card-label { font-size: 14px; letter-spacing: 0.02em; text-transform: none; color: var(--text-secondary); }
.acct-card-yield { font-size: 15px; }
.owed-line .unit { font-size: 15px; }
.owed-line .owed-apr { font-size: 14px; }
.acct-card-foot { font-size: 14px; }

/* 거래소 보유 잔고 — 자산 / 수량 두 칸 */
table.holdings-table th:nth-child(2), table.holdings-table td:nth-child(2) { text-align: right; }
.holdings-table td { font-size: 15px; padding-top: 16px; padding-bottom: 16px; }
.holdings-table td.asset { font-size: 15px; }
.coin { display: inline-flex; align-items: center; gap: 12px; }
.coin img { width: 24px; height: 24px; flex: 0 0 24px; display: block; }
.coin-fallback {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-secondary);
  font-size: 12px; font-weight: 600; font-family: var(--font-ui);
}

/* 전체 — 계정 목록 */
.acct-list td { vertical-align: middle; font-size: 15px; }
.acct-list th { white-space: nowrap; }
.acct-list .th-sub { font-weight: 400; color: var(--text-muted); margin-left: 4px; font-size: 12px; }
table.acct-list th:nth-child(2), table.acct-list td:nth-child(2) { text-align: right; }
.acct-cell { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.acct-cell .acct-link { display: block; font-size: 16px; font-weight: 600; font-family: var(--font-ui); }
.acct-cell:hover .acct-link { text-decoration: underline; }
.acct-sub { display: block; font-size: 13px; color: var(--text-muted); font-family: var(--font-ui); margin-top: 2px; }
.owed-cell { line-height: 1.6; }
.owed-row b { font-weight: 600; color: var(--text-primary); }
.owed-row .dim { margin-left: 4px; font-size: 13px; }
.apr-tag { margin-left: 10px; font-size: 13px; color: var(--text-secondary); font-family: var(--font-ui); }
.acct-list .pct { font-size: 13px; margin-top: 2px; }
.head-link { color: var(--text-secondary); }
@media (max-width: 860px) { .hero-owed.multi { grid-template-columns: 1fr; } }
.st-warn { color: var(--warning); }
.st-off { color: var(--text-muted); }
.acct-list .th-sub { display: none; }

/* 계약 추가 — 자산 드롭다운 */
select.cell-input { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.asset-select { min-width: 160px; }
.flow-add + .flow-add { border-top: none; padding-top: 0; margin-top: 16px; }

/* 유저 관리 */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin-top: 10px; }
.check-item { display: flex !important; align-items: center; gap: 10px; margin: 0 !important; font-size: 15px; cursor: pointer; }
.check-item input { width: 16px; height: 16px; }
.check-inline { flex-direction: row !important; align-items: center; gap: 10px; padding-bottom: 8px; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; }
.check-inline small { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.field-label { font-size: 15px; color: var(--text-secondary); margin-top: 22px; }
.field-label small { margin-left: 6px; font-size: 13px; }
.narrow-form { max-width: 520px; }
.btn-sm.danger { background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical); }
.user-table td { font-size: 15px; }
table.user-table th:nth-child(2), table.user-table td:nth-child(2),
table.user-table th:nth-child(3), table.user-table td:nth-child(3) { text-align: left; }
table.user-table td:nth-child(3) { white-space: normal; }

/* 사이드바 아래 — 로그인한 유저 */
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 14px; }
.side-user-name { font-size: 14px; color: var(--text-secondary); text-decoration: none; overflow-wrap: anywhere; }
.side-user-name:hover { color: var(--text-primary); }
.side-user .side-logout { margin: 0; padding: 0; }
html[data-side="collapsed"] .side-user-name { display: none; }
.lh-brand { z-index: 1; }


/* ═══════════════════════════════════════════════════════════════════════════
   디자인 레이어 (2026-10) — 모던 CMS 톤
   위쪽 규칙을 지우지 않고 여기서 덮는다. 크기·모서리·컨트롤 높이는 아래 토큰만 쓴다.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --h-control: 42px; --h-control-sm: 36px; --h-control-xs: 30px;
  --accent: var(--series-1);
  --side-bg: #f7f8fb;
  --shadow-1: 0 1px 2px rgba(15, 20, 32, 0.05), 0 1px 1px rgba(15, 20, 32, 0.03);
  --shadow-2: 0 12px 32px rgba(15, 20, 32, 0.14), 0 2px 6px rgba(15, 20, 32, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --side-bg: #0b0e14;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --side-bg: #0b0e14;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ── 사이드바 ───────────────────────────────────────────────────────────── */
.sidebar { --side-w: 300px; background: var(--side-bg); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px 20px; }
.brand { padding: 0; font-size: 17px; gap: 11px; }
.brand::before { content: none; }
.brand-mark, .lh-mark {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
  background: linear-gradient(135deg, #3987e5, #8cc0ff);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14) inset, 0 6px 16px rgba(57,135,229,0.35);
}
.side-toggle { position: static; width: 30px; height: 30px; border-radius: 8px; background: transparent; }
.side-toggle:hover { background: var(--surface-2); }
.side-nav { padding: 6px 12px 12px; }
.side-label { padding: 20px 12px 8px; font-size: 12px; letter-spacing: 0.08em; }
.side-item {
  position: relative; padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--r-md); font-size: 15px; color: var(--text-secondary);
}
.side-item:hover { background: color-mix(in srgb, var(--text-primary) 5%, transparent); color: var(--text-primary); }
.side-item.active { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text-primary); font-weight: 600; }
.side-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.side-name { gap: 11px; line-height: 1.35; }
/* 긴 계정명(이메일·지갑주소)도 두 줄까지 */
.side-acct { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-sub { font-size: 12px; color: var(--warning); }
.side-count {
  min-width: 26px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--surface-2);
}
.ico { width: 22px; height: 22px; flex: 0 0 22px; padding: 1px; fill: none; stroke: currentColor;
       stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side-user {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.su-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit;
          padding: 6px; margin: -6px; border-radius: var(--r-md); }
.su-who:hover { background: color-mix(in srgb, var(--text-primary) 5%, transparent); }
.su-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 15px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, #2a78d6, #6aa8f0);
}
.su-text { display: grid; min-width: 0; }
.su-name { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-role { font-size: 12px; color: var(--text-muted); }
.su-logout { margin: 0; }
.su-logout button {
  width: 36px; height: 36px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.su-logout button:hover { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.su-logout .ico { width: 18px; height: 18px; flex-basis: 18px; }

/* 접힌 레일 */
html[data-side="collapsed"] .side-top { flex-direction: column; gap: 12px; padding: 16px 0 10px; }
html[data-side="collapsed"] .brand { display: flex; }
html[data-side="collapsed"] .brand-name,
html[data-side="collapsed"] .side-text,
html[data-side="collapsed"] .side-count,
html[data-side="collapsed"] .su-text { display: none; }
html[data-side="collapsed"] .side-all::before { content: none; }
html[data-side="collapsed"] .side-nav { padding: 6px 8px; }
html[data-side="collapsed"] .side-item.active::before { left: -8px; }
html[data-side="collapsed"] .side-user { flex-direction: column; padding: 12px 0; }
html[data-side="collapsed"] .su-who { flex: none; margin: 0; }

/* ── 머리 ─────────────────────────────────────────────────────────────── */
.content-head {
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  padding: 22px 40px 0;
}
.content-head h1 { font-size: 28px; letter-spacing: -0.02em; }
.head-row { padding-bottom: 18px; align-items: center; }
.head-meta { font-size: 14px; margin-top: 8px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text-primary); }
.tabs { gap: 28px; }
.tabs a { padding: 12px 2px; font-size: 15px; }
.content-body { padding: 28px 40px 80px; max-width: 1240px; }

/* ── 카드 ─────────────────────────────────────────────────────────────── */
.card, .primary { border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card { padding: 22px 24px; border: 1px solid var(--border); }
.card h2 { font-size: 17px; color: var(--text-primary); font-weight: 600; letter-spacing: -0.005em; }
.card-head { margin-bottom: 16px; }
.primary {
  border: 1px solid var(--border);
  background:
    radial-gradient(900px 260px at 0% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--surface-1);
}
.card-flush { padding: 0; overflow: hidden; }
.card-pad { padding: 20px 24px 14px; margin: 0; }

/* ── 표 ───────────────────────────────────────────────────────────────── */
th {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 11px 16px; color: var(--text-muted);
}
td { padding: 15px 16px; }
table.lean tbody tr { transition: background 100ms ease; }
table.lean tbody tr:hover { background: color-mix(in srgb, var(--text-primary) 3%, transparent); }
.card-flush table th { background: color-mix(in srgb, var(--surface-2) 55%, transparent);
                       border-top: 1px solid var(--border); }
.card-flush table th:first-child, .card-flush table td:first-child { padding-left: 24px; }
.card-flush table th:last-child, .card-flush table td:last-child { padding-right: 24px; }

/* ── 버튼 ─────────────────────────────────────────────────────────────── */
.btn, .btn-sm, .btn-xs, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-md); font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, filter 120ms ease;
  white-space: nowrap;
}
.btn {
  height: var(--h-control); padding: 0 20px; font-size: 15px; font-weight: 600;
  color: #fff; border: 0;
  background: linear-gradient(180deg, #4a93ea, #2a78d6);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 6px 16px rgba(42,120,214,0.24);
}
.btn:hover { filter: brightness(1.06); }
.btn-sm, .btn-xs {
  border: 1px solid var(--border-strong); background: var(--surface-1);
  color: var(--text-primary); font-weight: 500;
}
.btn-sm { height: var(--h-control-sm); padding: 0 14px; font-size: 14px; }
.btn-xs { height: var(--h-control-xs); padding: 0 11px; font-size: 13px; }
.btn-sm:hover, .btn-xs:hover { background: var(--surface-2); filter: none; }
.btn-ghost { height: var(--h-control); padding: 0 16px; font-size: 15px; border: 0; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-2); }
.btn-sm.danger { border-color: color-mix(in srgb, var(--critical) 40%, transparent);
                 background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--critical); }

/* ── 입력 ─────────────────────────────────────────────────────────────── */
.cell-input,
.form input[type="text"], .form input[type="password"], .form input[type="date"], .form select {
  height: var(--h-control); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface-0);
  color: var(--text-primary); font-family: inherit; font-size: 15px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.cell-input:focus, .form input:focus, .form select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
select.cell-input { padding-right: 36px; }
.flow-field > span:first-child { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.flow-add { gap: 14px 16px; }

/* ── 칩·배너·알림 ──────────────────────────────────────────────────────── */
.chip { border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; font-weight: 600; }
.banner, .warn-banner {
  border-radius: var(--r-md); border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 7%, var(--surface-1));
  color: var(--text-secondary); padding: 13px 16px; font-size: 14px;
}
.warn-banner strong { color: var(--text-primary); }

.toast {
  position: fixed; top: 20px; right: 24px; z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: min(460px, calc(100vw - 32px));
  padding: 13px 14px 13px 16px; border-radius: var(--r-md);
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--good); box-shadow: var(--shadow-2);
  font-size: 14px; color: var(--text-primary); line-height: 1.5;
  animation: toast-in 220ms ease-out;
}
.toast button { border: 0; background: transparent; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast button:hover { color: var(--text-primary); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity 260ms ease, transform 260ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── 범위·자산 선택 (세그먼트) ─────────────────────────────────────────── */
.ranges { border-radius: var(--r-md); padding: 3px; background: var(--surface-2); }
.ranges a { border-radius: 8px; padding: 6px 14px; }
.ranges a.on { box-shadow: var(--shadow-1); }

/* ── 전체 요약 ────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  padding: 18px 20px; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface-1); box-shadow: var(--shadow-1); min-width: 0;
}
.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.kpi-value {
  margin-top: 8px; font-family: var(--font-display); font-size: 24px; font-weight: 650;
  letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-value .unit { font-size: 13px; margin: 0 8px 0 5px; }
.kpi-muted .kpi-value { font-size: 22px; }

@media (max-width: 860px) {
  .sidebar { --side-w: auto; }
  .content-head { padding: 16px 16px 0; }
  .content-body { padding: 18px 16px 48px; }
  .toast { left: 16px; right: 16px; top: 12px; }
}

/* 폼 폭 — 읽기 좋은 너비로 */
.form-narrow { max-width: 760px; }
.form label > span { font-size: 14px; font-weight: 500; }
.form fieldset { border-radius: var(--r-lg); border-color: var(--border); background: color-mix(in srgb, var(--surface-2) 30%, transparent); }
.form legend { font-weight: 600; color: var(--text-primary); }
.check-inline { align-self: flex-end; height: var(--h-control); display: inline-flex !important; align-items: center; }
.check-inline > span { margin: 0 !important; font-size: 14px !important; color: var(--text-primary) !important; }
.ui-font, .ui-font * { font-family: var(--font-ui) !important; }
input[type="checkbox"] { accent-color: var(--accent); }
.form select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; width: 100%; }
