/* StockEngine 레이아웃·컴포넌트 (다크 베이스, 트레이딩 터미널 스타일) */

/* ── 앱 셸: 좌측 사이드바 + 메인 ─────────────────────────── */

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

/* 가로 밀림 원천 차단: 어떤 자식이 넘쳐도 셸 레벨에서 옆으로 팬 되지
   않는다. hidden이 아닌 clip이어야 내부 sticky(상단 바)가 유지된다 */
.se-shell,
.se-shell-main {
  overflow-x: clip;
}

.se-sidebar {
  display: flex;
  flex-direction: column;
  width: 240px;
  flex-shrink: 0;
  background: var(--se-bg);
  border-right: 1px solid var(--se-border);
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--se-duration) var(--se-ease),
    padding var(--se-duration) var(--se-ease);
}

.sidebar-collapsed .se-sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: none;
}

.se-shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── 로고 ────────────────────────────────────────────── */

.se-logo {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--se-text);
  white-space: nowrap;
  padding: 4px 12px 16px;
}

.se-logo:hover {
  color: var(--se-text);
}

.se-logo-accent {
  background: linear-gradient(90deg, var(--hze-bi-01), var(--hze-bi-02));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── 사이드 내비게이션 ───────────────────────────────── */

.se-side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.se-side-section {
  margin: 16px 12px 6px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--se-text-faint);
  white-space: nowrap;
}

.se-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--se-radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--se-text-caption);
  white-space: nowrap;
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease);
}

.se-side-item:hover {
  background: var(--se-surface-subtle);
  color: var(--se-text);
}

.se-side-item.is-active {
  background: var(--se-surface-selected);
  color: var(--se-text);
}

.se-side-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--se-text-muted);
}

.se-side-item.is-active .se-side-icon {
  color: var(--hze-bi-05);
}

/* ── 사이드바 푸터 (사용자) ──────────────────────────── */

.se-side-footer {
  border-top: 1px solid var(--se-border);
  padding: 14px 12px 4px;
  white-space: nowrap;
}

.se-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.se-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--se-text);
}

.se-role-badge {
  font-size: 11px;
  line-height: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

.se-role-badge.is-admin {
  background: rgba(58, 67, 255, 0.18);
  color: var(--hze-bi-05);
}

.se-logout-form {
  margin: 0;
}

/* 버튼 공통 규격: primary/ghost는 색만 다르고 높이·패딩·서체는 동일하다.
   크기 변형은 .se-btn-xs(컴파운드 셀렉터, 아래 primary 정의 뒤) 사용 */
.se-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  background: transparent;
  color: var(--se-text-caption);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease);
}

.se-btn-ghost:hover {
  background: var(--se-surface-subtle);
  color: var(--se-text);
}

/* ── 상단 바 ─────────────────────────────────────────── */

.se-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  /* PWA 스탠드얼론(상태 바 투명)에서 시계·다이내믹 아일랜드와 겹치지
     않도록 safe-area만큼 내려 그린다. 배경이 패딩 영역을 채워 상태 바
     뒤판 역할도 겸한다. 일반 브라우저에서는 env()가 0이라 무해 */
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 20px 0;
  background: var(--se-bg);
  border-bottom: 1px solid var(--se-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.se-sidebar-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: none;
  border-radius: var(--se-radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease);
}

.se-sidebar-toggle:hover {
  background: var(--se-surface-subtle);
}

.se-sidebar-toggle span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--se-text-caption);
}

.se-topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--se-text-sub);
}

.se-topbar-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--se-text-faint);
}

.se-topbar-hint kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-xs);
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

/* ── 메인 콘텐츠 ─────────────────────────────────────── */

.se-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.se-page-title {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.se-page-desc {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--se-text-muted);
}

/* ── 카드 ────────────────────────────────────────────── */

.se-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.se-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 20px;
}

.se-card-label {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--se-text-muted);
}

.se-card-value {
  margin: 0;
  font-size: 28px;
  line-height: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.se-card-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--se-text-caption);
}

.se-gain {
  color: var(--se-gain);
}

.se-loss {
  color: var(--se-loss);
}

/* ── 페이지 헤드 ─────────────────────────────────────── */

.se-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.se-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 통화 전환 세그먼트 */

.se-seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  background: var(--se-surface-muted);
}

.se-seg-item {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--se-text-muted);
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease);
}

.se-seg-item:hover {
  color: var(--se-text);
}

.se-seg-item.is-active {
  background: var(--hze-bi-01);
  color: #fff;
}

/* 환율 표시 */

.se-fx {
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid var(--se-border);
  border-radius: 999px;
  background: var(--se-surface-muted);
  font-size: 12px;
  color: var(--se-text-caption);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.se-fx strong {
  color: var(--se-text);
  font-weight: 600;
}

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

.se-table-note {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--se-text-faint);
}

/* ── 실시간 표시 ─────────────────────────────────────── */

.se-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
  white-space: nowrap;
}

.se-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  animation: se-pulse 1.6s ease-in-out infinite;
}

