/* 디자인 규칙: DESIGN.md(apple) 중 적용 항목
   - 단일 강조색 Action Blue, 잉크 #1d1d1f, 파치먼트 #f5f5f7, 헤어라인 rgba(0,0,0,.08)
   - 크롬(버튼·카드)에 그라데이션·그림자 없음, 누르면 scale(.95)
   - 본문 17px · 굵기 400/600 만 사용 · 큰 제목만 음수 자간
   - 주요 버튼은 pill, 터치 영역 44px 이상
   apple-design 스킬: 반투명 바(콘텐츠가 아래로 흐름), 드래그로 닫는 시트, 가장자리 스와이프 뒤로가기 */
:root {
  --accent: #0071e3;
  --accent-text: #0066cc;
  --me: #0071e3;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #aeaeb2;
  --bg: #ffffff;
  --parchment: #f5f5f7;
  --card: #ffffff;
  --them: #e9e9eb;
  --bar: rgba(250, 250, 252, 0.78);
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-2: rgba(0, 0, 0, 0.08);
  --red: #e30000;
  --green: #1a8a3a;
  --orange: #c25e00;
  --scrim: rgba(0, 0, 0, 0.32);
  --code: rgba(0, 0, 0, 0.06);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bar-h: 52px;
  --tab-h: 50px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2997ff;
    --accent-text: #2997ff;
    --me: #0071e3;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #636366;
    --bg: #000000;
    --parchment: #000000;
    --card: #1c1c1e;
    --them: #262628;
    --bar: rgba(22, 22, 24, 0.76);
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.16);
    --fill: rgba(255, 255, 255, 0.08);
    --fill-2: rgba(255, 255, 255, 0.12);
    --red: #ff453a;
    --green: #30d158;
    --orange: #ff9f0a;
    --scrim: rgba(0, 0, 0, 0.55);
    --code: rgba(255, 255, 255, 0.1);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.47 system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
img { display: block; }

/* 누르는 즉시 반응 (pointer-down) */
.press { transition: transform 100ms ease-out, opacity 100ms; }
.press:active { transform: scale(0.95); }

/* ── 공용 버튼 ───────────────────────────── */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: #fff; }
.pill.ghost { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px currentColor; }
.pill.small { min-height: 32px; padding: 0 14px; font-size: 14px; }
.pill:disabled { opacity: 0.4; pointer-events: none; }
.link { color: var(--accent-text); min-height: 44px; display: inline-flex; align-items: center; }
.link:disabled { color: var(--ink-3); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent-text); border-radius: 50%; }

/* ── 로그인 ──────────────────────────────── */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--parchment); }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-icon { border-radius: 18px; }
.login-card h1 { margin: 10px 0 0; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.14; }
.login-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.field { width: 100%; padding: 0 20px; height: 44px; border-radius: 999px; border: 0; background: var(--card); color: var(--ink); outline: none; box-shadow: inset 0 0 0 1px var(--hairline-strong); font-size: 17px; }
.field:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.login-card .pill { width: 100%; }
.login-error { color: var(--red) !important; min-height: 1.4em; font-size: 14px !important; }

/* ── 레이아웃 ─────────────────────────────── */
.app { position: fixed; inset: 0; display: flex; height: 100dvh; }
.side { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--bg); width: 100%; min-width: 0; }
.tab-view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.chat-pane { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--bg); width: 100%; min-width: 0; }

@media (max-width: 759px) {
  .chat-pane { position: absolute; inset: 0; transform: translateX(100%); transition: transform 0.42s var(--ease); z-index: 3; }
  .app.in-chat .chat-pane { transform: translateX(0); }
  .side { transition: transform 0.42s var(--ease), filter 0.42s var(--ease); }
  .app.in-chat .side { transform: translateX(-25%); filter: brightness(0.92); }
  .app.dragging .chat-pane, .app.dragging .side { transition: none; }
  .empty-chat { display: none !important; }
}
@media (min-width: 760px) {
  .side { width: 360px; flex: none; border-right: 1px solid var(--hairline); }
  .chat-pane { flex: 1; }
  .back-btn { visibility: hidden; }
  .app:not(.in-chat) .chat-pane > :not(.empty-chat) { visibility: hidden; }
  .app.in-chat .empty-chat { display: none; }
}
.empty-chat { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); pointer-events: none; text-align: center; }

