/* pitch AI — chat + gateway management.
   Two voices in the type: Pretendard for people, JetBrains Mono for the machine
   (model ids, keys, numbers). One accent ("signal") marks where a request
   actually landed; the route rails reuse it everywhere. */

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/pretendard.woff2') format('woff2-variations'), url('/fonts/pretendard.woff2') format('woff2');
  font-weight: 45 920;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2-variations'), url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --sidebar: #eceef2;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --sunken: #eef0f4;
  --line: #e2e5ea;
  --line-strong: #cbd0d8;
  --ink: #12151a;
  --ink-2: #545b67;
  --muted: #8a909b;
  --signal: #3d5afe;
  --signal-ink: #ffffff;
  --signal-soft: #e9edff;
  --bubble: #e9edff;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --danger-ink: #b42323;
  --off: #a6abb4;
  --shadow: 0 1px 2px rgba(18, 21, 26, 0.04), 0 8px 24px rgba(18, 21, 26, 0.06);
  --font: 'Pretendard', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  --r-sm: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0f12; --sidebar: #111418; --panel: #15181d; --panel-2: #1a1e24; --sunken: #101317;
    --line: #242930; --line-strong: #353c46; --ink: #eef1f5; --ink-2: #aab1bc; --muted: #727a86;
    --signal: #7d8cff; --signal-ink: #0d0f12; --signal-soft: #1c2240; --bubble: #1e2442;
    --signal-btn: #4c5ce6; --signal-btn-ink: #ffffff;
    --danger-ink: #f08a8a; --off: #5b626c; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f12; --sidebar: #111418; --panel: #15181d; --panel-2: #1a1e24; --sunken: #101317;
  --line: #242930; --line-strong: #353c46; --ink: #eef1f5; --ink-2: #aab1bc; --muted: #727a86;
  --signal: #7d8cff; --signal-ink: #0d0f12; --signal-soft: #1c2240; --bubble: #1e2442;
  --signal-btn: #4c5ce6; --signal-btn-ink: #ffffff;
  --danger-ink: #f08a8a; --off: #5b626c; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, a, label, summary { touch-action: manipulation; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  word-break: keep-all; /* Korean wraps between words, not inside them */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- controls */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: 600 14px/1 var(--font);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn .ic { width: 16px; height: 16px; }