@keyframes se-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .se-live-dot { animation: none; }
  .se-refresh-btn.is-loading svg { animation: none; }
}

.se-live-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* 원형 새로고침 버튼 */

.se-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--se-border-strong);
  border-radius: 50%;
  background: var(--se-surface-muted);
  color: var(--se-text-caption);
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease);
}

.se-refresh-btn:hover {
  background: var(--se-surface-subtle);
  color: var(--se-text);
}

.se-refresh-btn.is-loading svg {
  animation: se-spin 0.8s linear infinite;
}

@keyframes se-spin {
  to { transform: rotate(360deg); }
}

/* ── 장 상태 배지 ────────────────────────────────────── */

.se-market {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 10px;
  border: 1px solid var(--se-border);
  border-radius: 999px;
  background: var(--se-surface-muted);
  font-size: 12px;
  color: var(--se-text-muted);
  white-space: nowrap;
}

.se-market-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--se-text-faint);
}

.se-market.is-open {
  color: var(--se-text-caption);
}

.se-market.is-open .se-market-dot {
  background: #34d399;
}

.se-market.is-extended .se-market-dot {
  background: #fbbf24;
}

/* ── 카드 변형 ───────────────────────────────────────── */

.se-card-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 4px;
}

.se-card-value-sm {
  font-size: 20px;
  line-height: 28px;
}

/* ── 포트폴리오 비중 ─────────────────────────────────── */

.se-alloc-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 24px;
}

.se-alloc-head {
  margin-bottom: 18px;
}

.se-alloc-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--se-surface-subtle);
}

.se-alloc-seg {
  display: block;
  height: 100%;
}

.se-alloc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
}

.se-alloc-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--se-text-caption);
}

.se-alloc-key strong {
  color: var(--se-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.se-alloc-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.seg-0 { background: #3a43ff; }
.seg-1 { background: #1a7eff; }
.seg-2 { background: #8086ff; }
.seg-3 { background: #53b9fc; }
.seg-4 { background: #ec4cff; }
.seg-5 { background: #34d399; }
.seg-6 { background: #fbbf24; }
.seg-7 { background: #f87171; }
.seg-8 { background: #a78bfa; }
.seg-9 { background: #7e80a0; }

.se-weight {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.se-weight-bar {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--se-surface-subtle);
  overflow: hidden;
}

.se-weight-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hze-bi-01), var(--hze-bi-02));
}

/* ── 주문 배지 ───────────────────────────────────────── */

.se-side-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--se-surface-subtle);
}

.se-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

/* ── 종목 상세 ───────────────────────────────────────── */

.se-stock-head-meta {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--se-text-muted);
}

.se-stock-head-title {
  margin-bottom: 8px;
}

.se-stock-head-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 24px;
}

.se-stock-last {
  font-size: 30px;
  line-height: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.se-stock-change {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.se-stock-change-label {
  font-size: 12px;
  color: var(--se-text-faint);
}

.se-warning-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}

/* 종목 상세 3컬럼: 차트 | 호가·체결 | 주문 (HTS 스타일) */

.se-main-wide {
  max-width: 1520px;
}

.se-stock-grid {
  display: grid;
  grid-template-areas: "main ob order";
  grid-template-columns: minmax(0, 1fr) 280px 320px;
  gap: 20px;
  margin-top: 28px;
  align-items: start;
}

.se-stock-col-main { grid-area: main; }
.se-stock-col-ob { grid-area: ob; }
.se-stock-col-order { grid-area: order; }

@media (max-width: 1280px) {
  .se-stock-grid {
    grid-template-areas:
      "main order"
      "ob order";
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 900px) {
  .se-stock-grid {
    grid-template-areas: "main" "order" "ob";
    grid-template-columns: 1fr;
  }
}

.se-stock-grid .se-section-title {
  margin-top: 24px;
}

.se-stock-grid section:first-child .se-section-title {
  margin-top: 0;
}

.se-trades-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.se-trades-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* 실시간 차트 (lightweight-charts) */

.se-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.se-chart-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 12px 12px 8px;
}

.se-tv-chart {
  width: 100%;
  height: 380px;
}

.se-tv-chart.se-chart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--se-text-muted);
  font-size: 14px;
}

.se-chart-attribution {
  margin: 6px 4px 0;
  font-size: 11px;
  color: var(--se-text-faint);
}

.se-chart-attribution a {
  color: var(--se-text-muted);
}

.se-seg-sm .se-seg-item {
  padding: 4px 12px;
  font-size: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.se-seg-sm .se-seg-item.is-active {
  background: var(--hze-bi-01);
  color: #fff;
}

.se-seg-wrap {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* EMA 토글 칩 */

.se-ema-chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.se-ema-chip {
  padding: 4px 10px;
  border: 1px solid var(--se-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--se-text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--se-duration) var(--se-ease),
    border-color var(--se-duration) var(--se-ease);
}

.se-ema-chip:hover {
  color: var(--se-text);
}

.se-ema-chip.is-active {
  border-color: var(--ema-color, var(--hze-bi-01));
  color: var(--ema-color, var(--hze-bi-01));
}

.se-tv-chart.is-loading {
  opacity: 0.6;
}

/* 차트 전체화면 */

.se-chart-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.se-chart-section.se-chart-fs {
  position: fixed;
  inset: 0;
  z-index: 320;
  margin: 0;
  background: var(--se-bg);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px
    calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.se-chart-fs .se-chart-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.se-chart-fs .se-tv-chart {
  flex: 1;
  height: auto;
  min-height: 0;
}

body.se-noscroll {
  overflow: hidden;
}

/* 종목 정보 표 */

.se-info-table th {
  width: 110px;
  background: var(--se-surface-muted);
  font-weight: 500;
}

.se-info-table td {
  font-variant-numeric: tabular-nums;
}

/* 호가 */

.se-ob-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 8px 0;
}

.se-ob-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 7px 16px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.se-ob-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: 0;
  border-radius: 3px 0 0 3px;
  opacity: 0.14;
}

.se-ob-bar.ask { background: var(--se-loss); }
.se-ob-bar.bid { background: var(--se-gain); }

.se-ob-price {
  position: relative;
  font-weight: 600;
}

.se-ob-vol {
  position: relative;
  color: var(--se-text-caption);
}

.se-ob-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--se-border-strong);
}

.se-ob-click {
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease);
}

.se-ob-click:hover {
  background: var(--se-surface-subtle);
}

.se-ob-hint {
  margin: 8px 2px 0;
  font-size: 11px;
  color: var(--se-text-faint);
}

/* 호가 클릭으로 가격이 입력됐을 때 잠깐 강조 */
.se-input.se-flash {
  border-color: var(--hze-bi-01);
  box-shadow: var(--se-focus-ring);
}

/* 체결 */

.se-trades-table td,
.se-trades-table th {
  padding: 8px 16px;
  font-size: 13px;
}

/* ── 마켓 테이블 ─────────────────────────────────────── */

.se-row-link {
  cursor: pointer;
}

.se-rank {
  width: 40px;
  color: var(--se-text-faint);
  font-size: 12px;
}

/* ── 주문 패널 ───────────────────────────────────────── */

.se-order-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 18px 16px;
}

.se-order-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
}

