[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-size: 15px; color: #191919; background: #fff; }
#app { height: 100dvh; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; background: #fff; }
.view.on { display: flex; }

/* 로그인 */
#v-login { justify-content: center; align-items: center; background: #fee500; }
.login-box { width: 80%; max-width: 320px; text-align: center; }
.logo { font-size: 56px; }
.login-box h1 { margin: 8px 0 4px; font-size: 24px; }
.sub { color: #555; margin: 0 0 20px; }
.login-box input { width: 100%; padding: 14px; border: 0; border-radius: 6px; font-size: 16px; margin-bottom: 10px; }
.login-box button { width: 100%; padding: 14px; border: 0; border-radius: 6px; background: #3c1e1e; color: #fff; font-size: 16px; }
.err { color: #c00; min-height: 1.2em; }

/* 상단 바 */
.bar { display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 12px; padding-top: env(safe-area-inset-top); border-bottom: 1px solid #eee; background: #fff; flex: none; }
.bar h2 { margin: 0; font-size: 18px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { border: 0; background: none; font-size: 30px; line-height: 1; padding: 0 8px 4px 0; color: #191919; }
.conn { font-size: 12px; color: #999; }
.conn.ok { color: #2a9d4b; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.list li:active { background: #f4f4f4; }
.avatar { width: 48px; height: 48px; border-radius: 18px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #fff; position: relative; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; background: #bbb; }
.avatar .dot.on { background: #2ecc71; }
.li-body { flex: 1; min-width: 0; overflow: hidden; }
.li-top { display: flex; align-items: center; gap: 6px; }
.li-title { flex: 0 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { color: #888; font-size: 13px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.li-right { text-align: right; font-size: 11px; color: #aaa; flex: none; align-self: flex-start; padding-top: 4px; }
.badge { font-size: 10px; padding: 1px 5px; border-radius: 8px; background: #eee; color: #666; flex: none; }
.badge.busy { background: #ff5a4e; color: #fff; }
.badge.phone { background: #fee500; color: #3c1e1e; }
.empty { color: #aaa; text-align: center; padding: 40px 0; cursor: default !important; justify-content: center; }

/* 대화창 */
.chat { background: #b2c7d9; }
.chat .bar { background: #b2c7d9; border-bottom: 0; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { font-size: 16px; }
#chat-sub { font-size: 11px; color: #4b5a68; }
#chat-scroll { flex: 1; overflow-y: auto; padding: 8px 10px 12px; overscroll-behavior: contain; }
.more { display: block; margin: 4px auto 10px; border: 0; background: rgba(0,0,0,.15); color: #fff; border-radius: 12px; padding: 5px 12px; font-size: 12px; }
.msg { display: flex; margin: 6px 0; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 82%; padding: 8px 11px; border-radius: 14px; background: #fff; line-height: 1.45; word-break: break-word; overflow-x: auto; }
.msg.user .bubble { background: #fee500; border-top-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { border-top-left-radius: 4px; }
.msg .time { align-self: flex-end; font-size: 10px; color: #556; margin: 0 5px; flex: none; }
.msg.tool { margin: 2px 0 2px 6px; }
.tool-line { font-size: 12px; color: #3f4f5e; font-family: Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; opacity: .85; }
.day { text-align: center; margin: 14px 0 8px; }
.day span { background: rgba(0,0,0,.12); color: #fff; font-size: 11px; border-radius: 10px; padding: 3px 10px; }
.bubble pre { background: #f3f3f3; padding: 8px; border-radius: 6px; overflow-x: auto; font-size: 12px; margin: 6px 0; white-space: pre; }
.bubble code { font-family: Consolas, monospace; font-size: 12.5px; background: #f1f1f1; padding: 0 3px; border-radius: 3px; }
.bubble pre code { background: none; padding: 0; }
.bubble table { border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.bubble th, .bubble td { border: 1px solid #ddd; padding: 3px 6px; vertical-align: top; }
.bubble th { background: #f6f6f6; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 15px; margin: 8px 0 4px; }
.bubble p { margin: 4px 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 20px; }
.typing { display: inline-flex; gap: 4px; background: #fff; padding: 10px 12px; border-radius: 14px; margin: 6px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #aaa; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

#composer { display: flex; gap: 6px; padding: 6px 8px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); background: #fff; flex: none; }
#msg { flex: 1; resize: none; border: 0; outline: 0; font: inherit; padding: 9px 4px; max-height: 120px; }
#btn-send { border: 0; background: #fee500; border-radius: 6px; padding: 0 14px; font-weight: 600; }
#btn-send:disabled { opacity: .4; }
.readonly { background: #fff; color: #888; text-align: center; font-size: 13px; padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); flex: none; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; padding: 8px 14px; border-radius: 16px; font-size: 13px; z-index: 10; max-width: 86%; text-align: center; }

/* 새 대화 버튼·시트 */
.fab { position: absolute; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: #fee500; color: #3c1e1e; font-size: 28px; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; z-index: 5; }
.sheet-box { background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-box h3 { margin: 0 0 12px; }
.sheet-box label { display: block; font-size: 12px; color: #888; margin: 10px 0 4px; }
.sheet-box select, .sheet-box textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid #ddd; border-radius: 8px; background: #fff; }
.sheet-btns { display: flex; gap: 8px; margin-top: 14px; }
.sheet-btns button { flex: 1; padding: 13px; border: 0; border-radius: 8px; background: #fee500; font-weight: 600; font-size: 15px; }
.sheet-btns .ghost { background: #eee; font-weight: 400; }
#btn-stop { border: 0; background: #ff5a4e; color: #fff; border-radius: 6px; padding: 0 14px; font-weight: 600; }
.msg.system { justify-content: center; }
.msg.system .note { background: rgba(0,0,0,.18); color: #fff; font-size: 12px; border-radius: 10px; padding: 5px 10px; max-width: 90%; white-space: pre-wrap; }
.msg.user.pending .bubble { opacity: .6; }

/* 질문 카드 */
.card { background: #fff; border-radius: 14px; padding: 12px; margin: 10px 0; border: 2px solid #fee500; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.card .ct { font-weight: 700; margin-bottom: 6px; }
.card .cs { font-size: 13px; color: #444; word-break: break-all; }
.card pre { background: #f5f5f5; font-size: 11.5px; padding: 6px; border-radius: 6px; max-height: 140px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 6px 0; }
.card .q { margin: 10px 0 4px; } .card .qh { font-size: 11px; color: #888; } .card .qt { font-weight: 600; margin: 2px 0 6px; }
.card .opt { display: block; width: 100%; text-align: left; border: 1px solid #ddd; background: #fafafa; border-radius: 10px; padding: 9px 10px; margin: 5px 0; font: inherit; }
.card .opt small { display: block; color: #888; font-size: 11.5px; margin-top: 2px; }
.card .opt.sel { border-color: #3c1e1e; background: #fff8b0; }
.card input.other { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 8px; font: inherit; margin-top: 4px; }
.card .cb { display: flex; gap: 8px; margin-top: 10px; }
.card .cb button { flex: 1; padding: 11px; border: 0; border-radius: 8px; font-weight: 600; font-size: 14px; }
.card .ok { background: #fee500; } .card .no { background: #eee; }
.badge.need { background: #3c1e1e; color: #fee500; }
.del { border: 0; background: #eee; color: #c33; border-radius: 6px; padding: 6px 10px; font-size: 12px; flex: none; }
.apk-link { display: block; margin-top: 18px; color: #3c1e1e; font-size: 14px; }
.apk-top { font-size: 12px; background: #fee500; color: #3c1e1e; border-radius: 12px; padding: 4px 10px; text-decoration: none; margin-right: 6px; flex: none; }
