/* ─── 색상 변수 ─── */
:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #131722;
  --surface-2: #171d2b;
  --surface-3: #1d2433;
  --primary: #2962ff;
  --primary-dark: #1e53ea;
  --primary-light: rgba(41, 98, 255, 0.14);
  --secondary: #26a69a;
  --accent: #f59e0b;
  --gain: #22ab94;
  --loss: #f23645;
  --text: #d9e1ee;
  --text-2: #9fb0c8;
  --muted: #6c7a90;
  --border: #222b3d;
  --shadow: rgba(0, 0, 0, 0.28);
  --shadow-md: rgba(0, 0, 0, 0.36);
  --overlay: rgba(8, 11, 18, 0.56);
  --topbar-bg: rgba(11, 15, 20, 0.86);
  --nav-bg: #0f141d;
  --input-bg: #0f141d;
  --table-head-bg: #121826;
  --row-hover: rgba(255, 255, 255, 0.02);
  --ring-track: #263042;
  --tab-h: 64px;
  --top-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #131722;
  --surface-2: #171d2b;
  --surface-3: #1d2433;
  --primary: #2962ff;
  --primary-dark: #1e53ea;
  --primary-light: rgba(41, 98, 255, 0.14);
  --secondary: #26a69a;
  --accent: #f59e0b;
  --gain: #22ab94;
  --loss: #f23645;
  --text: #d9e1ee;
  --text-2: #9fb0c8;
  --muted: #6c7a90;
  --border: #222b3d;
  --shadow: rgba(0, 0, 0, 0.28);
  --shadow-md: rgba(0, 0, 0, 0.36);
  --overlay: rgba(8, 11, 18, 0.56);
  --topbar-bg: rgba(11, 15, 20, 0.86);
  --nav-bg: #0f141d;
  --input-bg: #0f141d;
  --table-head-bg: #121826;
  --row-hover: rgba(255, 255, 255, 0.02);
  --ring-track: #263042;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f3f8;
  --surface: #ffffff;
  --surface-2: #f5f7fc;
  --surface-3: #edf0f7;
  --primary: #2962ff;
  --primary-dark: #1e53ea;
  --primary-light: rgba(41, 98, 255, 0.10);
  --secondary: #00897b;
  --accent: #f59e0b;
  --gain: #089981;
  --loss: #e53935;
  --text: #1a2332;
  --text-2: #4a5872;
  --muted: #8896b0;
  --border: #dde3ef;
  --shadow: rgba(0, 0, 0, 0.07);
  --shadow-md: rgba(0, 0, 0, 0.12);
  --overlay: rgba(241, 245, 251, 0.68);
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --table-head-bg: #f2f5fb;
  --row-hover: rgba(41, 98, 255, 0.04);
  --ring-track: #dbe3f2;
}

/* ─── 리셋 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(41, 98, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #0b0f14 0%, #0f141d 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(41, 98, 255, 0.07), transparent 30%),
    linear-gradient(180deg, #f0f3f8 0%, #e8ecf5 100%);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ─── 앱 레이아웃 ─── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 1280px;
  margin: 0 auto;
}
.app.is-auth-pending {
  visibility: hidden;
  pointer-events: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 980;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 22% 18%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 28%),
    radial-gradient(circle at 78% 74%, color-mix(in srgb, var(--secondary) 18%, transparent), transparent 30%),
    linear-gradient(180deg, var(--bg), var(--nav-bg));
}
.login-screen.is-hidden {
  display: none;
}
.login-card {
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 24px 70px var(--shadow-md);
  backdrop-filter: blur(20px);
}
.login-eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.login-card h1 {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}
.login-card p {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}
.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.login-card input {
  height: 46px;
  text-align: center;
  letter-spacing: 0.24em;
  font-size: 18px;
  font-weight: 900;
}
.login-card button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.login-card button:disabled {
  opacity: .65;
  cursor: wait;
}
.login-message {
  min-height: 18px;
  color: var(--loss);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.global-loading {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}
.global-loading.is-hidden { display: none; }
.global-loading-box {
  min-width: 220px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 20px 48px var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.global-loading-box strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

/* ─── 상단 헤더 ─── */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-h);
  padding: 0 16px;
  background: var(--topbar-bg);
  border-bottom: 1.5px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-eyebrow {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.topbar-brand strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar-center {
  display: none;
  align-items: center;
  gap: 8px;
}
.topbar-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* ─── 아이콘 버튼 ─── */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 150ms, color 150ms, transform 150ms;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .moon { display: none; }
[data-theme="dark"] .icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .moon { display: block; }

/* ─── 탭 내비 ─── */
.tab-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--topbar-bg);
  border-bottom: 1.5px solid var(--border);
  backdrop-filter: blur(16px);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  height: 52px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 150ms, background 150ms;
  position: relative;
}
.tab-btn::after { display: none; }
.tab-btn.active {
  color: var(--text);
  background: var(--surface);
}
.tab-btn:hover { background: var(--surface-2); }