.se-order-tab {
  padding: 9px 0;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  background: transparent;
  color: var(--se-text-caption);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease),
    border-color var(--se-duration) var(--se-ease);
}

.se-order-tab.is-buy.is-active {
  background: rgba(252, 95, 95, 0.14);
  border-color: var(--se-gain);
  color: var(--se-gain);
}

.se-order-tab.is-sell.is-active {
  background: rgba(83, 185, 252, 0.14);
  border-color: var(--se-loss);
  color: var(--se-loss);
}

.se-order-amount {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--se-text-caption);
}

.se-order-amount strong {
  color: var(--se-text);
  font-variant-numeric: tabular-nums;
}

.se-order-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  background: var(--se-surface-muted);
}

.se-order-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 12px;
  font-size: 13px;
}

.se-order-dl dt {
  color: var(--se-text-muted);
}

.se-order-dl dd {
  margin: 0;
  color: var(--se-text);
  font-variant-numeric: tabular-nums;
}

.se-order-dry {
  color: #fbbf24;
  font-weight: 600;
}

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

.se-order-actions .se-btn-primary {
  flex: 1;
}

.se-order-actions .se-btn-ghost {
  width: auto;
}

.se-order-result {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--se-radius-sm);
  background: rgba(83, 185, 252, 0.1);
  font-size: 13px;
  color: var(--hze-success);
}

.se-order-result.is-error {
  background: rgba(252, 95, 95, 0.12);
  color: var(--hze-error);
}

.se-order-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: #fbbf24;
}

.se-order-ctx {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--se-text-muted);
}

.se-order-ctx strong {
  color: var(--se-text-caption);
  font-variant-numeric: tabular-nums;
}

.se-order-ctx-title {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--se-text-muted);
}

.se-ctx-order {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--se-border);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.se-ctx-order .se-ctx-status {
  margin-left: auto;
  color: var(--se-text-muted);
  font-size: 12px;
}

/* .se-btn-xs 크기 규격은 버튼 시스템 섹션(se-btn-primary 정의 뒤)의
   컴파운드 셀렉터에서 변형 공통으로 정의한다 */

/* ── 자동매매 ───────────────────────────────────────── */

.se-btn-inline {
  display: inline-flex;
  width: auto;
}

.se-inline-form {
  display: inline-block;
  margin: 0;
}

.se-btn-kill {
  padding: 10px 18px;
  border: 1px solid var(--hze-error);
  border-radius: var(--se-radius-sm);
  background: rgba(252, 95, 95, 0.12);
  color: var(--hze-error);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--se-duration) var(--se-ease);
}

.se-btn-kill:hover {
  background: rgba(252, 95, 95, 0.24);
}

.se-btn-kill.is-active {
  background: var(--hze-error);
  color: #fff;
}

.se-strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.se-strategy-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 20px;
}

