:root {
  --bg: #F6FAF8;
  --bg-elev: #FFFFFF;
  --bg-elev-2: #EEF5F2;
  --text: #0B1210;
  --text-dim: #5B6B66;
  --mint: #2ECC9A;
  --mint-strong: #0F9E76;
  --mint-tint: #E4FBF3;
  --user-bubble: #E4FBF3;
  --border: #E1EAE6;
  --danger: #E5484D;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15,23,42,.05);
  --maxw: 720px;
  --sidebar-w: 280px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--mint); color: #06110d; padding: 8px 14px; border-radius: 10px; z-index: 999; }

#shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar: solution tree + recent chats ---------- */
#sidebar-scrim { display: none; }
#sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.brand-mark { border-radius: 50%; flex: none; }
.wordmark { font-weight: 600; font-size: 1.05rem; letter-spacing: .2px; }
.wordmark b { font-weight: 800; color: var(--mint-strong); }
.mobile-only.icon-btn, .mobile-only { display: none; }

.icon-btn {
  background: none; border: none; color: var(--text);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-elev-2); }

.sidebar-primary-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--mint-tint); color: var(--mint-strong); border: 1px solid var(--mint);
  font-weight: 700; font-size: .88rem;
  padding: 10px 14px; border-radius: 12px; cursor: pointer; margin: 6px 2px 12px;
}
.sidebar-primary-btn:hover { background: var(--mint); color: #06120d; }

.sidebar-section-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-dim); padding: 10px 6px 6px;
}
.solution-tree { display: flex; flex-direction: column; gap: 2px; }
.tree-group { border-radius: 10px; }
.tree-group summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 6px; border-radius: 10px; font-size: .86rem; font-weight: 700; color: var(--text);
}
.tree-group summary::-webkit-details-marker { display: none; }
.tree-group summary:hover { background: var(--bg-elev-2); }
.tree-group summary::after { content: '›'; transform: rotate(90deg); transition: transform .15s; color: var(--text-dim); }
.tree-group[open] summary::after { transform: rotate(-90deg); }
.tree-count { font-weight: 500; color: var(--text-dim); font-size: .74rem; margin-left: auto; margin-right: 6px; }
.tree-group ul { list-style: none; margin: 2px 0 6px; padding: 0 0 0 10px; display: flex; flex-direction: column; gap: 1px; }
.tree-leaf {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  background: none; border: none; color: var(--text-dim); font-size: .84rem;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
.tree-leaf:hover { background: var(--bg-elev-2); color: var(--text); }
.tree-leaf.active { background: var(--mint-tint); color: var(--mint-strong); font-weight: 700; }
.tree-leaf .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--mint); }
.tree-leaf .dot.academy { background: #8B5CF6; }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history-list li button {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 8px 8px; border-radius: 8px; cursor: pointer; font-size: .84rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-list li button:hover { background: var(--bg-elev-2); }
.drawer-empty { color: var(--text-dim); font-size: .8rem; padding: 2px 8px; }

/* ---------- Main column ---------- */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246,250,248,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
}
#switchback { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
#switchback[hidden] { display: none; }
.switchback-back {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
  font-weight: 700; font-size: .82rem; padding: 7px 12px; border-radius: 999px; cursor: pointer; flex: none;
}
.switchback-back:hover { border-color: var(--mint); color: var(--mint-strong); }
#switchback-title { font-size: .88rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#switchback[hidden] ~ .topbar-actions #switchback-open { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pill-btn {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font-weight: 700; font-size: .82rem; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
}
.pill-btn:hover { border-color: var(--mint); color: var(--mint-strong); }
.account-btn {
  background: var(--mint); color: #06120d; border: none;
  font-weight: 700; font-size: .88rem;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.account-btn.signed-in { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); }
.lang-select {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font-weight: 700; font-size: .82rem; padding: 8px 10px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; line-height: 1;
  /* 기본 폭이 가장 긴 옵션(ZH-TW)을 다 못 담아 글자가 잘렸다. 네이티브
     select는 화살표 자리를 따로 잡으므로 오른쪽 패딩과 최소 폭을 준다. */
  min-width: 5.5rem; padding-right: 8px; box-sizing: border-box;
}