.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 11px; font-weight: 700; }

/* ─── 콘텐츠 영역 ─── */
.tab-content {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.tab-panel {
  display: none;
  padding: 20px;
  padding-bottom: 32px;
  gap: 16px;
  flex-direction: column;
  animation: fade-in 200ms ease;
}
.tab-panel.is-active { display: flex; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── 카드 ─── */
.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 32px var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 { font-size: 14px; font-weight: 800; }

/* ─── 섹션 헤더 ─── */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}
.section-head h2 { font-size: 16px; font-weight: 800; }
.section-head small { font-size: 11px; color: var(--muted); font-weight: 600; }
.section-head .btn-sm { margin-left: auto; }

/* ─── 홈 탭 구분선 ─── */
.home-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
  border-radius: 1px;
}

/* ─── 달성률 링 ─── */
.goal-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 14%, transparent), transparent 30%),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.goal-ring-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.goal-ring {
  width: 130px;
  height: 130px;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 10;
}
.ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 800ms cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--primary) 40%, transparent));
}

.goal-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.goal-ring-label strong { font-size: 20px; font-weight: 900; color: var(--primary); }
.goal-ring-label span { font-size: 10px; color: var(--muted); font-weight: 600; }

.goal-edit-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 150ms, color 150ms, border-color 150ms;
}
.goal-edit-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.goal-edit-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.goal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  flex: 1 1 140px;
}
.goal-stats .stat-item:last-child {
  grid-column: 1 / -1;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* ─── 인사이트 카드 ─── */
.insight-card .card-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.insight-list {
  display: grid;
  gap: 8px;
}
.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.insight-item strong {
  display: block;
  font-size: 12px;
  font-weight: 850;
  color: var(--text);
}
.insight-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.insight-item em {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 10px;
  font-weight: 850;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 7px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.insight-item.is-high,
.risk-high {
  border-color: color-mix(in srgb, var(--loss) 35%, var(--border));
  background: color-mix(in srgb, var(--loss) 8%, var(--surface-2));
}
.insight-item.is-medium,
.risk-medium {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.risk-low {
  border-color: color-mix(in srgb, var(--gain) 24%, var(--border));
}
.mini-empty {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.monthly-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.monthly-cell {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.monthly-cell span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 4px;
}
.monthly-cell strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.daily-report {
  min-height: 128px;
}
.daily-report-body {
  display: grid;
  gap: 10px;
}
.daily-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.daily-report-meta span {
  font-size: 10px;
  font-weight: 850;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--surface-2);
}
.daily-report h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}
.daily-report p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.65;
}
.daily-report-diagnosis {
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.daily-report-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.daily-report-lists > div {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.daily-report-lists strong {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text);
}
.daily-report-lists ul {
  margin: 0;
  padding-left: 16px;
}
.daily-report-lists li {
  margin: 4px 0;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.45;
}
.daily-report-closing {
  font-weight: 750;
}
.daily-report-note {
  color: var(--muted);
  font-size: 10px;
}
.daily-report-skeleton {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}
.timeline-list {
  display: grid;
  gap: 8px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child {
  border-bottom: none;
}
.timeline-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}
.timeline-dot.trade { background: var(--gain); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gain) 12%, transparent); }
.timeline-dot.cash { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.timeline-item strong {
  display: block;
  font-size: 12px;
  font-weight: 850;
}
.timeline-item p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.timeline-item time {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* ─── 목표 기간 선택 ─── */
.goal-period-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.goal-period-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.goal-period-btns {
  display: flex;
  gap: 6px;
}
.goal-period-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.goal-period-btn.is-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.stat-item {}
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 16px; font-weight: 800; display: block; color: var(--text); }
.stat-value.gain { color: var(--gain); }
.stat-value.loss { color: var(--loss); }
.stat-sub { font-size: 12px; font-weight: 600; }
.stat-sub.gain { color: var(--gain); }
.stat-sub.loss { color: var(--loss); }

.cash-more-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
}
.cash-more-btn:hover { background: var(--surface-3); }