.se-strategy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.se-strategy-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--se-text);
}

.se-strategy-name:hover {
  color: var(--hze-bi-05);
}

.se-mode-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  white-space: nowrap;
}

.se-mode-badge.is-live {
  background: rgba(252, 95, 95, 0.16);
  color: var(--hze-error);
}

.se-type-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  white-space: nowrap;
}

.se-type-badge.is-portfolio {
  background: rgba(96, 165, 250, 0.16);
  color: #60a5fa;
}

/* AI 자동매매 설정 표시 (전략 상세) */
.se-llm-config {
  margin: 4px 0 22px;
}
.se-llm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.se-chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  color: #b8c0cc;
}
.se-chip.is-on {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}
.se-thesis {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #c8cdd6;
  margin-top: 6px;
}
.se-llm-last {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
}
.se-llm-last-reason {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #c8cdd6;
  white-space: pre-wrap;
  word-break: break-word;
}
.se-llm-picks {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #b8c0cc;
}
.se-llm-picks li {
  margin-bottom: 3px;
}
.se-llm-picks b {
  color: #e6e9ee;
}

.se-strategy-meta {
  margin: 4px 0 10px;
  font-size: 13px;
  color: var(--se-text-muted);
}

.se-strategy-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.se-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

.se-state-badge.state-running {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.se-state-badge.state-paused {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}

.se-state-badge .se-live-dot {
  background: currentColor;
}

.se-strategy-error {
  font-size: 12px;
  color: var(--hze-error);
}

.se-strategy-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--se-border);
  border-bottom: 1px solid var(--se-border);
}

.se-strategy-stats dt {
  font-size: 11px;
  color: var(--se-text-faint);
  margin-bottom: 4px;
}

.se-strategy-stats dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.se-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.se-signal-reason {
  max-width: 360px;
  font-size: 13px;
  color: var(--se-text-caption);
  white-space: normal;
}

.se-detail-2col {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .se-detail-2col {
    grid-template-columns: 1fr;
  }
}

/* 정정 모달 */

.se-dialog {
  width: 360px;
  max-width: calc(100vw - 48px);
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-lg);
  background: var(--se-surface);
  color: var(--se-text);
  padding: 0;
  box-shadow: var(--se-shadow-card);
}

.se-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.se-dialog-body {
  margin: 0;
  padding: 24px;
}

.se-dialog-title {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
}

.se-dialog-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--se-text-muted);
}

.se-btn-refresh {
  display: inline-block;
  width: auto;
  text-align: center;
  flex-shrink: 0;
}

.se-section-title {
  margin: 36px 0 14px;
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── 보유 종목 테이블 ────────────────────────────────── */

.se-table-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  overflow: hidden;
}

.se-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.se-table th {
  padding: 12px 16px;
  background: var(--se-surface-muted);
  border-bottom: 1px solid var(--se-border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--se-text-muted);
  text-align: left;
  white-space: nowrap;
}

.se-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--se-border);
  vertical-align: middle;
  white-space: nowrap;
}

.se-table tbody tr:last-child td {
  border-bottom: none;
}

.se-table tbody tr {
  transition: background var(--se-duration) var(--se-ease);
}

.se-table tbody tr:hover {
  background: var(--se-surface-subtle);
}

.se-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.se-table .se-strong {
  font-weight: 600;
}

.se-stock {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.se-stock-name {
  font-weight: 600;
  color: var(--se-text);
}

.se-stock-meta {
  font-size: 12px;
  color: var(--se-text-muted);
}

.se-rate {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.85;
}

/* ── 폼 공통 ─────────────────────────────────────────── */

.se-field {
  display: block;
  margin-bottom: 16px;
}

.se-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--se-text-sub);
}

.se-required {
  color: var(--hze-error);
  font-style: normal;
}

.se-field-help {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--se-text-faint);
}

.se-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  background: var(--se-surface-muted);
  color: var(--se-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--se-duration) var(--se-ease),
    box-shadow var(--se-duration) var(--se-ease);
}

.se-input::placeholder {
  color: var(--se-text-faint);
}

.se-input:focus {
  outline: none;
  border-color: var(--hze-bi-01);
  box-shadow: var(--se-focus-ring);
}

.se-form-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--se-radius-sm);
  background: rgba(252, 95, 95, 0.12);
  color: var(--hze-error);
  font-size: 13px;
}

.se-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--se-radius-sm);
  background: var(--hze-bi-01);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--se-shadow-btn-primary);
  transition: background var(--se-duration) var(--se-ease);
}

.se-btn-primary:hover {
  background: var(--hze-primary-hover);
  color: #fff;
}

/* 크기 변형: 변형(primary/ghost)과 무관하게 동일 규격.
   컴파운드 셀렉터로 소스 순서와 무관하게 베이스를 이긴다 */
.se-btn-primary.se-btn-xs,
.se-btn-ghost.se-btn-xs {
  width: auto;
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}

.se-btn-block {
  display: block;
  width: 100%;
}

/* ── 메시지 ──────────────────────────────────────────── */

