/* BM — 가운데 구조도 · 오른쪽 대화(접었다 펼친다). 종이 위에 잉크, 돈은 놋쇠빛. */
:root {
  --paper: #F6F4EF; --paper-2: #FFFFFF; --ink: #1E2129; --ink-2: #6B7080; --line: #E2DFD6; --line-2: #CFCBC0;
  --grid: #DAD6CC; --space: #F3F1EB; --shadow: #1E2129;
  --money: #C28F2C; --money-soft: #F7EBD0; --money-ink: #7A5610;
  --value: #2E8C7A; --value-soft: #DCEFEA; --value-ink: #1C5E52;
  --data: #7A6BC4; --data-soft: #E8E4F6; --data-ink: #4D3F96;
  --warn: #C98A2E; --bad: #C25A5A; --ok: #4C9A6A;
  --spark: #7A5CF5; --spark-soft: #F0EBFF; --spark-ink: #4B32B8; --spark-2: #E85BB0;
  --r-customer: #D9743C; --r-user: #E0A24A; --r-supplier: #3B82B5; --r-partner: #5BA37A; --r-channel: #4FA7B8;
  --r-advertiser: #C45C8E; --r-gov: #6C7A9C; --r-investor: #8B6DC4; --r-platform: #7F8A99; --r-other: #A0A5AF; --r-us: #1E2129;
  --font-d: 'Gowun Batang', 'Nanum Myeongjo', 'Apple SD Gothic Neo', serif;
  --font-b: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --font-m: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --chat-w: 380px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171C; --paper-2: #1E2128; --ink: #ECEAE3; --ink-2: #9AA0AD; --line: #2A2E37; --line-2: #3A3F4A;
    --grid: #262A33; --space: #181B21; --shadow: #000000;
    --money: #E0B35A; --money-soft: #3A2F16; --money-ink: #F1D08A;
    --value: #5BBFA8; --value-soft: #16302B; --value-ink: #A6E3D3;
    --data: #A496E8; --data-soft: #27223D; --data-ink: #CFC6F5;
    --warn: #E0A94F; --bad: #E07A7A; --ok: #6FBF8A; --r-us: #ECEAE3;
    --spark: #A994FF; --spark-soft: #251F45; --spark-ink: #D4C9FF; --spark-2: #F08AC8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.6 var(--font-b); -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--money); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) var(--chat-w); transition: grid-template-columns .42s var(--ease), grid-template-rows .42s var(--ease); }
#app.fold { grid-template-columns: minmax(0, 1fr) 0px; }

/* ---------- 가운데: 구조도 ---------- */
.space {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; background-color: var(--space);
  background-image: radial-gradient(var(--grid) 1.1px, transparent 1.2px); background-size: 20px 20px; background-position: 10px 10px;
}
#graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.space.dragging #graph { cursor: grabbing; }
.space.busy #graph { cursor: progress; }

/* 주체 — 상자 */
.node { cursor: pointer; transition: opacity .3s; }
.node .box { fill: var(--paper-2); stroke: var(--line-2); stroke-width: 1.3; filter: drop-shadow(0 3px 6px color-mix(in srgb, var(--shadow) 9%, transparent)); transition: stroke .2s, stroke-width .2s, fill .2s; }
.node .bar { fill: var(--r-other); }
.node .lab { font: 600 15.5px var(--font-b); fill: var(--ink); pointer-events: none; letter-spacing: -.01em; }
.node .cap { font: 500 11px var(--font-m); fill: var(--ink-2); pointer-events: none; letter-spacing: .02em; }
.node.r-customer .bar { fill: var(--r-customer); } .node.r-user .bar { fill: var(--r-user); } .node.r-supplier .bar { fill: var(--r-supplier); }
.node.r-partner .bar { fill: var(--r-partner); } .node.r-channel .bar { fill: var(--r-channel); } .node.r-advertiser .bar { fill: var(--r-advertiser); }
.node.r-gov .bar { fill: var(--r-gov); } .node.r-investor .bar { fill: var(--r-investor); } .node.r-platform .bar { fill: var(--r-platform); }
.node.us .box { fill: var(--ink); stroke: none; }
.node.us .bar { fill: var(--money); }
.node.us .lab { font: 700 17px var(--font-b); fill: var(--paper); }
.node.sel .box { stroke: var(--ink); stroke-width: 2.4; }
.node.near .box { stroke: var(--ink-2); stroke-width: 1.7; }
.node.drop .box { stroke: var(--money); stroke-width: 3; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--money) 60%, transparent)); }
.node.lit .box { stroke: var(--money); stroke-width: 2.6; }
.node.lit.us .box { fill: var(--money-ink); }
.node.out { opacity: 0 !important; transition: opacity .32s; }
#graph.has-sel .node:not(.sel):not(.near):not(.lit) { opacity: .42; }
#graph.has-sel .flow:not(.sel):not(.near):not(.lit) { opacity: .25; }
.handle { display: none; cursor: crosshair; }
.node.sel .handle { display: block; }
.handle rect { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.4; }
.handle path { stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; fill: none; }
.handle:hover rect { fill: var(--ink); } .handle:hover path { stroke: var(--paper); }

/* 흐름 — 직각 선 */
.flow { cursor: pointer; transition: opacity .3s; }
.flow .hit { fill: none; stroke: transparent; stroke-width: 14; }
.flow .line { fill: none; stroke-width: 1.8; stroke-linejoin: round; transition: stroke-width .2s; }
.flow.k-money .line { stroke: var(--money); }
.flow.k-value .line { stroke: var(--value); stroke-dasharray: 6 4; }
.flow.k-data .line { stroke: var(--data); stroke-dasharray: 2 4; stroke-width: 2; }
.flow .run { display: none; }
.flow.k-money .run { display: block; fill: none; stroke: var(--money-ink); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 17; animation: flow 1.15s linear infinite; opacity: .9; }
@media (prefers-color-scheme: dark) { .flow.k-money .run { stroke: #FFF2C9; } }
.flow.t-sub.k-money .run { animation-duration: .8s; stroke-dasharray: 1 11; }
.flow.t-free.k-money .run { display: none; }
.flow.t-free.k-money .line { stroke-dasharray: 2 6; }
@keyframes flow { to { stroke-dashoffset: -18; } }
.flow.t-sub.k-money .run { animation-name: flowSub; } @keyframes flowSub { to { stroke-dashoffset: -12; } }
.flab .lab rect { fill: var(--paper-2); stroke: var(--line-2); stroke-width: 1; }
.flab .lab text { font: 500 12.5px var(--font-b); fill: var(--ink); dominant-baseline: central; pointer-events: none; }
.flab .lab .t2 { font: 500 10.5px var(--font-m); }
.flab.noted .lab rect { fill: var(--paper-2); stroke: var(--money); stroke-width: 1.4; }
.flab.noted .lab .t2 { fill: var(--ink); }
.flab.k-money .lab rect { fill: var(--money-soft); stroke: color-mix(in srgb, var(--money) 60%, transparent); }
.flab.k-money .lab text { fill: var(--money-ink); font-weight: 600; }
.flab.k-value .lab rect { fill: var(--value-soft); stroke: color-mix(in srgb, var(--value) 50%, transparent); }
.flab.k-value .lab text { fill: var(--value-ink); }
.flab.k-data .lab rect { fill: var(--data-soft); stroke: color-mix(in srgb, var(--data) 50%, transparent); }
.flab.k-data .lab text { fill: var(--data-ink); }
.flow.sel .line { stroke-width: 3; } .flab.sel .lab rect { stroke: var(--ink); stroke-width: 1.6; }
.flab.lit .lab rect { stroke: var(--money); stroke-width: 2; }
.flow.out { opacity: 0 !important; transition: opacity .32s; }
.ah path { fill: var(--ink-2); }
.ah.money path { fill: var(--money); } .ah.value path { fill: var(--value); } .ah.data path { fill: var(--data); } .ah.temp path { fill: var(--ink); }
.templine { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 6 5; }

/* 제안(반짝이는 점선) — AI 아이디어. 누르면 넣기, × 버리기 */
.node .shine, .node .spark, .node .gx { display: none; }
.node.ghost { cursor: copy; animation: ghostIn .5s var(--ease) backwards; }
@keyframes ghostIn { from { opacity: 0; } }
.node.ghost .box { fill: var(--spark-soft); stroke: var(--spark); stroke-width: 1.8; stroke-dasharray: 7 5; animation: march 1.1s linear infinite, glow 2.2s ease-in-out infinite; }
@keyframes march { to { stroke-dashoffset: -24; } }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--spark) 35%, transparent)); } 50% { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--spark) 70%, transparent)); } }
.node.ghost .shine { display: block; pointer-events: none; opacity: .55; }
.node.ghost .bar { fill: var(--spark); }
.node.ghost .lab { fill: var(--spark-ink); }
.node.ghost .cap { fill: var(--spark); }
.node.ghost .spark { display: block; font: 700 15px var(--font-b); fill: var(--spark); pointer-events: none; transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .5; transform: scale(.8) rotate(0deg); } 50% { opacity: 1; transform: scale(1.2) rotate(20deg); } }
.node.ghost .gx { display: block; cursor: pointer; opacity: 0; transition: opacity .2s; }
.node.ghost:hover .gx { opacity: 1; }
.node.ghost .gx circle { fill: var(--paper-2); stroke: var(--spark); stroke-width: 1.3; }
.node.ghost .gx path { stroke: var(--spark-ink); stroke-width: 1.6; stroke-linecap: round; }
.node.ghost:hover .box { fill: color-mix(in srgb, var(--spark) 22%, var(--paper-2)); }
.flow.ghost { cursor: copy; }
.flow.ghost .line { stroke: var(--spark) !important; stroke-width: 2.2 !important; stroke-dasharray: 3 6 !important; animation: march 1s linear infinite; }
.flow.ghost .run { display: none !important; }
.flab.ghost .lab rect { fill: var(--spark-soft) !important; stroke: var(--spark) !important; stroke-width: 1.4 !important; animation: glow 2.2s ease-in-out infinite; }
.flab.ghost .lab text { fill: var(--spark-ink) !important; font-weight: 600; }
.flab.ghost:hover .lab rect { fill: color-mix(in srgb, var(--spark) 22%, var(--paper-2)) !important; }
.flow.doomed { opacity: .32; }
.node.born .box, .flab.born .lab rect { animation: born .9s var(--ease); }
@keyframes born { 0% { filter: drop-shadow(0 0 0 var(--spark)); } 30% { filter: drop-shadow(0 0 16px var(--spark)); } 100% { filter: drop-shadow(0 3px 6px color-mix(in srgb, var(--shadow) 9%, transparent)); } }
.flab.doomed .lab text { text-decoration: line-through; }
.ah.spark path { fill: var(--spark); }
#graph.has-sel .node.ghost, #graph.has-sel .flow.ghost { opacity: 1 !important; }

