/* WhyInvest — 공통 디자인 규격(wae/wae.css) 위에 앱 전용 값.
   값은 :root 토큰만 사용. 글자 5단계 / 둥글기 4종 / 간격 4의 배수. */
:root {
  --w-app:#6cc373;
  --bg:#fafafa; --surface:#fff; --surface-2:#f2f2ef; --surface-3:#e9e9e5;
  --border:#e4e4df; --border-strong:#c8c8c2;
  --text:#16181d; --text-2:#50545c; --text-3:#8a8e96;
  --primary:#16181d; --primary-hover:#2c2f37; --on-primary:#fff;
  --accent:#6cc373; --accent-soft:#e7f5ea;
  --ok:#2f9e44; --ok-soft:#e7f5ea; --ok-ink:#22783a;
  --bad:#e03131; --bad-soft:#fdecec; --bad-ink:#c22525;
  --warn:#e8a400; --warn-soft:#fff4d6; --warn-ink:#8a5a00;
  --info:#3049c8; --info-soft:#eaeefc;
  --fs-xs:12px; --fs-sm:14px; --fs-md:16px; --fs-lg:20px; --fs-xl:28px;
  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-pill:999px;
  --sh-1:var(--w-sh-1);
  --sh-2:var(--w-sh-2);
  --sh-pop:var(--w-sh-pop);
  --serif:'Noto Serif',Georgia,serif;
  --mono:ui-monospace,'SF Mono',Menlo,monospace;
  /* 이 서비스의 의미 별칭 */
  --up:var(--ok-ink); --down:var(--bad-ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--w-font);
  font-size: var(--fs-sm); line-height: 1.45; min-height: 100vh; padding: 0 var(--w-gutter) 80px;
  word-break: keep-all; overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button[disabled] { opacity: .45; cursor: default; }
a { color: inherit; }
h1, h2, h3 { letter-spacing: -.02em; }

/* ================= 부품 ================= */
/* 버튼: 알약, 흰 바탕 + 테두리 + 옅은 그림자. primary = 검정 채움(주요 행동에만) */
.btn, .edit-btn, .evctl .sort, .error button, .add button, dialog .close, .evpager button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 0; box-shadow: var(--sh-1);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text);
}
.btn:hover, .edit-btn:hover, .evctl .sort:hover, .evpager button:hover:not([disabled]) { background: var(--surface-2); }
.btn.primary, .edit-btn.on, .add button, dialog .close { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover, .edit-btn.on:hover, .add button:hover, dialog .close:hover { background: var(--primary-hover); }

/* 분절 알약: 서로 고르는 선택지. 선택된 칸만 검정 */
.pillgroup, .pager {
  display: inline-flex; align-items: stretch; border-radius: var(--r-pill); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.pager { border: 0; box-shadow: var(--sh-1); }
.pillgroup button, .pager button, .pager b {
  padding: 0 12px; height: 32px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.pillgroup button + button, .pager button + button { border-left: 1px solid var(--border); }
.pillgroup button.on, .pager .pg.on { background: var(--primary); color: var(--on-primary); }
.pillgroup button:hover:not(.on), .pager button:hover:not(.on):not([disabled]) { background: var(--surface-2); }

/* 분절 토글(화면 전환): 회색 트랙 위에서 선택된 쪽이 흰 알약으로 */
.w-seg button { display: inline-flex; align-items: center; justify-content: center; }
.w-seg button svg { width: 14px; height: 14px; }

/* 카드 */
.card { background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1); }

/* 배지: 원 안의 글자 / 알약 */
.badge {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: var(--fs-xs);
}
.b-악 { background: var(--bad); } .b-상 { background: var(--ok); } .b-중 { background: var(--text-3); }

/* 입력칸 */
.search input, .add input {
  width: 100%; height: 48px; border: 0; border-radius: var(--r-pill); background: var(--surface);
  padding: 0 24px; font: inherit; font-size: var(--fs-md); text-align: left; color: var(--text); box-shadow: var(--sh-1); outline: 0;
  transition: box-shadow .15s;
}
.add input { height: 40px; padding: 0 16px; }
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input:focus, .add input:focus { box-shadow: var(--sh-2); }
.search input::-webkit-search-cancel-button { display: none; }

/* ================= 헤더 (공통 .w-header) ================= */
.top.w-header { padding: 0; }
.tl { gap: 8px; flex-wrap: wrap; }
.mkt { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin: 0 0 8px; }
.mkt span.on { color: var(--ok-ink); } .mkt span.on::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.mkt .sep { font-style: normal; margin: 0 8px; color: var(--border-strong); }
.auth { display: flex; align-items: center; position: static; transform: none; gap: 0; font-size: inherit; }
/* 예전 헤더 규칙(가운데 정렬·28px 사진)이 캐시에 남아 섞여도 공통 규격이 이기도록 */
.top.w-header { text-align: left; min-height: 0; }
.top .w-logo { font-size: 20px; }
.auth .w-avatar img { width: 100%; height: 100%; border: 0; border-radius: 0; }
@media (max-width: 720px) { .top .w-logo { font-size: 17px; } }
.banner {
  max-width: 880px; margin: 8px auto 0; padding: 8px 16px; border-radius: var(--r-md);
  background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn-ink); font-size: var(--fs-xs); text-align: center;
}
.search { position: relative; max-width: 560px; margin: 16px auto 24px; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-pop); }
.sugg li button { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: var(--r-sm); text-align: left; font-size: var(--fs-sm); }
.sugg li button:hover, .sugg li button:focus { background: var(--surface-2); outline: 0; }
.sugg b { font-weight: 700; } .sugg span { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero { text-align: center; color: var(--text-3); font-weight: 600; font-size: var(--fs-lg); }
.hero p { margin: 0; }
.hint { text-align: center; color: var(--text-3); font-size: var(--fs-xs); margin: 8px 0 0; }
body.empty-mode .hero { margin-top: 20vh; margin-bottom: 16px; }
body.empty-mode .search { margin-top: 0; }

/* ================= 레이아웃 ================= */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 40px; max-width: 1280px; margin: 24px auto 0; }
.grid.one { grid-template-columns: minmax(0, 960px); justify-content: center; }
.detail-wrap { max-width: 1120px; margin: 16px auto 0; }
.back { display: inline-block; margin: 0 0 4px 8px; font-size: var(--fs-sm); color: var(--text-2); text-decoration: none; }
.back:hover { color: var(--text); }
.cell { min-width: 0; }
.cell .body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }
.chead { display: block; }
.pill-row { display: flex; justify-content: center; margin-bottom: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 0; box-shadow: var(--sh-1);
  font-weight: 600; font-size: var(--fs-md);
}
.pill .sym { background: none; font-weight: 600; font-size: inherit; }
.grid-mode .pill .sym:hover { text-decoration: underline; }
.pill .code { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); margin-left: 4px; }
.heart { font-size: var(--fs-md); line-height: 1; color: var(--border-strong); display: inline-flex; }
.heart.on { color: var(--accent); }
.del { width: 20px; height: 20px; border-radius: 50%; background: var(--bad); color: #fff; font-size: var(--fs-xs); line-height: 20px; text-align: center; }

/* ================= 뉴스 카드 ================= */
.events { display: flex; flex-direction: column; gap: 12px; min-width: 0; justify-content: flex-start; }
.ev {
  position: relative; flex: 1 1 0; min-height: 0; max-height: 120px; display: flex; flex-direction: column; justify-content: center;
  background: var(--surface); border: 0; border-radius: var(--r-md); box-shadow: var(--sh-1);
  padding: 12px 52px 12px 20px; cursor: default; outline: 0;
  transition: flex-grow .25s ease, box-shadow .2s ease;
}
.ev h3 { margin: 0; font-size: var(--fs-md); line-height: 1.3; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.ev h3 a { color: inherit; text-decoration: none; } .ev h3 a:hover { text-decoration: underline; }
.ev p {
  display: block; max-height: 0; opacity: 0; overflow: hidden; margin: 0;
  font-family: var(--serif); font-size: var(--fs-sm); font-weight: 400; line-height: 1.65; color: var(--text-2);
  transition: max-height .25s ease, opacity .2s ease, margin .2s ease;
}
.ev .meta { display: block; max-height: 0; opacity: 0; overflow: hidden; font-size: var(--fs-xs); color: var(--text-3); transition: max-height .25s ease, opacity .2s ease, margin .2s ease; }
.ev .badge { top: 50%; transform: translateY(-50%); right: 12px; transition: top .2s ease; }
.ev:hover, .ev:focus-visible, .ev.open { flex-grow: 3.2; max-height: 340px; box-shadow: var(--sh-2); z-index: 2; }
.ev:hover h3, .ev:focus-visible h3, .ev.open h3 { -webkit-line-clamp: 3; }
.ev:hover p, .ev:focus-visible p, .ev.open p { max-height: 160px; opacity: 1; margin-top: 8px; }
.ev:hover .meta, .ev:focus-visible .meta, .ev.open .meta { max-height: 40px; opacity: 1; margin-top: 4px; }
.ev:hover .badge, .ev:focus-visible .badge, .ev.open .badge { top: 24px; }
.ev.empty { display: grid; place-items: center; color: var(--text-3); font-size: var(--fs-sm); }
.ev.ph { visibility: hidden; box-shadow: none; background: none; border: 0; pointer-events: none; }
.ev .scope { display: inline-block; vertical-align: 1px; margin-right: 8px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.ev .scope.s-competitor { background: var(--warn-soft); color: var(--warn-ink); }
.ev .scope.s-industry { background: var(--info-soft); color: var(--info); }
.ev .imp { position: absolute; right: 12px; bottom: 8px; width: 28px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.ev .imp::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--text-3); }
.ev .imp.b-악::after { background: var(--bad); } .ev .imp.b-상::after { background: var(--ok); }
.evctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.evctl .sort { margin-left: auto; }
.evlist { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.evpager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.evpager button { width: 32px; padding: 0; }
.sk-ev { flex: 1 1 0; min-height: 52px; }

/* ================= 시세 카드 ================= */
.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.quote { padding: 20px; }
.q-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-weight: 700; display: grid; place-items: center; font-size: var(--fs-sm); flex: none; }
.q-name { font-size: var(--fs-lg); font-weight: 700; line-height: 1.1; }
.q-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 4px; }
.q-price { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.q-price .p { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; }
.q-price .cur { font-size: var(--fs-xs); color: var(--text-3); }
.chip { padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; }
.up .chip, .chip.up { background: var(--ok-soft); color: var(--ok-ink); }
.down .chip, .chip.down { background: var(--bad-soft); color: var(--bad-ink); }
.txt.up { color: var(--ok-ink); } .txt.down { color: var(--bad-ink); }
.q-abs { font-size: var(--fs-sm); font-weight: 600; }
.q-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 4px; }
.q-meta .link { text-decoration: underline; color: var(--text-3); font-size: inherit; }
/* 차트 기간: 있는 듯 없는 듯 — 테두리·배경 없이 글자만 */
.tabs { display: flex; gap: 4px; margin: 12px 0 8px; }
.tabs button { flex: 1; height: 24px; padding: 0 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); background: none; border: 0; transition: color .15s; }
.tabs button:hover { color: var(--text-2); }
.tabs button.on { color: var(--text); }
.tabs .tzbtn { flex: 0 0 auto; padding: 0 8px; color: var(--text-3); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; fill: var(--text-3); font-size: 10px; }
.chart .empty { padding: 40px 0; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.chart .tip { position: absolute; pointer-events: none; transform: translate(-50%, -110%); background: var(--primary); color: var(--on-primary); padding: 4px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); white-space: nowrap; z-index: 2; }
.chart .tip small { display: block; opacity: .75; }
.evm circle { cursor: help; }
.stats { display: grid; grid-template-columns: 1fr 1.25fr 1.15fr; gap: 0 16px; margin-top: 8px; font-size: var(--fs-xs); }
.stats dl { margin: 0; }
.stats .r { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.stats dt { color: var(--text-3); } .stats dd { margin: 0; font-weight: 600; }

/* ================= 판정 ================= */
.signal { padding: 20px; }
.sig-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; font-size: var(--fs-xs); color: var(--text-3); }
.conf { padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.conf.c-high { background: var(--ok-soft); color: var(--ok-ink); } .conf.c-low { background: var(--warn-soft); color: var(--warn-ink); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { position: relative; border-radius: var(--r-md); color: #fff; text-align: center; padding: 12px 4px; }
.tile b { display: block; font-size: var(--fs-md); font-weight: 700; line-height: 1.2; }
.tile span { display: block; font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; white-space: nowrap; }
.tile.sell { background: var(--bad); } .tile.hold { background: var(--text-3); } .tile.buy { background: var(--ok); }
.tile.top { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.tile .flag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--primary); color: var(--on-primary); border-radius: var(--r-pill); font-size: var(--fs-xs); font-style: normal; font-weight: 600; padding: 0 8px; white-space: nowrap; }
.signal.wide { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(220px, 1fr) minmax(260px, 1.25fr); gap: 16px 32px; align-items: center; padding: 16px 24px; }
.signal.wide .tile b { font-size: var(--fs-lg); }
.signal.wide .tile span { font-size: var(--fs-md); }
.signal.wide .sig-head { margin: 0 0 12px; }
.factors { margin: 0; display: grid; gap: 8px; }
.fac { display: grid; grid-template-columns: 112px 1fr 48px; align-items: center; gap: 12px; font-size: var(--fs-xs); }
.fac small { color: var(--text-3); font-size: var(--fs-xs); }
.fac .bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); }
.fac .bar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border-strong); }
.fac .bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.fac .bar i.pos { left: 50%; background: var(--ok); } .fac .bar i.neg { right: 50%; background: var(--bad); }
.fac b { text-align: right; font-weight: 700; }
.held { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--warn-ink); }
.why { margin: 0 0 8px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.why li { background: var(--surface-2); border-radius: var(--r-pill); padding: 0 8px; font-size: var(--fs-xs); color: var(--text-2); }
.note { margin: 0; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.sumline { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; margin: 0 0 8px; font-size: var(--fs-sm); color: var(--text-2); }
.sumline .v { padding: 0 8px; border-radius: var(--r-pill); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.sumline .v-buy { background: var(--ok); } .sumline .v-hold { background: var(--text-3); } .sumline .v-sell { background: var(--bad); }
.sumline .hl { font-weight: 700; color: var(--text); }
.sumline small { color: var(--text-3); font-size: var(--fs-xs); }
.sumline .busy { color: var(--warn-ink); }

/* ================= 상태·공통 ================= */
.loading, .error { padding: 48px 16px; text-align: center; color: var(--text-3); background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1); font-size: var(--fs-sm); }
.error button { margin-top: 12px; }
.sk { border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; }
.sk-quote { height: 260px; border-radius: var(--r-lg); } .sk-sig { height: 96px; border-radius: var(--r-lg); }
.detail-mode .sk-quote { height: 464px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.cell.dragging-ok { cursor: grab; outline: 2px dashed var(--border-strong); outline-offset: 8px; border-radius: var(--r-lg); }
.cell.dragging { opacity: .45; }
.pager { margin: 24px auto 0; display: flex; width: max-content; }
.edit-btn { position: fixed; right: 24px; bottom: 24px; height: 40px; }
.add { display: flex; justify-content: center; gap: 8px; margin: 16px auto 0; }
.add input { width: 260px; text-align: left; }
dialog { border: 0; border-radius: var(--r-lg); padding: 24px; max-width: 480px; box-shadow: var(--sh-pop); font-size: var(--fs-sm); line-height: 1.55; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(16, 18, 24, .35); }
dialog h4 { margin: 0 0 8px; font-size: var(--fs-md); }
dialog ul { padding-left: 16px; margin: 8px 0; }
dialog .close { margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); background: var(--primary); color: var(--on-primary); padding: 8px 16px; border-radius: var(--r-pill); font-size: var(--fs-sm); z-index: 5; box-shadow: var(--sh-pop); }

/* ================= 상세: [뉴스 | 가격] / [판정 가로 전체] ================= */
.detail-mode .body { grid-template-columns: 1fr 1fr; grid-template-areas: "ev q" "sig sig"; }
.detail-mode .body > .events { grid-area: ev; }
.detail-mode .body > .side { grid-area: q; }
.detail-mode .body > .sigrow { grid-area: sig; }
.detail-mode .body > .loading, .detail-mode .body > .error { grid-column: 1 / -1; }
.detail-mode .events { max-height: none; overflow: visible; }
.detail-mode .evlist .ev { flex: 0 0 auto; min-height: 64px; max-height: none; padding: 8px 52px 8px 16px; }
.detail-mode .ev .meta { max-height: 40px; opacity: 1; margin-top: 4px; }
.detail-mode .ev p { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }

/* ================= 한 화면 맞춤 (JS 가 body.fit 지정) ================= */
body.fit { padding-bottom: 0; overflow: hidden; }
body.fit .search { margin: 8px auto 16px; }
body.fit #app { height: var(--app-h); display: flex; flex-direction: column; overflow: hidden; }
body.fit .banner { margin-top: 4px; padding: 4px 16px; }
body.fit .grid { flex: 1; min-height: 0; margin-top: 0; max-width: 1440px; width: 100%; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 24px 40px; }
body.fit .grid.rows1 { grid-template-rows: minmax(0, 640px); }
body.fit .pager { flex: none; margin: 8px auto 0; }
body.fit .cell { display: flex; flex-direction: column; min-height: 0; }
body.fit .cell .chead { flex: none; }
body.fit .grid-mode .pill-row { margin-bottom: 4px; }
body.fit .grid-mode .pill { height: 32px; font-size: var(--fs-sm); }
body.fit .grid-mode .heart { font-size: var(--fs-md); }
body.fit .sumline { margin: 0 0 8px; font-size: var(--fs-xs); }
body.fit .cell .body { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
body.fit .events { min-height: 0; }
body.fit .grid-mode .ev { max-height: none; padding: 8px 48px 8px 16px; }
body.fit .grid-mode .ev .badge { width: 24px; height: 24px; }
body.fit .side { min-height: 0; }
body.fit .grid-mode .side { gap: 12px; }
body.fit .grid-mode .quote { flex: 1; min-height: 0; padding: 16px 20px 12px; display: flex; flex-direction: column; }
body.fit .chart { flex: 1; min-height: 60px; position: relative; margin-top: 4px; }
body.fit .chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
body.fit .grid-mode .signal { flex: none; padding: 12px 16px; }
body.fit .grid-mode .sig-head { margin: 0 0 12px; }
body.fit .grid-mode .tile { padding: 8px 4px; }
body.fit .grid-mode .tile b { font-size: var(--fs-md); }
body.fit .sk-quote, body.fit .sk-sig { height: auto; flex: 1; }
body.fit .sk-sig { flex: 0 0 72px; }
/* 메인(그리드) 카드에서는 지표·기간 메타 숨김, 기간 탭만 표시 */
.grid-mode .stats, .grid-mode .q-meta { display: none; }
.grid-mode .tabs { margin: 8px 0 4px; }
.grid-mode .chart { margin-top: 4px; }
/* 상세 */
body.fit .detail-wrap { flex: 1; min-height: 0; width: 100%; max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; position: relative; }
body.fit .detail-wrap > .back { position: absolute; left: 4px; top: 8px; margin: 0; z-index: 2; }
body.fit .detail-mode { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.fit .detail-mode .chead { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
body.fit .detail-mode .pill-row, body.fit .detail-mode .sumline { margin: 0; }
body.fit .detail-mode .body { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; gap: 12px 24px; }
body.fit .detail-mode .events { min-height: 0; overflow: hidden; }
body.fit .detail-mode .evlist .ev { flex: 1 1 0; min-height: 0; padding: 4px 48px 4px 16px; }
body.fit .detail-mode .side { min-height: 0; display: flex; }
body.fit .detail-mode .quote { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 8px; }
body.fit .detail-mode .q-head { margin-bottom: 4px; }
body.fit .detail-mode .q-meta { margin-top: 0; }
body.fit .detail-mode .tabs { margin: 8px 0 4px; }
body.fit .detail-mode .stats { margin-top: 4px; flex: none; }
body.fit .detail-mode .stats .r { padding: 0; }
body.fit .detail-mode .signal.wide { padding: 12px 20px; }
body.fit .edit-btn { top: auto; bottom: 24px; right: 24px; height: 40px; }

/* ================= ? 화면: 중요 사건 ================= */
.icard { background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 20px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; min-height: 0; overflow: hidden; }
.icard:hover { box-shadow: var(--sh-2); }
.icard h3 { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard h3 .mk { display: inline-block; vertical-align: 3px; margin-right: 8px; padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; }
.isec { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; }
.isec-h { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); margin-bottom: 8px; position: relative; padding-right: 36px; }
.isec-h .nm { font-weight: 600; }
.isec-h .sep { color: var(--border-strong); }
.isec-h .pred { font-style: normal; font-size: var(--fs-xs); padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.isec-h .badge { right: 0; top: 50%; transform: translateY(-50%); }
.ico { display: flex; gap: 8px; flex-wrap: wrap; }
.cpill { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--r-pill); color: #fff; font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpill.neg { background: rgba(224, 49, 49, var(--a)); }
.cpill.pos { background: rgba(47, 158, 68, var(--a)); }
.cpill small { font-weight: 500; opacity: .9; font-size: var(--fs-xs); }
.cpill:hover { filter: brightness(1.06); }
.cpill.light { color: var(--text); }
.cpill.neg.light { color: var(--bad-ink); } .cpill.pos.light { color: var(--ok-ink); }
.icard-sk { border-radius: var(--r-lg); min-height: 176px; }
.inote { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin: 8px 0 0; }
.iwarn { color: var(--warn-ink); }
.idetail { max-width: 960px; margin: 8px auto 0; position: relative; }
.idetail .back { display: inline-block; margin: 0 0 8px 8px; }
.icard.big { cursor: default; padding: 24px; gap: 12px; }
.icard.big:hover { box-shadow: var(--sh-1); }
.icard.big h3 { font-size: var(--fs-xl); -webkit-line-clamp: 3; }
.isum { margin: 0; font-family: var(--serif); font-size: var(--fs-md); line-height: 1.65; }
.idate { color: var(--text-3); font-size: var(--fs-xs); }
.icard.big .cpill { flex: 0 1 auto; min-width: 120px; }
.iarts { font-size: var(--fs-sm); }
.iarts ul { margin: 4px 0 0; padding-left: 16px; }
.iarts a { color: var(--info); }
body.fit .igrid { grid-template-rows: repeat(2, minmax(0, 1fr)); }
body.fit .igrid .icard { min-height: 0; }
body.fit .idetail { max-height: var(--app-h); overflow-y: auto; }

/* ================= 반응형 ================= */
@media (max-width: 1100px) { .grid, .grid.one { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .top.w-header { grid-template-columns: 1fr auto; height: auto; padding: 12px 0 0; row-gap: 12px; }
  .top .w-header-center { grid-column: 1 / -1; grid-row: 2; }
  .top .w-header-right { grid-column: 2; grid-row: 1; }
}
@media (max-width: 1000px) and (min-width: 721px) {
  .signal.wide { grid-template-columns: 1fr 1fr; }
  .signal.wide .sig-c { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .cell .body { grid-template-columns: 1fr; }
  .detail-mode .body { grid-template-columns: 1fr; grid-template-areas: "ev" "q" "sig"; }
  .signal.wide { grid-template-columns: 1fr; }
  .events { min-height: 320px; }
  .fac { grid-template-columns: 84px 1fr 44px; }
  .icard h3 { font-size: var(--fs-md); }
  .edit-btn { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ev, .ev p, .ev .badge, .sk { transition: none; animation: none; } }