.se-messages {
  max-width: 1200px;
  width: 100%;
  margin: 16px auto -16px;
  padding: 0 28px;
}

.se-message {
  padding: 10px 14px;
  border-radius: var(--se-radius-sm);
  font-size: 13px;
  background: var(--se-surface-subtle);
  color: var(--se-text-sub);
}

.se-message-success {
  background: rgba(83, 185, 252, 0.12);
  color: var(--hze-success);
}

.se-message-error {
  background: rgba(252, 95, 95, 0.12);
  color: var(--hze-error);
}

/* ── 로그인 (auth) ───────────────────────────────────── */

.se-auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(58, 67, 255, 0.14), transparent),
    var(--se-bg-secondary);
}

.se-auth-card {
  width: 380px;
  max-width: calc(100vw - 48px);
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-lg);
  padding: 40px 36px 36px;
  box-shadow: var(--se-shadow-card);
}

.se-auth-logo {
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: 24px;
}

.se-auth-desc {
  margin: 6px 0 28px;
  text-align: center;
  font-size: 13px;
  color: var(--se-text-muted);
}

/* ── 증권사 연동 온보딩 ──────────────────────────────── */

.se-connect {
  max-width: 520px;
}

.se-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.se-provider-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-md);
  background: var(--se-surface);
  color: var(--se-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--se-duration) var(--se-ease),
    background var(--se-duration) var(--se-ease),
    box-shadow var(--se-duration) var(--se-ease);
}

.se-provider-card:hover:not(.is-disabled) {
  border-color: var(--hze-bi-05);
}

.se-provider-card.is-selected {
  border-color: var(--hze-bi-01);
  background: var(--se-surface-selected);
  box-shadow: var(--se-focus-ring);
}

.se-provider-card.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.se-provider-name {
  font-size: 15px;
  font-weight: 600;
}

.se-provider-badge {
  font-size: 11px;
  line-height: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

.se-provider-badge.is-connected {
  background: rgba(83, 185, 252, 0.14);
  color: var(--hze-success);
}

.se-connect-help {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--se-text-faint);
}

/* ── 알림 ─────────────────────────────────────────────── */

.se-notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--se-radius-sm);
  color: var(--se-text-caption);
  transition: background var(--se-duration) var(--se-ease);
}

.se-notif-bell:hover {
  background: var(--se-surface-subtle);
  color: var(--se-text-sub);
}

.se-notif-count {
  position: absolute;
  top: 1px;
  right: -2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--se-gain);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.se-notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
}

.se-notif-item {
  padding: 12px 16px;
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  background: var(--se-surface);
}

.se-notif-item.is-unread {
  background: var(--se-surface-subtle);
  border-color: var(--se-border-strong);
}

.se-notif-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.se-notif-kind {
  font-size: 11px;
  font-weight: 600;
  color: var(--se-text-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.se-notif-item.level-warning .se-notif-kind { color: var(--se-warning, #e8a93c); }
.se-notif-item.level-critical .se-notif-kind { color: var(--se-gain); }

.se-notif-time {
  font-size: 11px;
  color: var(--se-text-faint);
  font-variant-numeric: tabular-nums;
}

.se-notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--se-text);
}

.se-notif-title a { color: inherit; }
.se-notif-title a:hover { text-decoration: underline; }

.se-notif-body {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--se-text-sub);
}

/* ── 분석·백테스트 ───────────────────────────────────── */

.se-empty {
  padding: 32px 20px;
  border: 1px dashed var(--se-border-strong);
  border-radius: var(--se-radius-md);
  color: var(--se-text-caption);
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
}

.se-analytics-chart {
  height: 320px;
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  background: var(--se-surface);
  overflow: hidden;
}

.se-backtest-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 1100px) {
  .se-backtest-grid {
    grid-template-columns: 1fr;
  }
}

.se-backtest-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .se-backtest-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.se-backtest-stats > div {
  padding: 12px 14px;
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  background: var(--se-surface);
}

.se-backtest-stats dt {
  font-size: 11px;
  color: var(--se-text-caption);
  margin-bottom: 4px;
}

.se-backtest-stats dd {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.se-backtest-result .se-analytics-chart {
  height: 260px;
  margin-bottom: 20px;
}

.se-table-scroll {
  max-height: 420px;
  overflow-y: auto;
}

.se-table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--se-bg);
  z-index: 1;
}

/* 일일 리포트 아코디언 */

.se-report-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.se-report-item {
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  background: var(--se-surface);
}

.se-report-item summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}

.se-report-item summary::-webkit-details-marker {
  display: none;
}

.se-report-item[open] summary {
  border-bottom: 1px solid var(--se-border);
}

.se-report-date {
  font-weight: 700;
  color: var(--se-text);
  font-variant-numeric: tabular-nums;
}

.se-report-summary {
  color: var(--se-text-sub);
}

.se-report-item .se-table-card,
.se-report-item table {
  border: none;
}

.se-report-item > table,
.se-report-item > p {
  margin: 0;
  padding: 8px 16px 12px;
}