/* ─── 현금 목록 ─── */
.cash-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.cash-balance-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cash-balance-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
#cash-balance {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
}
#cash-updated-at {
  font-size: 11px;
  color: var(--muted);
}
.cash-action-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cash-action-btn {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.cash-action-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.cash-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}
.cash-chip em { color: var(--primary); font-style: normal; }
.cash-chip small { font-size: 10px; color: var(--muted); font-weight: 600; }
.cash-chip.is-withdraw em { color: var(--loss); }
.cash-chip.is-deposit em { color: var(--gain); }

/* ─── 폼 ─── */
.simple-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 60px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A090AA' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }

/* 심볼 자동완성 */
.symbol-field { position: relative; }
.symbol-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow-md);
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}
.symbol-suggest.is-hidden { display: none; }
.symbol-suggest button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  height: auto;
  font-weight: 500;
}
.symbol-suggest button:hover { background: var(--primary-light); }
.symbol-suggest button strong { font-size: 13px; font-weight: 800; flex-shrink: 0; }
.symbol-suggest button span { font-size: 11px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symbol-suggest button em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 2px 6px; border-radius: 6px; flex-shrink: 0; }
.symbol-suggest-empty { padding: 12px; font-size: 12px; color: var(--muted); text-align: center; }

/* ─── 버튼 ─── */
button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  transition: background 150ms, transform 100ms, box-shadow 150ms;
}
button:active { transform: scale(0.97); }

.tab-panel button[type="submit"],
button[type="submit"] {
  height: 42px;
  background: linear-gradient(180deg, #2962ff, #1f56e8);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}
button[type="submit"]:hover { background: linear-gradient(180deg, #3a72ff, #2962ff); box-shadow: 0 6px 16px rgba(41, 98, 255, 0.24); }

.btn-ghost {
  height: 42px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  white-space: nowrap;
}
.btn-buy { background: color-mix(in srgb, var(--gain) 12%, transparent); color: var(--gain); border: 1.5px solid color-mix(in srgb, var(--gain) 25%, transparent); }
.btn-buy:hover { background: color-mix(in srgb, var(--gain) 20%, transparent); }
.btn-sell { background: color-mix(in srgb, var(--loss) 12%, transparent); color: var(--loss); border: 1.5px solid color-mix(in srgb, var(--loss) 25%, transparent); }
.btn-sell:hover { background: color-mix(in srgb, var(--loss) 20%, transparent); }
.btn-edit { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); border: 1.5px solid color-mix(in srgb, var(--primary) 28%, transparent); }
.btn-edit:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.btn-delete { background: color-mix(in srgb, #999 10%, transparent); color: var(--muted); border: 1.5px solid var(--border); }
.btn-delete:hover { background: color-mix(in srgb, var(--gain) 10%, transparent); color: var(--gain); }
.btn-history { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.btn-history:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.form-actions { display: flex; gap: 8px; }
.form-actions button { flex: 1; }
.mini-select {
  height: 30px;
  padding: 0 28px 0 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface-2);
  width: auto;
}

/* ─── 공통 뱃지 ─── */
.plan-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}
.badge-kr { background: color-mix(in srgb, var(--secondary) 15%, transparent); color: var(--secondary); }
.badge-us { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

.category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--muted);
  white-space: nowrap;
}
.stability-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.stab-best  { background: color-mix(in srgb, #3b82f6 15%, transparent); color: #3b82f6; }
.stab-good  { background: color-mix(in srgb, var(--gain) 15%, transparent); color: var(--gain); }
.stab-mid   { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #f59e0b; }
.stab-low   { background: color-mix(in srgb, var(--loss) 12%, transparent); color: var(--loss); }
.stab-worst { background: color-mix(in srgb, var(--loss) 20%, transparent); color: var(--loss); }

/* ─── 데이터 테이블 ─── */
.data-table-wrap {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 2px 10px var(--shadow), 0 0 0 1px var(--border);
  overflow-x: auto;
  overflow-y: hidden;
}
.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}
.data-table thead th {
  background: var(--table-head-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  vertical-align: middle;
}
.data-table th:last-child,
.data-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -10px 0 18px color-mix(in srgb, var(--surface) 88%, transparent);
}
.data-table thead th:last-child {
  z-index: 3;
  background: var(--table-head-bg);
}
.data-table tbody tr:hover td {
  background: var(--row-hover);
}
.data-table tbody tr:hover td:last-child {
  background: var(--row-hover);
}
.data-table tbody tr:first-child td { border-top: none; }
.data-table tbody tr.is-alert-buy  { background: color-mix(in srgb, var(--gain) 5%, var(--surface)); }
.data-table tbody tr.is-alert-sell { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.data-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.data-table .subtle {
  color: var(--muted);
  white-space: nowrap;
}
.table-symbol-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.table-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.table-symbol-cell strong {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.table-reason {
  max-width: 280px;
  color: var(--text-2);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.table-actions {
  display: flex;
  gap: 4px;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 48px;
}
.table-manage-actions {
  display: flex;
  gap: 4px;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 58px;
}
.num-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.1;
}
.num-stack strong {
  font-size: 12px;
  font-weight: 800;
}
.num-stack span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.trade-filter-bar {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(120px, 150px) minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0 10px;
}
.trade-filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.trade-filter-bar input {
  min-height: 34px;
}
.trade-table-wrap {
  border-top: 1px solid var(--border);
}
.trade-group-row td {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
}
.trade-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.trade-group-head small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.trade-child-row td {
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.trade-child-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.trade-group-actions {
  min-width: 52px;
}
.trade-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 2px;
}
.trade-pagination span {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
}

.household-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), transparent 48%),
    linear-gradient(315deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 42%),
    var(--surface);
}
.household-hero h2 {
  margin: 2px 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}
.household-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.household-target {
  min-width: 148px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  text-align: right;
}
.household-target span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
}
.household-target strong {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
}
.household-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.household-kpi {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 28px var(--shadow);
}
.household-kpi span,
.household-kpi small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.household-kpi strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
}
.household-kpi strong.gain,
.household-kpi .gain { color: var(--gain); }
.household-kpi strong.loss,
.household-kpi .loss { color: var(--loss); }
.household-input-card {
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}
.household-form {
  display: grid;
  gap: 14px;
}
.household-month-field {
  max-width: 180px;
}
.household-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.household-form input,
.household-form select,
.household-form textarea {
  width: 100%;
}
.household-form-section {
  display: grid;
  gap: 10px;
}
.household-form-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.household-form-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}
.household-form-section h3,
.household-owner-group h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
}
.household-form-grid,
.household-asset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.household-asset-entry {
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.asset-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.asset-entry-head strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}
.asset-entry-head small,
.asset-entry-delta {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.asset-entry-delta {
  margin-top: 2px;
}
.asset-entry-delta.gain { color: var(--gain); }
.asset-entry-delta.loss { color: var(--loss); }
.household-asset-inputs {
  display: grid;
  gap: 12px;
}
.household-owner-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.household-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.household-chart {
  min-height: 280px;
}
.household-memo-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.household-memo-item {
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 76%, transparent);
}
.household-memo-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.household-memo-item strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}
.household-memo-item span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.household-memo-item p {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.6;
}
.household-table .is-muted-row td {
  color: var(--muted);
  opacity: .62;
}
.household-table .is-summary-row td {
  font-weight: 800;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}
