/* 꿈비온 ⭐ 메신저 v2.1 — 화면 스타일
   크림·오트밀 바탕, 웜그레이 글자. 보라(딥 플럼)는 버튼·아이콘·프로필에만. 빨간색은 안 읽음·실패·하트에만. */
:root {
  /* v2.1 색: 크림 바탕 · 오트밀 메뉴 · 딥 플럼(버튼·아이콘·프로필만) · 버터 옐로(선택·중요) · 연라벤더(보조 배지) · 웜그레이 글자 */
  --bg-side: #EDE1CE;
  --bg-main: #FFF9EF;
  --surface: #FFFDF8;
  --surface-2: #F8F0E3;
  --surface-3: #F3EADC;
  --line: #E7DDCE;
  --line-2: #DCD0BF;
  --line-soft: #EFE7DA;
  --text: #514A43;
  --text-2: #5A524A;
  --text-3: #6F665D;
  --text-4: #7A7168;
  --primary: #614267;
  --primary-hover: #533858;
  --on-primary: #FFFDF8;
  --butter: #F3D77D;
  --butter-soft: #FBEFC4;
  --butter-text: #5E4A12;
  --lav: #DDD4EF;
  --lav-text: #4B3F66;
  --selected: #F3D77D;
  --chip: #F1E8DA;
  --mine: #F2E6D2;
  --red: #C8453C;
  --red-text: #9E372F;
  --red-bg: #F7E6E2;
  --red-line: #E3BDB6;
  --green: #5E8A5E;
  --green-text: #4F6B4F;
  --green-bg: #E8EFE4;
  --amber-text: #6E5620;
  --amber-bg: #FBF1D6;
  --radius: 10px;
  --font: "Pretendard", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  --mono: Consolas, "D2Coding", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg-main); font-size: 14px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid #8C6E92; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.i.s { width: 15px; height: 15px; }
.boot-loading { height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--text-4); }