#main { min-height: calc(100vh - 60px); }

.landing { max-width: var(--maxw); margin: 0 auto; padding: 40px 18px 60px; }
.hero { text-align: center; padding: 12px 0 8px; }
.hero-mascot { display: block; margin: 0 auto 16px; filter: drop-shadow(0 8px 20px rgba(46,204,154,.35)); }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.22; margin: 0 0 14px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--mint-strong); }
.hero .lead { color: var(--text-dim); font-size: 1rem; max-width: 580px; margin: 0 auto; line-height: 1.6; }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 26px; padding: 10px 10px 10px 18px; box-shadow: var(--shadow);
}
.composer textarea {
  flex: 1; resize: none; background: none; border: none; outline: none;
  color: var(--text); font-size: 1rem; font-family: inherit; line-height: 1.4;
  max-height: 160px; padding: 6px 0;
}
.composer textarea::placeholder { color: var(--text-dim); }
.send-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--mint); color: #06120d; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:disabled { opacity: .4; cursor: default; }
.composer-landing { margin: 28px auto 0; max-width: 640px; }

.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 16px auto 0; max-width: 640px;
}
.chip {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font-size: .84rem; padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--mint); color: var(--mint-strong); }

.showcase-sub { color: var(--text-dim); margin: 0 0 20px; font-size: .92rem; }

/* ---------- Landing: example conversation demo ---------- */
.live-demo { margin: 40px auto 0; max-width: 420px; }
.live-demo-label {
  text-align: center; color: var(--text-dim); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px;
}
.live-demo-phone {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 28px;
  box-shadow: var(--shadow); padding: 18px 14px 20px; min-height: 260px;
}
.live-demo-thread { display: flex; flex-direction: column; gap: 10px; }
.demo-bubble {
  max-width: 84%; padding: 10px 14px; border-radius: 16px; font-size: .88rem; line-height: 1.45;
  opacity: 0; transform: translateY(8px); animation: demoBubbleIn .35s ease forwards;
}
.demo-bubble.user {
  align-self: flex-end; background: var(--user-bubble); color: var(--text);
  border-bottom-right-radius: 4px;
}
.demo-bubble.assistant {
  align-self: flex-start; background: var(--bg-elev-2); color: var(--text);
  border-bottom-left-radius: 4px;
}
.demo-bubble.card {
  align-self: flex-start; background: #fff; border: 1px solid var(--border);
  border-bottom-left-radius: 4px; font-size: .82rem;
}
.demo-bubble.card ul { margin: 6px 0 0; padding-left: 18px; }
.demo-bubble.card li { margin: 2px 0; }
.demo-typing {
  align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px;
  background: var(--bg-elev-2); border-radius: 16px; border-bottom-left-radius: 4px;
  opacity: 0; transform: translateY(8px); animation: demoBubbleIn .35s ease forwards;
}
.demo-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
  animation: demoTypingDot 1s ease-in-out infinite;
}
.demo-typing span:nth-child(2) { animation-delay: .15s; }
.demo-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes demoBubbleIn { to { opacity: 1; transform: translateY(0); } }
@keyframes demoTypingDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .demo-bubble, .demo-typing { animation: none; opacity: 1; transform: none; }
}