/* 작은 그림(카드) */
svg.mini .node .box { filter: none; stroke-width: .8; }
svg.mini .node .lab { font: 600 10px var(--font-b); }
svg.mini .node.us .lab { font: 700 10.5px var(--font-b); }
svg.mini .flow .line { stroke-width: 1.2; }
svg.mini .flow.k-value .line { stroke-dasharray: 3 2.5; }
svg.mini .flow.k-data .line { stroke-dasharray: 1.2 2.5; stroke-width: 1.3; }
svg.mini .flow.k-money .run { stroke-width: 2; stroke-dasharray: 1 10; animation-duration: 1.4s; }

/* ---------- 위: 제목 · 유형 탭 · 접기 ---------- */
.top { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; align-items: flex-start; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0 12px; pointer-events: none; }
.top > * { pointer-events: auto; }
.model-pill {
  flex: none; display: inline-flex; align-items: center; gap: 8px; max-width: 240px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer;
  font: 700 15px/1.2 var(--font-d); color: var(--ink); padding: 8px 12px 8px 10px; border-radius: 999px; box-shadow: 0 6px 18px -12px var(--shadow); transition: background .2s, transform .2s var(--ease);
}
.model-pill:hover { transform: translateY(-1px); }
.model-pill svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.model-pill svg circle:first-child { fill: var(--money); stroke: none; }
.model-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.model-pill .caret { flex: none; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg) translate(-2px, -2px); transition: transform .3s var(--ease); }
#app.overview .model-pill .caret { transform: rotate(-135deg) translate(-1px, -1px); }
.type-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.type-wrap > * { pointer-events: auto; }
.types { min-width: 0; max-width: 100%; display: flex; gap: 3px; padding: 3px; overflow-x: auto; scrollbar-width: none; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px -12px var(--shadow); }
.types::-webkit-scrollbar { display: none; }
.types button { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: 500 13.5px/1 var(--font-b); padding: 9px 13px; border-radius: 9px; transition: background .25s, color .25s; white-space: nowrap; position: relative; }
.types button:hover { color: var(--ink); background: var(--paper); }
.types button.on { background: var(--ink); color: var(--paper); }
.types button em { font: 500 11px var(--font-m); font-style: normal; opacity: .75; }
.types button em:empty { display: none; }
.types button em::before { content: "· "; }
.types .car { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); transition: transform .3s var(--ease); opacity: .7; }
.types button.open .car { transform: rotate(-135deg) translate(-1px, -1px); }
.types button.open:not(.on) { background: var(--paper); color: var(--ink); }
.types button.wait { color: var(--money-ink); background: var(--money-soft); animation: pulse 1.1s ease-in-out infinite; }
/* 플랫폼 세부 — 필요할 때만 펼친다 */
.plats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: min(760px, 100%); padding: 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 34px -20px var(--shadow);
  opacity: 0; transform: translateY(-8px); visibility: hidden; transition: opacity .25s var(--ease), transform .3s var(--ease), visibility 0s linear .3s; }
.plats.open { opacity: 1; transform: none; visibility: visible; transition: opacity .25s var(--ease), transform .3s var(--ease); }
.plats button { display: grid; justify-items: start; gap: 3px; min-width: 104px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; border-radius: 10px; padding: 9px 12px; text-align: left; transition: border-color .2s, transform .2s var(--ease), background .2s; }
.plats.open button { animation: msgIn .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 25ms); }
.plats button b { font: 600 13.5px/1.1 var(--font-b); }
.plats button small { font: 500 11px/1.1 var(--font-m); color: var(--money-ink); }
.plats button:hover { border-color: var(--ink); transform: translateY(-1px); }
.plats button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.plats button.on small { color: var(--money-soft); }
.plats button.wait { background: var(--money-soft); animation: pulse 1.1s ease-in-out infinite; }
.plats.inline { box-shadow: none; max-width: 100%; justify-content: flex-start; padding: 0; border: 0; background: transparent; max-height: 0; overflow: hidden; transform: none; transition: max-height .35s var(--ease), opacity .25s, visibility 0s linear .35s; }
.plats.inline.open { max-height: 320px; padding-top: 6px; transition: max-height .35s var(--ease), opacity .25s; }
@keyframes pulse { 50% { opacity: .55; } }
.fold-btn {
  flex: none; position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px -12px var(--shadow); transition: transform .2s var(--ease), background .2s;
}
.fold-btn:hover { transform: translateY(-1px); }
.fold-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.fold-btn svg .pane { fill: currentColor; opacity: .22; transition: opacity .25s; }
#app.fold .fold-btn svg .pane { opacity: 0; }
.fold-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--money); opacity: 0; transform: scale(.4); transition: opacity .25s, transform .25s var(--ease); }
.fold-btn.new .dot { opacity: 1; transform: scale(1); }

