:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #697586;
  --line: #d8dee8;
  --green: #177245;
  --blue: #2457d6;
  --red: #c0392b;
  --gold: #b7791f;
}

* {
  box-sizing: border-box;
}

/* 🔴 `hidden` 속성을 한 곳에서 못 박는다 (2026-09-20).
 *
 * `hidden`은 브라우저 **기본** 스타일시트의 `[hidden]{display:none}`으로 동작한다.
 * 저자 CSS가 그 요소에 display를 주면 우선순위에서 이겨 **조용히 무력화된다.**
 * 로그인 폼이 정확히 그랬다 — `.login-form{display:grid}`가 이겨서 HTML의 `hidden`도,
 * JS의 `form.hidden = true`도 한 번도 들은 적이 없다(사용자 스크린샷으로 발견).
 * 09-18에 "렌더 타이밍 문제"로 잘못 짚었던 것의 진짜 원인이다.
 *
 * 아래 `.text-fold[hidden]`·`.card-detail[hidden]`은 같은 함정을 그때그때 때운 자국이다.
 * 이 규칙이 그 계열을 통째로 막는다. **새 컴포넌트마다 다시 때우지 말 것.**
 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(20px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.brand-logo {
  display: block;
  width: 210px;
  height: 54px;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #fff;
  background: #111827;
  border-radius: 8px;
  font-weight: 800;
}

.brand h1,
.brand p,
.section-grid h3,
.section-grid p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.nav a,
.nav span {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
}

.nav a:hover {
  background: #eef2ff;
  color: var(--blue);
}

main {
  display: grid;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: 28px auto 56px;
}

/* .hero / .strategy-panel 은 2026-09-04에 status-bar로 대체되며 제거됨. */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.metrics span,
.portfolio-panel span {
  color: var(--muted);
  font-size: 14px;
}

.metrics strong,
.portfolio-panel strong {
  font-size: 28px;
}

.section-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-top: 10px;
}

.section-grid h3 {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.25;
}

.content-grid,
.position-grid,
.settings-grid {
  display: grid;
  gap: 16px;
}

.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h4 {
  margin: 0;
  font-size: 18px;
}