/* ── 반투명 바 ────────────────────────────── */
.bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding-top: var(--safe-t);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.bar.scrolled, .chat-bar { border-bottom-color: var(--hairline); }
.nav-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: calc(var(--bar-h) + var(--safe-t)); padding: var(--safe-t) 8px 0 16px; }
.nav-bar .bar-title { margin: 0; font-size: 17px; font-weight: 600; opacity: 0; transition: opacity 0.2s; }
.nav-bar.scrolled .bar-title { opacity: 1; }
.nav-bar .left { justify-self: start; }
.nav-bar .right { justify-self: end; display: flex; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: calc(var(--bar-h) + var(--safe-t)); padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); overscroll-behavior: contain; }
.large-title { margin: 2px 16px 10px; font-size: 34px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.15; }

/* 탭 바 */
.tab-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--safe-b); height: calc(var(--tab-h) + var(--safe-b));
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hairline);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--ink-3); position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--accent); }
.tab .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; padding: 0 5px; }

/* ── 목록 행 ─────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.row-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 10px 16px 10px 12px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.row-item:active { background: var(--fill); }
.row-item.active { background: var(--fill-2); }
.row-item .body { min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--hairline); padding: 2px 0 12px; margin-bottom: -10px; }
.row-item:last-child .body { border-bottom: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { color: var(--ink-2); font-size: 15px; flex: none; }
.row-sub { color: var(--ink-2); font-size: 15px; line-height: 1.33; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 1px; }
.row-sub.one { -webkit-line-clamp: 1; }
.row-sub.live { color: var(--accent-text); }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--ink-2); margin-left: 6px; vertical-align: 2px; }
.tag.meeting { color: var(--accent-text); }
.dot-unread { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 4px; }

/* ── 아바타 ──────────────────────────────── */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: none; color: #fff; font-weight: 600; background: var(--c, #8e8e93); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 22px; height: 22px; font-size: 11px; }
.avatar.sm { width: 28px; height: 28px; font-size: 14px; }
.avatar.lg { width: 52px; height: 52px; font-size: 26px; }
.avatar.xl { width: 96px; height: 96px; font-size: 46px; }
.avatar-group { position: relative; width: 52px; height: 52px; flex: none; }
.avatar-group .avatar { position: absolute; width: 34px; height: 34px; font-size: 17px; box-shadow: 0 0 0 2px var(--bg); }
.avatar-group .avatar:nth-child(1) { left: 0; top: 0; }
.avatar-group .avatar:nth-child(2) { right: 0; bottom: 0; }
.avatar-group .avatar:nth-child(3) { right: 0; top: 0; width: 22px; height: 22px; font-size: 11px; }