/* 안(변형) — 왼쪽 아래 */
.variants { position: absolute; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 3; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; margin-bottom: -8px; max-width: calc(100% - 250px); }
.variants::-webkit-scrollbar { display: none; }
.vchip, .vadd { flex: none; }
.vchip { position: relative; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); cursor: pointer; border-radius: 999px; padding: 6px 12px 6px 12px; font: 500 12.5px/1 var(--font-b); box-shadow: 0 6px 18px -12px var(--shadow); transition: background .2s, color .2s, transform .2s var(--ease); animation: msgIn .35s var(--ease) backwards; }
.vchip:hover { transform: translateY(-1px); color: var(--ink); }
.vchip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.vchip i { font: 500 10px var(--font-m); opacity: .75; font-style: normal; }
.vchip b { font-weight: 400; font-size: 14px; line-height: 1; margin: -2px -5px -2px 0; padding: 0 3px; border-radius: 6px; opacity: 0; transition: opacity .2s; }
.vchip:hover b, .vchip.on b { opacity: .7; }
.vchip b:hover { opacity: 1; background: var(--bad); color: #fff; }
.vchip .vname { width: 70px; border: 0; background: transparent; color: inherit; font: inherit; outline: none; }
.vchip.ai { border-color: color-mix(in srgb, var(--spark) 55%, var(--line)); color: var(--spark-ink); background: linear-gradient(var(--paper-2), var(--paper-2)) padding-box, linear-gradient(120deg, var(--spark), var(--spark-2)) border-box; border: 1.5px solid transparent; }
.vchip.ai.on { background: linear-gradient(120deg, var(--spark), var(--spark-2)); color: #fff; border-color: transparent; }
.vadd { width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--line-2); background: var(--paper-2); color: var(--ink-2); cursor: pointer; font-size: 17px; line-height: 1; display: grid; place-items: center; transition: transform .2s var(--ease), color .2s, border-color .2s; }
.vadd:hover { transform: translateY(-1px); color: var(--ink); border-color: var(--ink); }

/* 범례 */
.legend { position: absolute; right: calc(70px + env(safe-area-inset-right, 0px)); bottom: calc(26px + env(safe-area-inset-bottom, 0px)); z-index: 2; display: flex; gap: 12px; font: 500 11px var(--font-m); color: var(--ink-2); opacity: .8; pointer-events: none; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 0; border-top: 2px solid var(--money); }
.legend .k-value i { border-top-style: dashed; border-color: var(--value); }
.legend .k-data i { border-top-style: dotted; border-color: var(--data); border-top-width: 3px; }

/* 도구 — 오른쪽 아래 */
.tools { position: absolute; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.tools .zoom { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: var(--paper-2); box-shadow: 0 8px 20px -14px var(--shadow); overflow: hidden; }
.tools .zoom button { border: 0; border-radius: 0; box-shadow: none; background: transparent; height: 38px; }
.tools .zoom button + button { border-top: 1px solid var(--line); }
.tools .zoom button:hover { transform: none; background: var(--paper); }
.tools .zoom button:disabled { color: var(--line-2); cursor: default; background: transparent; }
.tools button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 20px -14px var(--shadow); transition: transform .2s var(--ease), background .2s, color .2s; }
.tools button:hover { transform: translateY(-2px); }
.tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.tools svg .dot { fill: currentColor; stroke: none; }
.tools svg .half { fill: currentColor; stroke: none; opacity: .35; }
.tools #lensBtn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tools .invent { width: 48px; height: 48px; border: 0; color: #fff; background: linear-gradient(135deg, var(--spark), var(--spark-2)); box-shadow: 0 10px 24px -10px var(--spark); position: relative; overflow: visible; }
.tools .invent::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--spark) 45%, transparent); animation: ring 2.4s ease-out infinite; pointer-events: none; }
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.tools .invent svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.tools .invent svg .s2 { opacity: .8; animation: twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.tools .invent:hover { transform: translateY(-2px); }
.tools .invent:hover svg { transform: rotate(-12deg) scale(1.08); }
.tools .invent svg { transition: transform .3s var(--ease); }
.tools .invent.wait svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tools #lensBtn.on svg .half { opacity: 1; }
.tools [data-tip], .vadd[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translate(6px, -50%);
  background: var(--ink); color: var(--paper); font: 500 11.5px/1 var(--font-b); padding: 7px 10px; border-radius: 8px; white-space: pre;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); z-index: 5;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after, .tips-on [data-tip]::after { opacity: 1; transform: translate(0, -50%); }
.fold-btn[data-tip]::after { right: 0; top: calc(100% + 8px); transform: translate(0, -4px); }
.fold-btn[data-tip]:hover::after, .tips-on .fold-btn[data-tip]::after { transform: translate(0, 0); }
.vadd[data-tip]::after { right: auto; left: calc(100% + 10px); transform: translate(-6px, -50%); }
.vadd[data-tip]:hover::after, .tips-on .vadd[data-tip]::after { transform: translate(0, -50%); }
.pop .ico[data-tip]::after { right: auto; left: 50%; top: calc(100% + 6px); transform: translate(-50%, -4px); }
.pop .ico[data-tip]:hover::after { transform: translate(-50%, 0); }

/* 팝오버 — 고른 주체·흐름 */
.pop { position: absolute; z-index: 4; width: 312px; grid-template-columns: minmax(0, 1fr); background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px -22px var(--shadow); padding: 10px; display: grid; gap: 8px; animation: popIn .22s var(--ease); }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.pop > * { min-width: 0; }
.pop-row { display: flex; align-items: center; gap: 6px; }
#popLabel { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 10px; padding: 8px 11px; font: 500 14px var(--font-b); outline: none; transition: border-color .2s; }
#popLabel:focus { border-color: var(--ink); }
.pop .ico { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.pop .ico:hover { color: var(--ink); background: var(--paper-2); }
.pop .ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#popDel:hover { color: var(--bad); border-color: var(--bad); }
.pop-sec { display: flex; flex-wrap: wrap; gap: 4px; }
.pop-sec button { border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 999px; font: 500 12px/1 var(--font-b); padding: 6px 10px; transition: background .2s, color .2s, border-color .2s; }
.pop-sec button:hover { color: var(--ink); border-color: var(--ink-2); }
.pop-sec button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pop-sec.seg3 { gap: 0; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.pop-sec.seg3 button { flex: 1; border: 0; border-radius: 999px; }
.pop-sec.seg3 button[data-kind="money"].on { background: var(--money); color: #fff; }
.pop-sec.seg3 button[data-kind="value"].on { background: var(--value); color: #fff; }
.pop-sec.seg3 button[data-kind="data"].on { background: var(--data); color: #fff; }
#popTimings button.on { background: var(--money-ink); border-color: var(--money-ink); color: #fff; }
@media (prefers-color-scheme: dark) { #popTimings button.on { color: var(--paper); } }
.pop-twist { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--line); align-items: center; }
.pop-twist small { font: 600 11px var(--font-m); color: var(--spark); margin-right: 2px; }
.pop-twist button { border: 1px solid color-mix(in srgb, var(--spark) 40%, var(--line)); background: var(--spark-soft); color: var(--spark-ink); cursor: pointer; border-radius: 999px; font: 500 12px/1 var(--font-b); padding: 6px 10px; transition: background .2s, color .2s, transform .2s var(--ease); }
.pop-twist button:hover { background: var(--spark); color: #fff; transform: translateY(-1px); }
.pop-twist button.wait { background: var(--spark); color: #fff; animation: pulse 1s ease-in-out infinite; }
.pop-foot { padding-top: 2px; }
.pop-note { font: 500 11px/1.4 var(--font-m); color: var(--ink-2); min-width: 0; flex: 1; }
.pop-note b { color: var(--ink); }
.share { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.share button { border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: flex-end; gap: 2px; padding: 6px 7px; border-radius: 999px; transition: background .2s; }
.share button i { width: 3px; background: var(--ink-2); border-radius: 2px; }
.share button i:nth-child(1) { height: 6px; } .share button i:nth-child(2) { height: 10px; } .share button i:nth-child(3) { height: 14px; }
.share button.on { background: var(--ink); } .share button.on i { background: var(--paper); }

/* 제안 바 — 위 가운데. Enter 넣기 · Esc 버리기 */
.idea-bar { position: absolute; top: calc(66px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 3; display: flex; align-items: center; gap: 8px; max-width: min(560px, calc(100% - 24px));
  padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--spark); color: var(--spark-ink);
  box-shadow: 0 10px 30px -14px var(--spark), 0 0 0 4px color-mix(in srgb, var(--spark) 12%, transparent);
  opacity: 0; transform: translate(-50%, -10px) scale(.96); pointer-events: none; transition: opacity .3s var(--ease), transform .35s var(--ease); }
.idea-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.idea-bar .spark { font-style: normal; font-size: 15px; color: var(--spark); animation: twinkle 1.6s ease-in-out infinite; display: inline-block; }
.idea-bar .why { font: 600 13.5px/1.2 var(--font-b); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-bar .n { font: 600 11px var(--font-m); background: var(--spark); color: #fff; border-radius: 999px; padding: 2px 7px; }
.idea-bar .n:empty { display: none; }
.idea-bar button { flex: none; height: 32px; border: 0; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; transition: transform .2s var(--ease), background .2s; }
.idea-bar .yes { background: var(--spark); color: #fff; padding: 0 12px 0 10px; }
.idea-bar .yes kbd { font: 500 11px var(--font-m); opacity: .8; }
.idea-bar .no { width: 32px; justify-content: center; background: transparent; color: var(--spark-ink); }
.idea-bar button:hover { transform: translateY(-1px); }
.idea-bar .no:hover { background: var(--spark-soft); }
.idea-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* 끌어오는 알약 */
.dragchip { position: fixed; z-index: 50; transform: translate(-50%, -140%); pointer-events: none; padding: 6px 12px; border-radius: 999px; font: 500 12.5px var(--font-b); background: var(--paper-2); border: 1px solid var(--line-2); color: var(--ink); box-shadow: 0 12px 24px -14px var(--shadow); }
.dragchip.k-money { background: var(--money-soft); color: var(--money-ink); border-color: var(--money); }
.dragchip.k-value { background: var(--value-soft); color: var(--value-ink); border-color: var(--value); }
.dragchip.k-data { background: var(--data-soft); color: var(--data-ink); border-color: var(--data); }

/* 토스트 */
.toast { position: absolute; left: 50%; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); z-index: 6; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); max-width: min(92%, 520px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: var(--paper); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }

/* ---------- 오른쪽: 대화 · 서랍 ---------- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--paper); border-left: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); padding-right: env(safe-area-inset-right, 0px); transition: visibility 0s; }
.chat > * { min-width: calc(var(--chat-w) - 1px - env(safe-area-inset-right, 0px)); }
#app.fold .chat { visibility: hidden; transition: visibility 0s linear .42s; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.chat-title { font: 700 16px/1.2 var(--font-d); }
.model { flex: none; display: inline-flex; padding: 3px; gap: 2px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; margin-left: auto; }
.model button { position: relative; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: 500 12.5px/1 var(--font-b); padding: 6px 11px; border-radius: 999px; transition: background .25s, color .25s; }
.model button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.model button.off::after { content: ""; position: absolute; top: 3px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.practice { flex: none; font: 500 11px/1 var(--font-m); color: var(--warn); border: 1px dashed currentColor; border-radius: 999px; padding: 4px 8px; cursor: help; }

.talk { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { max-width: 92%; display: grid; gap: 5px; animation: msgIn .4s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg p { margin: 0; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.62; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.msg.ai { align-self: flex-start; }
.msg .about { font: 500 11.5px var(--font-m); color: var(--money-ink); padding: 0 4px; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.msg .about::before { content: ""; flex: none; width: 14px; height: 0; border-top: 2px solid var(--money); }
.msg.ai p { background: var(--paper-2); border: 1px solid var(--line); border-top-left-radius: 5px; }
.msg.me { align-self: flex-end; }
.msg.me p { background: var(--ink); color: var(--paper); border-top-right-radius: 5px; }
.msg.streaming p:empty { min-height: 38px; min-width: 56px; position: relative; }
.msg.streaming p:empty::before { content: ""; position: absolute; left: 14px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--ink-2); box-shadow: 11px 0 0 var(--ink-2), 22px 0 0 var(--ink-2); animation: think 1.1s infinite; }
@keyframes think { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.msg.streaming p:not(:empty)::after { content: "▍"; color: var(--money); margin-left: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg.err p { color: var(--ink-2); border-style: dashed; border-color: var(--bad); }
.choices { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.choice { border: 1px solid var(--ink); background: var(--paper-2); color: var(--ink); cursor: pointer; border-radius: 999px; font: 500 13px/1 var(--font-b); padding: 8px 13px; transition: background .2s, color .2s, transform .2s var(--ease), opacity .3s; animation: msgIn .4s var(--ease) backwards; }
.choice:nth-child(2) { animation-delay: .06s; } .choice:nth-child(3) { animation-delay: .12s; }
.choice:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
.choices.used .choice { pointer-events: none; opacity: .38; border-color: var(--line); color: var(--ink-2); }
.choices.used .choice.picked { opacity: 1; background: var(--money-soft); border-color: var(--money-soft); color: var(--money-ink); }

/* 닮은 회사 */
.similar { display: grid; gap: 6px; padding: 6px 0 2px; }
.similar small { font: 500 11px var(--font-m); color: var(--ink-2); padding: 0 4px; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sim { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); cursor: pointer; border-radius: 12px; padding: 7px 12px; text-align: left; transition: border-color .2s, transform .2s var(--ease), opacity .3s; animation: msgIn .4s var(--ease) backwards; }
.sim b { font-size: 13.5px; font-weight: 600; }
.sim span { font: 500 11px var(--font-m); color: var(--money-ink); }
.sim:hover { border-color: var(--money); transform: translateY(-1px); }
.sim.used { pointer-events: none; opacity: .4; }
.sim.used.picked { opacity: 1; border-color: var(--money); background: var(--money-soft); }

/* 새 BM 발명 — 카드 묶음 */
.msg.wide { max-width: 100%; }
.deck { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; margin: 0 -2px; scrollbar-width: thin; }
.inv { flex: none; width: 262px; scroll-snap-align: start; display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--paper-2); position: relative;
  border: 1.5px solid transparent; background: linear-gradient(var(--paper-2), var(--paper-2)) padding-box, linear-gradient(140deg, var(--spark), var(--spark-2) 60%, var(--line)) border-box;
  box-shadow: 0 12px 26px -20px var(--spark); animation: msgIn .45s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms); }
.inv-top { display: flex; align-items: center; gap: 7px; }
.inv-top i { font-style: normal; color: var(--spark); animation: twinkle 1.8s ease-in-out infinite; display: inline-block; }
.inv-top b { font: 700 15.5px/1.25 var(--font-d); }
.moves { display: flex; flex-wrap: wrap; gap: 4px; }
.moves span { font: 600 11px/1 var(--font-b); color: var(--spark-ink); background: var(--spark-soft); border-radius: 999px; padding: 5px 8px; }
.moves span + span::before { content: "+ "; opacity: .6; }
.inv svg.mini { display: block; width: 100%; height: 130px; border-radius: 10px; background-color: color-mix(in srgb, var(--spark-soft) 55%, var(--space)); background-image: radial-gradient(var(--grid) 1px, transparent 1.1px); background-size: 12px 12px; }
.msg .inv .pitch { margin: 0; padding: 0; border: 0; background: none; border-radius: 0; font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.inv-meta { display: grid; gap: 2px; font: 500 11.5px/1.35 var(--font-m); color: var(--ink-2); }
.inv-meta .fresh { color: var(--spark-ink); }
.inv .draw { justify-self: stretch; border: 0; border-radius: 10px; padding: 9px 12px; cursor: pointer; font: 600 13px var(--font-b); color: #fff; background: linear-gradient(120deg, var(--spark), var(--spark-2)); transition: transform .2s var(--ease), filter .2s; }
.inv .draw:hover { transform: translateY(-1px); filter: brightness(1.05); }
.inv.drawn .draw { background: var(--ink); }
.deck.old .inv { box-shadow: none; }

/* 분석 카드 */
.card { margin-top: 2px; width: 100%; max-width: 330px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; animation: msgIn .4s var(--ease) backwards; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 6px; }
.card-top b { font: 700 15px var(--font-d); }
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: 500 11.5px/1 var(--font-b); padding: 5px 9px; border-radius: 999px; transition: background .2s, color .2s; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.card svg.mini { display: block; width: 100%; height: 190px; background-color: var(--space); background-image: radial-gradient(var(--grid) 1px, transparent 1.1px); background-size: 14px 14px; }
.card-flows { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px 6px; }
.fchip { display: inline-grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: grab; border-radius: 10px; padding: 5px 9px 5px 8px; text-align: left; touch-action: none; user-select: none; transition: transform .2s var(--ease), border-color .2s; }
.fchip:hover { transform: translateY(-1px); border-color: var(--ink-2); }
.fchip:active { cursor: grabbing; }
.fchip i { grid-row: span 2; width: 14px; height: 0; border-top: 2px solid var(--money); }
.fchip.k-value i { border-color: var(--value); border-top-style: dashed; } .fchip.k-data i { border-color: var(--data); border-top-style: dotted; border-top-width: 3px; }
.fchip span { font: 500 12.5px/1.2 var(--font-b); }
.fchip em { font: 400 10.5px/1.2 var(--font-m); color: var(--ink-2); font-style: normal; }
.card-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px 10px; }
.card-act small { font: 500 11px var(--font-m); color: var(--ink-2); }
.card-act .apply { border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; transition: transform .2s var(--ease); }
.card-act .apply:hover { transform: translateY(-1px); }

.composer { display: grid; gap: 7px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--paper); }
.focus-chip { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ink-2); padding: 0 4px; animation: msgIn .3s var(--ease); }
.fc-label { color: var(--money-ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.focus-chip button { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 6px; }
.focus-chip button:hover { background: var(--paper-2); }
.row { min-width: 0; display: flex; align-items: flex-end; gap: 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 18px; padding: 6px 6px 6px 14px; transition: border-color .2s; }
.row:focus-within { border-color: var(--ink); }
#input { flex: 1; width: 0; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 15px/1.5 var(--font-b); resize: none; padding: 6px 0; max-height: 132px; outline: none; }
#input::placeholder { color: var(--ink-2); opacity: .7; }
.send { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer; transition: transform .2s var(--ease), opacity .2s; }
.send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send:disabled { opacity: .28; cursor: default; }
.send:not(:disabled):hover { transform: translateY(-1px); }
.send.busy { opacity: 1; background: var(--money-soft); color: var(--money-ink); }
.send.busy svg { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }

/* 서랍 */
.drawer { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: msgIn .35s var(--ease); }
.drawer-top { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.drawer-top b { font: 700 15px var(--font-d); }
.drawer-top small { font: 500 12px var(--font-m); color: var(--ink-2); }
.new-model { margin-left: auto; border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; transition: transform .2s var(--ease); }
.new-model:hover { transform: translateY(-1px); }
.model-list { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex: 1; min-height: 0; display: grid; align-content: start; gap: 6px; }
.model-it { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 14px; cursor: pointer; border: 1px solid transparent; transition: background .2s, border-color .2s; animation: msgIn .4s var(--ease) backwards; }
.model-it:hover { background: var(--paper-2); border-color: var(--line); }
.model-it.cur { background: var(--paper-2); border-color: var(--ink); }
.model-it .tag { font: 500 10px var(--font-m); font-style: normal; color: var(--money-ink); background: var(--money-soft); border-radius: 6px; padding: 3px 6px; min-width: 30px; text-align: center; }
.model-it .tag:empty { background: var(--line); min-width: 10px; height: 10px; border-radius: 50%; padding: 0; }
.model-it b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-it small { font-size: 12px; color: var(--ink-2); }
.model-it .del { border: 0; background: none; color: var(--ink-2); cursor: pointer; border-radius: 8px; padding: 4px 8px; font-size: 14px; opacity: 0; transition: opacity .2s; }
.model-it:hover .del, .model-it .del.confirm, .model-it .del:focus-visible { opacity: 1; }
.model-it .del.confirm { color: #fff; background: var(--bad); font-size: 12px; }
.empty-models { color: var(--ink-2); font-size: 13.5px; padding: 18px 8px; text-align: center; }
.drawer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.space-name { font-weight: 600; color: var(--ink); }
.sync { display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.sync[data-s="online"]::before { background: var(--ok); }
.sync[data-s="local"]::before, .sync[data-s="offline"]::before { background: var(--warn); }
.logout { margin-left: auto; border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.logout:hover { background: var(--paper-2); }

/* ---------- 시작 화면 ---------- */
.start { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: var(--paper); animation: fadeIn .4s var(--ease); overflow-y: auto; }
.start.leaving { opacity: 0; transform: scale(1.02); pointer-events: none; transition: opacity .45s var(--ease), transform .5s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }
.start-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 18px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); font-size: 20px; cursor: pointer; }
.start-model { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 18px; margin: 0; }
.start-in { width: min(100%, 560px); display: grid; gap: 16px; }
.start h1 { margin: 0; font: 700 clamp(44px, 9vw, 72px)/1 var(--font-d); letter-spacing: -.02em; }
.start .tag { margin: -6px 0 6px; color: var(--ink-2); font-size: 15px; }
.seed-form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field span { font: 500 12.5px var(--font-m); color: var(--ink-2); }
.field textarea { width: 100%; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: 16px; padding: 14px 16px; font: 17px/1.55 var(--font-b); resize: none; outline: none; transition: border-color .2s, box-shadow .3s; }
.field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.examples button { border: 1px dashed var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 999px; padding: 6px 12px; font: 500 12.5px var(--font-b); transition: color .2s, border-color .2s; }
.examples button:hover { color: var(--ink); border-color: var(--ink); border-style: solid; }
.seed-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.seed-row .or, .seed-row .go { margin-top: 4px; }
.seed-row .or { font: 500 12px var(--font-m); color: var(--ink-2); }
.start-types-wrap { flex: 1; min-width: 0; }
.start-types { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.start-types button { display: inline-flex; align-items: center; gap: 5px; }
.start-types button em { display: none; }
.start-types .car { width: 5px; height: 5px; border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); transition: transform .3s var(--ease); }
.start-types button.open { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.start-types button.open .car { transform: rotate(-135deg) translate(-1px, -1px); }
.start-types button { border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); cursor: pointer; border-radius: 999px; padding: 5px 10px; font: 500 12px var(--font-b); transition: background .2s, color .2s; }
.start-types button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.go { margin-left: auto; border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 11px 18px; font-size: 15px; cursor: pointer; transition: transform .2s var(--ease), opacity .2s; }
.go:disabled { opacity: .3; cursor: default; }
.go:not(:disabled):hover { transform: translateX(2px); }

/* ---------- 암호 ---------- */
.lock { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: var(--paper); transition: opacity .6s var(--ease); }
.lock.leaving { opacity: 0; pointer-events: none; }
.lock-in { width: min(100%, 340px); display: grid; justify-items: center; gap: 18px; text-align: center; }
.lock h1 { margin: 0; font: 700 clamp(40px, 8vw, 56px)/1 var(--font-d); letter-spacing: -.02em; }
.lock-mark { width: 120px; height: 70px; animation: bob 4.5s ease-in-out infinite; }
.lock-mark svg { width: 100%; height: 100%; fill: var(--paper-2); stroke: var(--ink); stroke-width: 2; }
.lock-mark circle:first-child { fill: var(--ink); }
.lock-mark .m { stroke: var(--money); stroke-dasharray: 1 7; stroke-linecap: round; stroke-width: 3; animation: flow 1.2s linear infinite; }
.lock-mark .v { stroke: var(--value); stroke-dasharray: 4 3; }
.lock-in.wait .lock-mark { animation: bob .8s ease-in-out infinite; }
.lock-field { width: 100%; display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); transition: border-color .2s, box-shadow .3s; }
.lock-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.lock-field input { flex: 1; width: 0; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 16px/1.4 var(--font-b); letter-spacing: .08em; outline: none; padding: 6px 0; }
.lock-field input::placeholder { letter-spacing: 0; color: var(--ink-2); opacity: .6; }
.lock-go { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer; transition: transform .2s var(--ease); }
.lock-go:hover { transform: translateX(2px); }
.lock-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lock-msg { margin: -6px 0 0; min-height: 20px; font-size: 13px; color: var(--bad); }
.lock-in.shake .lock-field { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 760px) {
  :root { --chat-w: 100%; }
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 46%; }
  #app.fold { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 0px; }
  .chat { border-left: 0; border-top: 1px solid var(--line); padding-right: 0; }
  .chat > * { min-width: 0; }
  .top { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .model-pill { max-width: 34%; font-size: 14px; padding: 8px 10px; }
  .model-pill .caret { display: none; }
  .plats button { min-width: 0; padding: 7px 10px; }
  .types { max-width: 100%; }
  .variants { max-width: 70%; bottom: 10px; left: 10px; }
  .legend { display: none; }
  .tools { right: 10px; bottom: 10px; }
  .pop { width: min(312px, calc(100% - 20px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ===================== 사례 · 보관함 · 회계 카드 · 재무제표 · 재생 ===================== */
.left-pills { display: flex; gap: 6px; flex: none; }
.case-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); cursor: pointer; font: 600 13.5px/1 var(--font-b); padding: 9px 12px 9px 10px; border-radius: 999px; box-shadow: 0 6px 18px -12px var(--shadow); transition: transform .2s var(--ease), background .2s; position: relative; }
.case-pill:hover { transform: translateY(-1px); }
.case-pill svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.case-pill svg .f { fill: var(--money); stroke: var(--money); }
.left-pills [data-tip]::after { right: auto; left: 0; top: calc(100% + 8px); transform: translate(0, -4px); }
.left-pills [data-tip]:hover::after, .tips-on .left-pills [data-tip]::after { transform: translate(0, 0); }

/* 로고 */
.logo { --s: 20px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .28); overflow: hidden; vertical-align: middle;
  background: hsl(var(--h) 55% 92%); color: hsl(var(--h) 45% 32%); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); }
.logo i { font: 700 calc(var(--s) * .52)/1 var(--font-b); font-style: normal; }
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: calc(var(--s) * .08); }
@media (prefers-color-scheme: dark) { .logo { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 60% 82%); } }
[data-logo] { display: inline-flex; align-items: center; gap: 7px; }

/* 닮은 회사 · 분석 카드 · 카드 묶음 */
.sim .sim-t { display: inline-flex; align-items: center; gap: 6px; }
.sim .why { font: 500 11px var(--font-m); color: var(--money-ink); padding-left: 24px; }
.sim.picked { border-color: var(--money); background: var(--money-soft); }
.card-top .ct-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; margin-right: auto; }
.card-top .big { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.card-top .big:hover { color: var(--ink); border-color: var(--ink); }
.deck-wrap { display: grid; gap: 8px; }
.draw-all { justify-self: start; border: 0; border-radius: 999px; padding: 9px 14px; cursor: pointer; font: 600 13px var(--font-b); color: #fff; background: linear-gradient(120deg, var(--spark), var(--spark-2)); box-shadow: 0 10px 22px -14px var(--spark); transition: transform .2s var(--ease); }
.draw-all:hover { transform: translateY(-1px); }
.draw-all:disabled { background: var(--ink); opacity: .7; cursor: default; transform: none; }
.inv-meta .borrow { display: inline-flex; align-items: center; gap: 5px; }
.varc { flex: none; border: 1px dashed var(--line-2); background: var(--paper-2); color: var(--ink-2); cursor: pointer; border-radius: 999px; padding: 6px 10px; font: 500 12px var(--font-m); }
.varc:hover { color: var(--ink); border-color: var(--ink); }

/* 공통 덮개(보관함 · 사례 모음) */
.vault, .gallery { position: absolute; inset: calc(64px + env(safe-area-inset-top, 0px)) 14px 14px 14px; z-index: 5; display: flex; flex-direction: column; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 60px -30px var(--shadow);
  opacity: 0; transform: translateY(10px) scale(.99); transition: opacity .25s var(--ease), transform .3s var(--ease); overflow: hidden; }
.vault.show, .gallery.show { opacity: 1; transform: none; }
.x { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); font-size: 18px; line-height: 1; cursor: pointer; transition: color .2s, border-color .2s; }
.x:hover { color: var(--ink); border-color: var(--ink); }
.vt-head, .gl-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vt-head > b, .gl-head > b { font: 700 18px var(--font-d); }
.gl-head small { color: var(--ink-2); font-size: 12.5px; }
.vt-tabs { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); }
.vt-tabs button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: 500 13px var(--font-b); padding: 7px 12px; border-radius: 999px; }
.vt-tabs button b { font: 600 11px var(--font-m); margin-left: 3px; opacity: .7; }
.vt-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.vt-new { margin-left: auto; border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 14px; font: 600 13px var(--font-b); cursor: pointer; }
#gallerySearch { margin-left: auto; width: min(240px, 40%); border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: 14px var(--font-b); outline: none; }
#gallerySearch:focus { border-color: var(--ink); }
.vt-grid, .gl-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-content: start; }
.vault-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-2); padding: 40px 10px; font-size: 14px; }
.vt-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.vt-foot .logout { margin-left: auto; }
.vcard { position: relative; display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); cursor: pointer; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; animation: msgIn .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 30ms); }
.vcard:hover { transform: translateY(-2px); border-color: var(--ink-2); box-shadow: 0 14px 26px -20px var(--shadow); }
.vcard.open { border-color: var(--ink); }
.vcard svg.mini, .gcard svg.mini { display: block; width: 100%; height: 120px; border-radius: 10px; background-color: var(--space); background-image: radial-gradient(var(--grid) 1px, transparent 1.1px); background-size: 12px 12px; }
.vc-body { display: grid; gap: 6px; }
.vc-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.vc-top b { font: 700 15px var(--font-b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-top i { font: 500 10.5px var(--font-m); font-style: normal; color: var(--money-ink); background: var(--money-soft); border-radius: 6px; padding: 2px 6px; flex: none; }
.vc-vs { display: flex; flex-wrap: wrap; gap: 4px; }
.vv { display: inline-flex; align-items: center; gap: 4px; font: 500 11.5px var(--font-b); border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 9px; color: var(--ink-2); background: var(--paper); }
.vv.cur { color: var(--ink); border-color: var(--ink-2); }
.vv.ai { color: var(--spark-ink); border-color: color-mix(in srgb, var(--spark) 50%, var(--line)); }
.vv.arc { opacity: .5; text-decoration: line-through; }
.vv b { font-weight: 400; font-size: 11px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.vv b:hover { background: var(--ink); color: var(--paper); }
.vc-body small { color: var(--ink-2); font-size: 12px; }
.vc-act { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.vcard:hover .vc-act { opacity: 1; }
.vc-act button { border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); border-radius: 8px; height: 28px; min-width: 28px; padding: 0 7px; cursor: pointer; font-size: 13px; }
.vc-act button:hover { color: var(--ink); border-color: var(--ink); }
.vc-act button.confirm { background: var(--bad); color: #fff; border-color: var(--bad); font-size: 12px; }
.gl-cats { display: flex; gap: 5px; padding: 10px 16px 0; overflow-x: auto; scrollbar-width: none; flex: none; }
.gl-cats::-webkit-scrollbar { display: none; }
.gl-cats button { flex: none; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); cursor: pointer; border-radius: 999px; padding: 6px 12px; font: 500 12.5px var(--font-b); }
.gl-cats button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.gcard { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); cursor: pointer; text-align: left; color: var(--ink); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; animation: msgIn .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 18ms); }
.gcard:hover { transform: translateY(-2px); border-color: var(--money); box-shadow: 0 16px 28px -20px var(--shadow); }
.gc-top { gap: 9px; }
.gc-top b { font: 700 15px var(--font-b); }
.gc-top i { font: 500 10.5px var(--font-m); font-style: normal; color: var(--ink-2); margin-left: auto; }
.gc-tag { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }

/* 시작 화면 — 회사로 보기 */
.start-cos { display: flex; align-items: flex-start; gap: 10px; }
.start-cos .or { flex: none; margin-top: 7px; }
.cos { display: flex; flex-wrap: wrap; gap: 6px; }
.co { border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); cursor: pointer; border-radius: 999px; padding: 4px 11px 4px 5px; font: 500 12.5px var(--font-b); transition: border-color .2s, transform .2s var(--ease); }
.co:hover { border-color: var(--ink); transform: translateY(-1px); }
.co.more { padding: 6px 12px; color: var(--ink-2); border-style: dashed; }

/* 예시 화면 */
.excard { position: absolute; top: calc(66px + env(safe-area-inset-top, 0px)); left: 14px; z-index: 4; width: min(300px, calc(100% - 28px)); padding: 16px; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: 0 20px 40px -26px var(--shadow);
  opacity: 0; transform: translateX(-10px); transition: opacity .25s var(--ease), transform .3s var(--ease); }
.excard.show { opacity: 1; transform: none; }
.excard .x { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; font-size: 15px; }
.ex-head { display: flex; align-items: center; gap: 10px; padding-right: 30px; }
.ex-title { display: grid; gap: 2px; }
.ex-title b { font: 700 19px/1.15 var(--font-d); }
.ex-title i { font: 500 11px var(--font-m); font-style: normal; color: var(--money-ink); }
.ex-tag { margin: 12px 0 8px; font-size: 14px; line-height: 1.55; }
.ex-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.ex-points li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ex-points li::before { content: "✧"; position: absolute; left: 0; color: var(--money); }
.ex-cta { position: absolute; top: calc(62px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 4; opacity: 0; transform: translateY(-6px); transition: opacity .25s var(--ease), transform .3s var(--ease); }
.ex-cta.show { opacity: 1; transform: none; }
.ex-cta .apply { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 13px 18px 13px 15px; cursor: pointer; font: 700 14.5px var(--font-b); color: #fff; background: linear-gradient(120deg, var(--spark), var(--spark-2)); box-shadow: 0 16px 30px -14px var(--spark); transition: transform .2s var(--ease); position: relative; }
.ex-cta .apply::before { content: ""; position: absolute; inset: -4px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--spark) 45%, transparent); animation: ring 2.4s ease-out infinite; pointer-events: none; }
.ex-cta .apply:hover { transform: translateY(-2px); }
.ex-cta .apply svg { width: 17px; height: 17px; fill: currentColor; }
.ex-cta.wait .apply { pointer-events: none; }
.ex-cta.wait .apply svg { animation: spin 1.2s linear infinite; }
.ex-form { display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--spark); box-shadow: 0 16px 30px -18px var(--spark); animation: popIn .25s var(--ease); }
.ex-form input { width: 240px; border: 0; background: transparent; color: var(--ink); font: 15px var(--font-b); padding: 6px 10px; outline: none; }
.ex-form button { width: 38px; height: 38px; border-radius: 50%; border: 0; color: #fff; background: linear-gradient(120deg, var(--spark), var(--spark-2)); cursor: pointer; font-size: 16px; }
.ex-cta.wait .ex-form button { animation: pulse 1s ease-in-out infinite; }
.space.example .variants, .space.example .idea-bar, .space.example #inventBtn, .space.example #lensBtn, .space.example #playBtn, .space.example .legend { display: none !important; }
.space.example #graph { cursor: grab; }

/* 번호 배지(렌즈·재생) */
.flab .num { pointer-events: none; }
#graph .flab .lab .num circle { fill: var(--ink); stroke: var(--paper-2); stroke-width: 2; }
#graph .flab .lab .num text { font: 700 11.5px var(--font-m) !important; fill: var(--paper) !important; dominant-baseline: central; }
#graph .flab.k-money .lab .num circle { fill: var(--money-ink); }

/* 회계 카드 패널 */
.ledger { position: absolute; top: calc(64px + env(safe-area-inset-top, 0px)); left: 14px; bottom: 62px; z-index: 4; width: 340px; display: flex; flex-direction: column; border-radius: 18px; background: color-mix(in srgb, var(--paper-2) 96%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: 0 24px 44px -28px var(--shadow);
  opacity: 0; transform: translateX(-12px); transition: opacity .25s var(--ease), transform .3s var(--ease); overflow: hidden; }
.ledger.show { opacity: 1; transform: none; }
.lg-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.lg-head b { font: 700 15px var(--font-d); margin-right: auto; }
.lg-head .x { width: 28px; height: 28px; font-size: 15px; }
.std { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.std button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: 600 11.5px var(--font-b); padding: 5px 9px; border-radius: 999px; transition: background .2s, color .2s; }
.std button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lg-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: grid; gap: 8px; align-content: start; }
.ledger.loading .lg-list::before { content: "AI가 장부를 읽는 중…"; font: 500 11.5px var(--font-m); color: var(--spark-ink); padding: 0 4px; animation: pulse 1.2s ease-in-out infinite; }
.lcard { padding: 10px 11px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); display: grid; gap: 6px; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); animation: msgIn .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.lcard:hover, .lcard.hot { border-color: var(--money); box-shadow: 0 10px 20px -16px var(--money); }
.lg-list.quiet .lcard { animation: none; }
.lcard.flash { animation: flash .9s var(--ease); }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--money) 40%, transparent); } }
.lcard.out { opacity: .7; }
.lcard header { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.lcard header .nb { grid-row: span 2; }
.lcard header b { font: 600 14px/1.25 var(--font-b); }
.lcard header small { font: 500 11px var(--font-m); color: var(--ink-2); }
.nb { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--money-ink); color: var(--paper); font: 700 11.5px var(--font-m); padding: 0 5px; margin-right: 4px; }
.lrow { display: grid; grid-template-columns: 62px 1fr; gap: 6px; align-items: baseline; font-size: 12.5px; line-height: 1.45; }
.lrow .ic { font: 600 10.5px var(--font-m); color: var(--ink-2); text-align: right; }
.lrow .ic.rv { color: var(--value-ink); } .lrow .ic.ca { color: var(--money-ink); }
.journal { position: relative; display: grid; gap: 4px; padding: 8px 9px; border-radius: 10px; background: var(--space); border: 1px dashed var(--line-2); font: 500 11.5px/1.45 var(--font-m); }
.journal.diff { border-color: var(--spark); }
.je { display: grid; gap: 2px; }
.je .then { font: 500 10px var(--font-m); font-style: normal; color: var(--ink-2); }
.je .dr, .je .cr { display: grid; grid-template-columns: 20px 1fr; gap: 4px; }
.je .cr { padding-left: 16px; }
.je em { font-style: normal; font-weight: 700; color: var(--ink-2); }
.je .dr em { color: var(--value-ink); } .je .cr em { color: var(--money-ink); }
.dtag { position: absolute; top: -8px; right: 8px; font: 600 10px var(--font-m); font-style: normal; color: #fff; background: var(--spark); border-radius: 999px; padding: 2px 7px; }
.where { display: flex; flex-wrap: wrap; gap: 4px; }
.where span { font: 500 11px var(--font-b); border-radius: 999px; padding: 3px 8px; }
.w-is { background: var(--value-soft); color: var(--value-ink); }
.w-bs { background: var(--money-soft); color: var(--money-ink); }
.outnote { margin: 0; font-size: 12px; color: var(--ink-2); }
.lg-sum { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.55; color: var(--ink); max-height: 140px; overflow-y: auto; }
.lg-sum button { border: 0; background: var(--spark-soft); color: var(--spark-ink); border-radius: 999px; padding: 4px 10px; font: 600 12px var(--font-b); cursor: pointer; margin-left: 4px; }
.lg-books { margin: 0 10px 10px; border: 0; border-radius: 12px; padding: 11px 14px; cursor: pointer; font: 700 13.5px var(--font-b); color: var(--paper); background: var(--ink); display: flex; justify-content: space-between; align-items: center; transition: transform .2s var(--ease); }
.lg-books:hover { transform: translateY(-1px); }
.lg-books span { transition: transform .2s var(--ease); }
.lg-books:hover span { transform: translateX(3px); }

/* 재무제표 창 */
.books { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--shadow) 35%, transparent); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s var(--ease); }
.books.show { opacity: 1; }
.bk-win { width: min(1120px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; border-radius: 22px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 40px 80px -30px var(--shadow); overflow: hidden; transform: translateY(14px) scale(.985); transition: transform .35s var(--ease); }
.books.show .bk-win { transform: none; }
.bk-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bk-title { display: grid; gap: 2px; margin-right: auto; }
.bk-title b { font: 700 20px var(--font-d); }
.bk-title small { font: 500 11.5px var(--font-m); color: var(--spark-ink); }
.std.big button { display: grid; gap: 1px; padding: 7px 14px; font-size: 13px; text-align: center; }
.std.big button small { font: 500 10px var(--font-m); opacity: .75; }
.bk-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
.bk-meta span { font: 500 11.5px var(--font-m); border-radius: 999px; padding: 4px 10px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-2); }
.bk-meta .unit { color: var(--ink); }
.bk-meta .ex { border-style: dashed; color: var(--warn); }
.bk-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 18px; display: grid; gap: 16px; align-content: start; }
.sheets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.sheets.swap .stmt { animation: msgIn .35s var(--ease); }
.stmt { border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); padding: 14px 14px 10px; }
.stmt h3 { margin: 0 0 8px; font: 700 15px var(--font-d); display: flex; align-items: center; gap: 8px; }
.stmt h3::after { content: ""; flex: 1; border-top: 2px solid var(--ink); }
.stmt ol { list-style: none; margin: 0; padding: 0; display: grid; }
.stmt li { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; font-size: 13px; }
.stmt li .t { display: inline-flex; align-items: center; min-width: 0; }
.stmt li .lead { flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-3px); min-width: 10px; }
.stmt li .v { font: 500 13px var(--font-m); font-variant-numeric: tabular-nums; }
.stmt li.lv1 { padding-left: 14px; color: var(--ink-2); }
.stmt li.lv0 { font-weight: 700; border-top: 1px solid var(--line); }
.stmt li.lv0:first-child { border-top: 0; }
.stmt li.lv0 .v { font-weight: 700; }
.stmt li.neg .v { color: var(--bad); }
.stmt li.chg .t::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--spark); margin-left: 6px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--spark) 20%, transparent); }
.stmt .nb { width: 19px; height: 19px; min-width: 19px; font-size: 10.5px; }
.diffs h3 { margin: 0 0 10px; font: 700 15px var(--font-d); }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.diff { padding: 12px; border-radius: 14px; background: var(--paper-2); border: 1px solid color-mix(in srgb, var(--spark) 40%, var(--line)); display: grid; gap: 8px; }
.diff > b { display: inline-flex; align-items: center; font: 700 13.5px var(--font-b); }
.pair { display: grid; grid-template-columns: 1fr 26px 1fr; align-items: stretch; }
.pair span { display: grid; gap: 3px; padding: 8px 10px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.4; transition: border-color .2s, background .2s; }
.pair span em { font: 700 10px var(--font-m); font-style: normal; color: var(--ink-2); }
.pair span.on { border-color: var(--spark); background: var(--spark-soft); }
.pair .link { align-self: center; height: 2px; background: repeating-linear-gradient(90deg, var(--spark) 0 4px, transparent 4px 7px); position: relative; }
.pair .link::before, .pair .link::after { content: ""; position: absolute; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--spark); }
.pair .link::before { left: -2px; } .pair .link::after { right: -2px; }
.bk-say { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--money-soft); color: var(--money-ink); font-size: 13.5px; line-height: 1.55; }
.bk-wait { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 80px 0; color: var(--ink-2); font-size: 14px; }
.bk-wait i { width: 9px; height: 9px; border-radius: 50%; background: var(--money); animation: think 1.1s infinite; }
.bk-wait i:nth-child(2) { animation-delay: .15s; } .bk-wait i:nth-child(3) { animation-delay: .3s; }

