
:root {
  color-scheme: dark;
  --bg: #060a10;
  --panel: #0c141d;
  --panel-2: #101b28;
  --line: #1d2a38;
  --soft-line: rgba(132,155,179,.13);
  --text: #edf4fa;
  --muted: #71859a;
  --blue: #2f81f7;
  --cyan: #33c3d4;
  --violet: #8b79ff;
  --green: #1bc58a;
  --amber: #f2b84b;
  --up: #f05252;
  --down: #4294ff;
  --shadow: 0 14px 36px rgba(0,0,0,.22);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: Inter, Pretendard, "Segoe UI", "Apple SD Gothic Neo", sans-serif; letter-spacing: -.025em; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.panel { border: 1px solid #1c2a37; border-radius: 10px; background: linear-gradient(145deg, rgba(14,24,34,.99), rgba(8,14,21,.99)); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 5px; color: #68839c; font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(circle at 78% -12%, rgba(47,129,247,.13), transparent 34%), var(--bg); }
.topbar { height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(6,11,17,.98); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px 4px 11px 4px; background: linear-gradient(135deg, #317fea, #514bd7); color: white; font-weight: 950; box-shadow: 0 10px 24px rgba(47,129,247,.25); }
.brand strong { display: block; font-size: 12px; letter-spacing: .1em; }
.brand small { display: block; margin-top: 2px; color: #667b91; font-size: 8px; letter-spacing: .15em; }
.market-clock { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.market-clock strong { font-size: 18px; letter-spacing: .05em; }
.market-clock small { color: #72869a; font-size: 10px; }
.live-badge { padding: 4px 7px; border-radius: 5px; background: rgba(27,197,138,.12); color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.top-status { justify-self: end; display: flex; align-items: center; gap: 14px; color: #8799aa; font-size: 10px; }
.top-status i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #516170; }
.top-status i.on { background: var(--green); box-shadow: 0 0 10px rgba(27,197,138,.7); }
.ai-pill { padding: 5px 8px; border: 1px solid rgba(139,121,255,.25); border-radius: 5px; background: rgba(139,121,255,.09); color: #a99bff; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.ticker { height: 32px; display: flex; align-items: center; gap: 27px; overflow: hidden; padding: 0 18px; border-bottom: 1px solid #17212c; background: #080e15; white-space: nowrap; font-size: 10px; }
.ticker-loading { color: #657a8f; }
.ticker-item { display: flex; gap: 7px; color: #a6b5c3; }
.ticker-item strong { color: #f2f6f9; font-variant-numeric: tabular-nums; }
.up-text { color: var(--up) !important; }
.down-text { color: var(--down) !important; }
.workspace { flex: 1; min-width: 0; min-height: 650px; display: grid; grid-template-columns: 224px minmax(480px,1fr) 356px; gap: 12px; padding: 12px; align-items: stretch; }
.left-rail { min-width: 0; padding: 16px 12px; overflow: visible; }
.rail-head, .section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rail-head h2, .section-head h2 { margin: 0; font-size: 16px; }
.count-badge { display: grid; place-items: center; min-width: 25px; height: 22px; border: 1px solid #2b3b4b; border-radius: 6px; color: #93a7b8; font-size: 10px; }
.search-wrap { position: relative; margin-top: 16px; }
.search-wrap > svg { position: absolute; left: 11px; top: 11px; width: 14px; fill: none; stroke: #60778c; stroke-width: 2; }
.search-wrap input { width: 100%; height: 39px; padding: 0 10px 0 33px; border: 1px solid #263746; border-radius: 7px; outline: none; background: #070e15; color: white; font-size: 12px; }
.search-wrap input:focus { border-color: #3b6d9d; box-shadow: 0 0 0 3px rgba(47,129,247,.08); }
.search-results { position: absolute; z-index: 20; top: 41px; left: 0; right: 0; overflow: hidden; border: 1px solid #2b3b4b; border-radius: 8px; background: #0c151f; box-shadow: 0 18px 44px rgba(0,0,0,.5); }
.search-result { width: 100%; display: flex; justify-content: space-between; padding: 10px; border: 0; border-bottom: 1px solid #1e2b37; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover { background: #142232; }
.search-result small { color: var(--muted); }
.rail-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0 8px; padding: 3px; border-radius: 7px; background: #071019; }
.rail-tabs button { border: 0; border-radius: 5px; padding: 7px 4px; background: transparent; color: #708296; cursor: pointer; font-size: 9px; font-weight: 800; }
.rail-tabs button.active { background: #172535; color: #e0e9f0; }
.symbol-list { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 320px); overflow-y: auto; }
.symbol-row { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: center; padding: 12px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
.symbol-row:hover { background: rgba(255,255,255,.025); }
.symbol-row.active { border-color: rgba(47,129,247,.28); background: rgba(47,129,247,.1); }
.symbol-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800; }
.symbol-meta { display: block; margin-top: 4px; color: #60758a; font-size: 8px; }
.symbol-quote { text-align: right; font-variant-numeric: tabular-nums; }
.symbol-quote strong { display: block; font-size: 12px; }
.symbol-quote small { display: block; margin-top: 3px; font-size: 8px; }
.rail-note { margin-top: 14px; padding: 11px; border-left: 2px solid #2d75cc; background: rgba(47,129,247,.055); }
.rail-note strong { display: block; color: #adc4da; font-size: 9px; }
.rail-note span { display: block; margin-top: 5px; color: #657d92; font-size: 8px; line-height: 1.55; }
.market-column { min-width: 0; display: grid; grid-template-rows: 120px minmax(360px,1fr) 142px; gap: 12px; }
.quote-hero { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(160px,1fr) auto minmax(300px,1.45fr); align-items: center; gap: 18px; padding: 17px 22px; overflow: hidden; }
.quote-hero::after { content: ""; position: absolute; right: -70px; top: -90px; width: 300px; height: 260px; transform: rotate(15deg); background: rgba(47,129,247,.045); }
.symbol-title span { display: flex; align-items: center; gap: 8px; }
.symbol-title em { padding: 3px 5px; border-radius: 3px; background: rgba(47,129,247,.13); color: #5aa0ff; font-style: normal; font-size: 8px; font-weight: 900; }
.symbol-title small { color: #647b91; font-size: 9px; }
.symbol-title h1 { margin: 10px 0 0; font-size: 25px; letter-spacing: -.05em; }
.price-block { min-width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
.price-block strong { display: block; font-size: 30px; }
.price-block span { display: block; margin-top: 7px; color: var(--down); font-size: 11px; font-weight: 800; }
.metrics { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; padding-left: 18px; border-left: 1px solid #20303e; }
.metrics small { display: block; color: #57718a; font-size: 8px; }
.metrics strong { display: block; margin-top: 7px; font-size: 11px; font-variant-numeric: tabular-nums; }
.favorite-toggle { position: static; z-index: 2; margin-left: 2px; padding: 0; border: 0; background: none; color: #586a7b; cursor: pointer; font-size: 17px; line-height: 1; }
.favorite-toggle.active { color: var(--amber); }
.chart-card { min-height: 0; padding: 17px 18px 14px; display: flex; flex-direction: column; }
.intervals { display: flex; gap: 2px; padding: 3px; border-radius: 7px; background: #071019; }
.intervals button { min-width: 38px; padding: 6px 7px; border: 0; border-radius: 5px; background: transparent; color: #718599; cursor: pointer; font-size: 8px; }
.intervals button.active { background: #1c3145; color: white; }
.chart-wrap { position: relative; flex: 1; min-height: 310px; margin-top: 10px; }
#price-chart { width: 100%; height: 100%; display: block; }
.chart-loader { position: absolute; inset: 0; display: grid; place-items: center; color: #7390aa; font-size: 10px; background: rgba(8,14,21,.6); }
.chart-foot { display: flex; justify-content: space-between; margin-top: 7px; color: #607489; font-size: 8px; }
.chart-foot i { display: inline-block; width: 7px; height: 7px; margin: 0 4px 0 10px; border-radius: 2px; }
.chart-foot i:first-child { margin-left: 0; }
.legend-up { background: var(--up); }.legend-down { background: var(--down); }.legend-volume { background: #586d82; }
.mission-card { min-height: 0; padding: 14px 18px; }
.mission-label { padding: 4px 7px; border-radius: 4px; background: rgba(51,195,212,.1); color: var(--cyan); font-size: 8px; font-weight: 900; }
.mission-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 10px; }
.mission-item { min-height: 74px; padding: 11px 12px; border: 1px solid #1f3040; border-radius: 8px; background: rgba(7,14,22,.66); cursor: pointer; transition: .15s ease; }
.mission-item:hover { transform: translateY(-1px); border-color: #325a7e; background: #0d1a27; }
.mission-item small { color: #4e779e; font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.mission-item strong { display: block; margin-top: 7px; color: #dce8f2; font-size: 10px; }
.mission-item p { margin: 6px 0 0; color: #71869a; font-size: 8px; line-height: 1.5; }
.coach-panel { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; border-color: #273748; box-shadow: -8px 0 30px rgba(0,0,0,.18); }
.coach-head { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 15px; border-bottom: 1px solid #1d2a37; background: linear-gradient(135deg,rgba(47,129,247,.09),rgba(139,121,255,.04)); }
.coach-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #496fea, #8c69ea); color: white; font-size: 10px; font-weight: 950; box-shadow: 0 8px 22px rgba(103,99,235,.26); }
.coach-head h2 { margin: 0; font-size: 15px; }
.coach-head > div:nth-child(2) > span { display: block; margin-top: 4px; color: #6d8297; font-size: 8px; }
.coach-actions { display: flex; align-items: center; gap: 6px; }
.clear-chat, .chat-close { border: 1px solid #2b3c4d; border-radius: 6px; padding: 6px 8px; background: #0b151f; color: #8497a9; cursor: pointer; font-size: 9px; }
.chat-close { display: none; width: 30px; height: 30px; padding: 0; font-size: 20px; line-height: 1; }
.coach-rule { display: flex; gap: 9px; padding: 10px 15px; border-bottom: 1px solid #182531; background: rgba(139,121,255,.045); }
.coach-rule > span { flex: 0 0 auto; width: 6px; height: 6px; margin-top: 4px; border-radius: 50%; background: #8f7bff; box-shadow: 0 0 8px rgba(143,123,255,.6); }
.coach-rule p { margin: 0; color: #7a8ea2; font-size: 8px; line-height: 1.55; }
.chat-messages { flex: 1; min-height: 180px; overflow-y: auto; padding: 16px 14px; }
.message { display: flex; gap: 8px; margin-bottom: 13px; }
.message.user { justify-content: flex-end; }
.message-role { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: #243a53; color: #a9c7e4; font-size: 8px; font-weight: 900; }
.message.user .message-role { order: 2; background: #295f9f; color: white; }
.message > div { max-width: calc(100% - 34px); }
.message p { margin: 0; padding: 10px 11px; border: 1px solid #203244; border-radius: 4px 10px 10px 10px; background: #101c29; color: #d4dfe8; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user p { border-color: #285a91; border-radius: 10px 4px 10px 10px; background: #16406c; color: white; }
.message small { display: block; margin-top: 4px; color: #5c7186; font-size: 7px; }
.message.user small { text-align: right; }
.message.pending p { color: #8ea4b8; }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: #8196aa; animation: bounce 1s infinite; }.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-4px);opacity:1} }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 14px 10px; }
.prompt-chips button { padding: 7px 9px; border: 1px solid #253748; border-radius: 14px; background: #0a141f; color: #90a4b7; cursor: pointer; font-size: 9px; }
.prompt-chips button:hover { border-color: #456681; color: #c1d0dc; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin: 0 13px; padding: 8px; border: 1px solid #283a4a; border-radius: 9px; background: #070f17; }
.chat-form:focus-within { border-color: #4c62b9; box-shadow: 0 0 0 3px rgba(109,92,221,.08); }
.chat-form textarea { resize: none; min-width: 0; border: 0; outline: 0; background: transparent; color: white; font-size: 12px; line-height: 1.45; }
.chat-form textarea::placeholder { color: #4e6275; }
.chat-form button { align-self: end; display: flex; align-items: center; gap: 5px; padding: 9px 10px; border: 0; border-radius: 7px; background: linear-gradient(135deg,#3779df,#6252d3); color: white; cursor: pointer; font-size: 9px; font-weight: 900; }
.chat-form button:disabled { opacity: .45; cursor: wait; }
.chat-form svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.coach-footer { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px 12px; color: #5d7185; font-size: 7px; }
.coach-footer span { display: flex; align-items: center; gap: 5px; }
.coach-footer i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.footer { height: 29px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 14px; border-top: 1px solid #17222d; color: #52677a; font-size: 7px; letter-spacing: .05em; }
.footer a { justify-self: end; color: #728ca3; text-decoration: none; }
.chat-toggle, .chat-backdrop { display: none; }
@media (max-width: 1250px) {
  .workspace { grid-template-columns: 190px minmax(420px,1fr) 310px; gap: 8px; padding: 8px; }
  .left-rail { padding: 14px 9px; }
  .rail-note { display: none; }
  .quote-hero { grid-template-columns: minmax(130px,1fr) auto; gap: 12px; }
  .price-block { padding-right: 0; }
  .metrics { grid-column: 1 / -1; grid-template-columns: repeat(5,minmax(0,1fr)); padding: 10px 0 0; border-left: 0; border-top: 1px solid #20303e; }
  .market-column { grid-template-rows: 154px minmax(340px,1fr) 142px; gap: 8px; }
  .mission-grid { gap: 6px; }
  .mission-item { padding: 10px; }
}
@media (min-width: 821px) and (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0,1fr) 300px; grid-template-rows: auto 1fr; }
  .left-rail { grid-column: 1; grid-row: 1; }
  .market-column { grid-column: 1; grid-row: 2; }
  .coach-panel { grid-column: 2; grid-row: 1 / span 2; }
  .symbol-list { max-height: 132px; }
}
@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .topbar { height: auto; grid-template-columns: 1fr auto; gap: 10px; padding: 11px 14px; }
  .market-clock { display: none; }.top-status span:nth-child(2){display:none}.ai-pill{display:none}
  .ticker { padding: 0 14px; }
  .app-shell, .workspace { min-width: 0; }
  .workspace { width: 100vw; max-width: 100vw; min-height: 0; grid-template-columns: minmax(0,1fr); padding: 8px; }
  .left-rail, .market-column { width: calc(100vw - 16px); max-width: calc(100vw - 16px); min-width: 0; grid-column: auto; grid-row: auto; }
  .symbol-list { max-height: 270px; }
  .quote-hero { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 17px; }
  .symbol-title, .price-block { min-width: 0; }
  .symbol-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .metrics { grid-column: 1 / -1; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 13px 0 0; border-left: 0; border-top: 1px solid #20303e; }
  .metrics strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .price-block strong { font-size: 23px; }
  .price-block { padding-right: 0; }
  .mission-grid { grid-template-columns: 1fr; }
  .chart-wrap { min-height: 300px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .market-column { grid-template-rows: auto minmax(420px,1fr) auto; }
  .coach-panel { position: fixed; z-index: 60; top: 0; right: 0; width: min(92vw,390px); max-width: 390px; height: 100dvh; border-radius: 12px 0 0 12px; transform: translateX(105%); transition: transform .22s ease; }
  .coach-panel.open { transform: translateX(0); }
  .chat-close { display: inline-grid; place-items: center; }
  .chat-toggle { position: fixed; z-index: 45; right: 16px; bottom: 18px; display: flex; align-items: center; gap: 8px; padding: 11px 14px; border: 1px solid rgba(126,113,255,.5); border-radius: 22px; background: linear-gradient(135deg,#286cd5,#6b54d9); color: white; box-shadow: 0 12px 34px rgba(31,73,170,.45); font-size: 12px; font-weight: 900; }
  .chat-toggle span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.15); font-size: 9px; }
  .chat-backdrop { position: fixed; z-index: 55; inset: 0; border: 0; background: rgba(1,5,10,.68); backdrop-filter: blur(3px); }
  .chat-backdrop.open { display: block; }
  body.chat-open { overflow: hidden; }
  .footer { grid-template-columns: 1fr auto; }.footer span:nth-child(2){display:none}
}
