/* 153 투자 OS — 화이트톤 (2026-12-06 Claude)
   목소리: 증권 앱처럼 숫자가 주인공, 차분한 흰 카드. 오르면 빨강·내리면 파랑(국내 증권 관례, 토스와 같음).
   그 밖의 강조는 차콜과 초록·주황(점검표·대가 의견)만 쓰고, 빨강·파랑은 가격 움직임에만 쓴다. */
:root {
  --bg: #f2f4f6; --card: #ffffff; --ink: #191f28; --ink2: #4e5968; --ink3: #8b95a1; --line: #e5e8eb; --soft: #f7f8fa;
  --up: #f04452; --down: #3182f6; --ok: #12a37f; --warn: #f08c00; --na: #b0b8c1; --brand: #191f28; --mark: #e2252b;
  --r: 20px; --nav: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom) + 16px); overflow-x: clip;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--down); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 머리띠 */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px 16px; background: rgba(242, 244, 246, .92); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.brand .mark { background: var(--mark); color: #fff; font-size: 13px; font-weight: 800; padding: 3px 7px; border-radius: 8px; letter-spacing: 0; }
.top-r { display: flex; align-items: center; gap: 2px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; color: var(--ink2); }
.icon-btn:active { background: var(--line); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--na); margin-right: 6px; }
.sync-dot[data-state="on"] { background: var(--ok); }
.sync-dot[data-state="busy"] { background: var(--warn); }
.sync-dot[data-state="error"] { background: var(--up); }

/* 본문 */
main { max-width: 600px; margin: 0 auto; padding: 4px 12px 0; }
.view > * + * { margin-top: 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 20px; }
.card.tight { padding: 14px 16px; }
.card h2, .h2 { font-size: 18px; line-height: 1.3; margin: 0 0 12px; font-weight: 700; letter-spacing: -.2px; }
.card h3 { font-size: 15px; margin: 16px 0 8px; color: var(--ink2); font-weight: 700; }
.row-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.row-h h2 { margin: 0; }
.muted { color: var(--ink3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink3); }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--ink3); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.gap8 { display: flex; gap: 8px; flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

/* 홈 히어로 */
.hero .label { font-size: 14px; color: var(--ink2); margin: 0; }
.hero .big { font-size: clamp(30px, 9vw, 40px); font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin: 4px 0 10px; }
.hero .line { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; padding: 3px 0; }
.hero .line .k { color: var(--ink2); }
.meta-line { margin-top: 12px; font-size: 12px; color: var(--ink3); line-height: 1.6; }
.alloc { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 6px 0 10px; }
.alloc i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink2); }
.legend b { font-weight: 700; color: var(--ink); }
.legend .sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 0; border: 0; background: none; text-align: left; }
.item:active { background: var(--soft); }
.item .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex: none; letter-spacing: -.3px; }
.item .main { flex: 1; min-width: 0; }
.item .main > span, .item .r > span { display: block; }
.item .t { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .r { text-align: right; flex: none; }
.item .r .t { font-size: 15.5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--soft); color: var(--ink2); margin-left: 4px; vertical-align: 1px; }