/* 재생 */
.tools .playb { color: var(--money-ink); }
.tools .playb svg { fill: currentColor; stroke: none; }
.tools .playb.on { background: var(--money-ink); color: #fff; border-color: var(--money-ink); }
#graph.staged .node:not(.now) { opacity: .35; }
#graph.staged .flow:not(.now):not(.done) { opacity: .12; }
#graph.staged .flow.done { opacity: .5; }
#graph.staged .flow.now .line { stroke-width: 3.4 !important; }
#graph.staged .flab.now .lab rect { stroke: var(--ink); stroke-width: 2; }
.node.ping .box { animation: ping .7s var(--ease); }
@keyframes ping { 0% { filter: drop-shadow(0 0 0 var(--money)); } 35% { filter: drop-shadow(0 0 14px var(--money)); } 100% { filter: drop-shadow(0 3px 6px color-mix(in srgb, var(--shadow) 9%, transparent)); } }
.play .trail { fill: none; stroke-width: 7; stroke-linecap: round; opacity: .3; }
.tok.k-money circle { fill: #F4C55A; stroke: var(--money-ink); stroke-width: 2; filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--money) 60%, transparent)); }
.tok.k-money text { font: 800 12px var(--font-b); fill: var(--money-ink); }
.tok.k-value rect { fill: var(--value); stroke: #fff; stroke-width: 1.5; } .tok.k-value path { stroke: #fff; stroke-width: 1.4; fill: none; }
.tok.k-data circle { fill: var(--data); stroke: #fff; stroke-width: 2; }
.tok.land { animation: land .5s var(--ease) forwards; }
@keyframes land { to { opacity: 0; } }
.space.playing .variants, .space.playing .legend, .space.playing .ledger { opacity: .25; pointer-events: none; }
.playbar { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 6; width: min(620px, calc(100% - 28px)); transform: translate(-50%, 16px); opacity: 0; transition: opacity .3s var(--ease), transform .35s var(--ease);
  display: grid; gap: 10px; padding: 14px 14px 10px; border-radius: 20px; background: var(--ink); color: var(--paper); box-shadow: 0 24px 50px -24px var(--shadow); }
.playbar.show { opacity: 1; transform: translate(-50%, 0); }
.pcap { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.pcap.in .ptxt, .pcap.in .pn { animation: msgIn .4s var(--ease); }
.pn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font: 800 17px var(--font-m); background: #F4C55A; color: #3A2A08; }
.pn.k-value { background: var(--value); color: #fff; } .pn.k-data { background: var(--data); color: #fff; }
.ptxt { display: grid; gap: 2px; min-width: 0; }
.ptxt small { font: 500 11.5px var(--font-m); opacity: .7; }
.ptxt b { font: 700 16px var(--font-b); }
.ptxt p { margin: 2px 0 0; font-size: 14px; line-height: 1.55; opacity: .92; word-break: keep-all; }
.pctl { display: flex; align-items: center; gap: 6px; }
.pctl button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--paper) 14%, transparent); color: var(--paper); cursor: pointer; display: grid; place-items: center; }
.pctl button:hover { background: color-mix(in srgb, var(--paper) 24%, transparent); }
.pctl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pctl .pp .i-play { display: none; fill: currentColor; stroke: none; }
.playbar.paused .pp .i-play { display: block; } .playbar.paused .pp .i-pause { display: none; }
.pdots { flex: 1; display: flex; gap: 4px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pdots i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--paper) 25%, transparent); cursor: pointer; transition: transform .2s, background .2s; }
.pdots i.past { background: color-mix(in srgb, #F4C55A 60%, transparent); }
.pdots i.on { background: #F4C55A; transform: scale(1.5); }
.pctl .pc { font-size: 18px; line-height: 1; }
.space.playing #playBtn::after { content: "재생 중"; }

@media (max-width: 760px) {
  .ledger { width: auto; right: 14px; top: auto; height: 46%; }
  .excard { width: calc(100% - 28px); }
  .ex-cta { top: auto; bottom: 74px; right: 50%; transform: translateX(50%); }
  .ex-cta.show { transform: translateX(50%); }
  .case-pill span { display: none; }
  .vault, .gallery { inset: 60px 8px 8px 8px; }
  .playbar { bottom: 8px; padding: 10px 10px 8px; gap: 6px; border-radius: 16px; width: calc(100% - 16px); }
  .pn { width: 30px; height: 30px; font-size: 14px; }
  .ptxt b { font-size: 14.5px; } .ptxt p { font-size: 13px; line-height: 1.45; }
  .pctl button { width: 28px; height: 28px; }
  .ex-cta .apply { padding: 11px 15px 11px 13px; font-size: 13.5px; }
  .ex-form input { width: 180px; }
}

/* ===================== 회계 카드 — 쉽게 보기 ===================== */
.lg-sub { display: none; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); font: 500 11.5px var(--font-m); color: var(--ink-2); }
.ledger:not(.easy) .lg-sub { display: flex; }
.lg-key { display: none; flex-wrap: wrap; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ledger.easy .lg-key { display: flex; }
.lg-key .fx { font-size: 11px; padding: 3px 8px; }
.lcard .say { margin: 0; font-size: 14px; line-height: 1.55; word-break: keep-all; }
.fxs { display: grid; gap: 5px; }
.fx-step { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fx-step > i { flex: none; width: 40px; font: 500 10.5px var(--font-m); font-style: normal; color: var(--ink-2); }
.fx { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 9px; font: 600 12px var(--font-b); border: 1px solid transparent; }
.fx b { font-size: 9px; }
.fx.k-a { background: var(--money-soft); color: var(--money-ink); }
.fx.k-l { background: color-mix(in srgb, var(--warn) 16%, var(--paper)); color: color-mix(in srgb, var(--warn) 65%, var(--ink)); }
.fx.k-r { background: var(--value-soft); color: var(--value-ink); }
.fx.k-e { background: color-mix(in srgb, var(--bad) 14%, var(--paper)); color: var(--bad); }
.fx.k-n { background: var(--space); color: var(--ink-2); }
.fx.dn { background: transparent; border-color: currentColor; opacity: .8; }
.stmt h3 small { font: 500 11.5px var(--font-b); color: var(--ink-2); }
.stmt li .pl { font: 500 10.5px var(--font-b); font-style: normal; color: var(--ink-2); margin-left: 6px; background: var(--space); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

/* ===================== 분해 ===================== */
.parts { position: absolute; top: calc(64px + env(safe-area-inset-top, 0px)); left: 14px; bottom: 62px; z-index: 4; width: 340px; display: flex; flex-direction: column; border-radius: 18px; background: color-mix(in srgb, var(--paper-2) 96%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: 0 24px 44px -28px var(--shadow);
  opacity: 0; transform: translateX(-12px); transition: opacity .25s var(--ease), transform .3s var(--ease); overflow: hidden; }
.parts.show { opacity: 1; transform: none; }
.parts.loading .pt-list::before { content: "AI가 우리 사업에 맞게 다듬는 중…"; font: 500 11.5px var(--font-m); color: var(--spark-ink); padding: 0 4px; animation: pulse 1.2s ease-in-out infinite; }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.formula .eq { font: 700 17px var(--font-d); color: var(--ink-2); margin-right: 2px; }
.formula > i { font-style: normal; font-weight: 700; color: var(--ink-2); }
.formula .one { font-size: 13px; color: var(--ink-2); }
.fchip { border: 0; cursor: pointer; border-radius: 999px; padding: 6px 11px; font: 700 13px var(--font-b); color: hsl(var(--h) 55% 28%); background: hsl(var(--h) 70% 90%); transition: transform .2s var(--ease), box-shadow .2s; }
.fchip.hot { transform: translateY(-1px); box-shadow: 0 0 0 2px hsl(var(--h) 60% 50%); }
.pcard { position: relative; padding: 11px 12px 11px 17px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); display: grid; gap: 7px; cursor: pointer; overflow: hidden; transition: border-color .2s, box-shadow .2s; animation: msgIn .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: hsl(var(--h) 65% 55%); }
.pcard.hot, .pcard.on { border-color: hsl(var(--h) 60% 55%); box-shadow: 0 10px 22px -16px hsl(var(--h) 60% 45%); }
.pcard header { display: flex; align-items: baseline; gap: 8px; }
.pcard header b { font: 700 16px var(--font-b); color: hsl(var(--h) 55% 30%); }
.pcard header small { margin-left: auto; font: 500 11px var(--font-m); color: var(--ink-2); }
.pcard p { margin: 0; font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.pcard svg.mini { display: block; width: 100%; height: 110px; border-radius: 10px; background-color: var(--space); background-image: radial-gradient(var(--grid) 1px, transparent 1.1px); background-size: 12px 12px; }
.pcard .like { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pcard .like > span { font: 500 11px var(--font-m); color: var(--ink-2); margin-right: 2px; }
.pcard .like .co { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; font-size: 12px; }
.pt-list { grid-auto-rows: max-content; }
.pt-list.quiet .pcard { animation: none; }
.space.parting .excard { opacity: 0 !important; pointer-events: none; }
@media (prefers-color-scheme: dark) {
  .fchip { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 35% 24%); }
  .pcard header b { color: hsl(var(--h) 70% 78%); }
}

/* 우클릭 메뉴 */
.ctx { position: fixed; z-index: 50; min-width: 170px; padding: 5px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: 0 18px 40px -18px var(--shadow); display: grid; gap: 1px;
  opacity: 0; transform: scale(.96); transform-origin: top left; transition: opacity .14s, transform .18s var(--ease); }
.ctx.show { opacity: 1; transform: none; }
.ctx button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; font: 500 13.5px var(--font-b); padding: 9px 12px 9px 10px; border-radius: 10px; }
.ctx button[hidden] { display: none; }
.ctx button:hover { background: var(--space); }
.ctx button i { font-style: normal; width: 20px; text-align: center; color: var(--ink-2); }
.ctx button[data-act="parts"] i { color: var(--spark); }
.ctx button.on::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--money); }
@media (max-width: 760px) {
  .parts, .ledger { width: auto; left: 8px; right: 8px; top: calc(58px + env(safe-area-inset-top, 0px)); bottom: 8px; height: auto; }
  .parts .lg-sum, .ledger .lg-sum { max-height: 64px; }
}