.panel-header span,
.tag {
  flex: none;
  padding: 5px 8px;
  color: var(--blue);
  background: #eef2ff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions .tag {
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.button.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.button.danger {
  color: #fff;
  background: #c9362b;
  border-color: #c9362b;
}

.button.warning {
  color: #7a3e00;
  background: #fff4dd;
  border-color: #e6a23c;
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}


.list {
  display: grid;
  gap: 12px;
}

.list-item,
.position-card,
.settings-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  background: #fafbfc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.list-item strong,
.position-card strong,
.settings-card strong {
  font-size: 16px;
}

.list-item span,
.position-card span,
.settings-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.list-item span,
.position-card span,
.feed-row p,
.evidence-list span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.position-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.real-review-card span {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* 수급동향(프로그램·외인·기관) — 제목 줄 + 3열 표(헤더행 + 값행) = 3줄. */
.supply-direction-line {
  margin-top: 3px;
}
.sd-title {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.sd-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 1px;
}
.sd-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  padding: 0 4px;
}
.sd-table td {
  font-size: 12.5px;
  text-align: center;
  padding: 0 4px 1px;
  white-space: nowrap;
}
.sd-table td b {
  font-weight: 600;
}
/* 표 안의 span(화살표)이 .position-card span 규칙에 걸려 블록으로 내려가는 것 방지 → 값 옆에 inline. */
.sd-table td span,
.sd-table td b {
  display: inline;
  overflow: visible;
  -webkit-line-clamp: unset;
}
.sd-flat {
  color: var(--muted);
}

.review-log-link {
  width: max-content;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.trade-tabs {
  display: inline-flex;
  gap: 6px;
  width: max-content;
  padding: 4px;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trade-tabs button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.trade-tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.log-tabs {
  margin: 0 0 12px;
}

.trade-panel {
  display: none;
}

.trade-panel.active {
  display: grid;
}

.simulation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 2px 0 14px;
}

.simulation-summary div,
.stat-fold-body > div,
.portfolio-panel > div:not(.portfolio-actions) {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.simulation-summary span,
.stat-fold-body > div span,
.portfolio-panel > div:not(.portfolio-actions) span {
  color: var(--muted);
  font-size: 13px;
}

.simulation-summary strong,
.stat-fold-body > div strong,
.portfolio-panel > div:not(.portfolio-actions) strong {
  font-size: 19px;
}

.trade-log-list {
  display: grid;
  gap: 10px;
}

.analysis-log-list {
  display: grid;
  gap: 10px;
}

.analysis-log-row {
  display: grid;
  gap: 7px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.analysis-log-row:last-child {
  border-bottom: 0;
}

.analysis-log-row strong {
  font-size: 14px;
  line-height: 1.45;
}

.analysis-log-row > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ai-log-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.ai-log-row {
  display: grid;
  gap: 9px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.ai-log-row h3,
.ai-log-row p {
  margin: 0;
}

.ai-log-row h3 {
  font-size: 17px;
  line-height: 1.45;
}

.ai-log-row p,
.ai-log-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.trade-log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #fafbfc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.trade-log-row > div {
  display: grid;
  gap: 6px;
}

.trade-log-row > div:last-child {
  justify-items: end;
}

.trade-log-row strong {
  font-size: 16px;
}

.trade-log-row span {
  color: var(--muted);
  font-size: 13px;
}

.exit-signals {
  margin-top: 2px;
}

.exit-signals > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  width: fit-content;
}

.exit-signals > summary:hover {
  color: inherit;
}

.exit-signals ul {
  margin: 6px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 8px;
}

.exit-signals li {
  font-size: 12px;
  line-height: 1.45;
  color: inherit;
}

.exit-signals a {
  color: inherit;
  text-decoration: underline;
}

.exit-excerpt {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.profit-positive {
  color: var(--green);
}

.profit-negative {
  color: var(--red);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.inline-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-form input {
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.simulation-mode-selector {
  display: grid;
  gap: 6px;
  min-width: 176px;
  margin: 0;
  padding: 0;
  border: 0;
}

.simulation-mode-selector legend {
  margin: 0 0 6px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.simulation-mode-selector > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.simulation-mode-selector label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 30px;
  cursor: pointer;
}

.simulation-mode-selector input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
}

.simulation-mode-selector span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.simulation-mode-selector input:checked + span {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.simulation-mode-selector input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.simulation-mode-selector input:disabled + span {
  cursor: not-allowed;
  opacity: 0.55;
}

.muted-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.portfolio-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.portfolio-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.portfolio-actions > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portfolio-panel p {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-panel .position-grid {
  grid-column: 1 / -1;
  width: 100%;
}

.portfolio-panel .position-policy {
  grid-column: 1 / -1;
  margin: 0;
}

.position-sell-preview {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* 카드 첫 줄: 종목코드(좌) + 매도 금지 체크박스(우). 카드가 grid라 한 줄을 flex로
   묶어 배치한다 — 절대배치는 아래 내용과 겹칠 위험이 있어 쓰지 않는다. */
.position-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}

.hold-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted, #8a8f98);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex: none;
}

.hold-lock-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #d0342c;
}

.hold-lock-toggle input:checked + span {
  color: #d0342c;
  font-weight: 700;
}

/* 잠긴 종목의 매도 판단 문구 — 위험(빨강)도 안전(초록)도 아닌 '보류' 톤. */
.position-sell-preview .hold-locked,
.position-card > .hold-locked {
  color: #b26a00;
  font-weight: 700;
}

.position-sell-preview span,
.position-sell-preview small {
  display: block;
  overflow: visible;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.position-sell-preview .sell-preview-reason {
  color: var(--ink);
}

.position-sell-preview small {
  color: var(--muted);
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-form input,
.settings-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.wide-field {
  grid-column: span 2;
}

.form-message {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.status-strip span {
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.status-ok {
  color: var(--green);
  background: #eaf7ef;
}

.status-warn {
  color: var(--gold);
  background: #fff7e6;
}

.status-muted {
  color: var(--muted);
  background: #f3f6fb;
}

.member-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #fafbfc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.member-card > div:first-child,
.member-actions {
  display: grid;
  gap: 7px;
}

.member-card strong {
  font-size: 16px;
}

.member-card span {
  color: var(--muted);
  font-size: 13px;
}

.member-actions {
  grid-template-columns: repeat(2, auto);
  justify-content: end;
}

.member-actions .button {
  min-height: 34px;
}

.broker-token-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  background: #fafbfc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
}

.checkbox-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 4px;
}

.page-title h2,
.page-title p {
  margin: 0;
}

.page-title h2 {
  margin-top: 8px;
  font-size: 36px;
}

.page-title p:not(.eyebrow) {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 180px)) auto;
  gap: 12px;
  align-items: end;
}

.filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-bar input,
.filter-bar select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.source-pill {
  display: inline-grid;
  gap: 2px;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.source-pill strong {
  font-size: 13px;
}

.source-pill span {
  color: var(--muted);
  font-size: 12px;
}

.feed-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.feed-row {
  display: grid;
  gap: 8px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.feed-row.empty {
  color: var(--muted);
}

.feed-row h3,
.feed-row p {
  margin: 0;
}

.feed-row h3 {
  font-size: 18px;
  line-height: 1.35;
}

.feed-row h3 a:hover {
  color: var(--blue);
}

.feed-row p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.feed-meta span {
  padding: 4px 7px;
  background: #f3f6fb;
  border-radius: 6px;
}

.evidence-list {
  display: grid;
  gap: 6px;
}

.evidence-list span {
  padding: 9px 10px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 18px;
}

.pager span {
  min-width: 80px;
  color: var(--muted);
  text-align: center;
}

.auth-main {
  place-items: center;
  min-height: calc(100vh - 132px);
}

/* 좌측 소개 패널(.auth-intro)을 걷어냈다(2026-09-06) — 외부 Unsplash 이미지를
   배경으로 쓰던 마케팅 칸이다. 로그인 화면은 로그인만 보여준다.
   ⚠️ 외부 이미지 의존이 사라져 오프라인·차단망에서도 화면이 온전하다. */
.auth-shell {
  display: grid;
  gap: 28px;
  width: min(440px, 100%);
}

.auth-panel {
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-panel {
  align-content: center;
  background: var(--surface);
}

.auth-panel h2 {
  margin: 8px 0 0;
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-panel .form-message {
  margin: 0;
  color: var(--red);
}

.social-login {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 860px) {
  .topbar,
  .nav {
    align-items: flex-start;
  }

  .topbar,
  .section-grid,
  .content-grid,
  .metrics,
  .position-grid,
  .simulation-summary,
  .portfolio-panel,
  .settings-grid,
  .settings-form,
  .member-card,
  .trade-log-row,
  .filter-bar,
  .inline-form,
  .checkbox-grid,
  .social-login,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    width: 180px;
  }

  .page-title {
    display: grid;
    align-items: start;
  }

  .topbar {
    display: grid;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .wide-field {
    grid-column: auto;
  }

  .member-actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .trade-log-row > div:last-child {
    justify-items: start;
  }
}

/* 보유 종목 카드 미니 호가창 (2026-08-24) */
.mini-book { margin: 8px 0; padding: 6px 8px; border-radius: 8px; background: rgba(127,127,127,.08); font-variant-numeric: tabular-nums; font-size: 12px; }
.mini-book .mb-row { display: grid; grid-template-columns: 1fr 74px 88px; align-items: center; gap: 6px; padding: 1px 0; }
.mini-book .mb-row span { text-align: right; opacity: .75; }
.mini-book .mb-row i { text-align: right; font-style: normal; }
.mini-book .mb-row b { text-align: right; font-weight: 700; }
.mini-book .mb-ask b { color: #2f6fed; }
.mini-book .mb-bid b { color: #e0453d; }
/* 증감 색 = 어느 쪽 호가인가(매도 파랑 / 매수 빨강). 방향은 화살표가 말한다.
   증가를 무조건 빨강으로 칠하면 '매도벽이 두꺼워짐'이 상승 신호로 읽힌다. */
.mini-book .mb-ask-delta { color: #2f6fed; }
.mini-book .mb-bid-delta { color: #e0453d; }
.mini-book .mb-flat { opacity: .3; }
.mini-book .mb-current { margin: 3px 0; padding: 2px 0; text-align: right; font-weight: 700; border-top: 1px solid rgba(127,127,127,.28); border-bottom: 1px solid rgba(127,127,127,.28); }
/* 동시호가 예상체결가 — 직전 체결가가 아니라 '이 가격에 체결될 예정'이라는 뜻이라
   평소 현재가 줄과 눈으로 구분되어야 한다. 라벨은 작게, 값은 그대로 강조. */
.mini-book .mb-change { font-size: 11px; font-weight: 600; margin-left: 4px; }
.mini-book .mb-flat { opacity: .65; }
.mini-book .mb-expected { color: #b8860b; }
.mini-book .mb-expected em { font-style: normal; font-weight: 600; font-size: 11px; opacity: .8; margin-right: 2px; }
.mini-book .mb-expected i { font-style: normal; font-weight: 600; font-size: 11px; opacity: .8; }
@media (prefers-color-scheme: dark) { .mini-book .mb-expected { color: #e8b93a; } }
.mini-book .mb-sum { margin-top: 4px; text-align: right; opacity: .6; font-size: 11px; }
.mini-book .mb-empty { text-align: center; opacity: .45; padding: 4px 0; }

/* 보유 종목 카드 상세 — 매도 계획·기술 보조·시나리오·투자 근거는 평소엔 접어 둔다.
   카드 하나가 10줄 넘게 차지해 보유 종목 여러 개를 한 화면에서 못 봤다. */
.position-detail {
  display: grid;
  gap: 7px;
  border-top: 1px solid #edf0f5;
  padding-top: 7px;
}

.position-detail > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
  user-select: none;
}

.position-detail > summary::-webkit-details-marker {
  display: none;
}

.position-detail > summary::before {
  content: "▸ ";
}

.position-detail[open] > summary::before {
  content: "▾ ";
}

.position-detail[open] > summary {
  margin-bottom: 1px;
}

/* 실거래 카드에선 .position-sell-preview가 이미 위쪽 구분선을 갖고 있다.
   여기에 상세의 구분선까지 겹치면 두 줄 간격으로 선이 두 번 그어져 지저분하다. */
.position-sell-preview > .position-detail {
  border-top: none;
  padding-top: 0;
}

/* 현금 확보 목표 — 출금 전에 목표 현금까지 나눠 매도시키는 컨트롤. */
.cash-reserve {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.cash-reserve > label {
  font-size: 13px;
  font-weight: 700;
}

.cash-reserve-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cash-reserve-input input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}

#cashReserveStatus {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

#cashReserveStatus.cash-reserve-active {
  color: #b26a00;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════════════
   접기 컴포넌트 + 모바일 레이아웃 (2026-09-04)

   이 화면은 **모바일에서 보려고** 서버에 올린 것인데 모바일이 가장 안 읽혔다.
   원인 두 가지를 나눠서 고친다.
     ① 레이아웃 — 상단 내비가 8개 항목을 flex로 나눠 가지며 글자가 세로로
        쪼개졌다. 3열 그리드가 모바일에서 1열이 되며 카드가 화면을 다 먹었다.
     ② 정보량 — 표에 이미 있는 값을 서술로 반복하고, 카드마다 산식·사유·근거를
        전부 펼쳐 놨다. 1차 지표만 남기고 나머지는 접는다.
   ══════════════════════════════════════════════════════════════════════ */

/* ── 접기: 통계 묶음 ─────────────────────────────────────────────────── */
.stat-fold {
  grid-column: 1 / -1;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat-fold > summary,
.text-fold > summary {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.stat-fold > summary::-webkit-details-marker,
.text-fold > summary::-webkit-details-marker {
  display: none;
}

/* 열림/닫힘을 글자로 알린다 — 삼각형만으로는 터치 화면에서 잘 안 보인다. */
.stat-fold > summary::before,
.text-fold > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.12s ease;
}

.stat-fold[open] > summary::before,
.text-fold[open] > summary::before {
  content: "▾ ";
}

.stat-fold > summary:hover,
.text-fold > summary:hover {
  color: var(--blue);
}

.stat-fold-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 12px 12px;
}

/* ── 접기: 서술 문단 ─────────────────────────────────────────────────── */
.text-fold {
  grid-column: 1 / -1;
  margin: 0 0 10px;
}

.text-fold p {
  margin: 0 0 8px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.6;
}

.text-fold[hidden] {
  display: none;
}

/* ── 카드 안 상세 토글 (후보 · AI 분석 기록) ─────────────────────────── */
.detail-toggle {
  justify-self: start;
  margin-top: 6px;
  padding: 5px 10px;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.detail-toggle:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.card-detail {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.card-detail[hidden] {
  display: none;
}

.candidate-card .card-eyebrow {
  font-size: 12px;
}

.candidate-card .card-headline {
  font-weight: 700;
}

/* ── 모바일 ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  /* 내비: 줄이는 대신 가로로 흘린다. flex 아이템이 줄어들면 글자가 세로로
     쪼개지므로 shrink를 막고 nowrap을 건다 — 이게 세로 글자의 원인이었다. */
  .topbar {
    gap: 10px;
    min-height: auto;
    padding: 10px 14px;
  }

  .nav {
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0 -14px;
    padding: 0 14px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a,
  .nav span {
    flex: 0 0 auto;
    padding: 7px 9px;
    white-space: nowrap;
  }

  .brand-logo {
    width: 132px;
    height: 34px;
  }

  main {
    width: calc(100% - 20px);
    gap: 16px;
    margin: 14px auto 40px;
  }

  /* 섹션 머리글은 한 줄로 눕힌다 — 세로로 쌓이면 스크롤만 늘어난다. */
  .section-grid {
    gap: 10px;
    padding-top: 4px;
  }

  .section-grid h3 {
    margin-top: 2px;
    font-size: 19px;
  }

  /* 3개짜리 핵심 지표는 짧아서 모바일에서도 3열이 낫다(1열이면 스크롤만 길다). */
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .metrics article {
    padding: 10px 8px;
  }

  .metrics span {
    font-size: 11px;
  }

  .metrics strong,
  .portfolio-panel strong {
    font-size: 18px;
  }

  /* 통계 타일은 2열. 1열이면 카드 하나가 화면을 다 먹는다. */
  .simulation-summary,
  .stat-fold-body,
  .portfolio-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .simulation-summary div,
  .stat-fold-body > div,
  .portfolio-panel > div:not(.portfolio-actions) {
    padding: 9px 10px;
  }

  .simulation-summary span,
  .stat-fold-body > div span,
  .portfolio-panel > div:not(.portfolio-actions) span {
    font-size: 11.5px;
  }

  .simulation-summary strong,
  .stat-fold-body > div strong,
  .portfolio-panel > div:not(.portfolio-actions) strong {
    font-size: 16px;
  }

  .panel {
    padding: 12px;
  }

  /* 실투자 조작 버튼은 한 줄에 다 안 들어간다. 세로로 눕히고 폭을 채운다. */
  .portfolio-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .portfolio-actions > div {
    justify-content: stretch;
  }

  .portfolio-actions > div .button {
    flex: 1 1 auto;
  }
}

/* 아주 좁은 화면(360px 이하)에서는 통계 타일도 1열로 떨어뜨린다. */
@media (max-width: 380px) {
  .simulation-summary,
  .stat-fold-body,
  .portfolio-panel {
    grid-template-columns: 1fr;
  }
}

/* ── 상단 상태 바 (2026-09-04, 종전 hero 대체) ─────────────────────────
   히어로는 마케팅 문구 + 매매 규칙 전문을 큰 판으로 깔고 있었다. 이 화면을
   보는 사람은 이미 무슨 서비스인지 알고, 규칙 전문은 매번 읽는 값이 아니다.
   살아 있는 상태 두 줄만 칩으로 남기고 규칙은 접는다.                      */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chips .chip {
  padding: 5px 10px;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-bar .rule-fold {
  grid-column: auto;
  margin: 0;
  min-width: 0;
}

.status-bar .rule-fold > summary {
  padding: 0;
}

.status-bar .rule-fold p {
  max-width: 72ch;
  margin: 8px 0 0;
  padding: 0;
}

@media (max-width: 860px) {
  .status-bar {
    align-items: flex-start;
    padding: 9px 10px;
  }

  .status-chips .chip {
    font-size: 11.5px;
  }
}