.se-logo-mark {
  border-radius: 6px;
  margin-right: 2px;
  vertical-align: -4px;
}

/* hidden 속성이 display를 가진 클래스에 덮이지 않게 강제 */
[hidden] {
  display: none !important;
}

/* ══ 모바일 (앱형 셸) ══════════════════════════════════ */

/* 하단 탭 네비게이션: 900px 이하에서만 표시 */
.se-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(13, 14, 18, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--se-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}

.se-bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  border: none;
  background: none;
  border-radius: var(--se-radius-sm);
  color: var(--se-text-faint);
  font-size: 10.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--se-duration) var(--se-ease);
}

.se-bnav-item svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.se-bnav-item.is-active {
  color: var(--se-text);
}

.se-bnav-item.is-active svg {
  stroke-width: 2.1;
}

/* 더보기 시트 */
.se-more-backdrop {
  position: fixed;
  inset: 0;
  z-index: 61;
  background: rgba(0, 0, 0, 0.55);
}

.se-more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 62;
  background: var(--se-surface);
  border: 1px solid var(--se-border-strong);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: se-sheet-up 0.22s var(--se-ease);
}

@keyframes se-sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.se-more-grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--se-border-strong);
  margin: 2px auto 12px;
}

.se-more-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 10px;
  border: none;
  background: none;
  border-radius: var(--se-radius-sm);
  color: var(--se-text);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.se-more-item:active {
  background: var(--se-surface-subtle);
}

.se-more-item-danger {
  color: var(--se-loss);
}

.se-more-logout {
  border-top: 1px solid var(--se-border);
  margin-top: 6px;
  padding-top: 6px;
}

/* 종목 상세 모바일 탭 (차트·정보 / 호가·체결 / 주문) */
.se-mobile-tabs {
  display: none;
  position: sticky;
  top: 52px;
  z-index: 20;
  gap: 6px;
  padding: 8px 0 10px;
  background: var(--se-bg);
}

.se-mobile-tab {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--se-border);
  background: var(--se-surface);
  border-radius: var(--se-radius-sm);
  color: var(--se-text-caption);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.se-mobile-tab.is-active {
  background: var(--se-surface-subtle);
  border-color: var(--se-border-strong);
  color: var(--se-text);
}

/* ── 인터랙션 레이어 ─────────────────────────────────── */

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

/* 페이지 진입 시 가벼운 페이드 업. live.js의 부분 교체는 .se-main 내부
   노드만 갈아끼우므로 재생되지 않는다 */
.se-main {
  animation: se-fade-up 0.28s var(--se-ease) both;
}

/* 페이지 이동 로딩 바: 상단 바 하단에서 무한 스윕 */
.se-nav-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 11;
}

.se-nav-progress::before {
  content: "";
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--hze-bi-01), #8a90ff);
  animation: se-nav-sweep 1.1s ease-in-out infinite;
}

/* 0.15s 지연: 즉시 끝나는 이동에서는 바가 보이지 않게 */
.se-nav-progress.is-active {
  opacity: 1;
  transition: opacity 0.2s var(--se-ease) 0.15s;
}

@keyframes se-nav-sweep {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(290%);
  }
}

/* 종목 검색 자동완성 */
.se-search-box {
  position: relative;
  max-width: 420px;
}

.se-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
  background: var(--se-surface);
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.se-search-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--se-border);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s var(--se-ease);
}

.se-search-item:last-child {
  border-bottom: none;
}

.se-search-item:hover,
.se-search-item:focus {
  background: var(--se-surface-subtle);
}

.se-search-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--se-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.se-search-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--se-text-muted);
  font-variant-numeric: tabular-nums;
}

.se-coverage-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--se-text-caption);
}

.se-ingest-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  padding: 16px;
}

.se-ingest-card .se-coverage-note {
  margin: 0 0 6px;
}

.se-ingest-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.se-market-search {
  margin-bottom: 14px;
}

/* 페이지네이션 (마켓 목록) */
.se-pager {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.se-pager-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-sm);
  color: var(--se-text-caption);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease),
    transform 0.12s var(--se-ease);
}

.se-pager-item:hover {
  background: var(--se-surface-subtle);
  color: var(--se-text);
}

.se-pager-item:active {
  transform: scale(0.94);
}

.se-pager-item.is-active {
  background: var(--hze-bi-01);
  border-color: var(--hze-bi-01);
  color: #fff;
}

/* 스크롤이 필요한 표 공통 래퍼 (카드 밖 bare 테이블용) */
.se-table-flow {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 누르는 맛: 버튼·세그먼트·리스트 항목 공통 프레스 피드백 */
.se-btn-primary,
.se-btn-ghost,
.se-seg-item,
.se-bnav-item,
.se-mobile-tab,
.se-mitem,
.se-mcard,
.se-row-link,
.se-refresh-btn,
.se-notif-bell {
  -webkit-tap-highlight-color: transparent;
}

.se-btn-primary {
  transition: background var(--se-duration) var(--se-ease),
    transform 0.12s var(--se-ease),
    box-shadow var(--se-duration) var(--se-ease);
}

.se-btn-primary:active {
  transform: scale(0.97);
}

.se-btn-ghost {
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease),
    transform 0.12s var(--se-ease);
}