.btn.lg { font-size: 15.5px; padding: 13px 22px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
/* buttons get their own (deeper) accent in dark mode so white text stays readable */
.btn.primary { background: var(--signal-btn, var(--signal)); border-color: var(--signal-btn, var(--signal)); color: var(--signal-btn-ink, var(--signal-ink)); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { color: var(--danger-ink); }
.btn.small { font-size: 13px; padding: 6px 10px; }
.btn.tiny { font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.btn.block { width: 100%; }
.icon-btn {
  flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0;
  font-size: 18px; color: var(--ink-2); background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  font: 14px/1.4 var(--font);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  min-width: 0;
}
textarea { resize: vertical; }
textarea.code, input.code { font-family: var(--mono); font-size: 12.5px; }
input.invalid { border-color: var(--critical); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.trust-row { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.grow { flex: 1 1 220px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.form-error { font-size: 13px; color: var(--danger-ink); margin: 0; }

/* ---------- login */
.login { position: relative; min-height: 100%; display: grid; place-items: center; padding: 64px 16px 32px; background: radial-gradient(1200px 500px at 50% -10%, var(--signal-soft), transparent 70%), var(--bg); }
.login-back { position: absolute; top: 18px; left: 18px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.login-back:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.login-back .ic { width: 16px; height: 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px 28px; box-shadow: 0 1px 2px rgba(18, 21, 26, .04), 0 24px 60px rgba(18, 21, 26, .10); }
.login-card input[type=email], .login-card input[type=password], .login-card input[type=text] { width: 100%; font-size: 15px; padding: 12px 14px; border-radius: 10px; }
.login-card input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.login-card .btn.primary { padding: 12px 14px; border-radius: 10px; font-size: 15px; }
.login-sub { margin: -6px 0 6px; color: var(--ink-2); font-size: 14px; }
.agree { font-size: 13px; color: var(--ink-2); align-items: flex-start; line-height: 1.5; }
.agree input { margin: 2px 0 0; accent-color: var(--signal); }
.legal-note { margin: 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }
.legal-note a, .agree a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.forgot { font-size: 13px; color: var(--muted); text-align: center; }
.forgot summary { cursor: pointer; list-style: none; display: inline; }
.forgot summary::-webkit-details-marker { display: none; }
.forgot summary:hover { color: var(--ink-2); text-decoration: underline; }
.forgot p { margin: 8px 0 0; text-align: left; line-height: 1.55; padding: 10px 12px; border-radius: var(--r-sm); background: var(--panel-2); }

/* ---------- brand: three relay nodes, the last one lit */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-lg { font-size: 22px; }
.brand-mark { display: inline-flex; align-items: center; gap: 3px; padding: 6px 7px; background: var(--ink); border-radius: 8px; }
.brand-mark i { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--panel); opacity: .55; }
.brand-mark i:last-child { width: 7px; height: 7px; background: var(--signal); border-color: var(--signal); opacity: 1; }
.brand-lg .brand-mark { padding: 8px 9px; gap: 4px; }
.brand-mark-xl { padding: 12px 14px; gap: 6px; border-radius: 14px; }
.brand-mark-xl i { width: 10px; height: 10px; border-width: 2px; }
.brand-mark-xl i:last-child { width: 12px; height: 12px; }

/* ---------- first paint, before we know who you are */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }
.boot .brand-mark { animation: boot 1.4s ease-in-out infinite; }
@keyframes boot { 50% { transform: scale(.94); opacity: .7; } }
body.ready .boot { display: none; }

/* ---------- app shell */
.app { display: grid; grid-template-columns: 276px minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-top { display: grid; gap: 12px; padding: 16px 14px 8px; padding-top: max(16px, env(safe-area-inset-top)); }
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 2px 4px; min-height: 36px; }
#close-nav { display: none; }
.new-chat { justify-content: flex-start; padding: 10px 14px; }
.side-search { position: relative; display: block; }
.side-search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.side-search input { width: 100%; padding: 8px 10px 8px 34px; font-size: 13.5px; background: var(--panel); border-color: var(--line); border-radius: 10px; }
.side-search input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.side-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 20px 6px; letter-spacing: .02em; }
.chat-list { flex: 1 1 auto; min-height: 80px; overflow-y: auto; padding: 0 8px; }
.chat-group { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 12px 12px 4px; }
.chat-item { position: relative; display: flex; align-items: center; border-radius: var(--r-sm); }
.chat-item a { flex: 1; min-width: 0; padding: 8px 12px; color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: var(--r-sm); }
.chat-item a:hover { text-decoration: none; background: var(--sunken); color: var(--ink); }
.chat-item.active a { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.chat-item .item-acts { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: none; gap: 0; padding-left: 18px; background: linear-gradient(90deg, transparent, var(--sunken) 16px); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.chat-item.active .item-acts { background: linear-gradient(90deg, transparent, var(--panel) 16px); }
.chat-item:hover .item-acts, .chat-item:focus-within .item-acts { display: flex; }
.chat-item .item-acts .icon-btn { width: 28px; height: 28px; }
.chat-item .item-acts .icon-btn:hover { background: transparent; color: var(--ink); }
.chat-item .item-acts .ic { width: 15px; height: 15px; }
.chat-item input.rename { flex: 1; min-width: 0; margin: 2px 0; padding: 6px 10px; font-size: 14px; border-color: var(--signal); }
.chat-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.search-hit a { display: grid; gap: 2px; white-space: normal; }
.search-hit .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit small { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-hit mark { background: color-mix(in srgb, var(--warning) 35%, transparent); color: inherit; border-radius: 2px; }
.admin-nav { display: grid; padding: 0 8px; }
.admin-nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 14px; font-weight: 500; }
.admin-nav a:hover { text-decoration: none; background: var(--sunken); color: var(--ink); }
.admin-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-badge { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--signal); color: var(--signal-ink); font: 700 11px/1.5 var(--mono); text-align: center; }
.admin-nav a.active { background: var(--panel); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }
/* "앱으로 설치" (shown only where the browser can install the site, and on iPhone/iPad) */
.side-install { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; margin: 8px 10px 0; padding: 9px 12px; border: 1px dashed var(--line-strong); border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.side-install:hover { border-color: var(--signal); background: var(--panel); }
.side-install .ic { grid-row: span 2; width: 20px; height: 20px; color: var(--signal); }
.side-install span { font-size: 13.5px; font-weight: 600; }
.side-install small { font-size: 11.5px; color: var(--muted); }
.install-steps { margin: 14px 0 12px; padding-left: 1.3em; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.6; }
.share-ic { display: inline-grid; place-items: center; width: 26px; height: 26px; vertical-align: -7px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--signal); }
.share-ic .ic { width: 16px; height: 16px; }
.side-foot { display: flex; align-items: center; gap: 2px; padding: 10px 8px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); margin-top: 12px; }
.side-foot .me { flex: 1; padding: 6px 8px; border-radius: var(--r-sm); color: var(--ink); }
.side-foot .me:hover { background: var(--sunken); text-decoration: none; }
.side-foot .me.active { background: var(--panel); box-shadow: var(--shadow); }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-title { flex: 1; min-width: 0; font-weight: 650; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.scrim { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); }
  .topbar { display: flex; }
  #close-nav { display: inline-grid; }
  .chat-item.active .item-acts { display: flex; }
  .chat-item.active a { padding-right: 68px; }
}
@media (hover: none) { .chat-item:not(.active) .item-acts { display: none !important; } }

/* ---------- chat */
.chat-view { display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-height: 58px; }
.chat-head-title { margin-left: auto; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.model-pick select { font: 500 13.5px/1.2 var(--font); max-width: min(360px, 60vw); padding: 8px 30px 8px 11px; border-radius: 999px; background: var(--panel); }
.system-box { display: grid; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 13px; color: var(--ink-2); }
.system-box textarea { width: 100%; }
#page-account textarea[aria-label="AI 지침"] { width: 100%; min-height: 140px; line-height: 1.6; }
.mem-meter { display: flex; align-items: center; gap: 12px; }
.mem-meter .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.mem-meter .bar i { display: block; height: 100%; border-radius: 3px; background: var(--signal); }
.mem-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); max-height: 380px; overflow-y: auto; }
.mem-list li { display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mem-list li:last-child { border-bottom: 0; }
.mem-list .mem-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mem-list .tag { margin-left: 0; }
.chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: 28px 20px 24px; display: grid; gap: 26px; }

.empty-chat { padding: 10vh 0 0; text-align: left; }
.empty-chat .hello { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--signal); }
.empty-chat h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 750; letter-spacing: -0.03em; margin: 0 0 10px; }
.empty-chat p { color: var(--ink-2); margin: 0; }
.empty-chat .next-hop { margin-top: 22px; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r); font-size: 14px; color: var(--ink-2); }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.starter { display: grid; gap: 4px; text-align: left; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; }
.starter:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.starter b { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.starter b .ic { width: 16px; height: 16px; color: var(--signal); }
.starter span { font-size: 13px; color: var(--muted); line-height: 1.45; }
@media (max-width: 600px) { .starters { grid-template-columns: minmax(0, 1fr); } .starter:nth-child(n+3) { display: none; } }

.msg { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.msg.user { justify-items: end; }
.msg.user .bubble { max-width: 85%; background: var(--bubble); border-radius: 18px 18px 6px 18px; padding: 11px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .msg-tools { opacity: 0; transition: opacity .15s; }
.msg.user:hover .msg-tools, .msg.user:focus-within .msg-tools { opacity: 1; }
@media (hover: none) { .msg.user .msg-tools { opacity: 1; } }
.edit-box { width: min(100%, 640px); display: grid; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--signal); border-radius: 16px; box-shadow: 0 0 0 3px var(--signal-soft); }
.edit-box textarea { width: 100%; border: 0; background: transparent; resize: none; font-size: 15.5px; line-height: 1.55; padding: 4px 6px; outline: none; max-height: 50vh; }
.edit-box .row { justify-content: flex-end; align-items: center; gap: 8px; }
.edit-box .note { margin-right: auto; padding-left: 6px; }
.msg.user .imgs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg.user .imgs img { max-width: 220px; max-height: 220px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; }
.msg.ai { padding-right: 4px; }
.msg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; min-height: 30px; }
.msg-tools .btn { color: var(--muted); }
.msg-tools .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.msg-tools .icon-btn:hover { color: var(--ink); }
.msg-tools .icon-btn .ic { width: 16px; height: 16px; }
.msg-tools .route { margin-left: 8px; }
.msg.ai .cut-box { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.ver-nav { display: inline-flex; align-items: center; gap: 0; margin-right: 4px; font: 500 12px/1 var(--mono); color: var(--muted); }
.ver-nav .icon-btn { width: 26px; height: 26px; font-size: 17px; line-height: 1; color: var(--ink-2); }
.ver-nav .icon-btn:disabled { opacity: .35; }
.ver-count { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.msg-tools .menu { left: 0; right: auto; top: auto; bottom: calc(100% + 6px); } /* the last answer sits right over the chat box */
.md .code-acts { display: inline-flex; align-items: center; gap: 2px; }
.md .save-code { padding-left: 7px; padding-right: 7px; }
.md .math-block { margin: 0 0 1em; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.md .math-block[data-tex], .md .math[data-tex] { font-family: var(--mono); font-size: .9em; color: var(--ink-2); white-space: pre-wrap; }
.md .katex { font-size: 1.08em; }
.msg.ai .error-box { border: 1px solid color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 7%, var(--panel)); border-radius: var(--r); padding: 12px 14px; font-size: 14px; }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

details.thinking { border-left: 2px solid var(--line-strong); padding: 2px 0 2px 12px; color: var(--muted); font-size: 13.5px; }
details.thinking summary { cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; }
details.thinking summary::-webkit-details-marker { display: none; }
details.thinking summary::before { content: '▸ '; }
details.thinking[open] summary::before { content: '▾ '; }
details.thinking .thinking-body { white-space: pre-wrap; margin-top: 6px; max-height: 320px; overflow-y: auto; }

/* markdown */
.md { font-size: 15.5px; line-height: 1.75; overflow-wrap: break-word; }
.md td, .md th { min-width: 4.5em; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .9em; }
.md h3, .md h4, .md h5 { margin: 1.3em 0 .5em; line-height: 1.35; letter-spacing: -0.015em; }
.md h3 { font-size: 1.25em; } .md h4 { font-size: 1.1em; } .md h5 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.4em; }
.md li { margin: .25em 0; }
.md li > p { margin: .45em 0 0; }
.md li > .code { margin: .55em 0 .45em; }
.md li > ul, .md li > ol { margin: .2em 0; }
.md blockquote { margin: 0 0 .9em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md code { font-family: var(--mono); font-size: .86em; background: var(--sunken); border-radius: 5px; padding: .12em .38em; }
.md .code { margin: 0 0 1em; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--code-bg, var(--panel-2)); }
.md .code-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 6px 5px 14px; border-bottom: 1px solid var(--line); font: 500 12px/1 var(--mono); color: var(--muted); background: var(--panel-2); }
.md .code-head .btn { gap: 5px; }
.md .code-head .btn .ic { width: 14px; height: 14px; }
.md pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; tab-size: 4; }
.md pre code { background: none; padding: 0; font-size: inherit; line-height: inherit; }
.md .code.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
/* chance cards: the AI's probability estimate (```chance blocks) */
/* answer cards (```chance / ```timeline / ```chart blocks), drawn by CARDS in app.js */
.md .ac { margin: 0 0 1em; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; line-height: 1.5; }
.ac-title { font-size: 15px; font-weight: 650; }
.md .ac-note { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.md .ac-wait { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: var(--muted); font-size: 14px; }
.chance-main { display: grid; gap: 10px; padding: 16px 18px 18px; }
.chance-head { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 13px; color: var(--ink-2); }
.chance-title { font-weight: 600; }
.chance-basis { color: var(--muted); }
.chance-basis::before { content: '·'; margin-right: 6px; }
.chance-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.chance-big b { font-size: 34px; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; color: var(--signal); font-variant-numeric: tabular-nums; }
.chance-big span, .chance-period { font-size: 14px; color: var(--ink-2); }
.chance-bar { position: relative; height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.chance-bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 99px; background: var(--signal); }
.chance-bar i.span { background: color-mix(in srgb, var(--signal) 35%, transparent); }
.chance-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.chance-split div { display: grid; gap: 2px; }
.chance-split span { font-size: 13px; color: var(--muted); }
.chance-split b { font-size: 17px; font-variant-numeric: tabular-nums; }
.md .chance-list { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 10px; }
.md .chance-list li { margin: 0; display: grid; gap: 5px; }
.chance-list .row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.chance-list .row b { font-variant-numeric: tabular-nums; }
.chance-list .chance-bar { height: 6px; }
.chance-list li:not(.top) .chance-bar i { background: color-mix(in srgb, var(--signal) 40%, var(--line-strong)); }
.chance-list li:not(.top) .chance-bar i.span { background: color-mix(in srgb, var(--line-strong) 50%, transparent); }
.chance-scen { padding: 14px 18px 16px; border-top: 1px solid var(--line); background: var(--panel-2); }
.chance-sub { margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.md .chance-scen ol { list-style: none; margin: 0; padding: 0; }
.md .chance-scen li { position: relative; margin: 0; padding: 0 0 14px 22px; }
.md .chance-scen li:last-child { padding-bottom: 0; }
.chance-scen li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--panel-2); }
.chance-scen li::after { content: ''; position: absolute; left: 7px; top: 20px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--line); }
.chance-scen li:last-child::after { display: none; }
.chance-scen li.pick::before { border-color: var(--good); background: var(--good); }
.chance-when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; font-weight: 650; }
.chance-tag { padding: 1px 8px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.chance-scen li.pick .chance-tag { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.chance-p { margin-left: auto; font: 600 12px/1.4 var(--mono); color: var(--muted); }
.md .chance-scen p { margin: 3px 0 0; font-size: 14px; color: var(--ink-2); }
/* timeline: days, steps or dates down a rail */
.md .ac.tl { padding: 16px 18px; }
.md .tl > ol { list-style: none; margin: 12px 0 0; padding: 0; }
.md .tl > ol > li { position: relative; margin: 0; padding: 0 0 16px 34px; }
.md .tl > ol > li:last-child { padding-bottom: 0; }
.tl-mark { position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border: 2px solid var(--signal); border-radius: 50%; background: var(--panel); }
.tl.steps .tl-mark { left: 0; top: 0; width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: var(--signal-soft); color: var(--signal); font: 650 12px/1 var(--mono); }
.tl > ol > li::after { content: ''; position: absolute; left: 11px; top: 22px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--line); }
.tl.steps > ol > li::after { top: 30px; }
.tl > ol > li:last-child::after { display: none; }
.tl-when { font-size: 12.5px; font-weight: 600; color: var(--signal); }
.tl-title { font-size: 15px; font-weight: 650; }
.md .tl p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.md .tl ul { margin: 6px 0 0; padding-left: 1.1em; font-size: 14px; color: var(--ink-2); }
.md .tl ul li { margin: 2px 0; }
/* charts. Series colors: a validated categorical order (dataviz skill),
   checked against --panel in both themes; slots are used in order. */
.ac.chart, .ch-tip { --ch1: #3d5afe; --ch2: #eb6834; --ch3: #1baf7a; --ch4: #eda100; --ch5: #e87ba4; --ch6: #008300; --ch-grid: var(--line); --ch-y: 52px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.ac.chart, .ch-tip) { --ch1: #6f7ff7; --ch2: #d95926; --ch3: #199e70; --ch4: #c98500; --ch5: #d55181; } }
:root[data-theme="dark"] :is(.ac.chart, .ch-tip) { --ch1: #6f7ff7; --ch2: #d95926; --ch3: #199e70; --ch4: #c98500; --ch5: #d55181; }
:is(.ac.chart, .ch-tip) .s0 { --c: var(--ch1); } :is(.ac.chart, .ch-tip) .s1 { --c: var(--ch2); } :is(.ac.chart, .ch-tip) .s2 { --c: var(--ch3); }
:is(.ac.chart, .ch-tip) .s3 { --c: var(--ch4); } :is(.ac.chart, .ch-tip) .s4 { --c: var(--ch5); } :is(.ac.chart, .ch-tip) .s5 { --c: var(--ch6); }
.md .ac.chart { display: grid; gap: 12px; padding: 16px 18px 12px; }
.ch-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; }
.ch-unit { font-size: 12px; color: var(--muted); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend .sw, .ch-legend-list .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.ch-legend .ln { width: 14px; height: 2px; border-radius: 1px; background: var(--c); }
.ch-scroll { overflow-x: auto; }
.ch-plot { position: relative; height: 190px; margin: 22px 0 0 var(--ch-y); }
.ch-tick { position: absolute; left: calc(-1 * var(--ch-y)); right: 0; height: 0; border-top: 1px solid var(--ch-grid); }
.ch-tick.zero { border-top-color: var(--line-strong); }
.ch-tick span { position: absolute; left: 0; width: calc(var(--ch-y) - 8px); transform: translateY(-50%); text-align: right; font: 11px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-cols { position: absolute; inset: 0; display: flex; }
.ch-col { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; gap: 2px; padding: 0 3px; border-radius: 6px; outline: none; }
.ch-col:hover, .ch-col:focus-visible { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ch-lane { position: relative; flex: 1 1 0; max-width: 24px; }
.ch-bar { position: absolute; left: 0; right: 0; background: var(--c); border-radius: 4px 4px 0 0; }
.ch-bar.neg { border-radius: 0 0 4px 4px; }
.ch-col:hover .ch-bar, .ch-col:focus-visible .ch-bar { filter: brightness(1.08); }
.ch-val { position: absolute; left: 50%; transform: translate(-50%, -4px); font: 600 11px/1 var(--font); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-xs { display: flex; margin: 6px 0 0 var(--ch-y); font-size: 11.5px; color: var(--muted); }
.ch-xs span { flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.ch-xs.line { position: relative; display: block; height: 16px; }
.ch-xs.line span { position: absolute; top: 0; transform: translateX(-50%); padding: 0; overflow: visible; }
.ch-xs.line span.first { transform: none; }
.ch-xs.line span.last { transform: translateX(-100%); }
.ch-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--c); opacity: .1; stroke: none; }
.ch-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--panel); pointer-events: none; }
.ch-end { position: absolute; transform: translate(-100%, -150%); font: 600 12px/1 var(--font); color: var(--ink); white-space: nowrap; pointer-events: none; }
.ch-hit { position: absolute; top: 0; bottom: 0; outline: none; }
.ch-hit i { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--line-strong); opacity: 0; }
.ch-hit:hover i, .ch-hit:focus-visible i { opacity: 1; }
.md .ch-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.md .ch-rows li { margin: 0; display: grid; gap: 4px; padding: 4px 6px; border-radius: 6px; outline: none; }
.ch-rows li:hover, .ch-rows li:focus-visible { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ch-rows .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.ch-rows .row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.ch-hbar { position: relative; height: 10px; }
.ch-hbar i { position: absolute; top: 0; bottom: 0; background: var(--c); border-radius: 0 4px 4px 0; }
.ch-hbar i.neg { border-radius: 4px 0 0 4px; }
.ch-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.ch-donut { width: 150px; height: 150px; flex: none; }
.ch-seg { fill: none; stroke: var(--c); stroke-width: 6; outline: none; transition: stroke-width .12s; }
.ch-seg:hover, .ch-seg:focus-visible { stroke-width: 7.5; }
.md .ch-legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 0 1 340px; min-width: 200px; font-size: 13.5px; }
.md .ch-legend-list li { margin: 0; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.ch-legend-list b { font-variant-numeric: tabular-nums; font-weight: 600; }
.ch-legend-list small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ch-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.ch-table summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.ch-table summary:hover { color: var(--ink-2); }
.ch-table[open] { flex-basis: 100%; }
.md .ch-table .table-wrap { margin: 8px 0 4px; }
.ch-tip { position: fixed; z-index: 60; min-width: 120px; max-width: 260px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); font-size: 12.5px; pointer-events: none; }
.ch-tip-head { margin-bottom: 4px; color: var(--muted); }
.ch-tip-row { display: flex; align-items: center; gap: 8px; }
.ch-tip-row .ln { width: 12px; height: 2px; border-radius: 1px; background: var(--c); flex: none; }
.ch-tip-row b { font-variant-numeric: tabular-nums; }
.ch-tip-row span { color: var(--ink-2); }
/* follow-up questions under the last answer */
.followups { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.followup { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 14px 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: border-color .15s, color .15s; }
.followup:hover { border-color: var(--line-strong); color: var(--ink); }
.followup .ic { width: 15px; height: 15px; color: var(--muted); }
.followup span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* videos the AI watched, under the message that linked them */
.video-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 85%; }
.video-chips a { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 11px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 12.5px; text-decoration: none; }
.video-chips a:hover { border-color: var(--line-strong); color: var(--ink); }
.video-chips .play { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--signal-soft); color: var(--signal); font-size: 8.5px; }
.video-chips .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* web search sources under an answer */
.md a.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin: 0 1px; border-radius: 9px; background: var(--sunken); color: var(--ink-2); font: 600 10.5px/1 var(--mono); text-decoration: none; vertical-align: 2px; }
.md a.cite:hover { background: var(--signal-soft); color: var(--signal); }
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.sources-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.sources a { display: inline-flex; align-items: center; gap: 6px; max-width: min(280px, 100%); padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 12.5px; text-decoration: none; }
.sources a:hover { border-color: var(--line-strong); color: var(--ink); }
.sources .n { flex: none; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--sunken); font: 600 11px/1 var(--mono); }
.sources .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources small { flex: none; color: var(--muted); font-size: 11px; }
@media (max-width: 600px) { .sources small { display: none; } .web-toggle span { display: none; } .web-toggle { padding: 0 8px; } }
.md h1, .md h2 { margin: 1.3em 0 .5em; line-height: 1.35; letter-spacing: -0.015em; font-size: 1.3em; }

