/* =========================================================
   웹 카카오톡 PC - Design System & Layout
   ========================================================= */
:root {
  --kakao-yellow: #FEE500;
  --kakao-yellow-hover: #F5DC00;
  --kakao-brown: #381E1F;

  --rail-bg: #ECECED;
  --rail-border: #DFDFE2;
  --sidebar-bg: #FFFFFF;
  --sidebar-hover: #F5F6F7;
  --sidebar-active: #EBECEE;

  --chat-bg: #BACEE0;
  --chat-header-bg: rgba(186, 206, 224, 0.92);
  --bubble-me-bg: #FEE500;
  --bubble-me-text: #191919;
  --bubble-sys-bg: rgba(0, 0, 0, 0.14);
  --bubble-sys-text: #FFFFFF;

  --composer-bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-sub: #F8F9FA;
  --border: #E5E7EB;
  --text-primary: #191919;
  --text-secondary: #5C6370;
  --text-muted: #8C939E;

  --danger: #E03131;
  --success: #2B8A3E;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* 깔끔한 웜그레이 채팅 배경 테마 */
body[data-chat-bg="clean"] {
  --chat-bg: #F1F3F5;
  --chat-header-bg: rgba(241, 243, 245, 0.94);
  --bubble-sys-bg: rgba(0, 0, 0, 0.08);
  --bubble-sys-text: #495057;
}

/* 다크 모드 */
body[data-theme="dark"],
body[data-chat-bg="dark"] {
  --rail-bg: #1D1F22;
  --rail-border: #2C2F35;
  --sidebar-bg: #23262A;
  --sidebar-hover: #2C3036;
  --sidebar-active: #343940;

  --chat-bg: #1A1D21;
  --chat-header-bg: rgba(26, 29, 33, 0.94);
  --bubble-me-bg: #FEE500;
  --bubble-me-text: #191919;
  --bubble-sys-bg: rgba(255, 255, 255, 0.1);
  --bubble-sys-text: #CED4DA;

  --composer-bg: #23262A;
  --surface: #23262A;
  --surface-sub: #2C3036;
  --border: #343940;
  --text-primary: #F1F3F5;
  --text-secondary: #ADB5BD;
  --text-muted: #868E96;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
}

html, body {
  height: 100%;
  background: var(--rail-bg);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

/* 스크롤바 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.55);
}

/* =========================================================
   앱 메인 3단 셸 (네비 레일 + 사이드바 + 채팅창)
   ========================================================= */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 1) 좌측 네비게이션 레일 */
.nav-rail {
  width: 64px;
  flex-shrink: 0;
  background: var(--rail-bg);
  border-right: 1px solid var(--rail-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  user-select: none;
}

.nav-top, .nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--kakao-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.nav-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0.65;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.nav-btn:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.12);
}

.nav-btn.active {
  opacity: 1;
  background: rgba(128, 128, 128, 0.16);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--kakao-brown);
}

body[data-theme="dark"] .nav-btn.active::before,
body[data-chat-bg="dark"] .nav-btn.active::before {
  background: var(--kakao-yellow);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #FF5B4D;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FAB005;
  display: inline-block;
}
.status-dot.ok {
  background: #40C057;
  box-shadow: 0 0 0 3px rgba(64, 192, 87, 0.25);
}
.status-dot.err {
  background: #FA5252;
  box-shadow: 0 0 0 3px rgba(250, 82, 82, 0.25);
}

/* 2) 중간 사이드바 */
.sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-header {
  height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: rgba(128, 128, 128, 0.14);
}
.icon-btn.small {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-sub);
  font-size: 13px;
  outline: none;
}
.sidebar-search input:focus {
  border-color: var(--kakao-yellow);
}

/* 채팅방 목록 */
.room-list, .snippet-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.room-item:hover {
  background: var(--sidebar-hover);
}
.room-item.active {
  background: var(--sidebar-active);
}

.room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--kakao-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.room-info {
  flex: 1;
  min-width: 0;
}

.room-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.room-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.room-bottom-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.room-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-count-pill {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* 상용구 목록 */
.snippet-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.snippet-item:hover {
  background: var(--sidebar-hover);
}
.snippet-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.snippet-item-title {
  font-size: 13px;
  font-weight: 700;
}
.snippet-item-text {
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-sub);
  flex-shrink: 0;
}