.se-btn-ghost:active {
  transform: scale(0.97);
  background: var(--se-surface-subtle);
}

.se-seg-item {
  transition: background var(--se-duration) var(--se-ease),
    color var(--se-duration) var(--se-ease),
    transform 0.12s var(--se-ease);
}

.se-seg-item:active {
  transform: scale(0.96);
}

.se-card {
  transition: border-color var(--se-duration) var(--se-ease);
}

.se-mitem {
  transition: background 0.15s var(--se-ease), transform 0.12s var(--se-ease);
}

.se-mitem:active {
  transform: scale(0.985);
}

.se-mcard {
  transition: background 0.15s var(--se-ease);
}

.se-mcard:active {
  background: var(--se-surface-subtle);
}

/* 하단 탭: 아이콘 팝 + 프레스 축소 */
.se-bnav-item svg {
  transition: transform 0.18s var(--se-ease), stroke-width 0.18s var(--se-ease);
}

.se-bnav-item.is-active svg {
  transform: translateY(-1px);
}

.se-bnav-item:active svg {
  transform: scale(0.85);
}

@media (prefers-reduced-motion: reduce) {
  .se-main {
    animation: none;
  }

  .se-btn-primary:active,
  .se-btn-ghost:active,
  .se-seg-item:active,
  .se-mitem:active,
  .se-bnav-item:active svg {
    transform: none;
  }
}

/* ── 모바일 리스트/카드 (900px 이하에서 표를 대체) ──────── */

.se-mlist {
  display: none;
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-md);
  overflow: hidden;
}

.se-mitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--se-border);
  color: inherit;
  text-decoration: none;
}

.se-mitem:last-child {
  border-bottom: none;
}

.se-mitem:active {
  background: var(--se-surface-subtle);
}

.se-mitem-rank {
  flex-shrink: 0;
  width: 18px;
  font-size: 12px;
  color: var(--se-text-faint);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.se-mitem-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.se-mitem-name {
  font-weight: 600;
  color: var(--se-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.se-mitem-meta {
  font-size: 12px;
  color: var(--se-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.se-mitem-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.se-mitem-val {
  font-weight: 600;
  color: var(--se-text);
}

.se-mitem-sub {
  font-size: 12px;
}

.se-mcard {
  padding: 12px 14px;
  border-bottom: 1px solid var(--se-border);
}

.se-mcard:last-child {
  border-bottom: none;
}

.se-mcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.se-mcard-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  color: var(--se-text);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.se-mcard-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.se-mcard-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--se-text-sub);
  font-variant-numeric: tabular-nums;
}

.se-mcard-row .lbl {
  font-size: 12px;
  color: var(--se-text-muted);
}

.se-mcard-note {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--se-text-muted);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.se-mcard-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  /* 셸: 사이드바 제거 + 하단 탭 */
  .se-sidebar {
    display: none;
  }

  .se-bottom-nav {
    display: flex;
  }

  .se-shell-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .se-topbar {
    height: calc(50px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 14px 0;
  }

  .se-sidebar-toggle,
  .se-topbar-hint {
    display: none;
  }

  .se-topbar-title {
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .se-notif-bell {
    margin-left: auto;
  }

  .se-main {
    padding: 18px 16px 32px;
  }

  /* 페이지 헤더: 세로 스택 + 터치 여백 */
  .se-page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 4px;
  }

  .se-page-actions {
    flex-wrap: wrap;
  }

  .se-page-title {
    font-size: 22px;
    line-height: 30px;
  }

  .se-page-desc {
    margin-bottom: 16px;
  }

  .se-section-title {
    margin: 28px 0 12px;
    font-size: 16px;
  }

  /* 요약 카드 2열. 카드가 홀수 개면 첫 카드(총 자산 등 대표 지표)를
     풀폭으로 키워 시각 위계를 준다 */
  .se-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .se-card-grid > .se-card:first-child:nth-last-child(odd) {
    grid-column: 1 / -1;
  }

  .se-card {
    padding: 16px;
    border-radius: var(--se-radius-lg);
  }

  .se-card-value {
    font-size: 20px;
    line-height: 28px;
  }

  .se-card-sub {
    font-size: 12px;
  }

  .se-empty {
    padding: 26px 16px;
  }

  .se-messages {
    padding: 0 16px;
  }

  /* 모바일 리스트: 터치 타깃·여백 확대 */
  .se-mlist {
    border-radius: var(--se-radius-lg);
  }

  .se-mitem {
    padding: 14px 16px;
  }

  .se-mcard {
    padding: 14px 16px;
  }

  /* 표 → 모바일 리스트 전환: 핵심 정보만, 가로 스크롤 없음 */
  .se-m-hide {
    display: none !important;
  }

  .se-mlist {
    display: block;
  }

  /* 모바일에 남는 표: 좁은 패딩 + 가로 스크롤은 최후 수단 */
  .se-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .se-table th,
  .se-table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* 종목 정보 표: 4열(항목·값 × 2) → 2열 스택 */
  .se-info-table,
  .se-info-table tbody {
    display: block;
  }

  .se-info-table tr {
    display: grid;
    grid-template-columns: minmax(88px, auto) 1fr;
    border-bottom: 1px solid var(--se-border);
  }

  .se-info-table tr:last-child {
    border-bottom: none;
  }

  .se-info-table th,
  .se-info-table td {
    border-bottom: none;
    white-space: normal;
    word-break: keep-all;
  }

  /* iOS 입력 줌 방지 + 터치 타깃 */
  .se-input,
  select.se-input {
    font-size: 16px;
    min-height: 44px;
  }

  .se-btn-primary:not(.se-btn-xs),
  .se-btn-ghost:not(.se-btn-xs) {
    min-height: 44px;
  }

  /* xs 버튼은 모바일에서만 터치 타깃 보강 */
  .se-btn-primary.se-btn-xs,
  .se-btn-ghost.se-btn-xs {
    height: 34px;
  }

  .se-strategy-grid {
    grid-template-columns: 1fr;
  }

  /* 종목 상세: 탭으로 컬럼 전환 */
  .se-mobile-tabs {
    display: flex;
  }

  /* 탭 상태는 컨테이너 클래스로 관리: 라이브 폴링이 패널 노드를
     통째로 교체(replaceWith)해도 상태가 유지된다 */
  .se-stock-grid {
    display: block;
  }

  .se-stock-grid > div {
    display: none;
  }

  .se-stock-grid.mtab-chart > .se-stock-col-main,
  .se-stock-grid.mtab-ob > .se-stock-col-ob,
  .se-stock-grid.mtab-order > .se-stock-col-order {
    display: block;
  }

  .se-tv-chart {
    height: 320px;
  }

  .se-trades-scroll {
    max-height: 300px;
  }

  .se-analytics-chart {
    height: 240px;
  }

  .se-backtest-stats {
    gap: 8px;
  }

  /* 분석 리포트 요약 줄바꿈 */
  .se-report-item summary {
    padding: 12px 12px;
  }
}

/* ── MCP 연동 ── */

.se-mcp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.se-mcp-card {
  display: flex;
  flex-direction: column;
}

.se-mcp-section {
  margin-top: 28px;
}

/* 발급 직후 1회 노출 콜아웃 (좌측 accent bar 금지 → 배경톤으로 강조) */
.se-token-reveal {
  background: var(--se-surface-subtle);
  border: 1px solid var(--se-border-strong);
  border-radius: var(--se-radius-md);
  padding: 16px 18px;
  margin-bottom: 24px;
}

.se-token-reveal-title {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--se-text);
}

.se-token-secret {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--se-bg-secondary);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-sm);
}