/* ── 버튼 ── */
.btn { height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.primary:disabled { background: #D9CFDB; border-color: #D9CFDB; color: var(--text-3); }
.btn.outline { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn.outline:hover:not(:disabled) { background: var(--surface-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--chip); }
.btn.danger { color: var(--red-text); border-color: var(--red-line); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.plain { border-color: transparent; background: transparent; color: var(--primary); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--butter); color: var(--primary); border-color: transparent; }

.badge { min-width: 20px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #FFFDF9; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.badge.soft { background: var(--lav); color: var(--lav-text); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--chip); color: var(--text-2); white-space: nowrap; }
.tag.imp { background: var(--butter); color: var(--butter-text); }
.tag.soft { background: var(--lav); color: var(--lav-text); }
.tag.red { background: var(--red-bg); color: var(--red-text); }
.tag.green { background: var(--green-bg); color: var(--green-text); }
.tag.amber { background: var(--amber-bg); color: var(--amber-text); }
.muted { color: var(--text-4); }
.small { font-size: 12px; }

/* ── 전체 틀 ── */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.m-back, .m-only { display: none !important; }
.side { background: var(--bg-side); border-right: 1px solid #E0D3BF; display: flex; flex-direction: column; padding: 16px 12px 12px; gap: 14px; min-height: 0; }
.me-row { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.avatar { position: relative; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; cursor: pointer; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar.has-img { background: var(--surface-3) !important; }
.avatar.me { width: 40px; height: 40px; border-radius: 13px; background: var(--primary) !important; color: #F7EFE3 !important; font-size: 16px; }
.avatar.me.has-img { background: var(--surface-3) !important; }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12.5px; }
.avatar.md { width: 38px; height: 38px; border-radius: 12px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 18px; cursor: default; }
.avatar.xl { width: 84px; height: 84px; border-radius: 26px; font-size: 28px; cursor: default; border: 3px solid var(--surface); box-sizing: content-box; }
.pres { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 6px; background: #C9BFB2; border: 2px solid var(--bg-side); }
.pres.on { background: #4FA36A; }
.avatar.xl .pres { width: 16px; height: 16px; border-radius: 9px; right: 2px; bottom: 2px; border-color: var(--surface); }
.chat-head .pres { border-color: var(--bg-main); }
.on-txt { color: #3F8457; font-weight: 600; }
.brand { display: flex; align-items: center; gap: 7px; padding: 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text-3); letter-spacing: .2px; }
.brand .heart svg { width: 15px; height: 15px; fill: #D8453E; display: block; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.me-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--green-text); }
.conn .dot { width: 7px; height: 7px; border-radius: 4px; background: var(--green); }
.conn.off { color: var(--red-text); }
.conn.off .dot { background: var(--red); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text); font-size: 14px; text-align: left; }
.nav-item svg.i { color: var(--primary); }
.nav-item:hover { background: #E5D7C2; }
.nav-item.on { background: var(--selected); color: var(--text); font-weight: 600; }
.nav-item .grow { flex: 1; }
.side-sep { height: 1px; background: #DCCDB7; flex-shrink: 0; }
.side-sub { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.side-label { font-size: 12px; color: var(--text-4); padding: 0 12px 6px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.side-label .grow { flex: 1; }
.filter { height: 38px; border: 0; border-radius: 9px; background: transparent; display: flex; align-items: center; padding: 0 12px; font-size: 13.5px; color: var(--text); text-align: left; flex-shrink: 0; }
.filter:hover { background: #E5D7C2; }
.filter.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.filter .grow { flex: 1; }
.filter .n { font-size: 12px; color: var(--text-4); font-weight: 500; }
.filter .n.red { color: var(--red-text); font-weight: 600; }
.side-foot { font-size: 11.5px; color: var(--text-3); padding: 0 12px; flex-shrink: 0; display: flex; align-items: center; gap: 7px; }
.side-foot .pres { position: static; border: 0; width: 8px; height: 8px; }
.side-note { font-size: 12.5px; color: var(--text-3); line-height: 1.6; padding: 0 12px; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin: 0 4px 6px; border-radius: 9px; background: var(--surface-2); color: var(--primary); flex-shrink: 0; }
.list-tools { padding: 0 28px 12px; flex-shrink: 0; }
.head-search { max-width: 420px; margin: 0; height: 38px; background: var(--surface); border: 1px solid var(--line-2); }
.head-search:focus-within { border-color: #A898AD; }
.search .x { border: 0; background: transparent; color: var(--text-4); padding: 0; display: flex; }
mark { background: var(--butter); color: inherit; border-radius: 3px; padding: 0 1px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 13px; color: var(--text); min-width: 0; }

.conv { min-height: 62px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; gap: 11px; padding: 8px 10px; text-align: left; width: 100%; flex-shrink: 0; }
.conv:hover { background: #E5D7C2; }
.conv.on { background: var(--surface-2); }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top { display: flex; gap: 6px; align-items: baseline; }
.conv-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11.5px; color: var(--text-4); flex-shrink: 0; }
.conv-bottom { display: flex; gap: 6px; align-items: center; }
.conv-prev { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-prev { color: var(--text-2); }
.room-results { display: flex; flex-direction: column; gap: 2px; }
.hit { border: 0; background: transparent; border-radius: 9px; text-align: left; padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; width: 100%; }
.hit:hover { background: #E5D7C2; }
.hit-top { display: flex; gap: 6px; font-size: 12.5px; font-weight: 600; }
.hit-top .grow { flex: 1; min-width: 0; }
.hit-text { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.banner { flex-shrink: 0; height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 20px; background: #F4DFDA; color: #7E2E27; font-size: 13px; }
.banner b { flex: 1; font-weight: 600; }
.banner .btn { height: 28px; font-size: 12px; border-color: #DDAFA7; color: #7E2E27; }
.banner.dnd { background: var(--butter-soft); color: var(--text); }
.view { flex: 1; min-height: 0; display: flex; }
.view-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.view-head { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 22px 28px 14px; }
.view-head .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.view-head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.view-head .sub { font-size: 13px; color: var(--text-3); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 28px 28px; }
.section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.section-title svg { color: var(--primary); }
.count { font-size: 12px; font-weight: 600; color: var(--text-3); }
.count.red { color: var(--red-text); }
.month { border-bottom: 1px solid var(--line-soft); }
.month > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.month > summary::-webkit-details-marker { display: none; }
.month > summary::before { content: '›'; display: inline-block; width: 10px; color: var(--primary); transition: transform .15s; }
.month[open] > summary::before { transform: rotate(90deg); }
.month > summary .grow { flex: 1; }
.month > summary .n { font-size: 12px; font-weight: 500; color: var(--text-4); }
.month > summary:hover { background: var(--surface-2); border-radius: 8px; }
.month .nrow:last-child { border-bottom: 0; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-4); font-size: 13.5px; line-height: 1.7; }

/* ── 공지 ── */
.ncard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 15px 18px; display: flex; gap: 16px; align-items: flex-start; cursor: pointer; }
.ncard:hover { border-color: var(--line-2); }
.ncard.sel { border-color: #CDBFAC; background: #FFFCF4; }
.ncard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ncard-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.ncard-title span.t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ncard-text { font-size: 13.5px; color: var(--text-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-4); flex-wrap: wrap; }
.ncard-act { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; align-items: stretch; }
.nrow { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; border-radius: 0; background: transparent; }
.nrow:hover { background: var(--surface-2); }
.nrow.sel { background: var(--surface-3); border-radius: 10px; border-bottom-color: transparent; }
.nrow .t { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrow .snip { margin-left: 10px; font-size: 12px; color: var(--text-4); }
.pin-btn, .pin-mark { width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 7px; color: #C3B7A8; padding: 0; margin-left: -6px; }
.pin-mark { color: var(--primary); }
.pin-btn:hover { background: var(--surface-3); color: var(--primary); }
.pin-btn.on { color: var(--primary); }
.pinned-lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--primary); font-weight: 600; }
a.link { color: #5B3F85; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
a.link:hover { color: var(--primary); }
.nrow .c { font-size: 12px; color: var(--text-4); flex-shrink: 0; }
.nrow .who { width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrow .when { width: 74px; }
.nrow .ack { width: 68px; text-align: right; }
.nrow.removed .t { color: var(--text-4); text-decoration: line-through; }
.detail { width: 380px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.detail-scroll > *, .editor > * { flex-shrink: 0; }
.detail h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.detail .body { font-size: 13.5px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.detail-foot { flex-shrink: 0; border-top: 1px solid var(--line-soft); padding: 12px 24px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ackbox { display: flex; flex-direction: column; gap: 10px; }
.progress { height: 5px; border-radius: 3px; background: #EFE7DA; overflow: hidden; }
.progress > div { height: 5px; background: #A89C8E; }
.ack-head { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.ack-head span { font-weight: 600; color: var(--text-2); }
.ack-grp { display: flex; flex-direction: column; gap: 2px; }
.ack-grp .lbl { font-size: 12px; color: var(--text-4); }
.names { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 7px; background: var(--chip); }
.chip.out { background: var(--surface); border: 1px solid #E0D5C5; }
.chip.red { background: var(--surface); border: 1px solid #EBC9C3; color: #8E332C; }
.img-slot { border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-4); font-size: 12px; cursor: zoom-in; padding: 0; }
.img-slot img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; }
.img-slot.loading { min-height: 120px; }
.history { font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 4px; }
.mynote { font-size: 12px; color: var(--text-4); }
.ack-done { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 10px; background: var(--green-bg); color: var(--green-text); font-size: 13.5px; font-weight: 600; }
.btn.block { width: 100%; height: 44px; font-size: 14px; }
.back-link { display: none; align-self: flex-start; }

/* ── 1:1 대화 ── */
.chat-head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 18px 0 24px; border-bottom: 1px solid var(--line); }
.chat-head .titles { flex: 1; min-width: 0; }
.chat-head .nm { font-size: 16px; font-weight: 600; }
.name-link { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0 10px; display: flex; flex-direction: column; gap: 4px; }
.day { display: flex; align-items: center; gap: 12px; padding: 10px 60px 8px; font-size: 12px; color: var(--text-4); }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: #E6DDCF; }
.m { display: flex; gap: 10px; padding: 2px 64px 2px 24px; align-items: flex-start; }
.m .gutter { width: 32px; flex-shrink: 0; }
.m .col { display: flex; flex-direction: column; gap: 4px; max-width: min(560px, 72%); min-width: 0; }
.m .who { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.m .who span { font-weight: 400; color: var(--text-4); margin-left: 5px; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 9px 13px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.m.first { margin-top: 8px; }
.m.mine { justify-content: flex-end; padding: 2px 24px 2px 120px; }
.m.mine .col { align-items: flex-end; }
.m.mine .row { display: flex; align-items: flex-end; gap: 8px; justify-content: flex-end; max-width: 100%; }
.m.theirs .row { display: flex; align-items: flex-end; gap: 8px; }
.m.mine .bubble { background: var(--mine); border-color: transparent; border-radius: 12px 4px 12px 12px; }
.bubble.deleted { background: transparent !important; border: 1px dashed var(--line-2) !important; color: var(--text-4); font-size: 13px; font-style: italic; }
.m-act { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text-4); padding: 0; display: inline-flex; align-items: center; justify-content: center; opacity: 0; flex-shrink: 0; align-self: center; }
.m:hover .m-act, .m-act:focus-visible { opacity: 1; }
.m-act:hover { background: var(--surface-3); color: var(--primary); }
.m.flash .bubble { box-shadow: 0 0 0 3px var(--butter); }
.m.mine.pending .bubble { background: var(--surface-3); color: var(--text-3); }
.m.mine.failed .bubble { background: var(--surface); border: 1px solid var(--red-line); }
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 11.5px; color: var(--text-4); flex-shrink: 0; white-space: nowrap; }
.m.theirs .stat { align-items: flex-start; }
.stat .read { color: var(--text-3); }
.stat .fail { color: var(--red-text); font-weight: 600; }
.stat .acts { display: flex; gap: 4px; margin-top: 3px; }
.m .img-slot { width: 220px; min-height: 90px; max-height: 260px; }
.m .img-slot img { max-height: 260px; }
.composer { flex-shrink: 0; padding: 0 24px 18px; }
.composer-box { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; }
.composer-box:focus-within { border-color: #A898AD; }
.composer-box.disabled { background: var(--surface-3); }
.attach-row { display: flex; gap: 6px; padding: 10px 12px 0; }
.attach-chip { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 6px; border-radius: 8px; background: var(--chip); font-size: 12.5px; color: var(--text-2); max-width: 100%; }
.attach-chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.attach-chip .nm { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button { width: 22px; height: 22px; border: 0; background: transparent; color: var(--text-3); display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 5px; }
.composer textarea { display: block; width: 100%; min-height: 72px; max-height: 200px; border: 0; resize: none; background: transparent; padding: 12px 14px 4px; outline: none; font-size: 14px; line-height: 1.6; color: var(--text); }
.composer textarea::placeholder { color: #9B8E82; }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 4px 10px 10px 8px; }
.composer-bar .hint { flex: 1; font-size: 11.5px; color: var(--text-4); }
.composer-bar .hint.warn { color: var(--red-text); }
.protect { font-size: 12px; color: var(--text-4); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.protect svg { color: var(--primary); }

/* ── 업무알림 ── */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 11px; }
.seg button { height: 34px; padding: 0 16px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); font-size: 13.5px; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; }
.trow { min-height: 64px; display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.trow:hover { border-color: var(--line-2); }
.trow.sel { background: var(--surface-3); border-color: var(--line-2); }
.trow.over { border-color: #E6C8C1; }
.trow.done { background: transparent; border-color: transparent; }
.trow.done .tt { color: var(--text-3); text-decoration: line-through; }
.check { width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid #B4A5B8; background: var(--surface); flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--on-primary); }
.check:hover { border-color: var(--primary); }
.check.on { background: var(--primary); border-color: var(--primary); }
.trow .tb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trow .tt { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .tm { font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.trow .tm.over { color: var(--red-text); font-weight: 600; font-size: 12px; }
.editor { width: 380px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--line); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.editor h2 { margin: 0; font-size: 17px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.input, .textarea, .select { height: 40px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; font-size: 14px; color: var(--text); background: var(--surface); font-weight: 400; outline: none; width: 100%; }
.input:focus, .textarea:focus, .select:focus { border-color: #A898AD; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; min-width: 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 13px; }
.pill.on { border-color: var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; }

/* ── 설정 ── */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h2 .grow { flex: 1; }
.card .desc { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.ntable { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)); align-items: center; }
.ntable .h { font-size: 12px; color: var(--text-4); padding-bottom: 6px; }
.ntable .c { text-align: center; }
.ntable .r { height: 42px; display: flex; align-items: center; border-top: 1px solid #EFE7DB; font-size: 14px; }
.ntable .r.c { justify-content: center; }
.switch { width: 40px; height: 24px; border-radius: 12px; border: 0; background: #D9CEC0; padding: 3px; display: inline-flex; justify-content: flex-start; flex-shrink: 0; transition: background .15s; }
.switch::after { content: ""; width: 18px; height: 18px; border-radius: 9px; background: #FFFDF9; }
.switch.on { background: var(--primary); justify-content: flex-end; }
.switch:disabled { opacity: .45; }
.radio { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.radio input { width: 16px; height: 16px; accent-color: var(--primary); margin: 3px 0 0; flex-shrink: 0; }
.radio small { display: block; font-size: 12.5px; color: var(--text-3); }
.path { min-height: 38px; display: flex; align-items: center; padding: 8px 12px; border-radius: 9px; background: var(--surface-3); font-size: 12.5px; color: var(--text-2); font-family: var(--mono); word-break: break-all; }
.note { font-size: 12.5px; border-radius: 8px; padding: 8px 10px; line-height: 1.55; }
.note.amber { background: var(--amber-bg); color: var(--amber-text); }
.note.red { background: var(--red-bg); color: var(--red-text); }
.note.plain { background: var(--surface-3); color: var(--text-2); }
.kv { display: flex; font-size: 13.5px; gap: 8px; align-items: center; }
.kv .k { width: 92px; color: var(--text-3); flex-shrink: 0; }
.kv .v { flex: 1; min-width: 0; word-break: break-all; }
.me-card { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; }
.me-card .grow { flex: 1; min-width: 0; }
.me-card .nm { font-size: 15px; font-weight: 700; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtable th { text-align: left; font-size: 12px; color: var(--text-4); font-weight: 500; padding: 6px 6px; border-bottom: 1px solid var(--line-soft); }
.mtable td { padding: 6px 6px; border-bottom: 1px solid #F1EADF; vertical-align: middle; }
.mtable .input { height: 32px; font-size: 13px; padding: 0 8px; }
.mtable tr.inactive td { color: var(--text-4); }
.admin-wide { grid-column: 1 / -1; }
.rooms { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.room-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid #F1EADF; }
.room-row .nm { flex: 1; min-width: 0; }

/* ── 첫 화면 / 로그인 ── */
.gate { height: 100vh; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 32px; background: var(--bg-side); }
.gate-card { margin: auto 0; width: 460px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px; display: flex; flex-direction: column; gap: 16px; }
.gate-card h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: #FBE9E4; display: flex; align-items: center; justify-content: center; }
.logo svg { width: 20px; height: 20px; fill: #D8453E; }
.gate-card p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.who-list { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow: auto; flex-shrink: 0; }
.who-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; width: 100%; }
.who-item:hover { background: var(--surface-2); }
.who-item.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.who-item .nm { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.who-item .avatar { cursor: inherit; }
.who-item .nm small { font-weight: 400; color: var(--text-4); margin-left: 6px; }
.err { color: var(--red-text); font-size: 13px; min-height: 18px; }

/* ── 모달 / 토스트 / 사진 크게 보기 ── */
.modal-back { position: fixed; inset: 0; background: rgba(60, 50, 44, .32); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 17px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.modal.narrow { width: 400px; }
.modal.profile { width: 400px; padding: 0; gap: 0; overflow: hidden; }
.cover { height: 150px; background: linear-gradient(135deg, #EDE1CE, #E4DAEE); background-size: cover; background-position: center; flex-shrink: 0; }
.pf-body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 24px 20px; margin-top: -44px; text-align: center; }
.pf-body .foot { width: 100%; justify-content: center; }
.pf-name { font-size: 18px; font-weight: 700; margin-top: 4px; }
.pf-status { font-size: 13.5px; color: var(--text-2); min-height: 20px; white-space: pre-wrap; word-break: break-word; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.choice:hover { background: var(--surface-2); border-color: #CBBFB0; }
.choice b { font-size: 14px; }
.choice span { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--primary); }
.lightbox { position: fixed; inset: 0; background: rgba(40, 34, 30, .85); display: flex; align-items: center; justify-content: center; z-index: 60; cursor: zoom-out; padding: 32px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
#toast-root { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; pointer-events: none; }
.toast { background: #4A433D; color: #FFFDF9; font-size: 13px; padding: 10px 16px; border-radius: 10px; max-width: 480px; }
.toast.err { background: #8E332C; }

/* ── 창이 좁을 때: 겹치거나 잘리지 않게 오른쪽 패널을 본문 대신 보여줌 ── */
@media (max-width: 1180px) {
  .detail, .editor { width: 340px; }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: 248px minmax(0, 1fr); }
  .view.has-panel.panel-open .view-col { display: none; }
  .view.has-panel:not(.panel-open) .detail, .view.has-panel:not(.panel-open) .editor { display: none; }
  .view.has-panel.panel-open .detail, .view.has-panel.panel-open .editor { width: auto; flex: 1; border-left: 0; }
  .back-link { display: inline-flex; }
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .m { padding-right: 32px; }
  .m.mine { padding-left: 60px; }
  .nrow .who { display: none; }
  .protect { display: none; }
}

/* ── 폰 화면 (720px 이하): 목록 ↔ 내용을 한 화면씩 ── */
@media (hover: none) { .m-act { opacity: .55; } }
@media (max-width: 720px) {
  body { font-size: 15px; }
  .app { grid-template-columns: minmax(0, 1fr); height: var(--app-h, 100dvh); }
  .app.m-side .main { display: none; }
  .app.m-main .side { display: none; }
  .side { border-right: 0; padding: 14px 12px 10px; padding-top: max(14px, env(safe-area-inset-top)); }
  .m-back { display: inline-flex !important; margin-left: -8px; flex-shrink: 0; }
  .m-only { display: flex !important; }
  .view-head { padding: 14px 16px 10px; padding-top: max(14px, env(safe-area-inset-top)); gap: 8px; flex-wrap: wrap; }
  .view-head .titles { min-width: 0; }
  .view-head h1 { font-size: 19px; }
  .view-head .sub { display: none; }
  .view-head .btn.primary { height: 36px; padding: 0 12px; }
  .list-tools { padding: 0 16px 10px; }
  .scroll { padding: 0 16px 20px; }
  .detail, .editor { width: auto !important; }
  .view.has-panel.panel-open .view-col { display: none; }
  .view.has-panel:not(.panel-open) .detail, .view.has-panel:not(.panel-open) .editor { display: none; }
  .view.has-panel.panel-open .detail, .view.has-panel.panel-open .editor { flex: 1; border-left: 0; }
  .detail-scroll { padding: 16px; }
  .detail-foot { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .back-link { display: inline-flex; }
  .ncard { flex-direction: column; gap: 10px; padding: 14px; }
  .ncard-act { flex-direction: row; }
  .nrow { padding: 8px 10px; flex-wrap: wrap; row-gap: 2px; }
  .nrow .t { flex-basis: calc(100% - 40px); white-space: normal; }
  .nrow .who { display: none; }
  .nrow .when { width: auto; margin-left: 26px; }
  .nrow .ack { width: auto; margin-left: auto; }
  .nrow .snip { display: block; margin: 2px 0 0; }
  .chat-head { height: auto; min-height: 56px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  .protect { display: none; }
  .m { padding: 2px 12px !important; }
  .m.mine { padding-left: 48px !important; }
  .m .col { max-width: 80%; }
  .day { padding: 10px 16px 8px; }
  .m .img-slot { width: 180px; }
  .composer { padding: 0 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .composer textarea { min-height: 48px; font-size: 16px; }
  .composer-bar .hint { font-size: 11px; }
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .ntable { grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr)); }
  .ntable .h { font-size: 11px; }
  .card { padding: 16px; }
  .input, .textarea, .select, .search input { font-size: 16px; }
  .modal-back { padding: 12px; align-items: flex-end; }
  .modal { padding: 18px; max-height: calc(100dvh - 24px); }
  .modal.profile { padding: 0; }
  .gate { padding: 16px; }
  .gate-card { padding: 22px 18px; }
  .mtable { font-size: 12px; }
  #toast-root { top: max(12px, env(safe-area-inset-top)); width: calc(100% - 32px); align-items: center; }
}

/* ── v2.4: 메시지 메뉴 · 답장 · 메시지로 알림 ── */
.ctx { position: fixed; z-index: 80; min-width: 170px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(60, 50, 44, .16); padding: 5px; display: flex; flex-direction: column; }
.ctx button { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px; border: 0; background: transparent; border-radius: 7px; font-size: 13.5px; color: var(--text); text-align: left; }
.ctx button svg { color: var(--primary); }
.ctx button:hover, .ctx button:focus-visible { background: var(--surface-2); outline: none; }
.ctx button[data-a="delMsg"] svg { color: var(--red-text); }
.quote { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--primary); background: rgba(97, 66, 103, .07); border-radius: 6px; padding: 5px 9px; margin: 0 0 6px; font-size: 12.5px; color: var(--text-3); cursor: pointer; }
.quote b { color: var(--text-2); font-size: 12px; }
.quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.quote:hover { background: rgba(97, 66, 103, .12); }
.m.mine .quote { background: rgba(255, 253, 248, .55); }
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 8px 10px 0; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--primary); font-size: 12.5px; color: var(--text-2); }
.reply-bar svg { color: var(--primary); flex-shrink: 0; }
.reply-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button { border: 0; background: transparent; color: var(--text-4); padding: 0; display: flex; }
.src-box { font-size: 13px; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 6px; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-mark { display: inline-flex; align-items: center; gap: 4px; }
.src-mark svg { color: var(--primary); }

.ctx-emojis { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.ctx .ctx-emojis button { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 18px; border-radius: 8px; }
.ctx .ctx-emojis button.on { background: var(--butter-soft); box-shadow: inset 0 0 0 1.5px var(--butter); }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; }
.react { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; line-height: 1; cursor: pointer; }
.react span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.react.mine { background: var(--butter-soft); border-color: var(--butter); }

/* ── v2.5: 동영상·파일 ── */
.fcard { display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 320px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: left; color: var(--text); }
.fcard > svg { width: 26px; height: 26px; color: var(--primary); flex-shrink: 0; }
.fcard .fb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fcard .fb b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .fb span { font-size: 12px; color: var(--text-4); }
.fcard.video { cursor: pointer; }
.fcard.video:hover { background: var(--surface-2); }
.fcard .play { width: 34px; height: 34px; border-radius: 17px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; padding-left: 2px; }
.fcard.gone { opacity: .7; border-style: dashed; }
.fcard.sending { opacity: .75; }
.vbox { display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.vbox video { width: 100%; max-height: 300px; border-radius: 10px; background: #000; }
.vmeta { font-size: 11.5px; color: var(--text-4); }
.linkbtn { border: 0; background: transparent; color: var(--primary); padding: 0 0 0 6px; font-size: 11.5px; text-decoration: underline; cursor: pointer; }
.attach-chip .fi { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--primary); }
#chat-shell.drop .msgs { outline: 2px dashed var(--primary); outline-offset: -8px; background: rgba(97, 66, 103, .04); }
