/* ── 합동 비서실 ───────────────────────────────────────────── */
:root {
  --bg: #0b1020;
  --bg-soft: #121a2e;
  --panel: #172038;
  --panel-2: #1e2946;
  --line: #26324f;
  --text: #eaf0ff;
  --text-dim: #9aa8c7;
  --accent: #6c8dff;
  --accent-2: #7ee6c1;
  --warn: #ffc46b;
  --danger: #ff7b8a;
  --ok: #55e2a8;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --bar-h: 56px;
  /* iOS Safari 주소창·키보드에 맞춘 실제 보이는 높이 (app.js 가 px 로 덮어쓴다) */
  --app-vh: 100vh;
  --app-kb: 0px;
  color-scheme: dark;
}
@supports (height: 100dvh) {
  :root { --app-vh: 100dvh; }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fc;
    --bg-soft: #ffffff;
    --panel: #ffffff;
    --panel-2: #eef2fb;
    --line: #dfe5f3;
    --text: #10182c;
    --text-dim: #5f6b85;
    --accent: #3a5bff;
    --accent-2: #0f9b78;
    --shadow: 0 8px 24px rgba(20, 35, 80, .10);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  /* 배경은 초록 계열 한 색의 그라데이션만 쓴다 (2026-11-29) — 파랑/초록이 위치에 따라 나뉘어 보이지 않게 */
  background:
    radial-gradient(1150px 720px at 50% -14%, rgba(126, 230, 193, .20), transparent 68%),
    radial-gradient(900px 620px at 0% 100%, rgba(126, 230, 193, .11), transparent 62%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

.screen { min-height: 100%; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.muted { color: var(--text-dim); font-weight: 500; }
.grow { flex: 1; }

/* ── 공통 버튼/입력 ───────────────────────────────────────── */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease, background .15s ease;
  background: var(--panel-2);
  color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 78%, #000));
  color: #fff;
  box-shadow: 0 6px 18px rgba(108, 141, 255, .28);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover { background: var(--panel-2); }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--text-dim) 80%, transparent); }

.field { display: block; margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 650; color: var(--text-dim); margin-bottom: 6px; }
.field .opt { font-weight: 500; opacity: .8; }
.row { display: flex; gap: 10px; align-items: center; }
.row.tight { gap: 8px; margin-top: 8px; }
.row.end { justify-content: flex-end; }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--text-dim); min-height: 1em; }
.hint.error { color: var(--danger); }
.hint.ok { color: var(--ok); }

/* ── 입장 화면 ───────────────────────────────────────────── */
.entry-screen {
  max-width: 460px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom));
}
.hero { display: flex; gap: 14px; align-items: flex-start; margin: 12px 0 24px; }
.mark {
  flex: none;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(108, 141, 255, .28), rgba(126, 230, 193, .16));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; }
.hero .sub { margin: 6px 0 0; color: var(--text-dim); font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  padding: 9px 8px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.count:empty { display: none; }

.entry-tabs { margin-bottom: 18px; }
.panel { display: none; animation: fade .18s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fineprint { margin-top: 22px; font-size: 12px; color: var(--text-dim); text-align: center; }

/* ── 비서실 화면 ─────────────────────────────────────────── */
.room-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.roombar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}
.roombar-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.roombar h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.code-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 32%, transparent);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-chip .ico { opacity: .7; }
.roombar-actions { display: flex; gap: 6px; flex: none; }

.statusline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 10px;
  font-size: 13px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--panel-2);
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.sync { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.me-chip { color: var(--text-dim); font-size: 12.5px; }

.main-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 16px 12px;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
}

.views { flex: 1; padding: 0 var(--pad-x, 16px) calc(16px + env(safe-area-inset-bottom, 0px)); --pad-x: 16px; }
.view { display: none; }
.view.active { display: block; }
.view.feed-view.active {
  display: flex;
  flex-direction: column;
  min-height: calc(var(--app-vh, 100vh) - 210px);
  padding: 0 0 calc(10px + env(safe-area-inset-bottom, 0px));
}

.section-title { font-size: 13px; color: var(--text-dim); margin: 20px 4px 8px; font-weight: 700; }