.se-token-secret code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--se-text-sub);
}

.se-code-block {
  margin: 8px 0 12px;
  padding: 12px 14px;
  background: var(--se-bg-secondary);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-sm);
  overflow-x: auto;
}

.se-code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--se-text-sub);
  white-space: pre-wrap;
  word-break: break-all;
}

.se-scope-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--se-surface-subtle);
  color: var(--se-text-caption);
}

.se-scope-badge.is-trade {
  background: rgba(252, 95, 95, 0.14);
  color: #fc7a7a;
}

.se-status-badge.is-on {
  background: rgba(83, 185, 252, 0.16);
  color: #7cc7fc;
}

.se-row-muted {
  opacity: 0.5;
}

.se-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
  font-size: 14px;
  color: var(--se-text-sub);
  cursor: pointer;
}

.se-check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 백테스트 리스크 접이식 */
.se-risk-fold {
  margin: 4px 0 8px;
  padding: 12px 14px;
  background: var(--se-surface-muted);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-sm);
}

.se-risk-fold > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--se-text-sub);
}

.se-risk-fold[open] > summary {
  margin-bottom: 8px;
}

.se-text-faint {
  color: var(--se-text-faint);
}

/* ── 전략 규칙 빌더 ── */
.se-rule-group {
  margin: 6px 0 18px;
}

.se-rule-combine-field {
  max-width: 220px;
}

.se-rule-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}

.se-rule-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--se-surface-muted);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-sm);
}

.se-operand {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.se-operand-params {
  display: inline-flex;
  gap: 6px;
}

.se-rule-row .se-input {
  width: auto;
  min-width: 88px;
  padding: 8px 10px;
}

.se-rule-row .se-operand-param {
  max-width: 84px;
}

.se-rule-row .se-rule-op {
  min-width: 96px;
}

.se-rule-row .se-btn-xs {
  margin-left: auto;
}

.se-account-limit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 18px;
  padding: 12px 14px;
  background: var(--se-surface-muted);
  border: 1px solid var(--se-border);
  border-radius: var(--se-radius-sm);
}
.se-account-limit .se-input { width: auto; min-width: 180px; }
.se-account-limit .se-field-label { margin: 0; }
.se-account-limit .se-field-help { flex-basis: 100%; margin: 0; }