/* ── 대화 상단 ────────────────────────────── */
.chat-bar { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; padding-bottom: 6px; }
.back-btn { color: var(--accent-text); display: flex; align-items: center; gap: 4px; height: 44px; padding-left: 10px; }
.back-badge { background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.chat-head { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 6px; min-width: 0; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 38px; height: 38px; font-size: 19px; box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar + .avatar { margin-left: -10px; }
.chat-name { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-name .chev { color: var(--ink-3); font-weight: 400; }
.chat-sub { font-size: 11px; color: var(--ink-2); min-height: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub.live { color: var(--accent-text); }
.stop-btn { color: var(--red); justify-self: end; margin-right: 12px; }

/* ── 메시지 ──────────────────────────────── */
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: calc(var(--bar-h) + var(--safe-t) + 46px) 0 12px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.stamp { text-align: center; font-size: 11px; color: var(--ink-2); margin: 16px 0 6px; }
.stamp b { font-weight: 600; }
.msg { display: flex; align-items: flex-end; gap: 8px; padding: 0 14px; margin-top: 2px; }
.msg.me { justify-content: flex-end; }
.msg.them { padding-left: 10px; }
.msg.first { margin-top: 10px; }
.msg .avatar-slot { width: 28px; flex: none; }
.col { display: flex; flex-direction: column; max-width: min(78%, 580px); min-width: 0; }
.msg.me .col { align-items: flex-end; }
.sender { font-size: 11px; color: var(--ink-2); margin: 0 0 2px 13px; }
.sender .role { color: var(--ink-3); }
.sched-label { font-size: 11px; color: var(--ink-2); margin: 0 4px 2px 0; }

.bubble { position: relative; padding: 7px 13px 8px; border-radius: 18px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; max-width: 100%; }
.bubble.enter { animation: pop 0.3s var(--ease); }
@keyframes pop { from { transform: translateY(8px) scale(0.97); opacity: 0; } }
.msg.me .bubble { background: var(--me); color: #fff; }
.msg.them .bubble { background: var(--them); color: var(--ink); }
.msg.tail .bubble::before, .msg.tail .bubble::after { content: ''; position: absolute; bottom: 0; height: 20px; }
.msg.me.tail .bubble::before { right: -7px; width: 20px; background: var(--me); border-bottom-left-radius: 16px 14px; }
.msg.me.tail .bubble::after { right: -10px; width: 10px; background: var(--bg); border-bottom-left-radius: 10px; }
.msg.them.tail .bubble::before { left: -7px; width: 20px; background: var(--them); border-bottom-right-radius: 16px 14px; }
.msg.them.tail .bubble::after { left: -10px; width: 10px; background: var(--bg); border-bottom-right-radius: 10px; }
.bubble.emoji-only { background: none !important; font-size: 44px; padding: 0 2px; line-height: 1.1; }
.bubble.emoji-only::before, .bubble.emoji-only::after { display: none; }

.bubble p { margin: 0; }
.bubble > * + * { margin-top: 8px; }
.bubble ul, .bubble ol { margin-bottom: 0; padding-left: 22px; }
.bubble li + li { margin-top: 2px; }
.bubble h4 { margin: 10px 0 2px; font-size: 17px; font-weight: 600; }
.bubble h4:first-child { margin-top: 0; }
.bubble code { font: 14px/1.4 ui-monospace, "SF Mono", Menlo, monospace; background: var(--code); padding: 1px 5px; border-radius: 5px; }
.bubble pre { background: var(--code); padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin-left: -4px; margin-right: -4px; }
.bubble pre code { background: none; padding: 0; white-space: pre; font-size: 13px; }
.bubble blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--ink-3); }
.bubble a { color: inherit; text-decoration: underline; }
.msg.them .bubble a { color: var(--accent-text); }
.bubble hr { border: 0; border-top: 1px solid var(--hairline-strong); }
.bubble table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--hairline-strong); padding: 3px 7px; text-align: left; }
.bubble th { font-weight: 600; }

/* 회의록 카드 */
.bubble.minutes { background: var(--card) !important; box-shadow: inset 0 0 0 1px var(--hairline-strong); padding: 12px 14px; }
.msg.them.tail .bubble.minutes::before, .msg.them.tail .bubble.minutes::after { display: none; }
.minutes-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.task-check { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 6px 0; min-height: 36px; }
.task-check + .task-check { border-top: 1px solid var(--hairline); }
.task-check .check { margin-top: 2px; }
.task-check.done .t { text-decoration: line-through; color: var(--ink-3); }
.task-check .t small { display: block; color: var(--ink-2); font-size: 13px; }

.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; margin: 4px 0 0 13px; padding: 2px 8px; border-radius: 10px; background: var(--fill); }
.chip.pass, .chip.agree { color: var(--green); }
.chip.revise, .chip.disagree { color: var(--orange); }
.meta { font-size: 11px; color: var(--ink-3); margin: 3px 13px 0; display: none; }
.col.show-meta .meta { display: block; }
.delivered { font-size: 11px; color: var(--ink-2); margin: 3px 4px 0 0; }

.sys { align-self: center; max-width: 86%; text-align: center; font-size: 12px; color: var(--ink-2); margin: 12px 20px 4px; line-height: 1.4; }
.sys.error { color: var(--red); }
.sys.pass { color: var(--green); font-weight: 600; }
.sys.limit { color: var(--orange); }
.sys.meeting-start { color: var(--accent-text); font-weight: 600; }
.sys.memory::before { content: '🧠 '; }

.typing-bubble { display: inline-flex; gap: 4px; padding: 12px 14px !important; }
.typing-bubble span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); opacity: 0.4; animation: blink 1.3s infinite; }
.typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 0.9; transform: translateY(-2px); } }