/* syntax colours */
:root { --tk-k: #7c3aed; --tk-s: #0a7d38; --tk-n: #b45309; --tk-c: #8a909b; --tk-f: #1d4ed8; --tk-t: #0e7490; --tk-a: #b42323; }
:root[data-theme="dark"] { --tk-k: #c4a7ff; --tk-s: #86e0a6; --tk-n: #f5b971; --tk-c: #6b7380; --tk-f: #93b7ff; --tk-t: #6fd3e6; --tk-a: #ff9e9e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tk-k: #c4a7ff; --tk-s: #86e0a6; --tk-n: #f5b971; --tk-c: #6b7380; --tk-f: #93b7ff; --tk-t: #6fd3e6; --tk-a: #ff9e9e; } }
.tk-k { color: var(--tk-k); }
.tk-s { color: var(--tk-s); }
.tk-n { color: var(--tk-n); }
.tk-c { color: var(--tk-c); font-style: italic; }
.tk-f { color: var(--tk-f); }
.tk-t { color: var(--tk-t); }
.tk-a { color: var(--tk-a); }
.md .table-wrap { overflow-x: auto; margin: 0 0 1em; }
/* The frame sits on the img itself: a percentage max-width makes the link's
   shrink-to-fit width ignore the cap, which left an empty strip beside the picture. */
.md .gen-img { display: inline-block; max-width: 100%; margin: 2px 0 6px; line-height: 0; }
.md .gen-img img { display: block; max-width: min(100%, 560px); max-height: 640px; width: auto; height: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--sunken); }
.md .gen-img:hover { text-decoration: none; }
.md .gen-img:hover img { border-color: var(--line-strong); }
.waiting { display: flex; align-items: center; gap: 10px; }
.md table { border-collapse: collapse; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 650; }

/* composer */
.composer-wrap { position: relative; padding: 0 20px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.composer { max-width: 780px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); padding: 10px 10px 8px 14px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft), var(--shadow); }
.composer.drag { border-style: dashed; border-color: var(--signal); background: var(--signal-soft); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; padding: 6px 2px; font-size: 15.5px; line-height: 1.55; max-height: 220px; outline: none; }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.composer-hint { flex: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-toggle { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px 0 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.web-toggle:hover { color: var(--ink); background: var(--sunken); }
.web-toggle .ic { width: 16px; height: 16px; }
.web-toggle[aria-pressed="true"] { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); font-weight: 600; }
.composer-foot { max-width: 780px; margin: 4px auto 0; text-align: center; font-size: 11.5px; color: var(--muted); }
/* under the box (like the Claude app): 수동/자동 on the left; 노력 and the usage ring on the right */
.composer-under { max-width: 780px; margin: 5px auto 0; padding: 0 4px; display: flex; align-items: center; gap: 4px; min-height: 30px; }
.composer-under .grow { flex: 1; }
.under-slot { position: relative; display: inline-flex; }
.under-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.under-btn:hover, .under-btn[aria-expanded="true"] { background: var(--sunken); color: var(--ink); }
.under-btn .ic { width: 15px; height: 15px; }
.under-btn .chev { width: 13px; height: 13px; color: var(--muted); }
.under-btn[aria-pressed="true"] { color: var(--signal); font-weight: 600; }
.composer-under .menu { top: auto; bottom: calc(100% + 6px); min-width: 250px; }
.composer-under .under-slot:first-child .menu { left: 0; right: auto; }
.menu .two { display: grid; gap: 2px; }
.menu .two small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.menu button.picked { background: var(--signal-soft); }
.menu button.picked .ic { color: var(--signal); }
.send { flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: var(--signal-btn, var(--signal)); color: var(--signal-btn-ink, var(--signal-ink)); transition: filter .15s, opacity .15s, background .15s; }
.send .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.send:hover { filter: brightness(1.08); }
.send:disabled { opacity: .35; cursor: default; filter: none; }
.send.stop { background: var(--ink); color: var(--panel); }
.to-bottom { position: absolute; z-index: 5; left: 50%; top: -48px; transform: translateX(-50%); width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-2); box-shadow: var(--shadow); cursor: pointer; }
.to-bottom:hover { color: var(--ink); }
.to-bottom .ic { width: 17px; height: 17px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 8px; }
.attachment { position: relative; }
.attachment img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.attachment button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-size: 12px; cursor: pointer; line-height: 1; }
.file-chip { position: relative; display: inline-flex; align-items: center; gap: 7px; max-width: 380px; height: 40px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; text-align: left; }
.file-chip .ic { flex: none; width: 18px; height: 18px; color: var(--signal); }
.file-chip .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-chip small { flex: none; color: var(--muted); font-size: 12px; }
.file-chip.pending { padding-right: 22px; }
.file-chip.reading { opacity: .65; }
.file-chip.pending button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-size: 12px; cursor: pointer; line-height: 1; }
button.file-chip { cursor: pointer; }
button.file-chip:hover { border-color: var(--line-strong); }
.file-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 85%; }
.file-chip .scan { flex: none; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.file-chip .scan.bad { background: #e5484d; color: #fff; }
.file-chip .scan.warn { background: #f5a623; color: #1c1300; }
.file-chip .scan.ok { background: var(--signal-soft); color: var(--signal); }
.file-chip .scan.scanning { animation: scan-pulse 1.4s ease-in-out infinite; }
@keyframes scan-pulse { 50% { opacity: .45; } }
.file-chip .scan.unk { background: var(--sunken); color: var(--muted); font-weight: 500; }
.file-view { max-height: 60vh; overflow: auto; margin: 14px 0 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunken); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.icon-btn.mic.rec { color: #fff; background: #e5484d; animation: rec-pulse 1.4s ease-in-out infinite; }
.icon-btn.mic.busy { opacity: .55; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, .2); } }

/* ---------- route rail (the signature): how a request fell through the chain */
.route { display: flex; flex-wrap: wrap; align-items: center; row-gap: 6px; font: 500 11.5px/1.2 var(--mono); color: var(--muted); }
.hop { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hop::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.hop .name { color: inherit; }
.hop.skip .name { text-decoration: line-through; text-decoration-thickness: 1px; }
.hop em { font: 500 11px/1 var(--font); font-style: normal; color: var(--muted); }
.hop.win { color: var(--ink); }
.hop.win::before { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.hop.fail::before { background: var(--critical); border-color: var(--critical); }
.route .link { width: 16px; height: 1px; background: var(--line-strong); margin: 0 7px; }

/* ---------- admin pages */
.page { max-width: 1120px; margin: 0 auto; padding: 30px 24px 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -0.03em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.section { margin-bottom: 30px; }
.section-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.section-title small { font-size: 13px; font-weight: 400; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.stack > * + * { margin-top: 14px; }
.scroll-x { overflow-x: auto; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 30px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.metric .label { font-size: 13px; color: var(--ink-2); }
.metric .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; line-height: 1.2; }
.metric .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .nowrap { white-space: nowrap; }
table.grid .actions { text-align: right; white-space: nowrap; }
table.grid .actions .btn + .btn { margin-left: 4px; }
.empty-row { padding: 22px 14px; text-align: center; color: var(--muted); }

.model { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.model .prov { color: var(--muted); }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { font-size: 12.5px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.badge::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--off)); }
.badge.good { --dot: var(--good); }
.badge.warning { --dot: var(--warning); }
.badge.critical { --dot: var(--critical); }
.badge.off { --dot: var(--off); color: var(--ink-2); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 500; color: var(--ink-2); background: var(--sunken); border-radius: 5px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.tag.signal { color: var(--signal); background: var(--signal-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font: 12px/1.5 var(--mono); background: var(--sunken); border-radius: 5px; padding: 1px 7px; }

/* vertical rail: the model chain as a switchboard */
.rail-row { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 18px 11px 0; border-bottom: 1px solid var(--line); }
.rail-row:last-child { border-bottom: 0; }
.rail-row::before { content: ''; position: absolute; left: 19px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.rail-row:first-child::before { top: 50%; }
.rail-row:last-child::before { bottom: 50%; }
.rail-node { position: relative; z-index: 1; justify-self: center; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--off); }
.rail-node.ready { background: var(--good); border-color: var(--good); }
.rail-node.cooldown { border-color: var(--warning); }
.rail-node.disabled { border-style: dashed; }
.rail-node.here { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.rail-main { min-width: 0; }
.rail-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-side { text-align: right; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }

.providers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.prov-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.prov-card .name { font-weight: 700; margin-bottom: 8px; }
.prov-card .detail { font-size: 12.5px; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.bar { display: flex; gap: 3px; height: 5px; margin-top: 10px; }
.bar span { flex: 1; border-radius: 3px; background: var(--off); }
.bar span.ready { background: var(--good); }
.bar span.cooldown { background: var(--warning); }

/* chain editor */
.two-col { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.model-list { max-height: 560px; overflow-y: auto; }
.model-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.model-item:last-child { border-bottom: 0; }
.checklist { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; display: grid; gap: 4px; }

/* modal + toasts */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 14, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.modal { width: min(580px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 24px 80px rgba(0, 0, 0, .3); animation: pop .18s ease-out; }
.modal.sm { width: min(420px, 100%); }
.kv.signup-info { margin-top: 12px; max-height: 62vh; overflow: auto; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; align-items: start; font-size: 13px; }
.kv.signup-info dd { overflow-wrap: anywhere; }
.modal h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.modal .modal-body { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.modal .modal-fields { display: grid; gap: 12px; margin-top: 16px; }
.modal .modal-fields input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-actions .grow { flex: 1; }
/* keyboard shortcuts list */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin: 16px 0 0; font-size: 14px; }
.keys dt { display: flex; gap: 4px; white-space: nowrap; }
.keys dd { margin: 0; color: var(--ink-2); }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--panel-2); font: 600 12px/1.5 var(--mono); text-align: center; color: var(--ink); }
@media (hover: none) { #keys-btn { display: none; } }
/* saved prompts: the list over the chat box, and the editor */
.snip-pop { position: absolute; z-index: 30; left: 50%; bottom: calc(100% - 4px); transform: translateX(-50%); width: min(780px, calc(100% - 40px)); max-height: 320px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .16); }
.snip-pop button[role=option] { display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.snip-pop button[role=option].on, .snip-pop button[role=option]:hover { background: var(--sunken); }
.snip-pop button[role=option] b { font-size: 14px; font-weight: 600; }
.snip-pop button[role=option] span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snip-empty { margin: 0; padding: 10px; font-size: 13px; color: var(--muted); }
.snip-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px 2px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 12px; color: var(--muted); }
.snip-modal .snip-rows { display: grid; gap: 10px; margin-top: 14px; max-height: 55vh; overflow-y: auto; padding-right: 2px; }
.snip-row { display: flex; gap: 6px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.snip-row-main { flex: 1; display: grid; gap: 6px; min-width: 0; }
.snip-row-main input, .snip-row-main textarea { width: 100%; }
.snip-row-main textarea { resize: vertical; min-height: 64px; }
/* "이 부분 질문하기" over selected answer text */
.ask-sel { position: fixed; z-index: 55; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, .16); font: 600 13px/1.2 var(--font); cursor: pointer; }
.ask-sel .ic { width: 15px; height: 15px; color: var(--signal); }
.ask-sel:hover { border-color: var(--signal); }
.md span.math-block { display: block; }
.btn.danger-fill { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.danger-fill:hover { filter: brightness(1.07); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.secret { display: flex; gap: 8px; margin: 16px 0; }
.secret input { flex: 1; font-family: var(--mono); font-size: 13px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: grid; gap: 8px; max-width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--panel); border-radius: 10px; padding: 10px 14px; font-size: 14px; box-shadow: var(--shadow); }
.toast.error { background: var(--critical); color: #fff; }
.banner { margin-bottom: 18px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--critical); background: var(--panel); font-size: 14px; }

@media (max-width: 600px) {
  .page { padding: 20px 16px 64px; }
  .chat-inner { padding: 20px 16px; }
  .composer-wrap { padding-left: 12px; padding-right: 12px; }
  .chat-head { padding: 10px 12px; }
  .chat-head-title { display: none; }
  .msg.user .bubble { max-width: 92%; }
}

/* accounts: admins see everything, everyone else the chat */
.is-user .admin-only, body:not(.is-owner) .owner-only { display: none !important; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--signal-soft); color: var(--signal); font-weight: 700; font-size: 13.5px; }
.me { display: flex; align-items: center; gap: 10px; padding: 2px 6px; min-width: 0; }
.me-text { display: grid; min-width: 0; line-height: 1.3; }
.me-text b { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sign-in */
.auth-form { display: grid; gap: 10px; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; padding: 11px 13px; background: var(--panel); color: var(--ink); }
.google-btn:hover { text-decoration: none; background: var(--panel-2); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-switch { margin: 2px 0 0; text-align: center; font-size: 13.5px; color: var(--ink-2); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--signal); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.notice { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--signal-soft); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.notice.error { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--danger-ink); }

/* usage: a ring in the composer, details in a popover above it */
.usage-btn { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; --ring: var(--signal); }
.usage-btn:hover { background: var(--sunken); }
.usage-btn svg { width: 20px; height: 20px; transform: rotate(-90deg); }
.usage-btn circle { fill: none; stroke-width: 2.6; }
.usage-btn .track { stroke: var(--line-strong); }
.usage-btn .fill { stroke: var(--ring); stroke-linecap: round; transition: stroke-dasharray .4s; }
.usage-btn.warn { --ring: var(--warning); }
.usage-btn.full { --ring: var(--critical); }
.usage-pop { position: absolute; z-index: 30; bottom: calc(100% + 8px); right: max(20px, calc((100% - 780px) / 2)); width: min(320px, calc(100vw - 32px)); display: grid; gap: 16px; padding: 16px 18px 18px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28); }
.u-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; }
.u-head .tag { margin: 0; }
.u-row { display: grid; gap: 7px; }
.u-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.u-title { font-weight: 650; font-size: 14px; }
.u-pct { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.u-bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.u-bar i { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--signal); transition: width .4s; }
.u-bar.warn i { background: var(--warning); }
.u-bar.full i { background: var(--critical); }
.u-note { font-size: 12.5px; color: var(--muted); }
.u-foot { margin: -4px 0 0; font-size: 12px; color: var(--muted); }

/* users page */
.who { display: flex; align-items: center; gap: 10px; }
.user-actions { justify-content: flex-end; gap: 4px; flex-wrap: nowrap; }
.callout { padding: 12px 16px; border-radius: var(--r); background: color-mix(in srgb, var(--warning) 16%, transparent); font-size: 14px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.uri { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 6px 2px 0; padding: 2px 4px 2px 8px; background: var(--sunken); border-radius: 6px; }
.uri .mono { font-size: 12.5px; word-break: break-all; }

/* a conversation whose answer is still being generated */
.pending-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--signal); vertical-align: 1px; animation: pend 1.2s ease-in-out infinite; }
@keyframes pend { 50% { opacity: .3; } }

/* ---------- small dropdown menus (chat ⋯) */
.menu-wrap { position: relative; }
.chat-head .menu-wrap { margin-left: 4px; }
.chat-head-title + .menu-wrap { margin-left: 0; }
.menu { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 190px; display: grid; padding: 6px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); animation: pop .12s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 14px/1.2 var(--font); text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--sunken); outline: none; }
.menu button .ic { width: 16px; height: 16px; color: var(--ink-2); }
.menu button.danger { color: var(--danger-ink); }
.menu button.danger .ic { color: currentColor; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ---------- account page */
.page.narrow { max-width: 760px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile .avatar { width: 52px; height: 52px; font-size: 20px; }
.profile h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.profile p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px 16px; align-items: center; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; min-width: 0; }
@media (max-width: 600px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 4px; } .kv dd { margin-bottom: 10px; } }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 10px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: 500 13.5px/1 var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg button .ic { width: 15px; height: 15px; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.action-row:last-child { border-bottom: 0; }
.action-row.sub { padding-left: 34px; }
/* two-step sign-in */
.mfa-intro { padding: 14px 18px 0; margin: 0; }
.mfa-setup { padding: 14px 18px 16px; }
.mfa-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mfa-tabs:empty { display: none; }
.qr { width: 196px; height: 196px; padding: 6px; background: #fff; border-radius: 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.recovery-codes { margin: 14px 0; padding: 14px 16px; border-radius: var(--r-sm); background: var(--sunken); font: 15px/1.9 var(--mono); columns: 2; user-select: all; }
.action-row b { display: block; font-size: 14.5px; font-weight: 650; }
.action-row span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.card.danger-zone { border-color: color-mix(in srgb, var(--critical) 35%, var(--line)); }
.page-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 28px; font-size: 13px; color: var(--muted); }
.page-foot a { color: var(--muted); }

/* ---------- public front page */
html:has(body.public) { scroll-behavior: smooth; }
.landing { min-height: 100%; background: var(--bg); }
.l-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; max-width: 1180px; margin: 0 auto; padding: 14px 24px; padding-top: max(14px, env(safe-area-inset-top)); }
.landing::before { content: ''; position: fixed; inset: 0 0 auto; height: 64px; z-index: 19; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.l-links { display: flex; gap: 4px; margin-right: auto; }
.l-links a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14.5px; font-weight: 500; }
.l-links a:hover { color: var(--ink); background: var(--sunken); text-decoration: none; }
.l-actions { display: flex; gap: 8px; }
.landing main { overflow: hidden; }

.hero { position: relative; max-width: 1180px; margin: 0 auto; padding: 72px 24px 88px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: 56px; align-items: center; }
.hero::before { content: ''; position: absolute; z-index: 0; inset: -140px -30% auto; height: 760px; background: radial-gradient(560px 360px at 72% 40%, color-mix(in srgb, var(--signal) 18%, transparent), transparent 70%), radial-gradient(420px 300px at 12% 20%, color-mix(in srgb, var(--signal) 9%, transparent), transparent 70%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 6px 12px 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); animation: ring 2s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero h1 { margin: 0; font-size: clamp(44px, 6.4vw, 76px); line-height: 1.04; font-weight: 800; letter-spacing: -0.045em; }
.lead { margin: 22px 0 0; max-width: 31em; font-size: clamp(16px, 1.6vw, 18.5px); line-height: 1.65; color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero-note { margin: 16px 0 0; font-size: 13.5px; color: var(--muted); }

.demo { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 1px 2px rgba(18, 21, 26, .05), 0 30px 80px -20px rgba(18, 21, 26, .25); overflow: hidden; transform: rotate(.6deg); }
.demo-bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.demo-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.demo-bar span { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.demo-body { display: grid; gap: 18px; padding: 22px 22px 8px; }
.demo-msg.user { display: grid; justify-items: end; }
.demo-msg .bubble { max-width: 88%; background: var(--bubble); border-radius: 18px 18px 6px 18px; padding: 10px 15px; font-size: 14.5px; }
.demo-msg .md { font-size: 14.5px; line-height: 1.65; }
.demo-msg .md ol { margin-bottom: 10px; }
.demo-input { display: flex; align-items: center; justify-content: space-between; margin: 10px 16px 16px; padding: 10px 10px 10px 16px; border: 1px solid var(--line-strong); border-radius: 16px; color: var(--muted); font-size: 14px; }
.demo-input b { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--signal-btn, var(--signal)); color: var(--signal-btn-ink, var(--signal-ink)); }
.demo-input .ic { width: 16px; height: 16px; stroke-width: 2.2; }

.l-section { max-width: 1180px; margin: 0 auto; padding: 72px 24px; }
.l-head { max-width: 640px; margin-bottom: 36px; }
.l-head h2 { margin: 0; font-size: clamp(28px, 3.6vw, 40px); font-weight: 780; letter-spacing: -0.035em; line-height: 1.15; }
.l-head p { margin: 12px 0 0; color: var(--ink-2); font-size: 16.5px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature { padding: 24px 24px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; transition: border-color .2s, transform .2s, box-shadow .2s; }
.feature:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.feature > .ic { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--signal-soft); color: var(--signal); stroke-width: 1.7; }
.feature h3 { margin: 18px 0 8px; font-size: 17px; letter-spacing: -0.02em; }
.feature p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }

.how { border-top: 1px solid var(--line); }
/* the hero's sample chat: a plan card and follow-up chips, as the app draws them */
.demo .md .ac.tl { margin: 10px 0 0; padding: 12px 14px; }
.demo .md .tl > ol { margin-top: 8px; }
.demo .md .tl > ol > li { padding-bottom: 10px; }
.demo-follow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.demo-follow .followup { cursor: default; font-size: 13px; padding: 5px 12px 5px 9px; }
.demo-follow .followup:hover { border-color: var(--line); color: var(--ink-2); }
.steps-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; counter-reset: s; }
.steps-row li { position: relative; padding-top: 4px; }
.steps-row li:not(:last-child)::after { content: ''; position: absolute; top: 20px; left: 52px; right: -16px; height: 2px; background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px); }
.step-n { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--panel); font: 700 15px/1 var(--mono); }
.steps-row li:last-child .step-n { background: var(--signal); color: #fff; box-shadow: 0 0 0 5px var(--signal-soft); }
.steps-row h3 { margin: 18px 0 6px; font-size: 17px; letter-spacing: -0.02em; }
.steps-row p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.65; }

.faq-list { display: grid; gap: 10px; max-width: 820px; }
.faq-list details { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; transition: border-color .15s; }
.faq-list details[open] { border-color: var(--line-strong); }
.faq-list summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; font-weight: 650; font-size: 15.5px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; font: 400 22px/1 var(--font); color: var(--muted); transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list p { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }

.final-cta { max-width: 1132px; margin: 24px auto 72px; padding: 64px 24px; text-align: center; border-radius: 28px; background: radial-gradient(600px 260px at 50% 0%, color-mix(in srgb, var(--signal) 22%, transparent), transparent 75%), var(--panel); border: 1px solid var(--line); }
.final-cta h2 { margin: 0; font-size: clamp(28px, 3.6vw, 40px); font-weight: 780; letter-spacing: -0.035em; }
.final-cta p { margin: 10px 0 26px; color: var(--ink-2); }
.l-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.l-foot nav { display: flex; gap: 18px; }
.l-foot a { color: var(--ink-2); }

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 48px; gap: 44px; }
  .demo { transform: none; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .l-links { display: none; }
  .l-nav { padding: 12px 16px; justify-content: space-between; }
  .l-actions .btn.primary { display: none; }
  .landing::before { height: 60px; }
  .hero { padding: 36px 16px 56px; }
  .l-section { padding: 52px 16px; }
  .features { grid-template-columns: minmax(0, 1fr); }
  .steps-row { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .steps-row li:not(:last-child)::after { display: none; }
  .final-cta { margin: 8px 16px 48px; padding: 44px 20px; }
  .l-foot { padding: 24px 16px 36px; }
}

/* the PC app band on the landing page */
.pc-band { padding-top: 12px; padding-bottom: 12px; }
.pc-band-in { display: flex; align-items: center; justify-content: space-between; gap: 24px 40px; padding: 30px 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.pc-band h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.03em; }
.pc-band p { margin: 0; color: var(--ink-2); max-width: 560px; line-height: 1.7; }
.pc-band .pc-band-tag { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--signal); }
.pc-band-tag .ic { width: 16px; height: 16px; }
.pc-band .btn { flex: none; }
.side-pc { text-decoration: none; }
@media (max-width: 720px) { .pc-band-in { flex-direction: column; align-items: flex-start; padding: 24px 20px; } }

/* ---------- documents (terms, privacy, 404) */
.doc-page { min-height: 100%; background: var(--bg); }
/* 문의 page (/contact) */
.contact-form { display: grid; gap: 16px; margin-top: 8px; }
.contact-form .field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.contact-form .field input, .contact-form .field select, .contact-form .field textarea { width: 100%; font-weight: 400; }
.contact-form textarea { resize: vertical; min-height: 150px; line-height: 1.6; }
.contact-form .hint { text-align: right; font-weight: 400; }
.contact-form .agree { align-items: flex-start; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.contact-form .agree input { margin-top: 5px; flex: none; }
.contact-form .btn { justify-self: start; min-width: 120px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-done { margin-top: 12px; padding: 24px 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.doc .contact-done h2 { margin: 0 0 6px; padding: 0; }
.contact-done .btn { margin-top: 8px; }
/* the owner's 문의 inbox */
.inq-tabs { justify-content: flex-start; margin: 4px 0 16px; }
.inq-list { display: grid; gap: 12px; }
.card.inq { padding: 16px 18px; display: grid; gap: 10px; }
.card.inq.new { border-left: 3px solid var(--signal); }
.inq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.inq-head .tag { margin-left: 0; }
.inq-mail { color: var(--ink-2); font-size: 12.5px; overflow-wrap: anywhere; }
.inq-time { margin-left: auto; }
.inq-msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.inq-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.doc-nav { display: flex; align-items: center; justify-content: space-between; max-width: 820px; margin: 0 auto; padding: 18px 24px; }
.doc { max-width: 820px; margin: 0 auto; padding: 24px 24px 80px; font-size: 15px; line-height: 1.8; }
.doc h1 { font-size: clamp(28px, 4vw, 36px); letter-spacing: -0.035em; line-height: 1.2; margin: 12px 0 6px; }
.doc .meta { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.doc h2 { font-size: 18px; letter-spacing: -0.02em; margin: 36px 0 10px; padding-top: 4px; }
.doc p, .doc li { color: var(--ink-2); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 4px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0 16px; line-height: 1.55; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--panel-2); font-weight: 650; color: var(--ink); }
.doc .table-wrap { overflow-x: auto; }
.doc .box { padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.doc-foot { max-width: 820px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
.doc-foot a { color: var(--ink-2); }

/* the PC app page (/download) */
.dl-hero { padding: 20px 0 8px; }
.dl-eyebrow { display: inline-block; margin: 0 0 12px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.doc.dl h1 { font-size: clamp(30px, 5vw, 44px); margin: 0 0 12px; }
.dl-lead { font-size: 16.5px; line-height: 1.7; max-width: 620px; margin: 0 0 24px; color: var(--ink-2); }
.dl-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.dl-cta .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-cta .btn.disabled { opacity: .5; pointer-events: none; }
.dl-meta { font-size: 13px; color: var(--muted); }
.dl-other { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.dl-other a { text-decoration: underline; text-underline-offset: 2px; }
.dl-shot { margin: 36px 0 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.dl-shot-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--muted); }
.dl-shot-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.dl-shot-bar span { margin-left: 8px; font-weight: 600; }
.dl-shot-body { padding: 18px 20px 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.6; }
.dl-bubble { justify-self: end; max-width: 80%; padding: 9px 14px; border-radius: 14px 14px 4px 14px; background: var(--bubble); color: var(--ink); }
.dl-step { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.dl-step b { color: var(--good); }
.dl-step span { font-weight: 650; white-space: nowrap; color: var(--ink); }
.dl-step code, .dl-answer code { font: 12px var(--mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dl-answer { margin: 6px 0 0; color: var(--ink); }
.dl-answer code { background: var(--sunken); border-radius: 4px; padding: 1px 5px; }
.dl-grid { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dl-grid li { margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); display: grid; gap: 4px; line-height: 1.6; }
.dl-grid b { color: var(--ink); font-size: 15px; }
.dl-grid span { font-size: 14px; }
.dl-list li b, .dl-steps b { color: var(--ink); }
.dl-steps { list-style: none; padding: 0 !important; counter-reset: dl; display: grid; gap: 12px; }
.dl-steps li { counter-increment: dl; display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; margin: 0; }
.dl-steps li::before { content: counter(dl); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--signal-soft); color: var(--signal); font-weight: 700; font-size: 13.5px; }
.dl-steps li > span { font-size: 14.5px; }
.dl-note { margin-top: 24px; padding: 14px 16px; border-radius: var(--r); background: var(--sunken); font-size: 14px; }
@media (max-width: 640px) { .dl-grid { grid-template-columns: minmax(0, 1fr); } }

/* the PC app's sign-in page (/desktop-login) */
.doc.dlogin { display: grid; place-items: center; padding-top: 6vh; }
.dlogin-card { width: min(440px, 100%); padding: 32px 28px 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); text-align: center; display: grid; justify-items: center; gap: 4px; }
.doc .dlogin-card h1 { font-size: 22px; margin: 16px 0 2px; }
.dlogin-lead { margin: 0 0 14px; font-size: 14.5px; }
.dlogin-who { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); text-align: left; line-height: 1.4; }
.dlogin-who span:last-child { display: grid; min-width: 0; }
.dlogin-who b { color: var(--ink); }
.dlogin-who small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.dlogin-device { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.dlogin-acts { display: flex; gap: 10px; justify-content: center; margin-top: 18px; width: 100%; }
.dlogin-acts .btn { flex: 1; justify-content: center; }
.dlogin-card .form-error { margin-top: 10px; }
.dlogin-note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.dlogin-note:empty { display: none; }
.notfound { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }
.sprite { position: absolute; }
.notfound .code404 { margin-top: 28px;  font: 800 clamp(72px, 14vw, 128px)/1 var(--font); letter-spacing: -0.06em; background: linear-gradient(180deg, var(--ink), var(--muted)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notfound p { color: var(--ink-2); margin: 10px 0 24px; }

/* ---------- phones and touch screens */
/* iOS zooms the page into any field whose text is under 16px; keep them at 16 on touch screens. */
@media (pointer: coarse), (max-width: 880px) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea,
  .composer textarea, .login-card input[type=email], .login-card input[type=password], .login-card input[type=text],
  .model-pick select, .side-search input, .order-opts input, .key-form input, .rename, .edit-box textarea { font-size: 16px; }
}
@media (max-width: 640px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { padding: 14px; }
  .metric .value { font-size: 24px; }
  .page-head h1 { font-size: 23px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }

  /* wide tables become one card per row, each cell labelled */
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.grid tr:last-child { border-bottom: 0; }
  table.grid td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; white-space: normal; }
  table.grid td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12.5px; text-align: left; }
  table.grid td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  table.grid td:first-child::before, table.grid td[data-label=""]::before { content: none; }
  table.grid td.actions, table.grid td:has(> .user-actions) { justify-content: flex-start; text-align: left; padding-top: 8px; }
  table.grid td.empty-row { display: block; text-align: center; }
  table.grid td.empty-row::before { content: none; }
  table.grid .clip { max-width: 60vw; }
  .user-actions { flex-wrap: wrap; justify-content: flex-start; }
  .card.scroll-x { overflow-x: visible; }

  .two-col { gap: 14px; }
}

/* ---------- a provider's model checklist (AI keys + models page) */
/* AI keys + models page: company tiles, the open company's keys, the order */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.prov-tile { display: grid; align-content: start; gap: 6px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.prov-tile.open { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.prov-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.prov-top b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 4px; }
.key-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.key-main { display: grid; gap: 4px; min-width: 0; }
.key-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.key-acts { display: flex; gap: 6px; }
.key-form { display: flex; flex-wrap: wrap; gap: 8px; }
.key-form input { flex: 1 1 200px; min-width: 0; }
.key-form input[aria-label="키 이름"] { flex: 0 1 160px; }
.order-row { border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: 0; }
.order-main { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 10px 8px 14px; }
.order-main .idx { font: 500 12px/1 var(--mono); color: var(--muted); text-align: right; }
.order-name { display: grid; gap: 2px; min-width: 0; }
.order-name > .mono { font-size: 13.5px; overflow-wrap: anywhere; }
.order-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.order-sub .tag { margin-left: 0; }
.order-sub .badge { font-size: 12px; }
.order-row.off .order-name { opacity: .6; }
.order-acts { display: flex; align-items: center; }
.order-acts .icon-btn { font-size: 15px; }
.order-acts .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.order-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; padding: 2px 18px 14px 52px; }
.order-opts .field.grow { flex: 1 1 240px; }
.order-opts input[type=number] { width: 110px; }
.order-opts .hint { flex-basis: 100%; }
.add-box { border-bottom: 1px solid var(--line); }
.add-head { padding: 12px 18px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.prov-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; }
.pill:hover { color: var(--ink); }
.pill.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); font-weight: 650; }
@media (max-width: 640px) {
  .prov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .prov-tile { padding: 12px; }
  .prov-top { flex-direction: column; align-items: flex-start; gap: 4px; }
  .order-main { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 4px 8px 8px; }
  .order-acts .icon-btn.sm { width: 30px; }
  .order-opts { padding: 2px 14px 14px; }
  .key-row { padding: 12px 14px; }
}
@media (max-width: 380px) { .prov-grid { grid-template-columns: minmax(0, 1fr); } }
.picker { border-bottom: 1px solid var(--line); background: var(--panel-2); }
.picker-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.picker-bar input[type=search] { flex: 1 1 220px; }
.picker .model-list { max-height: 420px; background: var(--panel); }
.model-item.pick { justify-content: flex-start; gap: 12px; cursor: pointer; }
.model-item.pick:hover { background: var(--panel-2); }
.model-item.pick input { flex: none; width: 17px; height: 17px; accent-color: var(--signal); }
.model-item.used { cursor: default; opacity: .65; }
.model-item.used:hover { background: none; }
.picker-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel); }
@media (max-width: 640px) { .picker-bar, .picker-foot { padding: 12px 14px; } .picker .model-list { max-height: 55vh; } }

.tag.warn { color: var(--danger-ink); background: color-mix(in srgb, var(--warning) 22%, transparent); }

/* shared conversation page (/s/<token>) */
.shared { min-height: 100vh; background: var(--bg); }
.shared-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.shared-title { max-width: 780px; margin: 0 auto; padding: 30px 20px 0; }
.shared-title h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.shared-title p { margin: 0; color: var(--muted); font-size: 13.5px; }
.shared-foot { display: grid; justify-items: center; gap: 12px; max-width: 780px; margin: 0 auto; padding: 8px 20px 56px; color: var(--muted); font-size: 13px; text-align: center; }
.shared-foot p { margin: 0; }
.shared-empty { min-height: 85vh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 20px; text-align: center; }
.shared-empty h1 { margin: 8px 0 0; font-size: 22px; }
.shared-empty p { margin: 0; color: var(--muted); }
.share-points { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; line-height: 1.75; }
.modal-actions.wrap { flex-wrap: wrap; }
.chat-item .shared-mark { display: inline-flex; margin-right: 5px; color: var(--muted); vertical-align: -2px; }
.chat-item .shared-mark .ic { width: 13px; height: 13px; }

/* thinking mode */
.think-toggle[aria-pressed="true"] { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.drafts .draft { padding: 10px 0 4px; border-top: 1px solid var(--line); }
.drafts .draft:first-of-type { border-top: 0; }
.drafts .draft-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.drafts .draft-head span { font-weight: 500; color: var(--muted); }
.drafts .md { font-size: 13.5px; color: var(--ink-2); }

/* ---------- 내 PC (inside the pitch AI PC app): the switch, the folder, and the steps of a job */
.pc-folder { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 220px; padding: 0 11px 0 9px; border: 1px dashed var(--line-strong); border-radius: 999px; background: transparent; color: var(--ink-2); font: 12.5px var(--mono); cursor: pointer; }
.pc-folder:hover { border-color: var(--signal); color: var(--ink); }
.pc-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-folder .ic { width: 15px; height: 15px; flex: none; color: var(--signal); }
.pc-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; } /* (a long code line scrolls in its block, not the page) */
.pc-steps > .md > :last-child { margin-bottom: 0; }
.pc-tool { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.pc-tool > summary { list-style: none; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 7px 12px; cursor: pointer; font-size: 13.5px; }
.pc-tool > summary::-webkit-details-marker { display: none; }
.pc-tool > summary:hover { background: var(--panel-2); }
.pc-tool > summary > .ic { flex: none; width: 16px; height: 16px; color: var(--ink-2); }
.pc-tool b { font-weight: 650; white-space: nowrap; }
.pc-detail { flex: 1; min-width: 0; font: 12px var(--mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-ms { flex: none; font: 11.5px var(--mono); color: var(--muted); }
.pc-mark { flex: none; width: 18px; height: 18px; display: grid; place-items: center; }
.pc-mark .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.pc-tool.ok .pc-mark { color: var(--good); }
.pc-tool.bad { border-color: color-mix(in srgb, var(--critical) 35%, var(--line)); }
.pc-tool.bad .pc-mark { color: var(--critical); }
.pc-tool.denied .pc-mark, .pc-tool.denied b, .pc-tool.denied .pc-detail { color: var(--muted); }
.pc-tool.denied b, .pc-tool.denied .pc-detail { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.pc-tool.ask { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.pc-tool.ask .pc-mark, .pc-tool.ask .pc-ms { color: var(--signal); }
.pc-mark .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--signal); animation: pc-spin .8s linear infinite; }
@keyframes pc-spin { to { transform: rotate(360deg); } }
.pc-tool-body { border-top: 1px solid var(--line); padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--panel-2); min-width: 0; }
.pc-tool-body .md { font-size: 14px; }
.pc-tool-body .md .code { margin: 0; }
.pc-tool-body .md pre { max-height: 300px; overflow: auto; }
.pc-out { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 340px; overflow: auto; color: var(--ink-2); }
.pc-tool.bad .pc-out { color: var(--danger-ink); }
.pc-diff { border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 300px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }
.pc-diff div { padding: 0 10px; }
.pc-diff .del { background: color-mix(in srgb, var(--critical) 12%, transparent); }
.pc-diff .add { background: color-mix(in srgb, var(--good) 14%, transparent); }
.pc-ask { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 600; color: var(--signal); }
.pc-ask .ic { width: 16px; height: 16px; }
.pc-where { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font: 11.5px var(--mono); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-where .ic { width: 13px; height: 13px; flex: none; }
@media (max-width: 600px) { .pc-folder { max-width: 120px; } .pc-detail { display: none; } }

/* ---------- inside the PC app: the 채팅 / 작업 tabs, where 작업 runs, find, right-click */
.mode-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 -2px; }
.nav-arrows { display: flex; gap: 2px; }
.nav-arrows .icon-btn { color: var(--muted); }
.nav-arrows .icon-btn:hover { color: var(--ink); }
.mode-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); }
.mode-switch button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; }
.mode-switch button .ic { width: 15px; height: 15px; }
.mode-switch button:hover { color: var(--ink); }
.mode-switch button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.mode-switch button[data-mode="work"][aria-selected="true"] .ic { color: var(--signal); }
.env-wrap { margin-top: -2px; }
.env-pick { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.env-pick:hover { border-color: var(--line-strong); }
.env-pick > .ic { width: 18px; height: 18px; color: var(--signal); flex: none; }
.env-pick .chev { width: 15px; height: 15px; color: var(--muted); }
.env-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.env-text b { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-text small { font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-wrap .menu { left: 0; right: 0; }
.env-warn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; padding: 10px 14px; border-radius: 12px; background: var(--signal-soft); color: var(--ink); font-size: 14px; }
.env-warn .ic { width: 17px; height: 17px; color: var(--signal); }
.work-mark { display: inline-grid; place-items: center; margin-right: 6px; vertical-align: -2px; color: var(--muted); }
.work-mark .ic { width: 14px; height: 14px; }
.ctx-menu { position: fixed; top: 0; left: 0; right: auto; min-width: 200px; }
.find-bar { position: absolute; z-index: 30; top: 66px; right: 20px; display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, .16); }
.find-bar input { width: 200px; height: 30px; padding: 0 8px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; outline: 0; }
.find-count { min-width: 44px; font: 12px var(--mono); color: var(--muted); text-align: right; }
.chat-view { position: relative; }
@media (max-width: 720px) { .mode-switch button span { display: none; } .find-bar { right: 10px; left: 10px; } .find-bar input { flex: 1; width: auto; } }

/* the work log: many tool cards folded into one scrolling, collapsible box */
.pc-log { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.pc-log > summary { list-style: none; display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; }
.pc-log > summary::-webkit-details-marker { display: none; }
.pc-log > summary:hover { background: var(--panel-2); }
.pc-log > summary > .ic { width: 16px; height: 16px; color: var(--signal); flex: none; }
.pc-log > summary .pc-detail { flex: 1; }
.pc-log > summary .chev { width: 15px; height: 15px; color: var(--muted); transition: transform .15s; }
.pc-log[open] > summary .chev { transform: rotate(180deg); }
.pc-log-body { max-height: 300px; overflow-y: auto; border-top: 1px solid var(--line); padding: 8px; display: grid; gap: 6px; background: var(--panel-2); }
.pc-log-body .pc-tool { background: var(--panel); }

/* SSH folder browser */
.folder-modal { width: min(520px, calc(100vw - 32px)); }
.folder-path { font: 12px var(--mono); color: var(--ink-2); background: var(--sunken); border-radius: 8px; padding: 8px 10px; margin: 4px 0 10px; word-break: break-all; }
.folder-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.folder-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.folder-row:hover { background: var(--sunken); }
.folder-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-row .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.folder-row .ic:first-child { color: var(--signal); }
.folder-row.up { color: var(--ink-2); }