.household-asset-table-wrap {
  border-radius: 10px;
}
.household-asset-table {
  min-width: 1040px;
}
.household-asset-table thead th {
  font-size: 10px;
  letter-spacing: 0;
}
.household-asset-table thead th.is-latest-month {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 16%, var(--table-head-bg));
}
.household-asset-table tbody td {
  padding-top: 10px;
  padding-bottom: 10px;
}
.asset-owner-cell {
  width: 96px;
  text-align: center;
  vertical-align: middle !important;
  border-right: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.asset-owner-badge {
  display: inline-flex;
  align-items: center;
  min-width: 46px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.asset-owner-cell small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.asset-owner-badge.is-couple {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 13%, transparent);
}
.asset-item-cell {
  min-width: 150px;
}
.asset-item-name,
.asset-latest-cell strong {
  display: block;
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}
.asset-item-cell small,
.asset-latest-cell small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.asset-month-cell.is-latest-month {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  font-weight: 900;
}
.asset-month-cell.is-zero {
  color: var(--muted);
  opacity: .55;
}
.household-asset-table tr:not(:first-child) .asset-owner-cell {
  border-top: 1px solid var(--border);
}
.household-asset-table .is-subtotal-row td {
  background: color-mix(in srgb, var(--secondary) 8%, var(--surface));
}
.household-asset-table .is-couple-row td {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.household-asset-table .is-change-row td {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.household-asset-table tbody tr:hover td {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2));
}
.household-asset-table th:last-child,
.household-asset-table td:last-child {
  min-width: 150px;
}

.skeleton-host:empty::before {
  content: "";
  display: block;
}
.skeleton-table .data-table tbody td,
.skeleton-table .data-table thead th {
  background: transparent;
}
.skeleton-line {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(108,122,144,.18), rgba(108,122,144,.32), rgba(108,122,144,.18));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s linear infinite;
}
.data-table thead .skeleton-line {
  height: 10px;
}
@keyframes skeleton-shimmer {
  from { background-position: 220% 0; }
  to { background-position: -20% 0; }
}