/* 버튼·입력 */
.btn { min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:disabled { opacity: .45; }
.btn.sub { background: var(--soft); color: var(--ink); }
.btn.line { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn:focus-visible, .item:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tabs button:focus-visible, .icon-btn:focus-visible { outline: 3px solid #9cc3ff; outline-offset: 2px; }
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 6px; font-weight: 600; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 16px; }
textarea.input { min-height: 120px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--ink2); outline: none; }
.search { position: relative; }
.search .input { padding-left: 42px; background: #fff; border: 0; min-height: 52px; border-radius: 16px; }
.search svg { position: absolute; left: 14px; top: 15px; color: var(--ink3); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: var(--soft); color: var(--ink2); font-size: 14px; font-weight: 600; }
.chip.on { background: var(--brand); color: #fff; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: none; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink3); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch input { width: 46px; height: 28px; appearance: none; background: var(--line); border-radius: 14px; position: relative; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 21px; }

/* 알림 띠 */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: #fff; font-size: 14px; color: var(--ink2); }
.note.warn { background: #fff6e6; color: #8a5300; }
.note.info { background: #eef5ff; color: #1b4f99; }
.note b { color: inherit; }
.note .btn { margin-left: auto; flex: none; }

/* 종목 상세 */
.back { border: 0; background: none; padding: 8px 0; color: var(--ink2); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.quote-head .nm { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.quote-head .px { font-size: clamp(28px, 8vw, 34px); font-weight: 800; letter-spacing: -.8px; margin-top: 2px; }
.quote-head .chg { font-size: 15px; font-weight: 600; }
.fig { position: relative; height: 200px; margin: 14px -4px 0; }
.fig-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--na); margin: 2px 0 6px; }
.fig svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin-top: 6px; }
.stats div { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.stats div span:first-child { color: var(--ink3); }
@media (min-width: 520px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 대가 점검표 */
.mcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mcard { border: 0; background: var(--soft); border-radius: 16px; padding: 12px; text-align: left; }
.mcard.on { box-shadow: inset 0 0 0 2px var(--brand); background: #fff; }
.mcard .who { font-size: 13px; color: var(--ink2); font-weight: 700; }
.mcard .sc { font-size: 22px; font-weight: 800; margin-top: 2px; }
.mcard .sc small { font-size: 13px; color: var(--ink3); font-weight: 600; }
.mcard .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; display: flex; }
.mcard .bar i { display: block; height: 100%; }
.crit { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.crit .mk { width: 18px; height: 18px; border-radius: 50%; margin-top: 2px; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 800; }
.crit .mk.y { background: var(--ok); } .crit .mk.n { background: var(--warn); } .crit .mk.x { background: #fff; box-shadow: inset 0 0 0 1.5px var(--na); color: var(--na); }
.crit .lb { font-weight: 700; }
.crit .vl { grid-column: 2; color: var(--ink2); }
.crit .rl { grid-column: 2; font-size: 12px; color: var(--ink3); }
.scroll { overflow-x: auto; }
table.fin { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
table.fin th, table.fin td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: right; }
table.fin th:first-child, table.fin td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.fin thead th { color: var(--ink3); font-weight: 600; border-top: 0; }

/* AI 위원회 */
.ai-head { display: flex; align-items: center; gap: 10px; }
.ai-head .seat { display: flex; }
.ai-head .seat i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; margin-left: -8px; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; color: #fff; }
.ai-head .seat i:first-child { margin-left: 0; }
.headline { font-size: 19px; font-weight: 800; letter-spacing: -.3px; line-height: 1.35; margin: 4px 0 8px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill.pos { background: #e3f7ef; color: #0b7a5c; } .pill.neu { background: var(--soft); color: var(--ink2); }
.pill.neg { background: #fff1db; color: #a35d00; } .pill.hold { background: #fff; color: var(--ink3); box-shadow: inset 0 0 0 1px var(--line); }
.pill.lv-낮음 { background: #e3f7ef; color: #0b7a5c; } .pill.lv-보통 { background: #fff1db; color: #a35d00; } .pill.lv-높음 { background: #ffe3e3; color: #b42318; }
.masters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.master { background: var(--soft); border-radius: 16px; padding: 12px; }
.master .nm { font-weight: 800; font-size: 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 6px; align-items: center; }
.master .lens { font-size: 12px; color: var(--ink3); margin: 2px 0 6px; }
.master ul, .points, .bullets { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink2); }
.master li + li, .points li + li, .bullets li + li { margin-top: 3px; }
.conf { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 2px 0 8px; }
.conf i { display: block; height: 100%; background: var(--ink2); }
.master .cm { font-size: 12px; color: var(--ink3); margin-top: 6px; }
.debate { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.debate > div { border-radius: 16px; padding: 12px; }
.debate .bull { background: #fff5f5; } .debate .bear { background: #f2f7ff; }
.debate h4 { margin: 0 0 6px; font-size: 14px; }
.analyst { padding: 11px 0; border-top: 1px solid var(--line); }
.analyst:first-child { border-top: 0; }
.analyst .rl { font-weight: 800; font-size: 14px; }
.analyst .vw { font-size: 14px; color: var(--ink); margin: 2px 0 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14.5px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); }
.loading-steps { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; color: var(--ink3); }
.loading-steps li { padding: 4px 0; }
.loading-steps li.on { color: var(--ink); font-weight: 700; }
.loading-steps li.on::before { content: "● "; color: var(--warn); }
@media (max-width: 380px) { .masters, .debate { grid-template-columns: minmax(0, 1fr); } .mcards { gap: 6px; } .mcard { padding: 10px; } }

/* 적립 */
.etf-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.etf-row:first-of-type { border-top: 0; }
.etf-row .t { font-weight: 800; }
.etf-row .s { font-size: 12.5px; color: var(--ink3); }
.etf-row .input { min-height: 42px; text-align: right; padding: 0 10px; }
.wbar { height: 6px; border-radius: 3px; background: var(--line); position: relative; margin-top: 6px; overflow: hidden; }
.wbar i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--ink2); border-radius: 3px; }
.wbar b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--mark); }
.plan-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 15px; }
.plan-row:first-child { border-top: 0; }
.sum-line { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; padding-top: 12px; margin-top: 4px; border-top: 2px solid var(--ink); }

/* 브리핑 */
.idx { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.idx div { background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.idx .n { font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.idx .v { font-size: 17px; font-weight: 800; }
@media (min-width: 520px) { .idx { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.disc { padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.disc:first-child { border-top: 0; }
.disc .w { color: var(--ink3); font-size: 12.5px; }
.disc .hot { color: #b42318; font-weight: 800; margin-right: 4px; }
.disc a { color: var(--ink); text-decoration: none; font-weight: 600; }

/* 일지 */
.jcard { border-top: 1px solid var(--line); padding: 14px 0; }
.jcard:first-child { border-top: 0; }
.jcard .t { font-weight: 800; font-size: 15.5px; }
.jcard .s { font-size: 13px; color: var(--ink3); }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 9px; background: var(--soft); color: var(--ink2); white-space: nowrap; flex: none; }
.jcard .row-h > div { min-width: 0; }
.st.done { background: #e3f7ef; color: #0b7a5c; } .st.skip { background: #fff; color: var(--ink3); box-shadow: inset 0 0 0 1px var(--line); }

/* 아래 메뉴 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs button { flex: 1; max-width: 120px; min-height: 52px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--na); font-size: 11.5px; font-weight: 700; border-radius: 12px; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--ink); }

/* 시트·토스트 */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); }
.sheet-card {
  position: relative; width: 100%; max-width: 600px; max-height: 88vh; overflow-y: auto; background: #fff;
  border-radius: 24px 24px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet-card h2 { font-size: 20px; margin: 0 0 6px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); z-index: 60;
  background: rgba(25, 31, 40, .94); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px); text-align: center;
}
.skeleton p { margin: 0; }
.empty { text-align: center; padding: 26px 10px; color: var(--ink3); font-size: 14.5px; }
.empty .btn { margin-top: 14px; }
.disclaimer { font-size: 12px; color: var(--ink3); line-height: 1.6; margin: 18px 4px 6px; }