.plans-teaser { margin-top: 48px; text-align: center; }
.plans-teaser h2 { font-size: 1.3rem; margin: 0 0 4px; }
.plans-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-top: 20px;
}
.plan-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 20px 14px; box-shadow: var(--shadow); }
.plan-card.featured { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint) inset, var(--shadow); }
.plan-card h3 { margin: 0 0 6px; font-size: .9rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.plan-card .price { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.plan-card .price span { font-size: .74rem; font-weight: 500; color: var(--text-dim); }
.plan-card p.note { color: var(--text-dim); font-size: .78rem; margin: 0 0 12px; }
.plan-choose-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%;
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 0; font-weight: 700; font-size: .8rem; text-decoration: none;
}
.plan-choose-btn:hover { border-color: var(--mint); color: var(--mint-strong); }
.plan-card.featured .plan-choose-btn { background: var(--mint); color: #06120d; border-color: var(--mint); }

.compare-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin: 18px auto 0;
  background: none; border: none; color: var(--mint-strong); font-weight: 700;
  font-size: .84rem; cursor: pointer; padding: 6px 10px;
}
.compare-toggle:hover { text-decoration: underline; }
.compare-chevron { transition: transform .18s ease; }
.compare-toggle[aria-expanded="true"] .compare-chevron { transform: rotate(180deg); }
.compare-table-wrap { margin: 14px auto 0; max-width: 640px; overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: .8rem; }
.compare-table th, .compare-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.compare-table th { color: var(--text-dim); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .3px; }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child, .compare-table th:first-child { white-space: normal; color: var(--text-dim); }

.soveai-footer { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 30px 0 6px; opacity: .75; font-size: .82rem; }
.soveai-footer img { border-radius: 5px; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 60px); max-width: var(--maxw); margin: 0 auto; width: 100%; }
.chat[hidden] { display: none; }
#thread { flex: 1; overflow-y: auto; padding: 20px 16px 10px; }
.msg { display: flex; gap: 10px; margin-bottom: 20px; max-width: 100%; }
.msg .avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; margin-top: 2px; background: radial-gradient(circle at 30% 30%, #B9FFE8, var(--mint) 60%, #0d8a6c 100%); }
.msg .bubble { line-height: 1.55; font-size: .97rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg.user .bubble { background: var(--user-bubble); padding: 10px 14px; border-radius: 16px; }
.msg .route-tag { display: block; margin-top: 6px; font-size: .72rem; color: var(--text-dim); }

/* Sovasta 모드 (Addendum A·B).
 *
 * 색을 쓰지 않고 테두리와 글자 굵기로만 고른 것을 나타낸다. 모드는 네 개가
 * 나란히 있고, 그중 하나를 색으로 강조하면 그 색이 "상태가 좋다/나쁘다" 처럼
 * 읽힌다 — 모드는 좋고 나쁜 것이 아니라 고르는 것이다.
 *
 * 대비는 본문 글자색(--text)을 그대로 쓴다. 브랜드 민트를 작은 글자에 쓰면
 * 흰 배경에서 4.5:1 을 넘지 못한다 — F-platform-007 에서 13개 사이트가 바로
 * 그 이유로 떨어졌다. 같은 실수를 새 UI 에서 되풀이하지 않는다. */
.mode-bar { display: flex; gap: 6px; padding: 0 2px 8px; flex-wrap: wrap; }
.mode-btn {
  font: inherit; font-size: .78rem; line-height: 1;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-dim); cursor: pointer;
}
.mode-btn:hover { border-color: var(--mint-strong); }
.mode-btn.active { border-color: var(--text); color: var(--text); font-weight: 700; }
/* 키보드로 고르는 사람에게 지금 어디인지 보여야 한다. */
.mode-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* 답변에 붙는 "Sovasta · Code" 배지. 서버가 알려 준 **실제로 돈 모드**다. */
.msg .route-mode {
  display: inline-block; margin-top: 6px; margin-right: 8px;
  font-size: .72rem; font-weight: 700; color: var(--text);
}
.msg .route-tag a { color: var(--mint-strong); text-decoration: none; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

.composer-dock { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.disclaimer { text-align: center; color: var(--text-dim); font-size: .72rem; margin: 8px 0 0; }
.link-btn { background: none; border: none; color: var(--mint-strong); font-size: .72rem; padding: 0; cursor: pointer; text-decoration: underline; }

/* ---------- Solution view (right-pane live embed of a Sovasta site) ---------- */
.solution-view { height: calc(100vh - 60px); display: flex; flex-direction: column; position: relative; }
.solution-view[hidden] { display: none; }
.solution-frame-fallback {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; box-shadow: var(--shadow); font-size: .84rem;
}
.solution-frame-fallback[hidden] { display: none; }
.solution-frame-fallback a { color: var(--mint-strong); font-weight: 700; }
#solution-frame { flex: 1; width: 100%; border: none; background: #fff; }

#notice {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: .85rem; z-index: 60; display: none; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
#notice.show { display: block; }

dialog#modal { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 380px; width: calc(100vw - 40px); }
dialog#modal::backdrop { background: rgba(15,23,42,.35); }
dialog#modal h2 { margin-top: 0; }
dialog#modal h3 { font-size: .9rem; margin: 16px 0 6px; }
dialog#modal .note { color: var(--text-dim); font-size: .88rem; }
dialog#modal .button { display: inline-block; background: var(--mint); color: #06120d; font-weight: 700; padding: 10px 18px; border-radius: 999px; text-decoration: none; margin-top: 10px; border: none; cursor: pointer; }
dialog#modal .row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
dialog#modal .row .icon-btn { width: auto; height: auto; border-radius: 999px; padding: 8px 14px; white-space: nowrap; }
dialog#modal input { width: 100%; margin: 4px 0 10px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
dialog#modal label { font-size: .82rem; color: var(--text-dim); }
.memory-list { padding-left: 18px; margin: 4px 0 10px; font-size: .86rem; }

/* ---------- Download apps modal ---------- */
.dl-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.dl-tab { flex: 1; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-dim); font-weight: 700; font-size: .84rem; padding: 8px; border-radius: 10px; cursor: pointer; }
.dl-tab.active { background: var(--mint); color: #06120d; border-color: var(--mint); }
.dl-panel[hidden] { display: none; }
.dl-qr { display: block; margin: 6px auto 10px; border-radius: 10px; border: 1px solid var(--border); }
.dl-fallback { font-size: .8rem; color: var(--text-dim); margin-top: 8px; }

/* ------------------------------------------------------------ area nav */
/* Desktop gets a segmented control in the topbar; the phone gets the bottom
   bar instead, so exactly one of the two is visible at any width. */
.area-nav { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); }
.area-btn {
  border: 0; background: none; color: var(--text-dim); cursor: pointer;
  font: inherit; font-weight: 700; font-size: .86rem; padding: 7px 14px; border-radius: 999px;
}
.area-btn:hover { color: var(--text); }
.area-btn.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ------------------------------------------------------------ developers */
.dev-view { padding: 28px 22px 64px; max-width: 980px; margin: 0 auto; width: 100%; overflow-y: auto; }
.dev-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.03em; margin: 0 0 10px; }
.dev-counts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.dev-count {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  font-size: .8rem; color: var(--text-dim);
}
.dev-count b { font-size: 1.1rem; color: var(--text); }
.dev-tabs { display: flex; gap: 4px; margin-top: 26px; border-bottom: 1px solid var(--border); }
.dev-tab {
  border: 0; background: none; cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem;
  color: var(--text-dim); padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.dev-tab:hover { color: var(--text); }
.dev-tab.active { color: var(--text); border-bottom-color: currentColor; }
.dev-grid { display: grid; gap: 16px; margin-top: 18px; }
/* An author `display: grid` beats the UA's `[hidden] { display: none }`, so the
   inactive panes would stay on screen without this. */
.dev-grid[hidden] { display: none; }

.tier-rows { display: grid; gap: 8px; margin-top: 12px; }
.tier-row { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--text-dim); }
.tier-row b { font-size: 1rem; color: var(--text); min-width: 2.4ch; text-align: right; }
.dev-pill.tier-green { background: #DCFCE7; color: #166534; }
.dev-pill.tier-amber { background: #FEF3C7; color: #92400E; }
.dev-pill.tier-red { background: #FEE2E2; color: #991B1B; }

/* ----------------------------------------------------------- attachments */
.attach-bar { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 10px; margin-bottom: 8px; }
.attach-chips { display: grid; gap: 7px; }
.attach-chip { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; }
.attach-chip.inert { opacity: .72; }
.attach-chip img { width: 30px; height: 30px; object-fit: cover; border-radius: 7px; flex: none; }
.attach-kind { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--border); font-size: .58rem; font-weight: 800; text-transform: uppercase; flex: none; }
.attach-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attach-meta b { font-size: .84rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-meta small { font-size: .72rem; color: var(--text-dim); }
.attach-x { border: 0; background: none; cursor: pointer; color: var(--text-dim); font-size: 1.15rem; line-height: 1; padding: 2px 5px; border-radius: 6px; flex: none; }
.attach-x:hover { color: var(--text); background: var(--card); }
.attach-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 9px; font-size: .76rem; }
.attach-tokens { color: var(--text-dim); font-weight: 700; }
.attach-pii { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.attach-pii.on { background: #ECFDF5; color: #166534; }
.attach-pii.off { background: #FEF3C7; color: #92400E; }
.attach-btn { border: 0; background: none; cursor: pointer; color: var(--text-dim); padding: 6px; border-radius: 9px; flex: none; align-self: flex-end; }
.attach-btn:hover { color: var(--text); background: var(--card); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: .74rem; color: var(--text-dim); }

.dropzone { position: fixed; inset: 0; z-index: 130; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 24px; }
.dropzone-card { background: var(--card); border: 2px dashed var(--mint, #2ECC9A); border-radius: 18px; padding: 34px 40px; text-align: center; display: grid; gap: 7px; max-width: 420px; }
.dropzone-card strong { font-size: 1.1rem; }
.dropzone-card span { color: var(--text-dim); font-size: .86rem; }

/* ------------------------------------------------------- command palette */

/* 작성자 스타일의 display는 브라우저 기본 [hidden]{display:none}을 이긴다.
   이 줄이 없으면 hidden을 붙여도 오버레이가 화면에 그대로 떠 있다 — 실제로
   팔레트와 드롭존이 동시에 겹쳐 보이는 사고가 났다.
   scripts/check-hidden.mjs 가 이 규칙이 빠지지 않았는지 검사한다. */
.palette[hidden], .dropzone[hidden], .attach-bar[hidden], .agent-panel[hidden] { display: none !important; }
.palette { position: fixed; inset: 0; z-index: 120; background: rgba(15,23,42,.42); display: grid; place-items: start center; padding: 12vh 16px 16px; }
.palette-box { width: min(560px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 70px rgba(15,23,42,.28); overflow: hidden; }
#palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: 1rem; padding: 15px 18px; outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 46vh; overflow-y: auto; }
.palette-list button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 0; background: none; cursor: pointer; font: inherit; text-align: left;
  padding: 10px 12px; border-radius: 9px; color: var(--text);
}
.palette-list button.on, .palette-list button:hover { background: var(--bg); }
.palette-list small { color: var(--text-dim); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; flex: none; }
.palette-empty { padding: 16px 14px; color: var(--text-dim); font-size: .88rem; }
.palette-foot { margin: 0; padding: 9px 14px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .74rem; }
.palette-foot kbd { font-family: inherit; border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; margin-right: 3px; }

.eco-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.eco-item { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; background: var(--bg); }
.eco-item p { margin: 6px 0 0; font-size: .86rem; color: var(--text-dim); }
.eco-name { font-weight: 800; font-size: .94rem; margin-right: 8px; }
.eco-name:hover { text-decoration: underline; }
.dev-pill.eco-protocol { background: #E0E7FF; color: #3730A3; }
.dev-pill.eco-registry { background: #FEF3C7; color: #92400E; }
.dev-pill.eco-skills { background: #EDE9FE; color: #5B21B6; }
.dev-pill.eco-runtime { background: #DCFCE7; color: #166534; }
.dev-pill.eco-infra { background: #F1F5F9; color: #475569; }
.dev-card { border: 1px solid var(--border); border-radius: 16px; background: var(--card); padding: 20px; }
.dev-card h2 { font-size: 1.1rem; margin: 0 0 12px; letter-spacing: -.02em; }
.dev-note { color: var(--text-dim); font-size: .86rem; margin: 6px 0; }
.dev-dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 0; align-items: baseline; }
.dev-dl dt { font-weight: 700; font-size: .82rem; color: var(--text-dim); }
.dev-dl dd { margin: 0; min-width: 0; }
.dev-view code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.dev-url { word-break: break-all; }
.dev-scopes { display: flex; flex-wrap: wrap; gap: 4px; }
.dev-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: .85rem; font-weight: 700; }
.dev-tools-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.dev-tool-name { font-weight: 700; }
.dev-h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin: 18px 0 8px; }
.dev-flow { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.dev-flow li { font-size: .8rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.dev-notes { margin: 0; padding-left: 18px; }
.dev-notes li { color: var(--text-dim); font-size: .85rem; margin: 6px 0; }
.dev-pre { background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 13px; overflow-x: auto; margin: 8px 0 0; }
.dev-pre code { background: none; border: 0; padding: 0; white-space: pre; }
.dev-reg-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 14px; }
.dev-search { flex: 1; min-width: 180px; padding: 9px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .86rem; }
.dev-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text-dim); font-weight: 700; }
.dev-registry { display: grid; gap: 8px; }
.dev-sol { border: 1px solid var(--border); border-radius: 11px; background: var(--bg); padding: 10px 14px; }
.dev-sol summary { cursor: pointer; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-weight: 700; font-size: .9rem; }
.dev-sol-count { margin-left: auto; font-size: .78rem; color: var(--text-dim); font-weight: 600; }
.dev-pill { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 999px; }
.dev-pill.ok { background: #DCFCE7; color: #166534; }
.dev-pill.off { background: #F1F5F9; color: #64748B; }
.dev-pill.warn { background: #FEF3C7; color: #92400E; }
.dev-actions { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .8rem; }
.dev-actions th { text-align: left; color: var(--text-dim); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.dev-actions td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dev-actions tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------ bottom nav */
.bottom-nav { display: none; }

@media (min-width: 901px) {
  .dev-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  #sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.25);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.4);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  #sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .mobile-only.icon-btn, .mobile-only { display: flex; }
  .wordmark { font-size: .98rem; }
  .composer-landing { margin-top: 20px; }
  .plans-grid { grid-template-columns: 1fr 1fr; }
  .pill-btn span.pill-label-long { display: none; }

  /* The segmented control gives way to the bottom bar on a phone. */
  .area-nav { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn-btn {
    border: 0; background: none; cursor: pointer; font: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 7px; color: var(--text-dim); font-size: .68rem; font-weight: 700;
  }
  .bn-btn.active { color: var(--accent, var(--text)); }
  /* Keep the composer and the scrolling panes clear of the bar.
     64px is its height before the safe-area inset. */
  body:not(.embed-mode) .chat .composer-dock,
  body:not(.embed-mode) .dev-view,
  body:not(.embed-mode) .landing { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .dev-view { padding-left: 16px; padding-right: 16px; }
  .dev-dl { grid-template-columns: 1fr; gap: 3px 0; }
  .dev-dl dt { margin-top: 8px; }
  .dev-actions { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Embed mode: rendered inside the floating widget iframe on Hub and other
   Sovasta solution sites. Same app, same backend — just chat-only chrome. */
body.embed-mode { background: var(--bg); }
body.embed-mode #sidebar,
body.embed-mode #sidebar-scrim,
body.embed-mode #menu-btn,
body.embed-mode #download-btn,
body.embed-mode .skip-link,
body.embed-mode .area-nav,
body.embed-mode .bottom-nav,
body.embed-mode .live-demo { display: none !important; }
body.embed-mode #shell { display: block; }
body.embed-mode #main { min-height: 100vh; }
body.embed-mode .chat { height: 100vh; }
body.embed-mode #topbar { position: sticky; }
.embed-expand-btn { display: none; }
body.embed-mode .embed-expand-btn { display: inline-flex; }

/* --------------------------------------------------------- execution profiles */
.exec-grid { display: grid; gap: 10px; margin-top: 10px; }
.exec-card { border: 1px solid var(--border); border-radius: 11px; padding: 13px 14px; background: var(--bg); }
.exec-card.off { opacity: .78; }
.exec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.exec-head b { font-size: .98rem; }
@media (min-width: 720px) { .exec-grid { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------- agent panel */
/* 솔루션 iframe 위에 겹쳐 띄운다. iframe이 전체 높이를 쓰므로 자리를
   비집고 들어가는 대신 떠 있는 패널로 둔다. */
.agent-panel {
  position: absolute; right: 14px; top: 14px; z-index: 5;
  width: min(390px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15,23,42,.14); padding: 14px;
}
.solution-view { position: relative; }
.ag-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ag-top strong { font-size: .9rem; flex: 1; }
.ag-close { border: 0; background: none; cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--text-dim); padding: 0 4px; }
.ag-close:hover { color: var(--text); }
.ag-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; counter-reset: ag; }
.ag-step { border: 1px solid var(--border); border-radius: 11px; padding: 10px 11px; background: var(--bg); }
.ag-step.info { opacity: .8; }
.ag-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-head b { font-size: .85rem; }
.ag-head code { font-size: .7rem; background: var(--bg-elev-2); border-radius: 5px; padding: 1px 5px; }
.ag-why { margin: 6px 0 0; font-size: .76rem; color: var(--text-dim); }
.ag-status { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-left: auto; }
.ag-status.run { color: #92400E; }
.ag-status.wait { color: #92400E; }
.ag-status.ok { color: #166534; }
.ag-status.fail { color: #991B1B; }
.ag-btn {
  margin-top: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  font: inherit; font-size: .76rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.ag-btn:hover { border-color: var(--mint); color: var(--mint-strong); }
.ag-btn.primary { background: var(--mint); border-color: var(--mint); color: #06120d; }
.ag-approve { margin-top: 9px; padding: 9px 10px; border-radius: 9px; background: #FFFBEB; border: 1px solid #FDE68A; }
.ag-approve p { margin: 0; font-size: .78rem; color: #92400E; }
.ag-approve-row { display: flex; gap: 7px; }
.ag-out { margin: 8px 0 0; padding: 8px; border-radius: 8px; background: var(--bg-elev-2); font-size: .7rem; overflow-x: auto; max-height: 140px; }
.ag-err { margin: 8px 0 0; font-size: .76rem; color: #991B1B; }
@media (max-width: 900px) {
  .agent-panel { position: static; width: auto; max-height: none; margin: 10px; }
}

/* 메모리 인스펙터: 솔루션별 삭제 버튼 */
.memory-list li { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.mem-forget-one {
  flex: none; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-dim);
  font: inherit; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer;
}
.mem-forget-one:hover { border-color: var(--danger); color: var(--danger); }
.mem-forget-one:disabled { opacity: .5; cursor: default; }

/* sove-qa: mobile overflow fix (F-platform-003) — 기존 규칙을 덮지 않고 좁게 겹쳐 쓴다.
   왜: 390px 폭에서 가로 스크롤이 생겨 오른쪽 글자가 잘렸다. 측정한 범인은
   (1) .navActions 가 줄바꿈하지 않는 것, (2) 히어로 글자가 컨테이너를 넘는 것.
   overflow-x:hidden 으로 가리지 않는다 — 잘린 글자는 그대로 잘린다. */
@media (max-width: 620px) {
  /* 버튼이 한 줄에 안 들어가면 다음 줄로 내려간다 */
  .navActions { flex-wrap: wrap; row-gap: 6px; justify-content: flex-end; }

  /* 긴 낱말과 자간이 겹쳐 폭을 넘기는 것을 막는다.
     낱말 중간을 끊지 않도록 break-word 를 쓴다 — break-all 은 읽기 어려워진다. */
  .eyebrow, .lead, h1, h2 { max-width: 100%; overflow-wrap: break-word; }

  /* 자간이 큰 라벨은 마지막 글자 뒤 여백이 그대로 폭에 더해진다 */
  .eyebrow { letter-spacing: .22em; }

  /* 탭 띠는 **자기 안에서** 가로로 스크롤한다.
     측정해 보니 .mobileBar 는 폭이 366px 로 멀쩡한데 그 안의 탭이 521px 까지
     뻗어 문서 전체를 밀고 있었다. 탭을 줄이거나 숨기는 대신 띠 안에서 밀리게
     한다 — 탭 바의 표준 동작이고, 항목이 사라지지 않는다.
     스크롤 막대는 숨긴다: 모바일에서는 손가락으로 미는 것이 자연스럽다. */
  .mobileBar, .tabs, .tabbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobileBar::-webkit-scrollbar, .tabs::-webkit-scrollbar, .tabbar::-webkit-scrollbar { display: none; }

  /* 상단 우측 영역은 스크롤보다 줄바꿈이 낫다 — 로그인 버튼이 숨으면 안 된다 */
  .topbar-right, .navRight, .headerRight { flex-wrap: wrap; row-gap: 6px; justify-content: flex-end; }

  /* 그리드·플렉스 항목의 기본 min-width:auto 를 푼다.
     이것이 agora/vcf/shield 의 진짜 원인이었다. .hero 는 모바일에서
     grid-template-columns:1fr 로 바뀌는데, 항목의 최소 폭이 '내용의 최소 폭'
     이라서 안의 버튼 줄이 열을 뷰포트 폭까지 밀어 올렸다 — 부모가 16px 패딩
     안에 있는데도 390px 를 차지해 오른쪽으로 16px 삐져나갔다.
     min-width:0 은 이 상황의 표준 해법이고, 내용을 자르지 않는다. */
  .hero > *, .workspace > *, .grid > * { min-width: 0; }

  /* 버튼 줄도 접히게 한다. 접히지 않으면 위의 min-width:0 이 글자를 짓눌러
     가로 스크롤 대신 레이아웃이 깨진 것처럼 보인다. */
  .actions { flex-wrap: wrap; row-gap: 8px; }
}

/* BYOK 연결 흐름 — 공급자별 안내. 경고는 눈에 띄어야 하지만 비명을 지르면
   안 읽힌다. 테두리 한 줄로 구분하고 색으로 종류를 가른다. */
.byok-row { margin: 14px 0 18px; }
.byok-row label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.byok-badge { font: 800 .68rem ui-monospace, monospace; border-radius: 999px; padding: 2px 8px; }
.byok-badge.free { background: #0f3d2e; color: #7df0c8; }
.byok-badge.paid { background: #2a2f33; color: #b9c2c9; }
.byok-where { margin: 4px 0 6px; font-size: .86rem; }
.byok-warn { margin: 6px 0 8px; padding: 8px 10px; border-left: 3px solid #d9a441;
  background: rgba(217,164,65,.10); border-radius: 0 8px 8px 0; font-size: .84rem; line-height: 1.45; }
.byok-warn.unverified { border-left-color: #7a8691; background: rgba(122,134,145,.10); }
.byok-footnote { font-size: .78rem; opacity: .75; }

/* Sovasta Compass 드리프트 배지 (연동 A4)
 *
 * 색만으로 뜻을 전하지 않는다 — 글자가 함께 간다 ("요청대로 0.21"). 색이
 * 유일한 신호면 색을 구별하지 못하는 사람에게는 아무 뜻이 없다 (WCAG 1.4.1).
 *
 * 네 색 모두 페이지 배경 대비 6:1 이상이다. --mint-strong(3.4:1)과
 * --danger(3.9:1)를 그냥 쓰지 않은 이유가 그것이다. */
.msg .route-drift {
  display: inline-block; margin-top: 6px; margin-right: 8px;
  font-size: .72rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid currentColor; background: transparent;
  cursor: help;
}
.msg .route-drift.ok      { color: #0A6B50; }
.msg .route-drift.warn    { color: #8A5200; }
.msg .route-drift.bad     { color: #B3261E; }
.msg .route-drift.unknown { color: #4A5A55; border-style: dashed; }