/* 삭제 버튼 */
.btn-delete { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 30%, var(--border)); }

/* ─── 실행 탭: 거래 배지 ─── */
.trade-side-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 7px;
  flex-shrink: 0;
  white-space: nowrap;
}
.side-buy  { background: color-mix(in srgb, var(--gain) 12%, transparent); color: var(--gain); }
.side-sell { background: color-mix(in srgb, var(--loss) 12%, transparent); color: var(--loss); }

/* ─── 현황: 보유종목 테이블 컨테이너 ─── */
.holdings-cards {
  display: block;
}

.holding-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px var(--shadow);
}

.holding-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.holding-symbol { font-size: 18px; font-weight: 900; }
.holding-name { font-size: 11px; color: var(--muted); margin-top: 1px; }

.holding-price-col { text-align: right; }
.holding-current { font-size: 17px; font-weight: 900; display: block; }
.holding-day-return { font-size: 12px; font-weight: 700; }

.holding-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.hstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hstat-label { font-size: 10px; color: var(--muted); font-weight: 600; }
.hstat-value { font-size: 12px; font-weight: 800; }
.hstat-currency { font-size: 9px; font-weight: 600; color: var(--muted); }
.holding-currency { font-size: 10px; font-weight: 600; color: var(--muted); }

/* 수익률 색상 */
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.flat { color: var(--muted); }

/* ─── 포트폴리오 차트 ─── */
.portfolio-chart {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}
.chart-placeholder {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* ─── 보유 종목 뉴스 ─── */
.news-card .card-head {
  align-items: baseline;
}
.news-card .card-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.news-list {
  display: grid;
  gap: 10px;
  min-height: 0;
}
.news-item {
  display: grid;
  gap: 7px;
  padding: 13px 14px;
  color: var(--text);
  text-decoration: none;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 46%),
    var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 14px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.news-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent 50%),
    var(--surface);
}
.news-meta,
.news-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.news-meta span,
.news-foot span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-symbol {
  flex: 0 0 auto;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 999px;
  padding: 3px 7px;
}
.sentiment-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 850;
}
.sentiment-positive { color: var(--gain); background: color-mix(in srgb, var(--gain) 12%, transparent); }
.sentiment-negative { color: var(--loss); background: color-mix(in srgb, var(--loss) 12%, transparent); }
.sentiment-neutral { color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); }
.news-title {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 850;
}
.news-foot {
  justify-content: space-between;
}
.news-empty {
  padding: 24px 12px;
}
.news-empty p {
  margin-top: 6px;
  line-height: 1.5;
}
.news-skeleton .skeleton-line {
  height: 11px;
}
.news-skeleton .skeleton-line:first-child {
  width: 38%;
}
.news-skeleton .skeleton-line.short {
  width: 56%;
}