.jump-btn { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 4; background: var(--card); color: var(--accent-text); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--hairline-strong); }

/* ── 입력창 ──────────────────────────────── */
.composer { flex: none; padding: 6px 12px calc(8px + var(--safe-b)); background: var(--bg); }
.composer-field { display: flex; align-items: flex-end; border-radius: 20px; box-shadow: inset 0 0 0 1px var(--hairline-strong); padding: 3px 3px 3px 14px; }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; font-size: 17px; line-height: 22px; padding: 5px 0; max-height: 160px; min-height: 32px; }
.composer textarea::placeholder { color: var(--ink-3); }
.send-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; flex: none; margin-left: 6px; transition: transform 0.15s, opacity 0.15s; }
.send-btn:disabled { opacity: 0; transform: scale(0.6); pointer-events: none; }
.quick-bar { display: flex; gap: 6px; padding: 6px 2px 0; overflow-x: auto; scrollbar-width: none; }
.quick-bar::-webkit-scrollbar { display: none; }
.quick-bar:empty { display: none; }
.quick-bar button { font-size: 13px; min-height: 28px; padding: 0 11px; border-radius: 14px; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.quick-bar button.on { color: #fff; background: var(--accent); }

/* ── 그룹 셀 (설정 스타일) ───────────────── */
.section-label { font-size: 13px; color: var(--ink-2); margin: 22px 32px 7px; }
.section-note { font-size: 13px; color: var(--ink-2); margin: 7px 32px 0; line-height: 1.4; }
.group { background: var(--card); border-radius: 12px; overflow: hidden; margin: 0 16px; box-shadow: inset 0 0 0 1px var(--hairline); }
.sheet .group { margin: 0; }
.sheet .section-label, .sheet .section-note { margin-left: 16px; margin-right: 16px; }
.cell { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 48px; width: 100%; text-align: left; position: relative; }
button.cell:active, .cell.tap:active { background: var(--fill); }
.cell + .cell::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--hairline); }
.cell .grow { flex: 1; min-width: 0; }
.cell .sub { font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.cell .value { color: var(--ink-2); font-size: 15px; text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .chev::after { content: '›'; color: var(--ink-3); font-size: 20px; margin-left: 4px; }
.cell input[type=text], .cell input[type=time], .cell input[type=date], .cell input[type=url], .cell input[type=password] { flex: 1; border: 0; outline: none; background: transparent; min-width: 0; font-size: 17px; }
.cell textarea { flex: 1; border: 0; outline: none; background: transparent; resize: vertical; min-height: 110px; font-size: 15px; line-height: 1.47; }
.cell.danger { color: var(--red); justify-content: center; }
.cell.action { color: var(--accent-text); justify-content: center; }
.check { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3); display: grid; place-items: center; flex: none; }
[aria-checked=true] > .check, .check.on { background: var(--accent); box-shadow: none; }
[aria-checked=true] > .check::after, .check.on::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status-dot.connected { background: var(--green); }
.status-dot.needs-auth { background: var(--orange); }
.status-dot.failed { background: var(--red); }

/* 스위치 */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-2); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.25s var(--ease); }
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }

/* 세그먼트 */
.segmented { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.segmented button { flex: 1; min-height: 30px; border-radius: 7px; font-size: 13px; padding: 0 8px; }
.segmented button.on { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg-wrap { margin: 4px 16px 12px; }

/* 칩 선택 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.chips button { min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--fill); font-size: 14px; }
.chips button.on { background: var(--accent); color: #fff; }

.stepper { display: flex; border-radius: 8px; overflow: hidden; background: var(--fill); }
.stepper button { width: 44px; height: 32px; font-size: 20px; }
.stepper button + button { border-left: 1px solid var(--hairline-strong); }
.stepper-val { min-width: 48px; text-align: right; color: var(--ink-2); }

/* 프로필 */
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; }
.me-card .n { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.me-card .s { font-size: 13px; color: var(--ink-2); }
.avatar-edit { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 12px; }
.avatar-edit .link { min-height: 32px; font-size: 15px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; background: var(--c); }
.swatches button.on { box-shadow: inset 0 0 0 3px var(--parchment), 0 0 0 2px var(--accent); }
.emoji-input { width: 64px; text-align: center; font-size: 22px; border: 0; background: var(--fill); border-radius: 10px; height: 40px; outline: none; }

/* 기억 */
.mem-empty { text-align: center; color: var(--ink-3); padding: 28px 16px; font-size: 15px; }
.due { font-size: 13px; color: var(--ink-2); }
.due.over { color: var(--red); }
.due.soon { color: var(--orange); }
.proj-status { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.proj-status.on { color: var(--accent-text); }
.url-box { font: 14px ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; color: var(--accent-text); }

/* ── 바텀 시트 ───────────────────────────── */
.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; animation: fade 0.3s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; margin: 0 auto; width: min(600px, 100%);
  max-height: calc(100dvh - var(--safe-t) - 24px); display: flex; flex-direction: column;
  background: var(--parchment); border-radius: 14px 14px 0 0; animation: up 0.45s var(--ease);
}
@media (prefers-color-scheme: dark) { .sheet { background: #1c1c1e; } .sheet .group { background: #2c2c2e; box-shadow: none; } .side .group { box-shadow: none; } }
@keyframes up { from { transform: translateY(100%); } }
.sheet-grip { padding: 7px 0 3px; cursor: grab; touch-action: none; }
.sheet-grip::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--ink-3); margin: 0 auto; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px 8px; touch-action: none; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head .l { justify-self: start; padding: 0 8px; }
.sheet-head .r { justify-self: end; padding: 0 8px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(28px + var(--safe-b)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; z-index: 40; font-size: 14px; max-width: calc(100% - 32px); animation: fade 0.2s; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .bar, .tab-bar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ── 페르소나 추가 UI ─────────────────────────── */
.chat-actions { display: flex; justify-content: flex-end; align-items: center; margin-right: 4px; }
.chat-actions .stop-btn { margin-right: 0; }
.add-ai-btn { color: var(--accent-text); }
.create-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; }
.create-card .plus { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; }
.create-card .n { font-size: 17px; font-weight: 600; color: var(--accent-text); }
.create-card .s { font-size: 13px; color: var(--ink-2); }
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 16px; }
.tpl-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--hairline); text-align: left; min-height: 132px; }
.tpl-card .t { font-size: 16px; font-weight: 600; }
.tpl-card .d { font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.tpl-card.blank { justify-content: center; align-items: center; text-align: center; color: var(--accent-text); box-shadow: inset 0 0 0 1.5px var(--hairline-strong); }
.tpl-card.blank .t { color: var(--accent-text); }
.member-pill { font-size: 12px; color: var(--ink-2); background: var(--fill); border-radius: 999px; padding: 2px 8px; margin: 4px 4px 0 0; display: inline-block; }
.cell .add { color: var(--accent-text); font-size: 15px; font-weight: 600; flex: none; }
.cell .remove { color: var(--red); font-size: 15px; flex: none; min-height: 32px; }
.room-intro { margin: 18px auto 8px; max-width: 340px; text-align: center; color: var(--ink-2); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.room-intro .faces { display: flex; }
.room-intro .faces .avatar { width: 44px; height: 44px; font-size: 22px; box-shadow: 0 0 0 2px var(--bg); }
.room-intro .faces .avatar + .avatar { margin-left: -10px; }
.room-intro .names { color: var(--ink); font-weight: 600; font-size: 15px; }
.sys.join, .sys.leave { color: var(--ink-2); }
.setup-steps { margin: 0; padding: 4px 16px 12px 36px; font-size: 14px; line-height: 1.55; color: var(--ink); }
.setup-steps li + li { margin-top: 4px; }
.badge-fixed { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--green); margin-left: 6px; vertical-align: 2px; }
.badge-temp { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--orange); margin-left: 6px; vertical-align: 2px; }
a.cell { color: inherit; text-decoration: none; }
.setup-steps a { color: var(--accent-text); }
.sheet .tpl-grid { margin: 0; }
@media (prefers-color-scheme: dark) { .sheet .tpl-card { background: #2c2c2e; box-shadow: none; } .sheet .tpl-card.blank { box-shadow: inset 0 0 0 1.5px var(--hairline-strong); } }
