:root {
  --bg: #f6f7f9; --card: #ffffff; --fg: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f6fed; --accent2: #d9480f; --good: #1f9d55; --bad: #d63939; --warn: #e8a317;
  --band: #2f6fed; --c1: #2f6fed; --c2: #d9480f; --c3: #1f9d55; --c4: #8e44ad; --c5: #e8a317; --c6: #16a2b8; --c7: #6b7385;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --card: #1b1f27; --fg: #e6e9ef; --muted: #98a1b3; --line: #2c323d;
    --accent: #6c9cff; --accent2: #ff8a50; --good: #4cc38a; --bad: #ff6b6b; --warn: #f2c14e;
    --band: #6c9cff; --c1: #6c9cff; --c2: #ff8a50; --c3: #4cc38a; --c4: #c08cf0; --c5: #f2c14e; --c6: #4fd1e0; --c7: #98a1b3;
  }
}
* { box-sizing: border-box; }
/* iOS 27 상단 강제 블러 회피: 맨 위에 헤더 색의 고정 바. 블러가 바 아래로 1~2pt 번져서 안전 영역보다 2px 더 내린다 */
:root { --topbar: max(8px, calc(env(safe-area-inset-top) + 2px)); }
/* 홈 화면에 추가한 앱 형태(standalone)에서는 iOS 블러가 더 남아 웹보다 4pt 더 내린다 */
@media all and (display-mode: standalone) { :root { --topbar: max(12px, calc(env(safe-area-inset-top) + 6px)); } }
html.standalone { --topbar: max(12px, calc(env(safe-area-inset-top) + 6px)); }
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: var(--topbar); background: var(--card); z-index: 20; pointer-events: none; }
body { padding-top: var(--topbar); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: var(--topbar); z-index: 5; flex-wrap: wrap; }
.brand { flex: none; } header .logo { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.logo { font-weight: 800; font-size: 19px; letter-spacing: .3px; color: var(--accent); }
.slogan { font-size: 12px; color: var(--muted); letter-spacing: .4px; text-align: center; margin: 0; padding: 4px 10px max(16px, env(safe-area-inset-bottom)); }
.headkpi { flex: 1; display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.headkpi b { font-size: 15px; }
nav { display: flex; gap: 2px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav button { border: 0; background: none; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; }
nav button.on { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1280px; margin: 0 auto; padding: 14px 16px 40px; }
.tab { display: none; } .tab.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap, .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.good { color: var(--good); } .bad { color: var(--bad); }
button { font: inherit; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: wait; }
input, select { font: inherit; padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
input[type=checkbox] { width: auto; }
label { display: inline-flex; align-items: center; gap: 6px; }
.seg button { padding: 4px 9px; font-size: 12px; } .seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.log { height: 130px; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: 12px/1.5 ui-monospace, Consolas, monospace; margin-top: 8px; }
.log .err { color: var(--bad); } .log .t { color: var(--muted); }
.tablewrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 5px 7px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.grid td.l, table.grid th.l { text-align: left; }
table.grid input { width: 7.5em; text-align: right; padding: 3px 5px; }
table.grid input[data-f="shares"], table.grid input[data-f="avg_cost"], table.grid input[data-f="price"] { width: 5.6em; }
table.grid input.wide { width: 14em; text-align: left; }
table.grid input.date { width: 9.5em; }
table.grid select { padding: 3px 4px; }
.tag { display: inline-block; font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.tag.manual { color: var(--accent2); border-color: var(--accent2); }
.addrow { margin-top: 10px; flex-wrap: nowrap; gap: 6px; }
.addrow #addTicker { flex: 1 1 8em; min-width: 0; }
.addrow input.num { flex: 0 0 5.6em; width: 5.6em; min-width: 0; text-align: right; }
.addrow button { flex: 0 0 auto; }
button.sm { padding: 4px 9px; font-size: 12.5px; }
.sechead { margin: 22px 2px 8px; font-size: 14px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi { min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); } .kpi .v { font-size: 20px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; } .kpi .s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 6px; } .bar i { display: block; height: 100%; background: var(--accent); }
.chartbox { position: relative; width: 100%; }
svg.chart { display: block; }
svg.chart .axis text { fill: var(--muted); font-size: 11px; }
svg.chart .grid { stroke: var(--line); }
svg.chart .cross, svg.chart .vline { stroke: var(--muted); stroke-dasharray: 2 3; }
svg.chart .hlabel { font-size: 11px; fill: var(--muted); }
svg.chart .muted { fill: var(--muted); }
.tip { position: absolute; display: none; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.12); white-space: nowrap; z-index: 3; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 4px; vertical-align: middle; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.smallmult { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.smallmult > div { min-width: 0; }
.smallmult h3 { font-size: 13px; margin: 0 0 4px; }
.help { background: var(--bg); border-radius: 8px; padding: 4px 12px; margin-top: 10px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 20px; margin-bottom: 12px; }
.formgrid label { justify-content: space-between; } .formgrid input { width: 7em; text-align: right; }
.formgrid .desc { display: block; font-size: 11px; color: var(--muted); }
.filebtn { border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; cursor: pointer; } .filebtn input { display: none; }
footer { text-align: center; padding: 10px; }
.probbar { display: flex; align-items: center; gap: 8px; margin: 4px 0; } .probbar .b { flex: 1; height: 14px; background: var(--bg); border-radius: 4px; overflow: hidden; } .probbar .b i { display: block; height: 100%; background: var(--accent); }
.probbar span:first-child { width: 9em; font-size: 12px; } .probbar span:last-child { width: 3.5em; text-align: right; font-weight: 600; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .3s; z-index: 10; }
.toast.on { opacity: .92; }
.log a{color:var(--accent)} .help a{color:var(--accent)}
@media (max-width: 700px) {
  header { position: static; gap: 6px 12px; padding: 8px 12px; }
  .logo { font-size: 17px; }
  .headkpi { gap: 2px 9px; font-size: 12px; } .headkpi span { white-space: nowrap; } .headkpi b { font-size: 13px; } .headkpi .muted { display: none; }
  .headact { display: none; }
  main { padding: 10px 8px 30px; } .card { padding: 12px; }
  .kpis { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); } .kpi { padding: 7px 8px; }
  .kpi .k { font-size: 11px; line-height: 1.3; } .kpi .v { font-size: 15px; } .kpi .s { font-size: 10.5px; line-height: 1.35; }
  .addrow input { padding: 5px 6px; font-size: 13px; }
  .addrow #addTicker::placeholder { font-size: 12px; }
  .addrow button.sm { padding: 5px 7px; font-size: 12px; }
}
.goalrow { gap: 8px 14px; } .goalrow input { width: auto; }
.stratgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 10px; }
.strat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.strat h3 { margin: 0 0 4px; font-size: 15px; } .strat .act { font-weight: 700; font-size: 15px; margin: 4px 0 6px; }
.strat ul { margin: 4px 0 0 18px; padding: 0; font-size: 12.5px; } .strat li { margin: 2px 0; }
.act.hold { color: var(--accent); } .act.trim { color: var(--accent2); } .act.wait { color: var(--warn); } .act.cash { color: var(--good); }
details.card summary { cursor: pointer; }
#anaNav { flex-wrap: wrap; }
details.opt > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
details.card.opt { padding: 10px 16px; }
.aiout { background: var(--bg); border-radius: 8px; padding: 6px 12px; min-height: 40px; line-height: 1.45; }
.aiout h4 { margin: 8px 0 2px; font-size: 13px; } .aiout p { margin: 4px 0; } .aiout ul, .aiout ol { margin: 4px 0 6px 18px; padding: 0; }
.aiout table { border-collapse: collapse; margin: 6px 0; font-size: 12px; display: block; overflow-x: auto; }
.aiout th, .aiout td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; }
.aiout code { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 0 3px; font-size: 11.5px; }
.aiout pre { background: var(--card); padding: 6px 8px; border-radius: 6px; overflow-x: auto; }
.aiout blockquote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid var(--line); color: var(--muted); }
.aiout hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.aiout ul ul, .aiout ol ul, .aiout ul ol { margin: 2px 0 2px 16px; }
.md p { margin: 4px 0; } .md ul, .md ol { margin: 4px 0 0 18px; padding: 0; } .md li { margin: 2px 0; } .md h4 { margin: 8px 0 2px; font-size: 13px; }
.strat .md { font-size: 12.5px; }
.aiout li { margin: 1px 0; } .aicard h2, #aiAutoCard h2 { font-size: 14px; margin: 0 0 6px; }
.schedrow { padding: 6px 0; border-bottom: 1px solid var(--line); } .schedrow:last-of-type { border-bottom: 0; }
.schedhead { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 11px; }
.chip b { font-size: 11.5px; } .chip span { color: var(--muted); font-size: 10px; }
.chip.once { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 10%, var(--card)); }
.chip.next { border: 2px solid var(--accent); }
/* 기업 사건 타일 */
.evtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 8px; margin-top: 8px; }
.evtile { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; }
.evtile .top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.evtile .tk { font-weight: 700; font-size: 14px; }
.evtile .kd { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.evtile.once .kd { border-color: var(--accent2); }
.evtile .dt { font-size: 12.5px; }
.evtile .ef { font-size: 12px; }
.evtile .nt { font-size: 11px; color: var(--muted); }
.evtile.next { border: 2px solid var(--accent); }
.evtile.off { opacity: .5; } .evtile.off .tk::after { content: " · 꺼짐"; font-weight: 400; font-size: 11px; color: var(--muted); }
.evtile.past { opacity: .45; }
.newsgrid h3, .futrow h3 { font-size: 13.5px; margin: 10px 0 4px; }
.newslist { margin: 0; padding-left: 20px; } ul.newslist { padding-left: 16px; }
.newslist li { margin: 0 0 9px; line-height: 1.4; }
.newslist a { color: var(--fg); text-decoration: none; font-weight: 600; } .newslist a:hover { text-decoration: underline; color: var(--accent); }
.nmeta { font-size: 11.5px; color: var(--muted); } .nsum { font-size: 12.5px; margin-top: 2px; }
.futrow { border-top: 1px solid var(--line); padding-top: 4px; } .futrow:first-child { border-top: 0; }
.fview { margin: 0 0 6px; } .ytpts { margin: 4px 0 8px 18px; padding: 0; } .ytpts li { margin: 3px 0; }
#xfNav { margin-bottom: 4px; gap: 4px; }
svg.chart .axis text.inlab { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
/* 인사이트 상자 */
.boxhead { font-size: 13.5px; margin: 14px 0 6px; }
.nbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.nitem { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); min-width: 0; }
.nitem a.nt { color: var(--fg); text-decoration: none; font-weight: 600; line-height: 1.4; } .nitem a.nt:hover { color: var(--accent); text-decoration: underline; }
.nitem .ntop { display: flex; align-items: center; gap: 6px; }
.nitem .tk { font-weight: 700; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nitem .kd { font-size: 11.5px; padding: 0 7px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.nitem .nsum { margin: 0; color: var(--fg); }
.nitem .nfoot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; }
.nitem .ncat { flex: none; margin-left: auto; font-size: 11px; white-space: nowrap; padding: 0 7px; border-radius: 999px; color: var(--accent); border: 1px solid var(--accent); }
.nitem.read a.nt { color: var(--muted); font-weight: 500; }
.nmsg { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px dashed var(--line); }
.nitem.empty { color: var(--muted); font-size: 12.5px; }
/* 미래 설계 Beyora (블로그) */
#beyora .logo { font-size: 15px; }
.bvcats { margin: 10px 0 8px; gap: 4px; }
.bvcats .add { border-style: dashed; }
.bvcats .n { font-size: 11px; opacity: .7; margin-left: 2px; }
.bvbar { margin: 0 0 8px; } .bvbar .seg button { font-size: 12px; padding: 3px 9px; }
.bvpost .th { width: calc(100% + 24px); margin: -10px -12px 4px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px 10px 0 0; background: var(--card); }
img.broken { display: none; }
.bvimg { margin: 12px 0; } .bvimg img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.bvimg figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
a.bvlink { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; margin: 2px 0; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); text-decoration: none; font-size: 13px; line-height: 1.6; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
a.bvlink::after { content: "↗"; font-size: 11px; } a.bvlink:hover { background: var(--accent); color: var(--bg); }
.bvtools { gap: 6px; align-items: center; }
.bvstat { margin: 8px 0 0; }
.bvlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 8px; }
.bvpost { overflow: hidden; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; min-width: 0; }
.bvpost:hover { border-color: var(--accent); }
.bvpost .ttl { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.bvpost .ex { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bvpost .ft { font-size: 11px; color: var(--muted); margin-top: auto; }
.bvcat { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); align-self: flex-start; }
.bvcat.past { color: var(--c4); border-color: var(--c4); } .bvcat.now { color: var(--c3); border-color: var(--c3); } .bvcat.future { color: var(--accent); border-color: var(--accent); }
.bvart { margin-top: 10px; }
.bvart h1 { font-size: 21px; margin: 6px 0 4px; line-height: 1.35; overflow-wrap: anywhere; }
.bvart .body { font-size: 14.5px; line-height: 1.75; margin: 14px 0; overflow-wrap: anywhere; }
.bvart .body p { margin: 0 0 10px; } .bvart .body h4 { font-size: 15px; margin: 16px 0 6px; } .bvart .body ul, .bvart .body ol { margin: 4px 0 10px 20px; padding: 0; }
.bvmeta { border-top: 1px solid var(--line); padding-top: 8px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.bvnav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.bvnav button { text-align: left; display: flex; flex-direction: column; gap: 2px; min-width: 0; background: var(--bg); }
.bvnav button.nx { text-align: right; align-items: flex-end; }
.bvnav button span { font-size: 11px; color: var(--muted); } .bvnav button b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bvnav button:disabled { opacity: .45; cursor: default; }
.bvedit { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.bvedit input, .bvedit select, .bvedit textarea { width: 100%; font: inherit; }
.bvedit input.t { font-size: 16px; font-weight: 600; }
.bvedit textarea { min-height: 260px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); line-height: 1.6; resize: vertical; }
