:root {
  --bg: #14161c; --panel: #1c1f27; --panel2: #242833; --line: #2f3442; --text: #eceef3; --dim: #9aa1b2;
  --accent: #c6f432; --accent-ink: #14161c; --warn: #ffb84d; --bad: #ff6b6b; --ok: #5ee39a;
  --r: 14px; --nav: 62px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 40px; text-align: center; color: var(--dim); }

/* 틀 */
.shell { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 17px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 26px; height: 26px; }
.main { flex: 1; overflow-y: auto; padding: 14px 16px 20px; }
.nav { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: var(--panel);
  height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--dim); text-decoration: none; font-size: 12px; position: relative; }
.nav a .i { font-size: 20px; line-height: 1; }
.nav a.on { color: var(--accent); }
.badge { position: absolute; top: 6px; left: 54%; background: var(--warn); color: #000; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; }

/* 공통 */
.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--panel2); cursor: pointer; }
.btn.p { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.bad { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.muted { color: var(--dim); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.field { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin: 4px 0 10px; }
.field:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.empty { text-align: center; color: var(--dim); padding: 30px 10px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
.tag { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--dim); }

/* 로그인 */
.auth { max-width: 380px; margin: 10vh auto; padding: 0 20px; }
.auth h1 { font-size: 24px; margin: 12px 0 4px; }

/* 대화 */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.tool { align-self: flex-start; font-size: 13px; color: var(--dim); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.tool .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.tool.failed .dot { background: var(--bad); }
.tool.rejected .dot { background: var(--dim); }
.tool-detail { font-size: 12px; color: var(--dim); background: var(--panel); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; margin-top: -4px; max-height: 220px; overflow: auto; }
.approve { align-self: stretch; border: 1px solid var(--warn); background: #2a2416; border-radius: var(--r); padding: 12px; }
.approve .t { font-size: 12px; color: var(--warn); font-weight: 700; margin-bottom: 6px; }
.approve .s { white-space: pre-wrap; margin-bottom: 10px; }
.approve.done { border-color: var(--line); background: var(--panel); }
.thinking { align-self: flex-start; color: var(--dim); font-size: 14px; }
.thinking::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { flex: 1; resize: none; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-height: 140px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggest button { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.convs .card { cursor: pointer; display: flex; gap: 10px; align-items: center; }

/* 목록 */
.list .card { display: flex; gap: 10px; align-items: flex-start; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--panel2); }
.status.done { color: var(--ok); } .status.failed { color: var(--bad); } .status.pending { color: var(--warn); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 20px); transform: translateX(-50%); background: #000; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 9; }

/* 시작 고르기 · 음성 */
.start { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.start .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; font-size: 15px; }
.start .btn .i { font-size: 26px; }
.voicebar { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 16px 10px; border-top: 1px solid var(--line); }
.mic { width: 76px; height: 76px; border-radius: 50%; border: 0; font-size: 30px; background: var(--accent); cursor: pointer; transition: transform .15s; }
.mic:disabled { opacity: .4; }
.mic.listen { background: var(--bad); animation: pulse 1.2s infinite; }
.mic.think { background: var(--panel2); }
.mic.speak { background: var(--ok); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,107,107,.6); } 100% { box-shadow: 0 0 0 18px rgba(255,107,107,0); } }
.vstat { font-size: 14px; color: var(--dim); text-align: center; min-height: 1.5em; max-width: 100%; }
.hf { display: flex; align-items: center; gap: 4px; }