.sdk-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.sdk-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FAB005;
}
.sdk-pill.ok .dot {
  background: #40C057;
}
.sdk-pill.err .dot {
  background: #FA5252;
}

.sidebar-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* 3) 우측 메인 채팅창 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--chat-bg);
  position: relative;
}

.chat-header {
  height: 58px;
  padding: 0 16px;
  background: var(--chat-header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  z-index: 5;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header .room-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  font-size: 18px;
}

.room-meta {
  min-width: 0;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-title-row h1 {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.room-subtitle {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* 대화 검색 바 */
.msg-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.msg-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
}
.search-stat {
  font-size: 12px;
  color: var(--text-muted);
}

/* 메시지 피드 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-divider {
  align-self: center;
  background: var(--bubble-sys-bg);
  color: var(--bubble-sys-text);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 999px;
  margin: 8px 0 4px;
}

.system-welcome {
  align-self: center;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.78);
  color: #343A40;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 6px 0 12px;
  box-shadow: var(--shadow-sm);
}
body[data-theme="dark"] .system-welcome,
body[data-chat-bg="dark"] .system-welcome {
  background: rgba(35, 38, 42, 0.9);
  color: #DEE2E6;
}
.system-welcome strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.system-welcome ul {
  padding-left: 16px;
}

/* 말풍선 행 (내 보낸 메시지 = 우측 정렬) */
.msg-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 7px;
  max-width: 100%;
}

.msg-row.highlight .bubble {
  box-shadow: 0 0 0 2.5px #FF922B;
}

.msg-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.msg-actions {
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.14s;
}
.msg-row:hover .msg-actions,
.msg-row:focus-within .msg-actions {
  opacity: 1;
}

.msg-act-btn {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: #343A40;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.msg-act-btn:hover {
  background: #FFFFFF;
}
body[data-theme="dark"] .msg-act-btn,
body[data-chat-bg="dark"] .msg-act-btn {
  background: #2C3036;
  color: #E9ECEF;
}

.msg-time {
  font-size: 10.5px;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
body[data-theme="dark"] .msg-time,
body[data-chat-bg="dark"] .msg-time {
  color: #868E96;
}

.bubble {
  position: relative;
  max-width: min(72%, 520px);
  background: var(--bubble-me-bg);
  color: var(--bubble-me-text);
  padding: 10px 13px;
  border-radius: 14px 2px 14px 14px;
  font-size: 14px;
  line-height: 1.52;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.bubble-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.bubble-tag {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(56, 30, 31, 0.1);
  color: var(--kakao-brown);
  padding: 2px 7px;
  border-radius: 999px;
}

.bubble-image-wrap {
  margin-bottom: 6px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
  cursor: zoom-in;
}
.bubble-image-wrap:last-child {
  margin-bottom: 0;
}
.bubble-image-wrap img {
  display: block;
  max-width: 260px;
  max-height: 260px;
  width: 100%;
  object-fit: cover;
}

.bubble-link-preview {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(56, 30, 31, 0.14);
  font-size: 12px;
}
.bubble-link-preview a {
  color: var(--kakao-brown);
  font-weight: 700;
  text-decoration: none;
}
.bubble-link-preview a:hover {
  text-decoration: underline;
}

.bubble-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #191919;
  text-decoration: none;
  margin-bottom: 6px;
  border: 1px solid rgba(56, 30, 31, 0.1);
}
.bubble-file-card:last-child {
  margin-bottom: 0;
}
.bubble-file-card:hover {
  background: rgba(255, 255, 255, 0.92);
}
.bubble-file-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.bubble-file-meta {
  min-width: 0;
  flex: 1;
}
.bubble-file-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble-file-sub {
  display: block;
  font-size: 11px;
  color: #495057;
  margin-top: 1px;
}

mark.search-hit {
  background: #FF922B;
  color: #FFFFFF;
  border-radius: 3px;
  padding: 0 2px;
}

/* 드래그 앤 드롭 오버레이 */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 25, 25, 0.52);
  backdrop-filter: blur(3px);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}
.drop-overlay-box {
  background: var(--surface);
  color: var(--text-primary);
  border: 2.5px dashed var(--kakao-yellow);
  border-radius: 20px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.drop-icon {
  font-size: 42px;
  margin-bottom: 10px;
}
.drop-overlay-box p {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.drop-overlay-box span {
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================
   나눠 보내기 도킹 패널
   ========================================================= */
.split-dock {
  background: var(--surface);
  border-top: 2px solid var(--kakao-yellow);
  padding: 12px 16px;
  max-height: 44vh;
  overflow-y: auto;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.split-dock-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.split-dock-head strong {
  font-size: 13.5px;
  display: block;
}
.split-dock-head p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.split-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.part-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-sub);
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.part-btn:hover {
  border-color: var(--kakao-yellow);
}
.part-btn.next {
  background: #FFFBE6;
  border-color: var(--kakao-yellow);
  box-shadow: 0 0 0 1.5px var(--kakao-yellow);
}
body[data-theme="dark"] .part-btn.next,
body[data-chat-bg="dark"] .part-btn.next {
  background: rgba(254, 229, 0, 0.14);
}
.part-btn.done {
  opacity: 0.72;
}
.part-btn .part-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}
.part-btn.done .part-title {
  color: var(--success);
}
.part-btn .part-preview {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-all-done {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

/* =========================================================
   하단 메시지 입력창 (Composer)
   ========================================================= */
.composer {
  background: var(--composer-bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 8;
}

.attachment-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-sub);
  border-bottom: 1px solid var(--border);
}
.attachment-strip img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.attachment-file-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--kakao-yellow);
  color: #191919;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.attachment-info {
  flex: 1;
  min-width: 0;
}
.attachment-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.attachment-expiry-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.attachment-expiry-wrap select {
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  color: var(--text-primary);
}
.expiry-warn {
  color: #D9480F;
}
.expiry-warn.safe {
  color: var(--success);
  font-weight: 600;
}

.long-mode-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 14px;
  background: #FFF9DB;
  border-bottom: 1px solid #FFE066;
  font-size: 12px;
  color: #381E1F;
}
body[data-theme="dark"] .long-mode-bar,
body[data-chat-bg="dark"] .long-mode-bar {
  background: rgba(254, 229, 0, 0.12);
  border-bottom-color: rgba(254, 229, 0, 0.25);
  color: #FFE066;
}

.long-mode-label {
  font-weight: 700;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #191919;
  cursor: pointer;
  font-weight: 600;
}
body[data-theme="dark"] .mode-chip,
body[data-chat-bg="dark"] .mode-chip {
  background: rgba(255, 255, 255, 0.1);
  color: #F1F3F5;
}
.mode-chip input {
  accent-color: #381E1F;
}

.composer-input-wrap {
  padding: 10px 14px 4px;
}

.composer textarea {
  width: 100%;
  min-height: 68px;
  max-height: 180px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}
.composer textarea::placeholder {
  color: var(--text-muted);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 10px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-sub);
  border: 1px solid var(--border);
  transition: background 0.12s, color 0.12s;
}
.tool-btn:hover {
  background: var(--sidebar-active);
  color: var(--text-primary);
}

