:root {
  color-scheme: light;
  --navy-950: #06162d;
  --navy-900: #0b2346;
  --navy-800: #12345f;
  --blue-600: #2f70b7;
  --blue-100: #eaf3fc;
  --line: #e3e8ef;
  --muted: #6e7887;
  --surface: #ffffff;
  --background: #f4f6f9;
  --danger: #e84855;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: #182131; background: var(--background); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.chat-app { display: grid; grid-template-columns: var(--room-pane-width, 360px) 8px minmax(0, 1fr); width: 100%; height: 100dvh; }
.chat-app.room-window { grid-template-columns: minmax(0, 1fr); }
.room-window .room-pane, .room-window .room-pane-resizer, .room-window .open-room-tabs { display: none !important; }
.room-window .conversation-pane { grid-column: 1; }
.room-window .conversation-strip { padding: 0; }
.room-window .chat-panel { width: 100%; min-width: 0; min-height: 0; height: 100%; resize: none; border: 0; border-radius: 0; box-shadow: none; }
.room-window .window-size-button { display: none; }
.room-pane { display: flex; min-width: 0; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.room-pane-resizer { position: relative; z-index: 5; cursor: col-resize; background: #edf1f6; touch-action: none; }
.room-pane-resizer::after { position: absolute; top: 50%; left: 2px; width: 4px; height: 54px; transform: translateY(-50%); border-radius: 999px; content: ""; background: #b9c6d5; opacity: .75; transition: background .15s ease, opacity .15s ease; }
.room-pane-resizer:hover::after, .room-pane-resizer:focus-visible::after, .chat-app.resizing .room-pane-resizer::after { background: var(--blue-600); opacity: 1; }
.room-pane-resizer:focus-visible { outline: 0; background: #dcecfb; }
.brand-header { display: flex; min-height: 74px; align-items: center; justify-content: space-between; padding: 12px 18px; color: white; background: var(--navy-900); }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 14px; color: var(--navy-900); background: white; font-size: 21px; font-weight: 900; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { letter-spacing: .04em; }
.brand small { margin-top: 3px; color: #dce9f6; font-size: 12px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.profile-photo-button { position: relative; display: grid; width: 40px; height: 40px; padding: 0; place-items: center; overflow: hidden; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; color: white; background: rgba(255,255,255,.13); font-size: 12px; font-weight: 900; }
.profile-photo-button img, .avatar img, .member-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar, .member-avatar { position: relative; overflow: hidden; }
.icon-button, .new-chat-button { min-height: 38px; border: 1px solid rgba(255,255,255,.24); border-radius: 12px; color: white; background: rgba(255,255,255,.1); }
.icon-button { width: 40px; font-size: 20px; }
.notification-button { position: relative; font-size: 19px; transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease; }
.notification-button.notification-on { border-color: rgba(163, 213, 255, .9); color: #fff; background: #1d609d; box-shadow: 0 0 0 3px rgba(154, 211, 255, .16); }
.notification-button.notification-on::after { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border: 1px solid var(--navy-900); border-radius: 50%; content: ""; background: #7ee081; }
.notification-button.notification-off { color: #d7e0eb; background: rgba(255,255,255,.06); }
.notification-button.notification-needs-permission { border-color: rgba(255, 203, 117, .82); color: #ffe0a8; }
.notification-button:hover { transform: translateY(-1px); }
.new-chat-button { padding: 0 12px; font-size: 13px; font-weight: 800; }
.room-toolbar { display: flex; align-items: end; justify-content: space-between; padding: 20px 20px 10px; }
.room-toolbar h1 { margin: 0; color: var(--navy-950); font-size: 25px; }
.room-toolbar p { max-width: 250px; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.room-category-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 16px 10px; padding: 4px; border-radius: 13px; background: #eef2f7; }
.room-category-tab { height: 38px; border: 0; border-radius: 10px; color: #687487; background: transparent; font-size: 13px; font-weight: 850; }
.room-category-tab:hover { color: var(--navy-800); background: #f8fbff; }
.room-category-tab.active { color: white; background: var(--navy-900); box-shadow: 0 2px 7px rgba(6,22,45,.18); }
.room-category-tab:focus-visible { outline: 3px solid #8db7df; outline-offset: 2px; }
.total-unread, .unread-badge { display: inline-grid; min-width: 22px; height: 22px; padding: 0 6px; place-items: center; border-radius: 999px; color: white; background: var(--danger); font-size: 12px; font-weight: 800; }
.search-box, .member-search { display: flex; gap: 8px; align-items: center; margin: 4px 16px 12px; padding: 0 13px; border: 1px solid transparent; border-radius: 12px; color: #8a93a1; background: #f1f4f8; }
.search-box:focus-within, .member-search:focus-within { border-color: #9dc2e8; background: white; }
.search-box input, .member-search input { width: 100%; height: 42px; border: 0; outline: 0; background: transparent; }
.room-list { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.room-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; width: 100%; overflow: hidden; padding: 13px 18px; border: 0; text-align: left; background: white; }
.room-item:hover, .room-item.open { background: #f4f8fc; }
.room-item.active { background: var(--blue-100); box-shadow: inset 4px 0 var(--blue-600); }
.avatar { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border-radius: 17px; color: white; background: linear-gradient(145deg, var(--blue-600), var(--navy-900)); font-size: 18px; font-weight: 900; }
.room-copy { min-width: 0; overflow: hidden; }
.room-title-row { display: flex; min-width: 0; gap: 6px; align-items: center; }
.room-title { min-width: 0; overflow: hidden; color: #152039; font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.group-count { color: var(--muted); font-size: 12px; }
.room-preview { display: block; max-width: 100%; margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.room-side { display: flex; min-width: 44px; flex-direction: column; align-items: end; gap: 8px; }
.room-time { color: #8e97a3; font-size: 11px; }
.list-empty { padding: 50px 28px; color: var(--muted); text-align: center; line-height: 1.6; }

.conversation-pane { display: flex; min-width: 0; height: 100dvh; flex-direction: column; background: #edf1f6; }
.empty-state { display: grid; min-height: 0; flex: 1; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.empty-symbol { display: grid; width: 76px; height: 76px; place-items: center; border-radius: 26px; color: white; background: var(--navy-900); font-size: 36px; font-weight: 900; box-shadow: 0 18px 40px rgba(11,35,70,.18); }
.empty-state h2 { margin: 22px 0 8px; color: var(--navy-950); }
.empty-state p { margin: 0 0 22px; color: var(--muted); }
.primary-button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 13px; color: white; background: var(--navy-900); font-weight: 800; }
.open-room-tabs { display: flex; min-height: 54px; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #d9e0ea; background: white; }
.open-room-tab-list { display: flex; min-width: 0; flex: 1; gap: 7px; overflow-x: auto; scrollbar-width: thin; }
.open-room-tab { display: inline-flex; min-width: 120px; max-width: 220px; height: 36px; gap: 7px; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid #d7dee8; border-radius: 11px; color: #4e5c70; background: #f8fafc; font-size: 12px; font-weight: 800; }
.open-room-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-room-tab b { display: grid; min-width: 19px; height: 19px; place-items: center; padding: 0 5px; border-radius: 999px; color: white; background: var(--danger); font-size: 10px; }
.open-room-tab.active { border-color: var(--navy-900); color: white; background: var(--navy-900); }
.close-all-rooms { flex: 0 0 auto; height: 36px; padding: 0 12px; border: 1px solid #d7dee8; border-radius: 11px; color: #536074; background: white; font-size: 11px; font-weight: 800; }
.conversation-strip { display: flex; min-width: 0; min-height: 0; flex: 1; align-items: center; justify-content: center; overflow: hidden; padding: 12px; }
.conversation { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-height: 0; height: 100%; }
.chat-panel { position: relative; width: min(920px, 100%); min-width: 440px; height: min(760px, 100%); min-height: 430px; max-width: 100%; max-height: 100%; overflow: hidden; resize: both; border: 1px solid #d9e0ea; border-radius: 17px; background: #edf1f6; box-shadow: 0 8px 28px rgba(6,22,45,.08); }
.chat-panel.maximized { width: 100%; height: 100%; resize: none; }
.chat-panel.focused { border-color: #8db7df; box-shadow: 0 10px 34px rgba(24,75,126,.16); }
.conversation-header { display: flex; grid-row: 1; gap: 9px; min-height: 68px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: white; }
.mobile-back { display: none; width: 36px; height: 42px; border: 0; color: var(--navy-900); background: transparent; font-size: 38px; line-height: 1; }
.conversation-heading { min-width: 0; flex: 1; }
.conversation-heading h2 { margin: 0; overflow: hidden; color: var(--navy-950); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-heading p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-search-button, .conversation-media-button { display: grid; height: 34px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid #d7dee8; border-radius: 10px; color: var(--navy-800); background: white; line-height: 1; }
.conversation-search-button { width: 34px; line-height: 0; }
.conversation-search-button svg { display: block; width: 18px; height: 18px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2.25; }
.conversation-media-button { min-width: 42px; padding-inline: 8px; font-size: 11px; font-weight: 850; }
.conversation-search-button:hover, .conversation-search-button[aria-expanded="true"], .conversation-media-button:hover, .conversation-media-button[aria-expanded="true"] { border-color: #8db7df; background: var(--blue-100); }
.rename-room-button { min-height: 34px; padding: 0 9px; border: 1px solid #d7dee8; border-radius: 10px; color: var(--navy-800); background: white; font-size: 11px; font-weight: 800; white-space: nowrap; }
.rename-room-button:hover { background: var(--blue-100); }
.window-size-button { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid #d7dee8; border-radius: 10px; color: var(--navy-800); background: white; font-size: 18px; line-height: 1; }
.window-size-button:hover { border-color: #8db7df; background: var(--blue-100); }
.close-room-button { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 10px; color: #64748b; background: #f1f5f9; font-size: 20px; }
.close-room-button:hover { color: #b42335; background: #ffe7ea; }
.conversation-search { display: grid; grid-row: 2; grid-template-columns: auto minmax(0, 1fr) auto repeat(3, 30px); gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.conversation-search .conversation-search-symbol { color: #7a8798; font-size: 18px; }
.conversation-search-input { width: 100%; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid #d7dee8; border-radius: 10px; outline: 0; background: white; font-size: 12px; }
.conversation-search-input:focus { border-color: #81afd9; box-shadow: 0 0 0 3px rgba(47,112,183,.1); }
.conversation-search-count { color: #687386; font-size: 10px; font-weight: 800; white-space: nowrap; }
.conversation-search button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 1px solid #d7dee8; border-radius: 9px; color: var(--navy-800); background: white; font-size: 15px; }
.conversation-search button:hover:not(:disabled) { border-color: #8db7df; background: var(--blue-100); }
.conversation-search button:disabled { cursor: default; opacity: .35; }
.conversation-media-browser { display: flex; grid-row: 3; min-height: 0; flex-direction: column; overflow: hidden; background: #f6f8fb; }
.media-search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); background: white; }
.media-browser-title { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; color: var(--navy-950); }
.media-browser-title button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 0; border-radius: 9px; color: #64748b; background: #eef2f6; font-size: 19px; }
.media-kind-tabs { display: grid; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 12px; background: #edf1f6; }
.media-kind-tabs button { height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.media-kind-tabs button.active { color: white; background: var(--navy-900); }
.media-query { grid-column: 1 / -1; width: 100%; height: 38px; padding: 0 11px; border: 1px solid #d7dee8; border-radius: 10px; outline: 0; }
.media-query:focus, .media-date-fields input:focus { border-color: #81afd9; box-shadow: 0 0 0 3px rgba(47,112,183,.1); }
.media-date-fields { display: grid; min-width: 0; grid-template-columns: 1fr 1fr; gap: 7px; }
.media-date-fields label { display: grid; min-width: 0; gap: 3px; color: var(--muted); font-size: 10px; font-weight: 750; }
.media-date-fields input { width: 100%; min-width: 0; height: 38px; padding: 0 7px; border: 1px solid #d7dee8; border-radius: 10px; outline: 0; font-size: 11px; }
.media-search-submit { min-width: 70px; border: 0; border-radius: 10px; color: white; background: var(--navy-900); font-size: 12px; font-weight: 850; }
.media-results { min-height: 0; flex: 1; overflow-y: auto; padding: 5px 12px 18px; overscroll-behavior: contain; }
.media-empty { display: grid; min-height: 180px; place-items: center; color: var(--muted); text-align: center; font-size: 12px; }
.media-date-heading { margin: 17px 2px 8px; color: #526074; font-size: 12px; }
.media-result-card { position: relative; display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 9px; margin-bottom: 9px; overflow: hidden; padding: 8px; border: 1px solid #dce3ec; border-radius: 14px; background: white; }
.media-preview { position: relative; display: grid; width: 82px; height: 68px; place-items: center; overflow: hidden; border-radius: 10px; background: #e8edf3; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-play { position: absolute; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: white; background: rgba(6,22,45,.7); font-size: 11px; }
.media-file-symbol { color: var(--blue-600); font-size: 12px; font-weight: 900; }
.media-result-copy { min-width: 0; padding-top: 3px; }
.media-result-copy b, .media-result-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-result-copy b { color: #1b2638; font-size: 12px; }
.media-result-copy small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.media-result-card > button { grid-column: 2; justify-self: start; min-height: 29px; padding: 0 10px; border: 1px solid #bdd0e4; border-radius: 9px; color: var(--navy-800); background: var(--blue-100); font-size: 10px; font-weight: 850; }
.conversation.media-open .message-scroller { display: none; }
.message-scroller { grid-row: 3; min-height: 0; overflow-y: auto; padding: 16px 13px; overscroll-behavior: contain; scroll-behavior: auto; }
.message-list { display: flex; flex-direction: column; gap: 8px; min-height: 100%; justify-content: flex-end; }
.older-button { align-self: center; margin: 0 auto 16px; padding: 8px 14px; border: 1px solid #d3dbe6; border-radius: 999px; color: #4e5c70; background: rgba(255,255,255,.82); font-size: 12px; }
.date-divider { display: flex; gap: 10px; align-items: center; margin: 12px 0; color: #7b8593; font-size: 11px; }
.date-divider::before, .date-divider::after { height: 1px; flex: 1; content: ""; background: #d8dfe8; }
.message-row { display: flex; gap: 8px; align-items: flex-end; content-visibility: auto; contain-intrinsic-size: auto 120px; }
.message-row.message-menu-open { content-visibility: visible; contain: none; }
.message-row.mine { justify-content: flex-end; }
.message-group { max-width: 82%; }
.sender-name { margin: 0 0 4px 4px; color: #596577; font-size: 11px; }
.bubble-wrap { display: flex; gap: 6px; align-items: flex-end; }
.mine .bubble-wrap { flex-direction: row-reverse; }
.message-bubble { padding: 10px 13px; border-radius: 6px 17px 17px; color: #192131; background: white; box-shadow: 0 2px 8px rgba(20,36,58,.07); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; -webkit-user-select: text; cursor: text; }
.message-link { color: #1264ad; font-weight: 750; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.mine .message-link { color: #d8eaff; }
.mine .message-bubble { border-radius: 17px 6px 17px 17px; color: white; background: var(--navy-900); }
.message-bubble.canceled { border: 1px solid #d6dde7; color: #727d8c; background: #f5f7fa; font-style: italic; box-shadow: none; }
.mine .message-bubble.canceled { color: #657186; background: #eef2f6; }
.message-row.mentioned-me .message-bubble { outline: 3px solid rgba(232,72,85,.28); }
.message-row.search-hit .message-bubble, .message-row.search-hit .file-card, .message-row.search-hit .message-image-card, .message-row.search-hit .message-video-card { outline: 4px solid rgba(255,193,7,.72); outline-offset: 2px; }
.mention-label { display: inline-block; margin: 0 0 5px 4px; padding: 3px 7px; border-radius: 999px; color: #b42335; background: #ffe7ea; font-size: 10px; font-weight: 850; }
.file-card { display: flex; gap: 10px; min-width: min(270px, 64vw); align-items: center; padding: 11px; border: 1px solid #dce3ec; border-radius: 14px; color: var(--navy-900); background: white; text-decoration: none; box-shadow: 0 2px 8px rgba(20,36,58,.07); }
.file-card:hover { border-color: #8db7df; background: #f8fbff; }
.file-symbol { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 13px; color: white; background: var(--blue-600); font-size: 11px; font-weight: 900; }
.file-copy { min-width: 0; }
.file-name { display: block; overflow: hidden; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.mine .file-card { border-color: rgba(255,255,255,.26); color: white; background: var(--navy-800); }
.mine .file-meta { color: #cfdeee; }
.message-image-card { display: block; width: min(320px, 64vw); max-width: 100%; overflow: hidden; border: 1px solid #dce3ec; border-radius: 16px; color: var(--navy-900); background: white; text-decoration: none; box-shadow: 0 2px 8px rgba(20,36,58,.08); }
.message-image-card:hover { border-color: #8db7df; }
.message-image-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #eef2f6; }
.html-file-card .file-symbol { background: #d96d31; }
.message-image-meta { display: block; min-width: 0; padding: 9px 11px 10px; }
.message-image-meta b, .message-image-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-image-meta b { font-size: 12px; }
.message-image-meta small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.mine .message-image-card { border-color: rgba(255,255,255,.26); color: white; background: var(--navy-800); }
.mine .message-image-meta small { color: #cfdeee; }
.message-video-card { display: block; width: min(320px, 64vw); max-width: 100%; overflow: hidden; border: 1px solid #dce3ec; border-radius: 16px; color: var(--navy-900); background: white; box-shadow: 0 2px 8px rgba(20,36,58,.08); }
.message-video-card video { display: block; width: 100%; max-height: 340px; background: #071326; }
.mine .message-video-card { border-color: rgba(255,255,255,.26); color: white; background: var(--navy-800); }
.message-meta { display: flex; min-width: 28px; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 2px; padding-bottom: 2px; }
.mine .message-meta { align-items: flex-start; }
.message-unread { color: #d58b00; font-size: 11px; font-weight: 900; line-height: 1; }
.message-time { color: #7c8694; font-size: 10px; white-space: nowrap; }
.message-edited { color: #7c8694; font-size: 9px; white-space: nowrap; }
.message-actions { position: relative; align-self: center; }
.message-menu-toggle { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 9px; color: #6d7888; background: transparent; cursor: pointer; font-size: 18px; font-weight: 900; }
.message-menu-toggle:hover, .message-menu-toggle[aria-expanded="true"] { color: var(--navy-900); background: rgba(255,255,255,.82); }
.message-action-menu { position: fixed; z-index: 50; display: grid; min-width: 190px; max-height: calc(100dvh - 16px); overflow-x: hidden; overflow-y: auto; padding: 5px; border: 1px solid #d8dfe8; border-radius: 12px; background: white; box-shadow: 0 12px 32px rgba(6,22,45,.18); }
.message-action-menu button { min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; color: #283548; text-align: left; background: white; font-size: 12px; font-weight: 750; white-space: nowrap; }
.message-action-menu button:hover { background: var(--blue-100); }
.message-action-menu .danger { color: #b42335; }
.message-reaction-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 2px 2px 5px; border-bottom: 1px solid #edf1f5; margin-bottom: 3px; }
.message-reaction-picker button { display: grid; min-width: 28px; min-height: 32px; place-items: center; padding: 0; text-align: center; font-size: 17px; }
.message-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mine .message-reactions { justify-content: flex-end; }
.message-reaction { display: inline-flex; min-height: 27px; gap: 4px; align-items: center; padding: 2px 8px; border: 1px solid #d5dce6; border-radius: 999px; color: #536074; background: rgba(255,255,255,.92); font-size: 13px; }
.message-reaction b { font-size: 10px; }
.message-reaction.mine { border-color: #82aeda; color: var(--navy-900); background: #e7f2ff; }
.scroll-latest-button { position: absolute; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 16; display: inline-flex; min-width: 68px; height: 36px; gap: 5px; align-items: center; justify-content: center; padding: 0 11px; border: 1px solid #cbd8e5; border-radius: 999px; color: var(--navy-900); background: rgba(255,255,255,.96); box-shadow: 0 7px 18px rgba(6,22,45,.18); font-size: 12px; font-weight: 850; }
.scroll-latest-button:hover { border-color: #78a7d3; background: #eaf3fc; }
.scroll-latest-button span { font-size: 18px; line-height: 1; }
.composer { position: relative; display: flex; grid-row: 4; min-height: 0; gap: 8px; align-items: flex-end; padding: 10px 11px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
.chat-panel.file-drop-active .composer { outline: 3px dashed #3978b7; outline-offset: -5px; background: #edf6ff; }
.chat-panel.file-drop-active .composer::after { position: absolute; inset: 5px; z-index: 25; display: grid; place-items: center; border-radius: 10px; color: #153b68; background: rgba(237,246,255,.94); content: "여기에 파일을 놓으면 대화에 첨부합니다"; font-size: 13px; font-weight: 850; pointer-events: none; }
.reply-target { position: absolute; right: 12px; bottom: calc(100% + 4px); left: 12px; z-index: 11; padding: 8px 34px 8px 10px; border-left: 3px solid #4f7faf; border-radius: 7px; color: #34475e; background: #eef4fa; box-shadow: 0 5px 15px rgba(20,36,58,.1); font-size: 11px; line-height: 1.35; }
.reply-target span { display: block; color: #5d6f84; font-size: 10px; }.reply-target b { color: #17335f; }.reply-target p { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-target button { position: absolute; top: 50%; right: 6px; width: 25px; height: 25px; transform: translateY(-50%); border: 0; border-radius: 50%; color: #637188; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.reply-target button:hover { color: #12234b; background: #dce8f4; }
.composer-input-wrap { position: relative; display: flex; min-width: 0; flex: 1; align-items: flex-end; }
.composer textarea { display: block; width: 100%; max-height: 120px; min-height: 46px; margin: 0; resize: none; padding: 11px 14px; border: 1px solid #d7dee8; border-radius: 15px; outline: none; line-height: 1.4; vertical-align: top; }
.composer textarea:focus { border-color: #81afd9; box-shadow: 0 0 0 3px rgba(47,112,183,.1); }
.composer button { min-width: 64px; height: 46px; margin: 0; align-self: flex-end; border: 0; border-radius: 14px; color: white; background: var(--navy-900); font-weight: 800; }
.composer .attach-button { min-width: 46px; width: 46px; color: var(--navy-900); background: #eaf0f7; font-size: 25px; font-weight: 500; }
.composer button:disabled { cursor: default; opacity: .5; }
.attachment-control { position: relative; display: flex; flex: 0 0 auto; align-items: flex-end; }
.native-file-input { position: fixed; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.attachment-menu { position: absolute; z-index: 20; bottom: calc(100% + 9px); left: 0; display: grid; width: 154px; gap: 4px; padding: 6px; border: 1px solid #d7dee8; border-radius: 14px; background: white; box-shadow: 0 16px 36px rgba(6,22,45,.18); }
.composer .attachment-menu button { display: flex; width: 100%; min-width: 0; height: 42px; gap: 9px; align-items: center; padding: 0 12px; border-radius: 10px; color: #26344a; text-align: left; background: white; }
.composer .attachment-menu button span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; color: var(--navy-800); background: var(--blue-100); font-size: 11px; }
.composer .attachment-menu button:hover, .composer .attachment-menu button:focus-visible { color: var(--navy-900); background: var(--blue-100); }
.mention-suggestions { position: absolute; right: 0; bottom: calc(100% + 8px); left: 0; z-index: 10; max-height: 220px; overflow-y: auto; padding: 6px; border: 1px solid #d7dee8; border-radius: 14px; background: white; box-shadow: 0 18px 50px rgba(6,22,45,.18); }
.mention-option { display: flex; gap: 10px; width: 100%; align-items: center; padding: 9px 10px; border: 0; border-radius: 10px; text-align: left; color: #1b2638; background: white; }
.mention-option:hover, .mention-option.active { background: var(--blue-100); }
.mention-option b { display: block; font-size: 13px; }
.mention-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.new-chat-dialog { width: min(520px, calc(100% - 24px)); max-height: min(720px, calc(100dvh - 28px)); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 30px 90px rgba(6,22,45,.28); }
.new-chat-dialog::backdrop { background: rgba(6,22,45,.5); backdrop-filter: blur(2px); }
.new-chat-dialog form { display: flex; max-height: inherit; flex-direction: column; }
.new-chat-dialog header { display: flex; justify-content: space-between; padding: 22px 22px 12px; }
.new-chat-dialog h2 { margin: 0; color: var(--navy-950); }
.new-chat-dialog header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.dialog-close { width: 40px; height: 40px; border: 0; border-radius: 12px; color: #536074; background: #f0f3f7; font-size: 26px; }
.chat-type-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 22px 14px; padding: 4px; border-radius: 13px; background: #edf1f6; }
.chat-type { height: 38px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 800; }
.chat-type.active { color: var(--navy-900); background: white; box-shadow: 0 2px 8px rgba(20,36,58,.08); }
.field { display: grid; gap: 6px; margin: 0 22px 12px; color: #536074; font-size: 12px; font-weight: 700; }
.field input { height: 44px; padding: 0 12px; border: 1px solid #d7dee8; border-radius: 12px; outline: 0; }
.member-search { margin-inline: 22px; }
.member-list { min-height: 160px; flex: 1; overflow-y: auto; border-top: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4; }
.member-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center; width: 100%; padding: 11px 22px; border: 0; text-align: left; background: white; }
.member-row:hover { background: #f6f9fc; }
.member-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 15px; color: white; background: var(--blue-600); font-weight: 900; }
.member-name { display: block; color: #1b2638; font-weight: 800; }
.member-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.member-check { display: grid; width: 23px; height: 23px; place-items: center; border: 2px solid #c9d1dc; border-radius: 50%; color: white; font-size: 13px; }
.member-row.selected .member-check { border-color: var(--navy-900); background: var(--navy-900); }
.share-message-preview { margin: 0 22px 13px; padding: 11px 13px; border: 1px solid #dbe5f0; border-radius: 12px; color: #33445d; background: #f6f9fc; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.share-room-list { max-height: 310px; }
.share-room-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center; width: 100%; padding: 11px 22px; border: 0; color: #1b2638; text-align: left; background: white; }
.share-room-row:hover, .share-room-row.selected { background: #f1f7fc; }
.share-room-row .share-room-title { display: block; overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.share-room-row .share-room-meta { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.share-room-check { display: grid; width: 23px; height: 23px; place-items: center; border: 2px solid #c9d1dc; border-radius: 50%; color: white; font-size: 13px; }
.share-room-row.selected .share-room-check { border-color: var(--navy-900); background: var(--navy-900); }
.dialog-error { min-height: 18px; margin: 8px 22px 0; color: #c53b48; font-size: 12px; }
.new-chat-dialog footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 22px 20px; }
.new-chat-dialog footer span { color: var(--muted); font-size: 13px; }
.rename-dialog { width: min(430px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(6,22,45,.28); }
.rename-dialog::backdrop { background: rgba(6,22,45,.5); backdrop-filter: blur(2px); }
.rename-dialog form { padding: 24px; }
.rename-dialog h2 { margin: 0; color: var(--navy-950); }
.rename-dialog p { margin: 7px 0 16px; color: var(--muted); font-size: 13px; }
.rename-dialog input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #d7dee8; border-radius: 12px; outline: 0; }
.rename-dialog input:focus { border-color: #81afd9; box-shadow: 0 0 0 3px rgba(47,112,183,.1); }
.message-edit-dialog textarea { width: 100%; min-height: 132px; resize: vertical; padding: 12px 13px; border: 1px solid #d7dee8; border-radius: 12px; outline: 0; line-height: 1.5; }
.message-edit-dialog textarea:focus { border-color: #81afd9; box-shadow: 0 0 0 3px rgba(47,112,183,.1); }
.rename-dialog .dialog-error { margin: 7px 0 0; }
.rename-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.rename-actions button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 12px; }
#cancelRenameBtn { color: #536074; background: #edf1f6; }
#cancelEditMessageBtn { color: #536074; background: #edf1f6; }
.toast { position: fixed; z-index: 50; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; max-width: calc(100% - 32px); padding: 11px 16px; transform: translate(-50%, 20px); border-radius: 12px; color: white; background: rgba(6,22,45,.94); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.startup-loader { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; color: var(--navy-900); background: #f4f6f9; text-align: center; transition: opacity .18s ease; }
.startup-loader-mark { display: grid; width: 56px; height: 56px; place-items: center; margin-bottom: 4px; border-radius: 20px; color: white; background: var(--navy-900); font-size: 27px; font-weight: 900; box-shadow: 0 14px 32px rgba(6,22,45,.2); }
.startup-loader strong { font-size: 17px; }
.startup-loader span { color: var(--muted); font-size: 13px; }

@media (max-width: 820px) {
  .chat-app { display: block; }
  .room-pane-resizer { display: none; }
  .room-pane, .conversation-pane { width: 100%; height: 100dvh; }
  .conversation-pane { display: none; }
  .chat-app.room-open .room-pane { display: none; }
  .chat-app.room-open .conversation-pane { display: flex; }
  .open-room-tabs { min-height: 50px; padding: 7px 8px; }
  .open-room-tab-list { gap: 6px; }
  .open-room-tab { min-width: 104px; max-width: 165px; height: 36px; padding-inline: 10px; }
  .close-all-rooms { height: 36px; padding-inline: 9px; }
  .conversation-strip { display: block; min-height: 0; padding: 0; overflow: hidden; }
  .chat-panel { display: none; width: 100%; min-width: 0; min-height: 0; height: 100%; resize: none; border: 0; border-radius: 0; box-shadow: none; }
  .chat-panel.focused { display: grid; box-shadow: none; }
  .mobile-back { display: inline-grid; place-items: center; }
  .conversation-header { min-height: 64px; padding: 7px 8px 7px 3px; }
  .conversation-header .avatar { width: 42px; height: 42px; border-radius: 15px; }
  .rename-room-button { width: 38px; min-width: 38px; padding: 0; font-size: 0; }
  .conversation-media-button { min-width: 38px; width: 38px; padding: 0; font-size: 0; }
  .window-size-button { display: none; }
  .conversation-media-button::after { content: "▦"; font-size: 17px; }
  .rename-room-button::after { color: var(--navy-800); content: "✎"; font-size: 18px; }
  .close-room-button { width: 34px; height: 34px; }
  .message-scroller { padding: 16px 12px; }
  .message-group { max-width: 80%; }
  .message-menu-toggle { width: 32px; height: 32px; background: rgba(255,255,255,.66); }
  .composer { padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); }
  .composer button { min-width: 58px; }
  .composer .attach-button { min-width: 44px; width: 44px; }
  .brand-header { padding-top: calc(12px + env(safe-area-inset-top)); }
  .new-chat-dialog { width: 100%; max-width: none; max-height: 88dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .share-room-list { max-height: 38dvh; }
}

@media (max-width: 390px) {
  .conversation-avatar { display: none; }
  .conversation-heading h2 { font-size: 15px; }
  .open-room-tab { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