/* ─── 비어있음 상태 ─── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px dashed var(--border);
}
.empty-state-icon { font-size: 36px; display: block; margin-bottom: 8px; }

/* ─── 모달 ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  padding: 0;
}
.modal-backdrop.is-hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 75dvh;
  overflow-y: auto;
  padding: 20px 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slide-up 250ms cubic-bezier(.4,0,.2,1);
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal-head h2 { font-size: 16px; font-weight: 800; }

/* ─── 이력 목록 ─── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
}
.history-item-head { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.history-item strong { font-size: 12px; font-weight: 700; display: block; }
.history-item p { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.trade-preview-summary {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 14px;
}
.trade-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.trade-preview-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.trade-preview-grid strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

/* ─── 반응형: 모바일 ─── */
@media (max-width: 640px) {
  .app { max-width: none; }
  .topbar-center { display: none; }
  .tab-panel { padding: 14px; gap: 12px; }
  #panel-home.is-active {
    padding-top: 136px;
    animation: none;
    transform: none;
  }
  .card { padding: 14px; border-radius: 14px; }
  .goal-hero { gap: 14px; }
  .goal-ring-wrap { width: 112px; height: 112px; }
  .goal-ring { width: 112px; height: 112px; }
  .holding-stats { grid-template-columns: 1fr 1fr; }
  .monthly-report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-report-lists { grid-template-columns: 1fr; }
  .household-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .household-target {
    width: 100%;
    text-align: left;
  }
  .household-kpis,
  .household-grid {
    grid-template-columns: 1fr;
  }
  .household-memo-list {
    grid-template-columns: 1fr;
  }
  .household-form-grid,
  .household-asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .household-chart {
    min-height: 240px;
  }
  .data-table { min-width: 780px; }
  .trade-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
  .trade-filter-bar label:nth-child(3) {
    grid-column: 1 / -1;
  }
  .trade-filter-bar button {
    grid-column: 1 / -1;
    width: 100%;
  }
  .trade-group-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .trade-group-head small {
    white-space: normal;
  }
  .table-manage-actions {
    min-width: 54px;
    gap: 3px;
  }
  .table-actions {
    min-width: 44px;
    gap: 3px;
  }
  .table-actions .btn-sm,
  .table-manage-actions .btn-sm {
    height: 26px;
    padding: 0 6px;
    font-size: 10px;
    border-radius: 7px;
  }
  .table-reason { max-width: 180px; }
  .topbar-brand strong { font-size: 14px; }
  .topbar-brand small { font-size: 10px; }
  .news-card {
    position: fixed;
    top: calc(var(--top-h) + 52px);
    left: 10px;
    right: 10px;
    z-index: 95;
    padding: 10px 12px;
    border-radius: 16px;
    max-height: 120px;
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), transparent 52%),
      color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 14px 32px var(--shadow-md);
    backdrop-filter: blur(18px);
  }
  .news-card .card-head {
    margin-bottom: 7px;
  }
  .news-card .card-head h2 {
    font-size: 12px;
  }
  .news-card .card-head small {
    font-size: 10px;
  }
  .news-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
    max-height: 72px;
  }
  .news-item {
    flex: 0 0 min(82vw, 320px);
    min-height: 68px;
    padding: 10px 11px;
    border-radius: 12px;
    scroll-snap-align: start;
  }
  .news-meta,
  .news-foot { flex-wrap: wrap; }
  .news-title {
    display: -webkit-box;
    font-size: 12px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .news-foot { display: none; }
  .news-empty {
    min-width: 100%;
    padding: 12px;
  }
  .news-empty .empty-state-icon,
  .news-empty p {
    display: none;
  }
}

@media (max-width: 420px) {
  .household-form-grid,
  .household-asset-grid {
    grid-template-columns: 1fr;
  }
  .household-month-field {
    max-width: none;
  }
}

/* ─── 반응형: 태블릿/데스크탑 ─── */
@media (min-width: 641px) {
  .app {
    max-width: 100%;
    display: grid;
    grid-template-rows: var(--top-h) 52px 1fr;
    grid-template-columns: 200px 1fr;
    height: 100dvh;
  }

  .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .tab-nav {
    grid-column: 1;
    grid-row: 2 / -1;
    display: flex;
    flex-direction: column;
    border-bottom: none;
    border-right: 1.5px solid var(--border);
    height: 100%;
    overflow-y: auto;
    padding: 12px 8px;
    gap: 4px;
    background: var(--nav-bg);
  }

  .tab-btn {
    flex-direction: row;
    justify-content: flex-start;
    height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    gap: 10px;
  }
  .tab-label { font-size: 13px; }

  .tab-content {
    grid-column: 2;
    grid-row: 2 / -1;
  }

  .tab-panel { max-width: 980px; }
  #panel-home.tab-panel.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(286px, 340px);
    align-items: start;
    gap: 16px;
    max-width: 100%;
  }
  #panel-home > :not(.news-card) {
    grid-column: 1;
    min-width: 0;
  }
  #panel-home .news-card {
    grid-column: 2;
    grid-row: 1 / span 7;
    position: sticky;
    top: 16px;
    max-height: calc(100dvh - var(--top-h) - 84px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #panel-home .news-list {
    overflow-y: auto;
    padding-right: 2px;
  }
  .topbar-center {
    display: flex;
  }

  .goal-hero { flex-wrap: nowrap; }

  .holding-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ─── 로딩 스피너 ─── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

/* ─── 토스트 알림 ─── */
.toast-container {
  position: fixed;
  bottom: calc(var(--tab-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  pointer-events: none;
  width: min(360px, 90vw);
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--shadow-md);
  animation: toast-in 250ms ease forwards;
  pointer-events: auto;
}
.toast.error { background: var(--gain); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