.char-counter {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}
.split-hint {
  color: #D9480F;
  font-weight: 700;
  margin-right: 4px;
}

.btn-send-kakao {
  padding: 8px 20px;
  border-radius: 8px;
  background: var(--kakao-yellow);
  color: #191919;
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.15s, opacity 0.15s;
}
.btn-send-kakao:hover:not(:disabled) {
  background: var(--kakao-yellow-hover);
}
.btn-send-kakao:disabled {
  background: var(--surface-sub);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
}

/* 빠른 상용구 팝오버 */
.snippet-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  width: min(320px, calc(100vw - 24px));
  max-height: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}
.popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}
.popover-list {
  overflow-y: auto;
  max-height: 230px;
}
.popover-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.popover-item:last-child {
  border-bottom: none;
}
.popover-item:hover {
  background: var(--sidebar-hover);
}
.popover-item strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 2px;
}
.popover-item span {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   단독 뷰어 화면 (사진 뷰어 / 긴 글 뷰어 / 상대방 안내)
   ========================================================= */
.standalone-wrap {
  min-height: 100vh;
  height: 100%;
  overflow-y: auto;
  background: #EEF0F3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.standalone-card {
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  color: #191919;
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.standalone-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.viewer-img-box {
  width: 100%;
  max-height: 62vh;
  overflow: auto;
  border-radius: 12px;
  background: #111;
  margin: 14px 0 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.viewer-img-box img {
  max-width: 100%;
  height: auto;
  display: block;
}

.doc-card {
  max-width: 560px;
  text-align: left;
}
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.doc-header h1 {
  margin-bottom: 0;
}
.doc-meta {
  font-size: 12px;
  color: #868E96;
}
.doc-content {
  background: #F8F9FA;
  border: 1px solid #E9ECEF;
  border-radius: 14px;
  padding: 18px;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 56vh;
  overflow-y: auto;
  margin-bottom: 18px;
  color: #212529;
}

.notice-icon {
  font-size: 42px;
  margin-bottom: 10px;
}
.file-viewer-icon {
  font-size: 48px;
  margin-bottom: 10px;
}
.file-viewer-box {
  background: #F8F9FA;
  border: 1px solid #E9ECEF;
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0 18px;
  word-break: break-all;
}
.file-viewer-name {
  font-size: 15px;
  font-weight: 700;
  color: #191919;
  margin-bottom: 5px;
}
.file-viewer-meta {
  font-size: 12.5px;
  color: #6C757D;
}
.file-viewer-note {
  margin-top: 14px;
  font-size: 11.5px;
  color: #868E96;
}
.notice-card p {
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.notice-card .sub-text {
  font-size: 12.5px;
  color: #6C757D;
  margin-bottom: 20px;
}

.standalone-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-kakao, .btn-primary-dark, .btn-secondary, .btn-ghost {
  display: inline-block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-kakao {
  background: var(--kakao-yellow);
  color: #191919;
}
.btn-kakao:hover:not(:disabled) {
  background: var(--kakao-yellow-hover);
}
.btn-kakao:disabled {
  background: #E9ECEF;
  color: #868E96;
  cursor: not-allowed;
}
.btn-primary-dark {
  background: #191919;
  color: #FFFFFF;
}
.btn-primary-dark:hover {
  background: #333333;
}
.btn-secondary {
  background: #F1F3F5;
  color: #495057;
}
.btn-secondary:hover {
  background: #E9ECEF;
}
.btn-ghost {
  color: #868E96;
  font-weight: 600;
}

.switch-link-wrap {
  margin-top: 18px;
  text-align: center;
}
.switch-link-wrap a {
  font-size: 11.5px;
  color: #ADB5BD;
  text-decoration: none;
}
.switch-link-wrap a:hover {
  text-decoration: underline;
}

/* =========================================================
   모달 & 라이트박스 & 토스트
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-dialog {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 18px;
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-sub);
  font-size: 13.5px;
  outline: none;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--kakao-yellow);
}
.field-help {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emoji-opt {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 19px;
  background: var(--surface-sub);
  border: 1.5px solid transparent;
}
.emoji-opt.selected {
  background: #FFF9DB;
  border-color: var(--kakao-yellow);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.btn-row {
  display: flex;
  gap: 8px;
}
.btn-row > button {
  flex: 1;
}

.info-note {
  background: var(--surface-sub);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 10px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 8px;
}
.modal-footer-right {
  display: flex;
  gap: 8px;
}

.btn-kakao-sm {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--kakao-yellow);
  color: #191919;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.btn-kakao-sm:hover {
  background: var(--kakao-yellow-hover);
}

.btn-secondary-sm {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.btn-secondary-sm:hover {
  background: var(--sidebar-active);
}

.btn-ghost-sm {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-sub);
}

.btn-danger-ghost {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
}
.btn-danger-ghost:hover {
  background: rgba(224, 49, 49, 0.1);
}

.btn-danger-outline {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
  border: 1px solid rgba(224, 49, 49, 0.35);
}
.btn-danger-outline:hover {
  background: rgba(224, 49, 49, 0.08);
}

/* 라이트박스 */
.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lightbox-content img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #191919;
  color: #FFFFFF;
  font-size: 15px;
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #FFFFFF;
  font-size: 13px;
}

/* 토스트 알림 */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: rgba(25, 25, 25, 0.9);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   반응형 (모바일 / 좁은 창)
   ========================================================= */
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }
  .nav-rail {
    width: 54px;
  }
  .sidebar {
    width: calc(100vw - 54px);
    flex: 1;
  }
  .chat-main {
    display: none;
  }
  .app-shell.chat-open .sidebar {
    display: none;
  }
  .app-shell.chat-open .chat-main {
    display: flex;
  }
  .bubble {
    max-width: 84%;
  }
  .tool-btn {
    padding: 5px 8px;
    font-size: 12px;
  }
}