/* 카드 */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.add-card { margin-bottom: 12px; }
.me-card { margin-bottom: 4px; }
.me-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: 16px; }
.me-sub { font-size: 12px; color: var(--text-dim); }
.avatar {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #9d7bff);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

.status-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pill {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.pill.on { color: #fff; border-color: transparent; }

/* 참여자 */
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.member .avatar { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.member-note {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-tag {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.empty { color: var(--text-dim); font-size: 13.5px; text-align: center; padding: 22px 10px; margin: 0; }

/* 할 일 */
.chips { display: flex; gap: 6px; margin: 0 0 10px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  appearance: none; font: inherit; font-size: 12.5px; font-weight: 650;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  white-space: nowrap;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* 할 일 그룹 (2026-11-29): 진행 중 → 기본 할 일 → 완료, 그룹별 접기/펼치기 */
.task-group { display: block; }
.task-group + .task-group { margin-top: 6px; }
.task-group-head {
  appearance: none; font: inherit; width: 100%;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 2px 7px 4px; margin: 0;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text-dim); cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.task-group-head:active { opacity: .7; }
.task-group-caret {
  flex: none; width: 0; height: 0;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 5.5px solid currentColor;
  opacity: .75;
  transition: transform .15s ease; transform-origin: 50% 40%;
}
.task-group-head.collapsed .task-group-caret { transform: rotate(-90deg); }
.task-group-name { font-size: 13px; font-weight: 750; color: var(--text); letter-spacing: .01em; }
.task-group[data-group="doing"] .task-group-name { color: var(--accent); }
.task-group[data-group="done"] .task-group-name { color: var(--ok); }
.task-group-count {
  font-size: 11.5px; font-weight: 700; min-width: 20px; text-align: center;
  padding: 1px 6px; border-radius: 999px; line-height: 1.5;
  background: color-mix(in srgb, var(--text-dim) 15%, transparent);
  color: var(--text-dim);
}
.task-group-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.task.done { opacity: .62; }
.task-toggle {
  flex: none;
  margin-top: 2px;
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  color: transparent;
  font-size: 13px;
  line-height: 1;
}
.task.doing .task-toggle { border-color: var(--accent); color: var(--accent); }
.task.done .task-toggle { background: var(--ok); border-color: var(--ok); color: #06281c; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 600; word-break: break-word; overflow-wrap: anywhere; }
.task.done .task-title { text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--text-dim); align-items: center; }
.task-state {
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.task-state[data-s="진행 중"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.task-state[data-s="완료"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.icon-btn {
  flex: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

/* 피드 */
.feed {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  max-height: calc(var(--app-vh, 100vh) - 300px);
  -webkit-overflow-scrolling: touch;
}
.msg { display: flex; gap: 8px; max-width: 88%; }
.msg .avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; }
.msg-body { min-width: 0; }
.msg-head { font-size: 11.5px; color: var(--text-dim); margin-bottom: 3px; display: flex; gap: 6px; align-items: baseline; }
.msg-name { font-weight: 700; color: var(--text); }
.bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 5px;
  padding: 9px 12px;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .msg-head { justify-content: flex-end; }
.msg.mine .bubble {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 92%, #fff 4%), color-mix(in srgb, var(--accent) 74%, #000));
  color: #fff;
  border-color: transparent;
  border-radius: 14px 14px 5px 14px;
}
/* 채팅 하단 입력창 — 배경·테두리 없이 입력줄만 (2026-11-29, 카드 구획 제거) */
.composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0 0;
  scroll-margin-bottom: 96px;
}
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer input { flex: 1; }
/* 채팅 입력창: 1줄 높이에서 시작해 입력량에 따라 늘어나고, 최대 높이에서 내부 스크롤 */
.composer textarea {
  flex: 1;
  min-height: 0;
  height: 44px;
  max-height: 132px;
  padding: 11px 14px;
  line-height: 1.45;
  resize: none;
  overflow-y: hidden;
}
.composer .btn { flex: none; }

/* 메모 */
.notes { display: grid; gap: 10px; }
@media (min-width: 640px) { .notes { grid-template-columns: 1fr 1fr; } }
.note {
  position: relative;
  border-radius: 14px;
  padding: 12px 12px 8px;
  background: color-mix(in srgb, var(--warn) 9%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
}
.note textarea {
  background: transparent;
  border: 0;
  padding: 0;
  min-height: 56px;
  box-shadow: none;
  font-size: 14px;
  resize: none;
}
.note textarea:focus { box-shadow: none; border: 0; }
.note-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-dim); }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  background: rgba(18, 24, 40, .96);
  color: #fff;
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 시트 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 8, 18, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* 모바일에서 내용이 길어도 카드가 화면 위로 넘치지 않게: 카드 높이를 뷰포트에 맞추고 본문만 내부 스크롤 (2026-11-28)
   상단 헤더(.sheet-head)는 sticky 로 항상 보이므로 닫기(✕) 버튼이 화면 밖으로 밀리지 않는다. */
.sheet-body {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 0 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .4);
  animation: up .2s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.invite-meta { display: flex; gap: 18px; margin: 4px 0 16px; font-size: 13px; }
.invite-meta > div { display: flex; flex-direction: column; gap: 2px; }
.invite-meta strong { font-size: 15px; }

@media (min-width: 760px) {
  .room-screen { max-width: 760px; }
  .views { padding-bottom: 40px; }
  .feed { max-height: calc(var(--app-vh, 100vh) - 320px); }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 24px; }
  .roombar h2 { font-size: 17px; }
  .br-m { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   채널 · 역할 · 멘션 (2026-11-28)
   ───────────────────────────────────────────────────────────── */

/* 역할 선택 · 배지 */
.role-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.role-pill {
  appearance: none; font: inherit; font-size: 13.5px; font-weight: 650;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
  transition: all .15s;
}
.role-pill.on {
  background: color-mix(in srgb, var(--accent) 24%, var(--panel));
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.role-badge {
  flex: none;
  font-size: 10.5px; font-weight: 800; letter-spacing: .01em;
  padding: 1px 7px; border-radius: 999px;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text-dim) 13%, transparent);
  border: 1px solid var(--line);
}
.role-badge.ai {
  color: #c9b6ff;
  background: rgba(140, 110, 255, .16);
  border-color: rgba(165, 135, 255, .45);
}
@media (prefers-color-scheme: light) {
  .role-badge.ai { color: #5b3fd6; background: rgba(120, 90, 240, .12); border-color: rgba(120, 90, 240, .35); }
}
.me-tag {
  flex: none; font-size: 10.5px; font-weight: 800;
  padding: 1px 6px; border-radius: 999px;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
}
.member-name { flex-wrap: wrap; }
.member.mine { border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line)); }
.member .mention-now { flex: none; margin-left: 2px; }
.me-text { flex: 1; }
.me-row .btn { flex: none; }

/* 채널 목록 (모바일: 상단 가로 바 / PC: 좌측 사이드바) */
.room-body { display: block; }
.channels {
  display: flex; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  padding: 0 16px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.channels::-webkit-scrollbar { display: none; }
.channel-list { display: flex; gap: 6px; }
.channel-chip {
  flex: none;
  appearance: none; font: inherit; font-size: 13.5px; font-weight: 650;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
  white-space: nowrap; transition: all .15s;
}
.channel-chip.on {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.channel-chip .channel-hash { opacity: .5; font-weight: 800; }
.channel-chip.on .channel-hash { opacity: .9; }
.channel-lock { font-size: 10px; opacity: .85; }
.channel-chip.add { border-style: dashed; color: var(--accent); }
.channel-chip.gear { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.channel-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 2px 2px 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.channel-header strong { font-size: 15px; }
#channel-sub { font-size: 12px; }

/* 방 상단 버튼 (좁은 화면에서 줄바꿈) */
.roombar { flex-wrap: wrap; }
.roombar-actions { flex-wrap: wrap; }
#admin-btn.on {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.link-btn {
  appearance: none; border: 0; background: transparent;
  color: var(--text-dim); font: inherit; font-size: 12px;
  text-decoration: underline; cursor: pointer; margin-left: auto; padding: 0;
}

/* 멘션 */
.mention {
  font-weight: 750;
  padding: 0 3px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.mention.ai { color: #b39bff; background: rgba(150, 120, 255, .18); }
.mention.all-ai {
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(150, 120, 255, .5);
}
.mention.ghost { font-weight: 600; border-bottom: 1px dashed currentColor; background: transparent; }
.mention.me {
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 45%, transparent);
}
@media (prefers-color-scheme: light) {
  .mention.ai { color: #5b3fd6; background: rgba(120, 90, 240, .14); }
}
.msg.mine .bubble .mention { color: #fff; background: rgba(255, 255, 255, .22); }
.msg.mine .bubble .mention.me { background: rgba(255, 255, 255, .36); box-shadow: none; }

.msg-cmd {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 38%, transparent);
}
.msg.mine .msg-cmd { background: color-mix(in srgb, var(--warn) 20%, transparent); }

/* 본문 속 링크 */
.auto-link {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
  word-break: break-all;
}
.auto-link:hover { color: var(--accent-2); }
.msg.mine .bubble .auto-link, .msg.mine .bubble .auto-link:hover { color: #fff; }
.edit-history-text .auto-link { font-weight: 600; }

/* 수정 시트의 담당자 편집(오너) */.edit-assignee-details { margin-top: 8px; }
.edit-assignee-details > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text-dim);
  padding: 6px 2px; user-select: none;
}
.edit-assignee-details[open] > summary { margin-bottom: 6px; }
.edit-assignee-details .pick-list { margin: 0; }

/* 채널 순서 바꾸기 */
.channel-order-list {
  list-style: none; margin: 0 0 6px; padding: 0;
  display: grid; gap: 6px;
}
.channel-order-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
}
.channel-order-idx {
  flex: none; width: 20px; height: 20px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  background: color-mix(in srgb, var(--text-dim) 14%, transparent);
}
.channel-order-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-order-lock { flex: none; font-size: 11px; }
.channel-order-item .order-btn { flex: none; width: 30px; height: 30px; font-size: 14px; }
.channel-order-item .order-btn:disabled { opacity: .3; cursor: default; }
.channel-order-empty { font-size: 12.5px; padding: 4px 2px; }

.note-mentions { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0 2px; }
.note-mentions .mention { font-size: 11.5px; }

/* 멘션 자동완성 팝업 */
.mention-pop {
  position: fixed;
  z-index: 95;
  max-height: 260px;
  overflow-y: auto;
  min-width: 220px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.mention-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  font: inherit; font-size: 13.5px;
  padding: 7px 9px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--text);
  cursor: pointer;
}
.mention-item.on, .mention-item:hover { background: var(--panel-2); }
.mention-item.all-ai {
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 4px 4px;
  margin-bottom: 3px;
  background: color-mix(in srgb, #9678ff 12%, transparent);
}
.mention-item.all-ai.on, .mention-item.all-ai:hover { background: color-mix(in srgb, #9678ff 22%, transparent); }
.mention-item.all-ai .mention-name { font-weight: 800; }
.mention-name {
  flex: 1; min-width: 0; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatar.xs { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }

/* 관리자 · 채널 시트 */
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0 -18px;
  padding: 18px 18px 10px;
  background: var(--panel);
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.sheet-body.is-scrolled > .sheet-head { border-bottom-color: var(--line); }
.sheet-head h3 { margin: 0; }
/* 카드(시트) 전체가 스크롤되므로 목록은 따로 스크롤하지 않고 자연스럽게 이어진다 */
.modal-list { max-height: none; overflow: visible; margin-top: 10px; }
.pick-list {
  display: grid; gap: 6px;
  max-height: 190px; overflow-y: auto;
  margin-bottom: 8px;
}
.pick {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 13.5px;
  cursor: pointer;
}
.pick input { width: auto; margin: 0; padding: 0; flex: none; }
.pick.on { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.pick-name { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-online { flex: none; font-size: 10.5px; font-weight: 700; color: var(--ok); }
.pick-online.off { color: var(--text-dim); }
.btn.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

.help-list {
  margin: 4px 0 14px; padding-left: 18px;
  display: grid; gap: 8px;
  font-size: 13.5px; line-height: 1.55;
}
.help-list b { font-weight: 750; }

/* PC: 좌측 채널 사이드바 */
@media (min-width: 900px) {
  .room-screen { max-width: 1080px; }
  .room-body {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 0 16px;
  }
  .channels {
    overflow: visible;
    padding: 0;
    position: sticky;
    top: 10px;
  }
  .channel-list { flex-direction: column; width: 100%; }
  .channel-chip {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
    padding: 9px 12px;
  }
  .room-main { min-width: 0; }
  .main-tabs { margin: 0 0 12px; }
  .views { padding: 0 0 40px; --pad-x: 0px; }
  .feed { max-height: calc(var(--app-vh, 100vh) - 330px); }
}

@media (max-width: 520px) {
  .roombar-actions .btn.sm { padding: 6px 9px; font-size: 12px; }
  .roombar { padding: 12px 14px 8px; }
  .channels { padding-left: 14px; padding-right: 14px; }
}

/* 내 상태 편집 (2026-11-28) */
.status-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 8px; }
.status-head-label { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.status-head .link-btn { margin-left: 0; font-size: 12.5px; }
.pill.on { background: var(--s-color, #4b6bd6); color: #fff; border-color: transparent; }
.status-tag { color: var(--s-color, var(--text-dim)); border-color: color-mix(in srgb, var(--s-color, var(--line)) 42%, transparent); }
.status-edit-list { display: grid; gap: 6px; margin: 10px 0 12px; max-height: 40vh; overflow-y: auto; }
.status-edit-row { display: flex; align-items: center; gap: 6px; }
.status-edit-row .status-edit-input { flex: 1 1 80px; min-width: 0; }
.status-color-input {
  flex: none; width: 30px; height: 30px; padding: 2px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer;
}
.status-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.status-color-input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.status-hex-input {
  flex: none; width: 72px; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; letter-spacing: .2px;
}
.status-hex-input::placeholder { font-family: inherit; letter-spacing: 0; }
.status-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.status-edit-row .icon-btn:disabled { opacity: .3; cursor: default; }

/* 관리자 메시지 삭제 (2026-11-28) */
.msg-del {
  align-self: center;
  flex: none;
  opacity: .5;
  font-size: 13px;
  line-height: 1;
  padding: 3px 5px;
}
.msg-del:hover { opacity: 1; color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ─────────────────────────────────────────────────────────────
   로그인·회원가입 · 가입 승인 · 역할 태그 (2026-11-28)
   ───────────────────────────────────────────────────────────── */

/* 로그인 / 회원가입 탭 */
.auth-tab { flex: 1; }
.entry-screen .hero .sub { margin: 6px 0 0; color: var(--text-dim); font-size: 14px; }
.entry-screen .panel .btn.block { margin-top: 4px; }
#login-hint, #signup-hint { min-height: 1.4em; }

/* 상단 탭이 많아질 때 (모바일 가로 스크롤) */
@media (max-width: 560px) {
  .main-tabs { overflow-x: auto; scrollbar-width: none; }
  .main-tabs::-webkit-scrollbar { display: none; }
  .main-tabs .tab { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
}

/* 가입 요청 · 승인된 회원 */
.request-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.request {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 13px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.request-main { flex: 1; min-width: 0; }
.request-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; font-size: 14.5px; }
.request-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--text-dim); }
.request-actions { display: flex; gap: 6px; flex: none; }
.request .btn.sm { padding: 7px 11px; }
/* 승인된 회원의 분류(유저/AI) 전환 */
.role-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 7px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
}
.role-toggle-label { font-size: 11.5px; font-weight: 700; color: var(--text-dim); padding: 0 5px 0 7px; }
.role-pick {
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 4px 11px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.role-pick.on { background: var(--accent); color: #fff; }
.role-pick.on:last-child { background: #7c5cff; }
.role-pick:hover { color: var(--text); }
.role-pick.on:hover { color: #fff; }

/* 보고 (2026-11-28) */
.report-grid { display: grid; gap: 10px; margin-bottom: 6px; }
@media (min-width: 640px) { .report-grid { grid-template-columns: 1fr 1fr; } }
.report-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 13px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.report-head { display: flex; align-items: center; gap: 10px; }
.report-head .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }
.report-who { flex: 1; min-width: 0; }
.report-name { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-weight: 650; font-size: 14px; }
.report-time { font-size: 11.5px; }
.report-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
/* 2,000자 제한 전에 저장된 긴 보고도 화면을 밀지 않도록 카드 안에서 스크롤 */
.report-text.over-limit {
  max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px; border-radius: 8px;
  outline: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent);
}
.report-over-tag { font-size: 11px; font-weight: 700; color: var(--warn); }
.report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.report-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 11px 13px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.report-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#view-reports .add-card textarea { min-height: 76px; }

/* 보고 하위 탭 */
.report-tabs { margin-bottom: 10px; }
.report-tabs .chip { flex: none; }

/* 할 일 담당 다중 선택 (2026-11-28) */
.assignee-chips { margin: 8px 0 0; min-height: 0; }
.assignee-chips:empty { display: none; }
.assignee-chip { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.assignee-chip .chip-x { cursor: pointer; opacity: .7; font-size: 10px; }
.assignee-chip .chip-x:hover { opacity: 1; }
.assignee-wrap { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.assignee {
  font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.assignee.me { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 16%, transparent); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.task.for-me { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); background: color-mix(in srgb, var(--accent-2) 6%, var(--panel)); }
.note.readonly textarea { color: var(--text); opacity: .95; }
.note.readonly { background: color-mix(in srgb, var(--text-dim) 6%, var(--panel)); border-color: var(--line); }

/* 헤더 관리 버튼 · 관리 시트 (2026-11-28) */
#admin-panel-btn { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
#admin-panel-btn.on { color: var(--ok); }
.admin-sheet-body { display: flex; flex-direction: column; max-height: 88vh; }
.admin-scroll { overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }
.admin-sheet-body .sheet-head { flex: none; }
.admin-sheet-body > .btn.block { flex: none; margin-top: 10px; }
.admin-sheet-body h4.section-title { font-size: 12.5px; }

/* 모바일 헤더: 제목 줄 + 버튼 줄로 분리해 '성빈하우스'가 잘리지 않게 (2026-11-28) */
@media (max-width: 640px) {
  .roombar {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .roombar-main { flex: none; width: 100%; min-width: 0; }
  .roombar h2 {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    font-size: 19px;
  }
  .roombar-actions { width: 100%; flex-wrap: wrap; gap: 6px; }
  .roombar-actions .btn.sm {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 6px;
    font-size: 12.5px;
    white-space: nowrap;
    text-align: center;
  }
}

/* 참여 현황: 일반 유저 / AI 그룹 (2026-11-28) */
.member-group-title {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  margin: 14px 4px 6px; letter-spacing: .02em;
}
.status-tag.offline { color: var(--text-dim); border-color: var(--line); }
.member .status-tag.offline { opacity: .85; }

/* 전체 유저 모달: 지금 머무는 채널 배지 (2026-11-28) */
.chan-badge {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 70%;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
}
.member-note { display: flex; align-items: center; gap: 6px; min-width: 0; }
.member-note-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 할 일 상태 변경 권한 (2026-11-28) */
.task-toggle:disabled { opacity: .3; cursor: default; }
.task.locked .task-title { opacity: .9; }
.task-lock { font-size: 11px; font-weight: 700; color: var(--text-dim); }

/* 관리자 계정 관리 · 비밀번호 재설정 (2026-11-28) */
.request-actions { flex-wrap: wrap; justify-content: flex-end; }
#owner-admin-section { margin-top: 4px; }
#owner-admin-section .card { margin-top: 8px; }
#owner-admin-section .request-actions .btn.sm { padding: 6px 9px; font-size: 12px; }

/* 글 수정 · (수정됨) · 수정 전 원문 이력 토글 (2026-11-29) */
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg .item-actions { margin-top: 4px; }
.msg.mine .item-actions { justify-content: flex-end; }
.act-btn {
  appearance: none; font: inherit; font-size: 11.5px; font-weight: 650;
  padding: 3px 10px; border-radius: 999px; cursor: pointer; line-height: 1.5;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  -webkit-tap-highlight-color: transparent;
}
.act-btn:hover { background: var(--panel-2); color: var(--text); }
.act-btn.danger:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.edited-tag {
  font-size: 10.5px; font-weight: 650; opacity: .72;
  margin-left: 5px; white-space: nowrap; letter-spacing: -.01em;
}
.has-history { cursor: pointer; }
.has-history:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.edit-history {
  margin-top: 6px; padding: 7px 9px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--text-dim) 8%, transparent);
  border-radius: 0 10px 10px 0;
}
.edit-history-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--text-dim); margin-bottom: 5px;
}
.edit-history-count {
  font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 18%, transparent);
}
.edit-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.edit-history-item { font-size: 12.5px; }
.edit-history-when { font-size: 10.5px; font-weight: 650; color: var(--text-dim); margin-bottom: 2px; }
.edit-history-text {
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  padding: 5px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.note-text {
  font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  min-height: 20px;
}
.note-foot .item-actions { margin-top: 0; }
.note-foot .act-btn { padding: 1px 8px; font-size: 11px; }
.task-title.has-history, .report-text.has-history { border-radius: 8px; }
.report-card .item-actions, .report-item .item-actions { margin-top: 6px; }
#edit-input { min-height: 120px; resize: vertical; line-height: 1.55; }
#edit-count { font-size: 11.5px; }
#edit-count.over { color: var(--danger); font-weight: 700; }

/* ─────────────────────────────────────────────────────────────
   사진 첨부 · 한 줄 배지 · iOS 사파리 하단 여백 (2026-11-29)
   ───────────────────────────────────────────────────────────── */

/* 사진 썸네일 · 크게 보기(라이트박스) */
.photo-thumb {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: var(--panel-2);
  object-fit: contain;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.bubble .photo-thumb { margin-bottom: 6px; max-height: 260px; border-color: rgba(255, 255, 255, .18); }
.bubble.photo-only { padding: 4px; }
.bubble.photo-only .photo-thumb { margin-bottom: 0; border-radius: 11px; border-color: transparent; }
.task-main .photo-thumb, .report-card .photo-thumb, .report-item .photo-thumb {
  margin-top: 6px; max-height: 190px;
}
.msg-body { max-width: 100%; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(3, 6, 14, .93);
  backdrop-filter: blur(6px);
  animation: fade .16s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
}
.lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(15, 22, 40, .78);
  color: #fff;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
body.lightbox-open { overflow: hidden; }

/* 사진 고르는 버튼 — 채팅 입력창(정사각) · 할 일/보고(글자 버튼) */
.photo-btn {
  flex: none;
  appearance: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.photo-btn:hover { filter: brightness(1.08); }
.photo-btn:active { transform: scale(.96); }
.photo-pick { white-space: nowrap; }

/* 첨부 전 미리보기 + 취소(✕) */
.photo-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.photo-preview .photo-thumb {
  max-height: 88px;
  border-radius: 10px;
  border-color: var(--line);
}
.photo-remove {
  flex: none;
  appearance: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.photo-remove:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.photo-hint { font-size: 11.5px; color: var(--text-dim); }
.photo-loading {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-dim);
  padding: 10px 12px; border-radius: 10px;
  border: 1px dashed var(--line); background: var(--panel-2);
}
.photo-file { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#edit-photo-preview { margin-bottom: 8px; }

/* @…에게 전달됨 배지 + 읽음 표시를 같은 줄에 (말풍선 폭을 넘지 않게) */
.msg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  min-width: 0;
  max-width: 100%;
}
.msg-foot > .msg-cmd {
  margin-top: 0;
  /* @…에게 전달됨 배지는 절대 잘리지 않는다 */
  flex: 0 0 auto;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.5;
}
.msg-foot > .msg-cmd > span {
  min-width: 0;
  white-space: nowrap;
}
.msg-foot > .item-actions {
  margin-top: 0;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* ─────────────────────────────────────────────────────────────
   채팅 말풍선 ⋯ 더보기 메뉴 + 읽음 확인 (2026-11-29)
   ───────────────────────────────────────────────────────────── */

/* 말풍선과 ⋯ 버튼을 한 줄로 — 내 말풍선은 ⋯가 왼쪽, 상대 말풍선은 오른쪽 */
.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}
.msg.mine .bubble-row { flex-direction: row-reverse; }
.bubble-row > .msg-stack { min-width: 0; max-width: 100%; }

.msg-more {
  flex: 0 0 auto;
  appearance: none;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  width: 26px;
  height: 26px;
  padding: 0 0 4px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  opacity: .7;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.msg-more:hover, .msg-more:focus-visible {
  opacity: 1;
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

.more-menu {
  position: fixed;
  z-index: 95;
  min-width: 118px;
  padding: 5px;
  display: grid;
  gap: 2px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
  animation: fade .12s ease;
}
.more-item {
  appearance: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.more-item:hover { background: var(--panel-2); }
.more-item.danger { color: var(--danger); }
.more-item.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* 말풍선 아래 읽음 표시 — 남은 폭만큼만 늘어나고 넘치면 말줄임(…) */
.msg-foot > .msg-read {
  margin-top: 0;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  appearance: none;
  font: inherit;
  font-size: 11px;
  line-height: 1.5;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.msg-foot > .msg-read:hover { color: var(--text); }
.msg-foot > .msg-read > .msg-read-label { flex: 0 0 auto; font-weight: 700; opacity: .85; }
.msg-foot > .msg-read > .msg-read-names {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   채팅 말풍선 아래 줄(배지·읽음)을 말풍선 폭에 딱 맞춘다 (2026-11-29, 순수 CSS)
   · .msg-stack 이 말풍선과 아래 줄을 함께 감싸 폭의 기준이 된다 (JS 측정 없음 → 타이밍 오차 없음)
   · @…에게 전달됨 배지(.msg-cmd)는 flex:0 0 auto — 절대 잘리지 않는다.
     배지가 말풍선보다 길면 .msg-stack 이 배지 폭까지 넓어지고,
     .bubble 이 width:100% 이므로 말풍선 끝선과 배지 끝선이 1px 오차 없이 맞는다
   · 읽음(.msg-read)은 width:0 + flex:1 1 0 — 폭에 기여하지 않고,
     말풍선(+배지)이 정한 폭 안에서만 말줄임(…)된다
   ───────────────────────────────────────────────────────────── */
.msg-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  min-width: 0;
}
.msg-stack > .bubble {
  width: 100%;
  min-width: 68px;
  box-sizing: border-box;
}
/* 수정 전 원문 이력도 말풍선 끝선에 맞춘다 — 상대 말풍선은 왼쪽 끝, 내 말풍선은 오른쪽 끝 */
.msg-stack > .edit-history {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  align-self: flex-start;
}
.msg.mine .msg-stack > .edit-history {
  align-self: flex-end;
  text-align: left;   /* 오른쪽 끝에 붙어도 본문 글자는 왼쪽부터 */
}
.msg-body .msg-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.msg-body .msg-foot > .msg-cmd {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-body .msg-foot > .msg-cmd > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-body .msg-foot > .msg-read {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;   /* 상대 말풍선: 읽음 문구는 왼쪽 끝 */
}
/* 내 말풍선: 아래 줄과 읽음 문구를 오른쪽 끝에 고정 */
.msg.mine .msg-body .msg-foot { justify-content: flex-end; }
.msg.mine .msg-body .msg-foot > .msg-read { justify-content: flex-end; text-align: right; }
.msg.mine .msg-body .msg-foot > .msg-read > .msg-read-names { flex: 0 1 auto; text-align: right; }

.read-row .read-time { flex: 0 0 auto; font-size: 11.5px; color: var(--text-dim); }
.readers-hint { margin: 0 0 10px; font-size: 11.5px; line-height: 1.5; }

/* 모바일: 채팅 영역을 '지금 보이는 높이'에 딱 맞춰 입력창·전송 버튼이 Safari 하단 바 위로
   항상 드러나게 한다. --feed-top 은 app.js 가 채팅 영역의 문서상 위치로 채워 준다. */
@media (max-width: 900px) {
  .view.feed-view.active {
    height: calc(var(--app-vh, 100vh) - var(--feed-top, 250px) - 10px);
    min-height: 280px;
    margin-bottom: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  .view.feed-view.active .feed {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding-bottom: 10px;
  }
  .composer { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}

/* ─────────────────────────────────────────────────────────────
   채팅 답장 · 멘션 브라우저 알림 (2026-11-29)
   ───────────────────────────────────────────────────────────── */

/* 상태바의 🔔 알림 토글 */
.statusline { flex-wrap: wrap; row-gap: 6px; }
.notify-btn {
  flex: 0 0 auto;
  margin-left: auto;
  appearance: none;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.notify-btn:hover { color: var(--text); }
.notify-btn.on {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 42%, transparent);
  background: color-mix(in srgb, var(--accent-2) 13%, transparent);
}
.statusline #help-btn { margin-left: 4px; }

/* 입력창 바로 위 답장 미리보기 바 */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}
.reply-bar-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.reply-bar-to {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-bar-text {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-bar-cancel {
  flex: 0 0 auto;
  appearance: none;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reply-bar-cancel:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

/* 말풍선 위 인용 블록 — 2줄에서 말줄임 */
.reply-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  min-width: 0;
  margin: 0 0 6px;
  padding: 5px 8px;
  appearance: none;
  font: inherit;
  text-align: left;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reply-quote:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.reply-quote-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-quote-text {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.msg.mine .reply-quote {
  border-left-color: rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .18);
}
.msg.mine .reply-quote:hover { background: rgba(255, 255, 255, .26); }
.msg.mine .reply-quote-name { color: #fff; }
.msg.mine .reply-quote-text { color: rgba(255, 255, 255, .86); }

/* 원문으로 이동했을 때 잠깐 강조 */
@keyframes msg-flash-pulse {
  0%, 100% { background-color: transparent; }
  18%, 62% { background-color: color-mix(in srgb, var(--accent) 18%, transparent); }
}
.msg.msg-flash {
  border-radius: 14px;
  animation: msg-flash-pulse 1.7s ease;
}
