:root {
  --bg: #1a1b26;
  --bg-2: #1f2030;
  --bg-3: #24263a;
  --panel: #20212e;
  --sidebar: #16161f;
  --border: #2c2e40;
  --text: #e4e6f0;
  --muted: #8b8fa8;
  --accent: #8b7cf6;
  --accent-2: #6c5ce7;
  --green: #4ade80;
  --danger: #f87171;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #2a2150, var(--bg));
}
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 48px 40px; width: 360px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.login-logo { font-size: 56px; }
.login-card h1 { margin: 8px 0 4px; font-size: 28px; }
.login-sub { color: var(--muted); margin: 0 0 24px; }
.login-btn { display: block; width: 100%; text-decoration: none; padding: 12px; box-sizing: border-box; text-align: center; }
.login-hint { color: var(--muted); font-size: 12px; margin: 12px 0; }
.login-hint a { color: var(--accent); }
.login-err { color: var(--danger); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 10px; text-align: left; margin-top: 20px; }
.login-form input {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 14px; font-size: 14px; width: 100%; box-sizing: border-box;
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form .login-err { margin: 0; }
.login-form .login-btn { margin-top: 4px; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
body.has-conn-banner .app { height: calc(100vh - 28px); }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; padding-right: 10px; }
.brand { font-size: 18px; font-weight: 700; padding: 18px 18px 12px; }
.notif-bell { position: relative; font-size: 17px; width: 30px; height: 30px; }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700;
  line-height: 15px; text-align: center;
}
.notif-dropdown {
  position: fixed; z-index: 200; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45);
}
.notif-dropdown-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel);
}
.notif-dropdown-head h4 { margin: 0; font-size: 13.5px; }
.notif-mark-all { background: transparent; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.notif-mark-all:hover { text-decoration: underline; }
.notif-row {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); padding: 10px 14px; font-size: 13px; cursor: pointer;
}
.notif-row:hover { background: var(--bg-3); }
.notif-row.unread { background: rgba(139,124,246,.08); }
.notif-row .avatar-sm { flex-shrink: 0; }
.notif-row-body { flex: 1; min-width: 0; }
.notif-row-body .notif-text { line-height: 1.4; }
.notif-row-body .notif-time { color: var(--muted); font-size: 11px; margin-top: 3px; }
.notif-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }

/* mentions */
.mention {
  color: var(--accent); background: rgba(139,124,246,.13); border-radius: 5px; padding: 0 3px; font-weight: 600;
}
.mention-me { color: #fff; background: var(--accent-2); }

/* mention/user autocomplete (chat input) */
.mention-menu {
  position: fixed; z-index: 1000; width: 240px; max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45); padding: 6px;
}
.mention-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.mention-menu-item.active { background: var(--accent-2); }
.tabs { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.tabs button {
  flex: 1; background: transparent; color: var(--muted); border: none;
  padding: 8px 4px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.tabs button:hover { background: var(--bg-3); color: var(--text); }
.tabs button.active { background: var(--accent-2); color: #fff; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin: 14px 4px 6px;
}
.side-head:first-child { margin-top: 0; }
.icon-btn {
  background: transparent; border: none; color: var(--muted); font-size: 16px;
  width: 24px; height: 24px; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

/* channels */
.channel-list, .doc-list { display: flex; flex-direction: column; gap: 2px; }
.channel-item, .doc-item {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text); padding: 7px 8px;
  border-radius: 7px; font-size: 14px; cursor: pointer;
}
.channel-item:hover, .doc-item:hover { background: var(--bg-3); }
.channel-item.active, .doc-item.active { background: var(--accent-2); color: #fff; }
.hash { color: var(--muted); font-weight: 700; }
.channel-item.active .hash { color: #d6c9ff; }
.doc-icon { width: 18px; text-align: center; }
.doc-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-dot { color: var(--green); font-size: 9px; }
.fav-dot { font-size: 10px; }
.doc-more {
  opacity: 0; flex-shrink: 0; font-size: 15px; font-weight: 700;
}
.doc-item:hover .doc-more, .doc-item:focus-within .doc-more { opacity: 1; }
.doc-item.active .doc-more { color: #fff; }
.doc-item.active .doc-more:hover { background: rgba(255,255,255,.18); color: #fff; }

/* nested page tree (2-2) */
.doc-caret, .doc-caret-spacer { width: 14px; height: 14px; flex-shrink: 0; font-size: 9px; }
.doc-caret { color: var(--muted); }
.doc-caret:hover { color: var(--text); }
.doc-item.active .doc-caret { color: #fff; }
.doc-item.drag-over { outline: 2px solid var(--accent); outline-offset: -2px; }

.channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-item.unread .channel-name { font-weight: 700; color: #fff; }
.channel-item.unread.active .channel-name { color: #fff; }
.unread-badge {
  flex-shrink: 0; background: var(--bg-3); color: var(--text); border-radius: 999px;
  padding: 1px 7px; font-size: 11px; font-weight: 700; line-height: 1.6;
}
.unread-badge.mention { background: var(--danger); color: #fff; }
.channel-item.active .unread-badge { background: rgba(255,255,255,.22); color: #fff; }
.channel-item.active .unread-badge.mention { background: var(--danger); }

.presence-list { display: flex; flex-direction: column; gap: 4px; }
.presence-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 7px; }
.presence-row.presence-clickable { cursor: pointer; }
.presence-row.presence-clickable:hover { background: var(--bg-3); }
.dot-online { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: auto; }

.doc-search {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; font-size: 13px;
}
.doc-search:focus { outline: none; border-color: var(--accent); }
.import-btn {
  width: 100%; background: var(--bg-3); border: 1px dashed var(--border); color: var(--muted);
  border-radius: 8px; padding: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 6px;
}

/* server-backed search results (3-1) — shown alongside the instant title filter */
.search-results-section { margin-bottom: 10px; }
.search-results-section.hidden { display: none; }
.side-head-plain {
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin: 8px 4px 6px;
}
.search-results-empty { padding: 4px 8px; }
.search-result-row {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--text); padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.search-result-row:hover { background: var(--bg-3); }
.search-result-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-snippet {
  font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-snippet mark { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 1px; }
.import-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.import-btn:disabled { opacity: .6; cursor: default; }
.import-progress-panel {
  margin: 2px 0 10px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-3);
}
.import-progress-panel[hidden], .import-progress-row[hidden] { display: none; }
.import-progress-row + .import-progress-row { margin-top: 9px; }
.import-progress-label {
  color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.import-progress-track {
  position: relative; height: 7px; overflow: hidden; border-radius: 999px;
  background: rgba(139,143,168,.18);
}
.import-progress-fill {
  height: 100%; width: 0; border-radius: inherit; background: var(--accent);
  transition: width .2s ease;
}
.import-progress-track.indeterminate .import-progress-fill {
  position: absolute; animation: import-progress-slide 1.15s ease-in-out infinite;
}
@keyframes import-progress-slide {
  from { left: -35%; }
  to { left: 100%; }
}

/* user box */
.user-box {
  display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.workspace-switch-row, .workspace-user-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.workspace-switcher {
  min-width: 0; flex: 1; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 8px;
  font-size: 12.5px; font-weight: 650;
}
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-3); object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; }
.user-mail { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Content ---------- */
.content { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.empty { margin: auto; color: var(--muted); }
.content-head {
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.content-head .topic { color: var(--muted); font-size: 13px; margin-left: 10px; }
.ch-title-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ch-title-group .icon-btn { opacity: 0; }
.ch-title-group:hover .icon-btn { opacity: 1; }
.ch-edit-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.ch-edit-name, .ch-edit-topic {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 5px 9px; font-size: 13.5px;
}
.ch-edit-name { width: 140px; font-weight: 700; }
.ch-edit-topic { width: 220px; }

/* ---------- pinned messages panel ---------- */
.pin-panel {
  max-height: 220px; overflow-y: auto; border-bottom: 1px solid var(--border);
  padding: 6px 22px; background: var(--bg-2);
}
.pin-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pin-row:last-child { border-bottom: none; }
.pin-row-main { flex: 1; min-width: 0; }
.pin-row-head { display: flex; align-items: baseline; gap: 8px; }
.pin-row-body { font-size: 13px; color: var(--text); word-wrap: break-word; margin-top: 2px; }

/* ---------- channel browser ---------- */
.browse-topic { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Chat ---------- */
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-main.is-file-dragover::after {
  content: '이미지 또는 파일을 놓아 메시지에 첨부';
  position: absolute; inset: 12px; z-index: 30; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  color: var(--text); font-size: 15px; font-weight: 700; pointer-events: none;
}
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 22px; min-height: 0; }
.msg { display: flex; gap: 10px; padding: 3px 0; }
.msg.grouped { padding-top: 0; }
.msg-spacer { width: 28px; flex: none; }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-time { color: var(--muted); font-size: 11px; }
.msg-body { word-wrap: break-word; }
.msg-body p { margin: 2px 0; }
.msg-actions { display: flex; align-items: flex-start; gap: 2px; opacity: 0; flex-shrink: 0; }
.msg:hover .msg-actions { opacity: 1; }
.msg-thread-summary {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
  background: transparent; border: none; color: var(--accent); font-size: 12.5px;
  font-weight: 600; padding: 2px 0; cursor: pointer;
}
.msg-thread-summary:hover { text-decoration: underline; }
.msg-edited { color: var(--muted); font-size: 11px; }
.msg-deleted { color: var(--muted); font-style: italic; }

/* doc-activity system posts (4-3) */
.msg-system { opacity: .85; }
.msg-system .msg-body { color: var(--muted); font-size: 13px; }
.msg-system .msg-head strong { font-weight: 600; }
.msg-edit-wrap { display: flex; flex-direction: column; gap: 6px; }
.msg-edit-input {
  width: 100%; min-height: 60px; resize: vertical; background: var(--bg-3);
  border: 1px solid var(--accent); color: var(--text); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
.msg-edit-input:focus { outline: none; }
.msg-edit-actions { display: flex; gap: 6px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 12px; padding: 2px 8px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
}
.reaction-chip:hover { border-color: var(--accent); }
.reaction-chip.mine { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.reaction-count { font-size: 11px; font-weight: 600; }
.reaction-picker {
  position: fixed; z-index: 200; display: flex; gap: 2px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.reaction-picker-item {
  background: transparent; border: none; font-size: 18px; padding: 4px 6px;
  border-radius: 6px; line-height: 1; cursor: pointer;
}
.reaction-picker-item:hover { background: var(--bg-3); }
.day-divider { text-align: center; margin: 14px 0; border-top: 1px solid var(--border); }
.day-divider span {
  background: var(--bg); color: var(--muted); font-size: 11px; padding: 0 10px;
  position: relative; top: -10px;
}
.read-divider { text-align: center; margin: 14px 0; border-top: 1px solid var(--danger); }
.read-divider span {
  background: var(--bg); color: var(--danger); font-size: 11px; font-weight: 700; padding: 0 10px;
  position: relative; top: -10px;
}
.channel-start { text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; margin: 6px 0 16px; }
.chat-form { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1; background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 14px; font-size: 14px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }

/* ---------- chat attachments ---------- */
.attach-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 22px 0; }
.attach-preview:empty { display: none; padding: 0; }
.attach-chip {
  display: flex; align-items: center; gap: 6px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px 4px 4px; font-size: 12.5px;
}
.attach-chip-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }
.attach-chip-icon { font-size: 18px; width: 28px; text-align: center; }
.attach-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip-remove {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 2px; line-height: 1;
}
.attach-chip-remove:hover { color: var(--danger); }
.msg-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; max-width: 320px; }
.attach-image-link { display: inline-block; }
.attach-image { max-width: 280px; max-height: 280px; border-radius: 8px; display: block; }
.attach-file-card {
  display: flex; align-items: center; gap: 10px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  text-decoration: none; color: var(--text);
}
.attach-file-card:hover { border-color: var(--accent); }
.attach-file-icon { font-size: 20px; }
.attach-file-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attach-file-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file-size { font-size: 11px; color: var(--muted); }

/* ---------- thread panel ---------- */
.thread-panel {
  width: 340px; flex-shrink: 0; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; background: var(--bg-2); min-height: 0;
}
.thread-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.thread-head h4 { margin: 0; font-size: 14px; }
.thread-head-actions { display: flex; gap: 4px; }
.thread-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; min-height: 0; }
.thread-sep {
  color: var(--muted); font-size: 11.5px; font-weight: 600; margin: 10px 0 8px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.msg.thread-parent { padding-bottom: 10px; }
.thread-form { padding: 12px 16px; border-top: 1px solid var(--border); }

.btn { border: none; border-radius: 9px; padding: 9px 16px; font-weight: 600; font-size: 13px; }
.btn-primary { background: var(--accent-2); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.published { color: var(--green); border-color: var(--green); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/* ---------- Docs ---------- */
.doc-breadcrumb {
  display: flex; align-items: center; gap: 6px; padding: 8px 22px 0; flex-wrap: wrap;
}
.breadcrumb-item {
  background: transparent; border: none; color: var(--muted); font-size: 12.5px;
  cursor: pointer; padding: 2px 4px; border-radius: 5px; white-space: nowrap;
}
.breadcrumb-item:hover { background: var(--bg-3); color: var(--text); }
.breadcrumb-sep { color: var(--muted); font-size: 12px; }
.breadcrumb-sep:last-child { display: none; }

.doc-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.doc-icon-input {
  width: 40px; height: 36px; font-size: 22px; text-align: center; background: transparent;
  border: 1px solid transparent; border-radius: 8px; color: var(--text); cursor: pointer;
}
.doc-icon-input:hover, .doc-icon-input:focus { border-color: var(--border); outline: none; }
.doc-icon-display { width: 40px; font-size: 22px; text-align: center; }

/* cover image (2-6) */
.doc-cover { position: relative; height: 220px; overflow: hidden; }
.doc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-cover-actions {
  position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px;
}
.doc-cover-actions .btn { background: rgba(20,20,30,.6); backdrop-filter: blur(4px); }
.doc-add-cover { margin: 10px 22px 0; align-self: flex-start; }

/* emoji icon picker (2-6) */
.emoji-picker {
  position: fixed; z-index: 1000; width: 260px; max-height: 240px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45); padding: 8px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
}
.emoji-picker-item {
  background: transparent; border: none; font-size: 19px; padding: 5px 0; border-radius: 6px; cursor: pointer;
}
.emoji-picker-item:hover { background: var(--bg-3); }
.doc-title-input {
  flex: 1; font-size: 20px; font-weight: 700; background: transparent;
  border: none; color: var(--text);
}
.doc-title-input:focus { outline: none; }
.save-state { color: var(--muted); font-size: 12px; min-width: 64px; text-align: right; }
.sync-state { color: var(--green); font-size: 11.5px; white-space: nowrap; }
.sync-state.sync-offline { color: var(--muted); }

/* offline connectivity banner (4-4) — a normal flow element (not fixed) so it
   pushes #app down instead of overlapping the tab bar underneath it. */
.conn-banner {
  text-align: center; background: var(--accent-2); color: #fff;
  font-size: 12.5px; font-weight: 600; padding: 6px 12px;
}
.space-badge {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.space-badge.team { color: #b8acff; border-color: #4a3f8a; }
.space-badge.personal { color: #5eead4; border-color: #115e59; }
.space-badge:hover { filter: brightness(1.25); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.legend-dot.team { background: #8b7cf6; }
.legend-dot.personal { background: #2dd4bf; }

.doc-main { flex: 1; display: flex; min-height: 0; }
.editor-pane { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg-2); position: relative; }

/* Collaborators currently in this doc's Yjs room (2-1) — a presence
   indicator, not a conflict warning (real collaborative merge replaced the
   old "OO님이 편집 중입니다" banner entirely). */
.doc-collaborators {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; padding: 10px 30px 0;
}
.doc-collaborators:empty { display: none; }
.collaborator-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--bg-2);
}

/* Notion database board reconstructed from imported CSV + row pages. */
.notion-board-shell { padding: 8px 30px 24px; }
.notion-board-toolbar {
  display: flex; align-items: center; gap: 4px; margin: 2px 0 12px;
  border-bottom: 1px solid var(--border);
}
.notion-view-tab {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); padding: 8px 10px; font-size: 13px; font-weight: 650;
  cursor: pointer;
}
.notion-view-tab:hover { color: var(--text); }
.notion-view-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.notion-board-scroll { overflow-x: auto; padding: 0 0 12px; }
.notion-board { display: flex; align-items: flex-start; gap: 12px; min-width: max-content; }
.notion-board-column {
  width: 280px; padding: 8px; border-radius: 10px; background: var(--bg-3);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
}
.notion-board-column.progress { background: color-mix(in srgb, #2f80ed 8%, var(--bg-3)); }
.notion-board-column.done { background: color-mix(in srgb, #2f9e64 8%, var(--bg-3)); }
.notion-board-column-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 9px; font-size: 12.5px; font-weight: 700;
}
.notion-status { display: inline-flex; align-items: center; gap: 6px; }
.notion-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5a3a0; }
.notion-board-column.progress .notion-status-dot { background: #2f80ed; }
.notion-board-column.done .notion-status-dot { background: #36a269; }
.notion-board-column.other .notion-status-dot { background: #a36be2; }
.notion-board-count { color: var(--muted); font-weight: 500; }
.notion-board-cards { display: flex; flex-direction: column; gap: 6px; }
.notion-board-card {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2);
  color: var(--text); padding: 10px 11px; font-size: 13.5px; cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
}
.notion-board-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.notion-board-card-icon { flex: 0 0 auto; opacity: .75; }
.notion-board-add {
  width: 100%; margin-top: 7px; padding: 8px 9px; border: 1px solid transparent;
  border-radius: 8px; background: transparent; color: var(--muted); text-align: left;
  font-size: 13px; cursor: pointer;
}
.notion-board-add:hover { color: var(--text); background: var(--bg-2); border-color: var(--border); }

@media (max-width: 720px) {
  .notion-board-shell { padding-inline: 16px; }
  .notion-board-column { width: 250px; }
}

/* ---------- TipTap collaborative editor (2-1) ---------- */
.note-editor { max-width: 820px; margin: 0 auto; min-height: 100%; padding: 8px 30px 40vh; }
.note-editor .ProseMirror {
  outline: none; font-size: 15px; line-height: 1.75; color: var(--text); caret-color: var(--accent);
}
.note-editor h1 { font-size: 28px; font-weight: 800; line-height: 1.3; margin: 20px 0 4px; }
.note-editor h2 { font-size: 23px; font-weight: 700; line-height: 1.3; margin: 16px 0 4px; }
.note-editor h3 { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 12px 0 4px; }
.note-editor p { margin: 4px 0; }
.note-editor blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--muted); margin: 8px 0; }
.note-editor ul, .note-editor ol { padding-left: 1.6em; }
.note-editor ul[data-type="taskList"] {
  list-style: none; padding-left: 0; margin: 7px 0;
}
.note-editor li.notion-task-item {
  display: flex; align-items: flex-start; gap: 7px; margin: 2px 0;
}
.note-editor li.notion-task-item > label {
  position: relative; flex: 0 0 18px; width: 18px; height: 18px;
  display: grid; place-items: center; margin-top: 4px; cursor: pointer; user-select: none;
}
.note-editor li.notion-task-item > label input[type="checkbox"] {
  position: absolute; inset: 0; width: 18px; height: 18px; margin: 0;
  opacity: 0; cursor: pointer;
}
.note-editor li.notion-task-item > label span {
  box-sizing: border-box; width: 15px; height: 15px; border: 1.5px solid var(--muted);
  border-radius: 3px; background: var(--bg-2); transition: background .12s, border-color .12s;
}
.note-editor li.notion-task-item > label:hover span { border-color: var(--text); }
.note-editor li.notion-task-item > label input:focus-visible + span {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;
}
.note-editor li.notion-task-item > label input:checked + span {
  position: relative; background: var(--accent); border-color: var(--accent);
}
.note-editor li.notion-task-item > label input:checked + span::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 6px; height: 3px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
.note-editor li.notion-task-item > div { flex: 1 1 auto; min-width: 0; }
.note-editor li.notion-task-item > div > p:first-child { margin-top: 0; }
.note-editor li.notion-task-item > div > p:last-child { margin-bottom: 0; }
.note-editor li.notion-task-item[data-checked="true"] > div {
  color: var(--muted); text-decoration: line-through;
}
.note-editor li.notion-task-item ul[data-type="taskList"] { margin: 3px 0 3px 2px; padding-left: 20px; }
.note-editor pre {
  font-family: "SF Mono", ui-monospace, monospace; font-size: 13px;
  background: var(--bg-3); padding: 10px 14px; border-radius: 8px; overflow-x: auto;
}
.note-editor code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: 13px;
  font-family: "SF Mono", ui-monospace, monospace; }
.note-editor pre code { background: none; padding: 0; }
.note-editor a[href] {
  color: color-mix(in srgb, var(--text) 78%, var(--accent));
  text-decoration-color: color-mix(in srgb, var(--muted) 62%, transparent);
  text-underline-offset: 3px; cursor: pointer;
}
.note-editor a[href]:hover { color: var(--text); text-decoration-color: currentColor; }
.note-editor a[data-asset-download] {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-3);
  color: var(--text); text-decoration: none; user-select: none;
}
.note-editor a[data-asset-download]::before {
  content: '↓'; color: var(--muted); font-size: 12px; font-weight: 800;
}
.note-editor a[data-asset-download]:hover {
  border-color: color-mix(in srgb, var(--muted) 65%, var(--border));
  background: color-mix(in srgb, var(--text) 5%, var(--bg-3));
  text-decoration: underline; text-underline-offset: 2px;
}
.note-editor .wikilink { cursor: pointer; }
.note-editor img { max-width: 100%; border-radius: 8px; margin: 4px 0; display: block; }
.note-editor [data-resize-container][data-node="image"] {
  max-width: 100%; margin: 4px 0;
}
.note-editor [data-resize-container][data-node="image"] [data-resize-wrapper] {
  max-width: 100%;
}
.note-editor [data-resize-container][data-node="image"] img {
  margin: 0; cursor: grab;
}
.note-editor [data-resize-container][data-node="image"] img:active { cursor: grabbing; }
.note-editor [data-resize-container][data-node="image"] [data-resize-handle] {
  width: 12px; height: 12px; z-index: 2; opacity: 0; pointer-events: none;
  border: 2px solid var(--bg-2); border-radius: 50%; background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: opacity .12s ease;
}
.note-editor [data-resize-handle="bottom-left"] {
  cursor: nesw-resize; transform: translate(-50%, 50%);
}
.note-editor [data-resize-handle="bottom-right"] {
  cursor: nwse-resize; transform: translate(50%, 50%);
}
.note-editor [data-resize-container][data-node="image"].ProseMirror-selectednode [data-resize-wrapper],
.note-editor [data-resize-container][data-node="image"][data-resize-state="true"] [data-resize-wrapper] {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px;
}
.note-editor [data-resize-container][data-node="image"].ProseMirror-selectednode [data-resize-handle],
.note-editor [data-resize-container][data-node="image"][data-resize-state="true"] [data-resize-handle] {
  opacity: 1; pointer-events: auto;
}
.notion-asset-file {
  display: flex; align-items: center; gap: 8px; width: min(100%, 520px);
  margin: 6px 0; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-3); cursor: grab; user-select: none;
}
.notion-asset-file:active { cursor: grabbing; }
.notion-asset-file.ProseMirror-selectednode {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.notion-asset-file-grip { color: var(--muted); font-size: 16px; line-height: 1; }
.notion-asset-file-icon { font-size: 17px; }
.note-editor .notion-asset-file-link[data-asset-download] {
  min-width: 0; padding: 0; border: 0; background: none; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-editor .notion-asset-file-link[data-asset-download]::before { display: none; }
.notion-asset-file-size { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.note-editor .notion-property-source { display: none; }

/* Inline child pages created with /페이지. */
.notion-subpage {
  display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%;
  margin: 3px 0; padding: 3px 6px; border-radius: 5px; color: var(--text);
  cursor: pointer; user-select: none;
}
.notion-subpage:hover { background: var(--bg-3); }
.notion-subpage-icon { flex: 0 0 auto; font-size: 16px; opacity: .8; }
.notion-subpage-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 550; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
  text-underline-offset: 3px;
}

/* Database row properties live below the page title, outside editable body. */
.notion-page-properties {
  max-width: 760px; margin: 0 auto; padding: 2px 30px 12px;
}
.notion-property-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center;
  min-height: 34px; font-size: 13.5px;
}
.notion-property-name { color: var(--muted); }
.notion-property-select {
  justify-self: start; border: 0; border-radius: 6px; padding: 4px 25px 4px 9px;
  background: var(--bg-3); color: var(--text); font: inherit; cursor: pointer;
}
.notion-property-select.progress { background: color-mix(in srgb, #2f80ed 18%, var(--bg-3)); }
.notion-property-select.done { background: color-mix(in srgb, #36a269 18%, var(--bg-3)); }
.notion-property-select:disabled { cursor: default; opacity: .8; }
.note-editor .ProseMirror .is-empty::before {
  content: attr(data-placeholder); color: var(--muted); pointer-events: none; float: left; height: 0;
}

/* tables (2-3) */
.note-editor table, .preview-doc table {
  border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px;
}
.note-editor th, .note-editor td, .preview-doc th, .preview-doc td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.note-editor th, .preview-doc th { background: var(--bg-3); font-weight: 700; }

/* callouts (2-3) — a callout renders as <blockquote class="callout ...">,
   so these need to out-specificity the plain ".note-editor blockquote" rule
   above rather than relying on source order alone. */
.note-editor blockquote.callout, .preview-doc blockquote.callout, div.callout {
  display: flex; gap: 10px; margin: 10px 0; padding: 10px 14px;
  border-left: 4px solid var(--accent); background: var(--bg-3); border-radius: 0 8px 8px 0;
}
.callout::before { flex-shrink: 0; font-size: 16px; line-height: 1.6; }
/* editor-only wrapper (see callout-extension.js renderHTML): without this,
   an empty/short paragraph is a flex item with no grow, so it collapses to
   zero width and can't be clicked into; multiple paragraphs would also sit
   side-by-side instead of stacking. */
.callout-body { flex: 1 1 auto; min-width: 0; }
.callout-body > p:first-child { margin-top: 0; }
.callout-body > p:last-child { margin-bottom: 0; }
.callout-note::before { content: 'ℹ️'; }
.callout-warning::before, .callout-caution::before { content: '⚠️'; }
.callout-tip::before { content: '💡'; }
.callout-danger::before, .callout-important::before { content: '🚨'; }
.callout-warning, .callout-caution { border-left-color: #f08c00; }
.callout-tip { border-left-color: var(--green); }
.callout-danger, .callout-important { border-left-color: var(--danger); }

/* toggle / details (2-3) */
.note-editor details, .preview-doc details {
  margin: 8px 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
}
.note-editor summary, .preview-doc summary {
  cursor: pointer; font-weight: 600; padding: 4px 2px; user-select: none;
}
.note-editor details[open] summary, .preview-doc details[open] summary { margin-bottom: 4px; }

/* link embed cards (2-3) */
.embed-card {
  display: flex; gap: 12px; align-items: stretch; margin: 10px 0; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--bg-3); cursor: pointer;
}
.embed-card:hover { border-color: var(--accent); }
.embed-card-text {
  flex: 1; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column;
  gap: 4px; justify-content: center; color: inherit; text-decoration: none;
}
.embed-card-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embed-card-desc { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.embed-card-image { width: 140px; flex-shrink: 0; object-fit: cover; }

/* chat "[[문서]]" mention cards (4-2) — same visual language as embed-card */
.msg-doc-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.doc-mention-card {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px; max-width: 360px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-3); cursor: pointer;
}
.doc-mention-card:hover { border-color: var(--accent); }
.doc-mention-card-icon { font-size: 20px; flex-shrink: 0; }
.doc-mention-card-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-mention-card-title { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-mention-card-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "/" slash command menu (2-3) */
.slash-menu {
  position: fixed; z-index: 1000; min-width: 180px; max-height: 280px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45); padding: 6px;
}
.slash-item { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.slash-item:hover, .slash-item.active { background: var(--accent-2); color: #fff; }

/* document comments (2-4): hover gutter button + "has comment" marker */
.block-comment-btn {
  position: absolute; z-index: 40; width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  align-items: center; justify-content: center; cursor: pointer; font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.block-comment-btn:hover { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.note-editor .ProseMirror .has-comment {
  position: relative; box-sizing: border-box; padding-right: 34px; border-radius: 4px;
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 72%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 58%);
}
.note-editor .ProseMirror .has-comment::after {
  content: attr(data-comment-indicator); position: absolute; z-index: 3;
  top: 2px; right: 3px; box-sizing: border-box; width: 24px; height: 24px;
  display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--muted);
  font-size: 11px; line-height: 1; cursor: pointer; pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.note-editor .ProseMirror .has-comment:hover::after {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}

.comments-block .doc-comment-form { display: flex; gap: 8px; margin-bottom: 10px; }
.comments-block .doc-comment-form input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); font-size: 13.5px;
}
.comments-block .comment-anchor-hint {
  font-size: 12px; color: var(--muted); margin-bottom: 6px;
}
.comment-thread { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg-2); }
.comment-thread.resolved { opacity: .65; }
.comment-row { display: flex; gap: 8px; margin-bottom: 6px; }
.comment-row .avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.comment-row-body { flex: 1; min-width: 0; }
.comment-row-head { display: flex; align-items: baseline; gap: 6px; }
.comment-row-name { font-weight: 600; font-size: 13px; }
.comment-row-time { font-size: 11px; color: var(--muted); }
.comment-row-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.comment-replies { margin: 6px 0 0 32px; }
.comment-thread-actions { display: flex; gap: 8px; margin-top: 4px; }
.comment-thread-actions button { font-size: 12px; }
.comment-reply-form { display: flex; gap: 6px; margin: 8px 0 0 32px; }
.comment-reply-form input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 8px; color: var(--text); font-size: 12.5px;
}
.comments-resolved-toggle { cursor: pointer; color: var(--muted); font-size: 12.5px; margin: 4px 0 8px; user-select: none; }
.comment-flash { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.msg-flash { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

/* remote collaborator cursors + selections (y-prosemirror's default builders) */
.ProseMirror-yjs-cursor {
  position: relative; margin-left: -1px; margin-right: -1px; border-left: 1.5px solid;
  border-right: 1.5px solid; word-break: normal; pointer-events: none;
}
.ProseMirror-yjs-cursor > div {
  position: absolute; top: -1.6em; left: -1.5px; font-size: 11px; font-weight: 700;
  line-height: 1; user-select: none; white-space: nowrap; padding: 2px 5px; border-radius: 4px 4px 4px 0;
  color: #fff;
}
.ProseMirror-yjs-selection { border-radius: 2px; }

/* to-do checkbox lists (preview + published) */
.todo-list { list-style: none; padding-left: 4px; }
.todo-list .todo { display: flex; align-items: baseline; gap: 4px; }
.todo-list .todo .checkbox { cursor: pointer; user-select: none; color: var(--accent); }
.todo-list .todo.done { color: var(--muted); text-decoration: line-through; }
.todo-list .todo.done .checkbox { color: var(--green); }

/* markdown */
.preview-pane h1, .preview-pane h2, .preview-pane h3 { margin: 18px 0 8px; line-height: 1.3; }
.preview-pane h1 { font-size: 26px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.preview-pane h2 { font-size: 21px; }
.preview-pane h3 { font-size: 17px; }
.preview-pane p { margin: 8px 0; }
.preview-pane ul, .preview-pane ol { padding-left: 22px; }
.preview-pane code {
  background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: 13px;
  font-family: "SF Mono", ui-monospace, monospace;
}
.preview-pane pre {
  background: var(--bg-3); padding: 14px 16px; border-radius: 10px; overflow-x: auto;
}
.preview-pane pre code { background: none; padding: 0; }
.preview-pane blockquote {
  border-left: 3px solid var(--accent); margin: 10px 0; padding: 4px 14px; color: var(--muted);
}
.preview-pane a { color: var(--accent); }
.preview-pane img { max-width: 100%; border-radius: 8px; }
.wikilink {
  color: var(--accent); text-decoration: none; background: rgba(139,124,246,.13);
  padding: 1px 5px; border-radius: 5px; font-weight: 500;
}
.wikilink:hover { background: rgba(139,124,246,.28); }
.wikilink-new { color: var(--muted); background: rgba(139,143,168,.13); border-bottom: 1px dashed var(--muted); }
.notion-page-link {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 1px 3px; border-radius: 4px; background: transparent;
  color: color-mix(in srgb, var(--accent) 58%, var(--text));
  font-weight: 550; text-decoration: none;
  vertical-align: text-bottom; cursor: pointer; user-select: none;
}
.notion-page-link:hover {
  color: color-mix(in srgb, var(--accent) 82%, var(--text));
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.notion-page-link-icon {
  flex: 0 0 auto; color: color-mix(in srgb, var(--accent) 42%, var(--text));
  font-size: .95em; line-height: 1; opacity: .9;
}
.notion-page-link-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 48%, transparent);
  text-underline-offset: 3px;
}
.notion-page-link:hover .notion-page-link-title { text-decoration-color: currentColor; }
.notion-page-link.wikilink-new {
  color: color-mix(in srgb, var(--muted) 76%, var(--accent));
  background: transparent; border-bottom: 0;
}

/* #tags (3-2) — editor decoration + read-view chip share this look */
.tag-chip, span.tag-chip {
  color: #f0b429; background: rgba(240,180,41,.14); padding: 1px 5px;
  border-radius: 5px; font-weight: 600; cursor: pointer;
}
.tag-chip:hover { background: rgba(240,180,41,.26); }

.tag-list { display: flex; flex-direction: column; gap: 2px; }
.tag-list-item {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text); padding: 6px 8px;
  border-radius: 7px; font-size: 13.5px; cursor: pointer;
}
.tag-list-item:hover { background: var(--bg-3); }
.tag-list-item .tag-count { margin-left: auto; color: var(--muted); font-size: 11.5px; }

.tag-page-title { font-size: 20px; font-weight: 700; padding: 14px 22px 0; }
.tag-page-count { color: var(--muted); font-size: 13px; padding: 2px 22px 14px; border-bottom: 1px solid var(--border); }
.tag-page-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }

/* link panels rendered as a docked footer */
.doc-side-dock {
  border-top: 1px solid var(--border); padding: 12px 22px; display: flex; gap: 28px;
  background: var(--bg-2); flex-wrap: wrap;
}

/* We render outlinks/backlinks via grid in content; reuse simple blocks */
.side-block h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.link-chip {
  display: inline-block; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); border-radius: 20px; padding: 4px 12px; margin: 0 6px 6px 0; font-size: 13px;
}
.link-chip:hover { border-color: var(--accent); color: var(--accent); }

/* unlinked mentions (3-3) */
#unlinked-mentions h4 { margin-top: 14px; }
.unlinked-mention-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.unlinked-mention-row .link-chip { margin: 0; flex-shrink: 0; }

/* "이 문서가 언급된 대화" (4-2) */
.chat-mention-row {
  display: block; width: 100%; text-align: left; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; color: var(--text); cursor: pointer;
}
.chat-mention-row:hover { border-color: var(--accent); }
.chat-mention-head { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
.chat-mention-channel { font-weight: 600; }
.chat-mention-author { color: var(--muted); }
.chat-mention-time { margin-left: auto; }
.chat-mention-snippet { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Focused document workspace ----------
   The document view follows Notion's page-first hierarchy: a compact utility
   bar, a generous title canvas, and contextual metadata that stays out of the
   writing flow until requested. */
.content.docs-content {
  --doc-canvas: #1f1f1f;
  --doc-hover: rgba(255,255,255,.055);
  --doc-soft-border: rgba(255,255,255,.085);
  background: var(--doc-canvas);
}
.docs-content .doc-topbar {
  flex: 0 0 46px; min-width: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--doc-soft-border); background: color-mix(in srgb, var(--doc-canvas) 94%, transparent);
  backdrop-filter: blur(12px); z-index: 20;
}
.docs-content .doc-breadcrumb {
  min-width: 0; flex: 1; flex-wrap: nowrap; gap: 3px; padding: 0; overflow: hidden;
}
.docs-content .breadcrumb-item,
.docs-content .breadcrumb-current {
  flex: 0 1 auto; min-width: 0; max-width: 180px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; border-radius: 5px;
  padding: 3px 5px; font-size: 12.5px;
}
.docs-content .breadcrumb-current { color: var(--text); }
.docs-content .breadcrumb-sep { flex: 0 0 auto; opacity: .55; }
.docs-content .doc-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 3px;
  flex: 0 0 auto; white-space: nowrap;
}
.docs-content .doc-toolbar-btn,
.docs-content .space-badge,
.docs-content .viewer-badge {
  min-height: 28px; padding: 4px 8px; border: 0; border-radius: 6px;
  background: transparent; font-size: 12.5px; font-weight: 500;
}
.docs-content .doc-toolbar-btn:hover,
.docs-content .space-badge:hover { background: var(--doc-hover); color: var(--text); }
.docs-content .space-badge.team,
.docs-content .space-badge.personal { border: 0; color: var(--muted); }
.docs-content .save-state,
.docs-content .sync-state { min-width: 0; font-size: 11px; opacity: .82; }
.docs-content .save-state:empty,
.docs-content .sync-state:empty { display: none; }

.docs-content .doc-cover { flex: 0 0 auto; height: clamp(180px, 27vh, 280px); }
.docs-content .doc-cover-actions { opacity: 0; transition: opacity .15s ease; }
.docs-content .doc-cover:hover .doc-cover-actions,
.docs-content .doc-cover:focus-within .doc-cover-actions { opacity: 1; }
.docs-content .doc-cover-actions .btn {
  padding: 6px 10px; border-color: rgba(255,255,255,.2); color: #fff;
}
.docs-content .doc-page-header {
  flex: 0 0 auto; width: min(100%, 820px); margin: 0 auto;
  padding: 30px 30px 12px;
}
.docs-content .doc-page-header.has-cover { padding-top: 0; }
.docs-content .doc-page-icon-row {
  min-height: 58px; display: flex; align-items: center; gap: 10px;
}
.docs-content .doc-page-header.has-cover .doc-page-icon-row {
  position: relative; z-index: 2; min-height: 76px; margin-top: -38px;
}
.docs-content .doc-icon-input,
.docs-content .doc-icon-display {
  width: 64px; height: 64px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; font-size: 48px; line-height: 1;
}
.docs-content .doc-icon-input:hover,
.docs-content .doc-icon-input:focus-visible { background: var(--doc-hover); }
.docs-content .doc-add-cover {
  opacity: 0; margin: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); padding: 5px 7px; font: inherit; font-size: 12px;
}
.docs-content .doc-page-header:hover .doc-add-cover,
.docs-content .doc-page-header:focus-within .doc-add-cover { opacity: 1; }
.docs-content .doc-add-cover:hover { color: var(--text); background: var(--doc-hover); }
.docs-content .doc-title-row { display: flex; align-items: center; gap: 6px; }
.docs-content .doc-title-input {
  width: 100%; min-width: 0; padding: 2px 0 5px; font-size: clamp(32px, 4vw, 42px);
  font-weight: 720; letter-spacing: -.035em; line-height: 1.18;
}
.docs-content .doc-title-input::placeholder { color: color-mix(in srgb, var(--muted) 62%, transparent); }
.docs-content .daily-nav {
  flex: 0 0 auto; width: 30px; height: 34px; font-size: 27px; font-weight: 300;
}

.docs-content .doc-workspace {
  position: relative; flex: 1; min-width: 0; min-height: 0; display: flex;
  border-top: 1px solid transparent;
}
.docs-content .doc-main { flex: 1; min-width: 0; min-height: 0; }
.docs-content .editor-pane { background: var(--doc-canvas); scroll-padding-top: 24px; }
.docs-content .note-editor { max-width: 820px; padding: 8px 30px 42vh; }
.docs-content .note-editor .ProseMirror {
  font-size: 16px; line-height: 1.72; letter-spacing: -.006em;
}
.docs-content .note-editor p { margin: 3px 0; }
.docs-content .note-editor h1 { margin: 26px 0 6px; font-size: 30px; letter-spacing: -.025em; }
.docs-content .note-editor h2 { margin: 22px 0 5px; font-size: 24px; letter-spacing: -.02em; }
.docs-content .note-editor h3 { margin: 18px 0 4px; font-size: 19px; }
.docs-content .note-editor blockquote { border-left-color: var(--muted); }
.docs-content .notion-page-properties { max-width: 820px; padding: 0 30px 12px; }
.docs-content .notion-board-shell { padding-inline: max(30px, calc((100% - 1060px) / 2)); }
.docs-content .doc-collaborators { max-width: 820px; margin: 0 auto; padding-inline: 30px; }

.docs-content .doc-side-dock {
  display: none; flex: 0 0 340px; width: 340px; min-height: 0; overflow-y: auto;
  padding: 0; border: 0; border-left: 1px solid var(--doc-soft-border);
  background: color-mix(in srgb, var(--doc-canvas) 92%, #2d2d2d);
}
.docs-content .doc-side-dock.is-open { display: block; }
.docs-content .doc-details-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center;
  justify-content: space-between; min-height: 46px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--doc-soft-border); background: inherit; font-size: 13.5px;
}
.docs-content .side-block {
  display: block; margin: 0; padding: 0 14px 14px;
  border-bottom: 1px solid var(--doc-soft-border);
}
.docs-content .side-block > summary {
  margin: 0 -6px; padding: 12px 6px 10px; border-radius: 5px;
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
  list-style: none;
}
.docs-content .side-block > summary::-webkit-details-marker { display: none; }
.docs-content .side-block > summary::after {
  content: '›'; float: right; color: var(--muted); font-size: 18px; line-height: 16px;
  transform: rotate(0); transition: transform .14s ease;
}
.docs-content .side-block[open] > summary::after { transform: rotate(90deg); }
.docs-content .side-block > summary:hover { background: var(--doc-hover); }
.docs-content .side-block h4 { margin: 5px 0 7px; font-size: 11.5px; font-weight: 500; }
.docs-content .side-block h4:not(:first-of-type) { margin-top: 15px; }
.docs-content .link-chip {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 0 4px 5px 0; padding: 4px 8px; border: 0; border-radius: 5px;
  background: var(--doc-hover); font-size: 12.5px;
}
.docs-content .local-graph-canvas { height: 210px; border: 1px solid var(--doc-soft-border); }

/* The document library stays quiet and page-centric while preserving all
   import/export and hierarchy controls. */
.sidebar.docs-mode { --doc-hover: rgba(255,255,255,.055); background: #171717; }
.sidebar.docs-mode .sidebar-body { padding: 10px 8px 16px; }
.sidebar.docs-mode .doc-search {
  height: 32px; margin: 0 0 8px; padding: 6px 10px 6px 30px; border: 0;
  border-radius: 6px; background: var(--doc-hover); font-size: 12.5px;
  background-image: linear-gradient(transparent, transparent);
}
.sidebar.docs-mode .sidebar-body { position: relative; }
.sidebar.docs-mode .sidebar-body::before {
  content: '⌕'; position: absolute; top: 13px; left: 17px; z-index: 1;
  color: var(--muted); font-size: 17px; pointer-events: none;
}
.sidebar.docs-mode .doc-library-tools {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 10px;
}
.sidebar.docs-mode .import-btn {
  margin: 0; min-width: 0; padding: 6px 7px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; font-size: 11.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar.docs-mode .import-btn:hover:not(:disabled) { background: var(--doc-hover); color: var(--text); }
.sidebar.docs-mode .side-head { margin: 13px 6px 4px; font-size: 10.5px; text-transform: none; letter-spacing: 0; }
.sidebar.docs-mode .doc-list { gap: 0; }
.sidebar.docs-mode .doc-item {
  min-height: 29px; padding-top: 4px; padding-bottom: 4px; border-radius: 5px;
  color: color-mix(in srgb, var(--text) 88%, transparent); font-size: 13px;
}
.sidebar.docs-mode .doc-item:hover { background: var(--doc-hover); }
.sidebar.docs-mode .doc-item.active { background: rgba(255,255,255,.11); color: #fff; }
.sidebar.docs-mode .doc-caret,
.sidebar.docs-mode .doc-caret-spacer { width: 12px; }
.sidebar.docs-mode .doc-icon { opacity: .86; }
.sidebar.docs-mode .tag-list-item { padding-block: 5px; border-radius: 5px; font-size: 12.5px; }

@media (max-width: 1180px) {
  .docs-content .save-state { display: none; }
  .docs-content .doc-side-dock {
    position: absolute; inset: 0 0 0 auto; z-index: 30; width: min(360px, 92%);
    box-shadow: -18px 0 40px rgba(0,0,0,.28);
  }
}

@media (max-width: 820px) {
  body.docs-mode .app { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-content .doc-topbar { padding-left: 10px; gap: 6px; }
  .docs-content .breadcrumb-item { display: none; }
  .docs-content .breadcrumb-sep { display: none; }
  .docs-content .doc-toolbar { gap: 1px; }
  .docs-content .doc-toolbar .space-badge,
  .docs-content .doc-toolbar #history-btn,
  .docs-content .doc-toolbar #publish-btn,
  .docs-content .doc-toolbar #share-btn { display: none; }
  .docs-content .doc-page-header,
  .docs-content .note-editor,
  .docs-content .notion-page-properties { padding-left: 22px; padding-right: 22px; }
  .docs-content .doc-title-input { font-size: 32px; }
}

@media (max-width: 600px) {
  body.docs-mode .app { grid-template-columns: 172px minmax(0, 1fr); }
  .sidebar.docs-mode .brand { font-size: 15px; padding-left: 10px; }
  .sidebar.docs-mode .tabs { padding-inline: 5px; }
  .sidebar.docs-mode .tabs button { font-size: 0; }
  .sidebar.docs-mode .tabs button::before { font-size: 15px; }
  .sidebar.docs-mode .tabs button[data-view="chat"]::before { content: '💬'; }
  .sidebar.docs-mode .tabs button[data-view="docs"]::before { content: '📄'; }
  .sidebar.docs-mode .tabs button[data-view="graph"]::before { content: '🕸'; }
  .docs-content .doc-page-header,
  .docs-content .note-editor,
  .docs-content .notion-page-properties { padding-left: 16px; padding-right: 16px; }
  .docs-content .doc-title-input { font-size: 28px; }
}

/* ---------- Graph ---------- */
.content.graph-content { background: #171821; }
.graph-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
.graph-canvas {
  width: 100%; height: 100%; display: block; cursor: grab;
  background:
    radial-gradient(circle at 50% 42%, rgba(66,68,104,.25), transparent 48%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    #171821;
  background-size: auto, 28px 28px, 28px 28px, auto;
}
.graph-stage-toolbar {
  position: absolute; z-index: 3; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  pointer-events: none; color: var(--muted); font-size: 12px;
}
.graph-stage-toolbar > * { pointer-events: auto; }
.graph-stage-toolbar .btn { background: rgba(31,32,48,.86); backdrop-filter: blur(8px); }
.graph-hover-card {
  position: absolute; z-index: 3; top: 56px; left: 14px; width: min(280px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 3px; padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 9px;
  background: rgba(31,32,48,.92); box-shadow: 0 10px 28px rgba(0,0,0,.3);
  backdrop-filter: blur(10px); pointer-events: none;
}
.graph-hover-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.graph-hover-card span { color: var(--muted); font-size: 11.5px; }
.graph-hover-kind { color: var(--accent); font-size: 10.5px; font-weight: 700; }
.graph-gesture-hint {
  position: absolute; z-index: 2; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: calc(100% - 28px); padding: 6px 10px; border-radius: 7px;
  background: rgba(22,22,31,.78); color: var(--muted); font-size: 11.5px;
  white-space: nowrap; pointer-events: none; backdrop-filter: blur(8px);
}
.graph-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; padding: 30px; text-align: center;
}
.graph-empty-icon { font-size: 34px; opacity: .8; }
.graph-empty span { max-width: 420px; color: var(--muted); font-size: 12.5px; }
.graph-empty code, .graph-sidebar-desc code { background: var(--bg-3); padding: 1px 4px; border-radius: 4px; }

.sidebar.graph-mode { background: #16161f; }
.sidebar.graph-mode .sidebar-body { padding: 16px 14px; }
.graph-sidebar-title { font-size: 17px; font-weight: 720; letter-spacing: -.02em; }
.graph-sidebar-desc { margin: 4px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.graph-legend {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px 8px;
  padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.02);
}
.graph-legend-row { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; }
.graph-node-sample { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #8b7cf6; }
.graph-node-sample.personal { background: #2dd4bf; }
.graph-node-sample.tag { border-radius: 2px; background: #f0b429; transform: rotate(45deg) scale(.82); }
.graph-edge-sample { width: 17px; height: 1px; flex: 0 0 auto; background: rgba(160,168,196,.75); }
.graph-control-group { margin-top: 16px; }
.graph-control-title { margin-bottom: 7px; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.sidebar.graph-mode .doc-search { margin: 0; border: 0; background: var(--bg-3); }
.graph-search-status { min-height: 18px; padding: 3px 2px 0; }
.graph-filter-row {
  display: flex; align-items: center; gap: 7px; min-height: 29px; margin: 1px 0;
  padding: 4px 5px; border-radius: 6px; color: color-mix(in srgb, var(--text) 82%, transparent);
  font-size: 12.5px; cursor: pointer;
}
.graph-filter-row:hover { background: var(--bg-3); color: var(--text); }
.graph-filter-row input { accent-color: var(--accent); }
.graph-tag-select {
  width: 100%; margin-top: 7px !important; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 6px 8px; font-size: 12.5px;
}
.graph-stats {
  margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px;
}
.graph-stats strong { color: var(--text); font-weight: 650; }
.local-graph-canvas {
  width: 100%; height: 180px; display: block; border-radius: 8px; cursor: grab;
  background: radial-gradient(400px 260px at 50% 40%, #20223a, var(--bg));
}

@media (max-width: 720px) {
  body.graph-mode .app { grid-template-columns: 210px minmax(0, 1fr); }
  .graph-stage-toolbar > span { display: none; }
  .graph-stage-toolbar { justify-content: flex-end; }
  .graph-gesture-hint { font-size: 10.5px; }
}

/* ---------- version history / restore modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}

/* ---------- command palette (4-1) ---------- */
.palette-overlay { align-items: flex-start; padding-top: 12vh; z-index: 400; }
.palette-modal {
  width: min(640px, 94vw); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.palette-input {
  border: none; border-bottom: 1px solid var(--border); background: transparent;
  color: var(--text); font-size: 16px; padding: 16px 18px; outline: none;
}
.palette-results { overflow-y: auto; padding: 6px; }
.palette-group-label {
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; padding: 10px 10px 4px;
}
.palette-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-item.active { background: var(--accent-2); }
.palette-item.active .palette-item-sub { color: rgba(255,255,255,.75); }
.palette-item-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-sub {
  font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.palette-item-sub mark { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 1px; }
.palette-empty { padding: 16px; text-align: center; }
.history-modal {
  width: min(960px, 96vw); height: min(640px, 90vh);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.history-head h3 { margin: 0; font-size: 15px; }
.history-body { flex: 1; display: flex; min-height: 0; }
.history-list {
  width: 260px; flex-shrink: 0; overflow-y: auto; padding: 10px;
  border-right: 1px solid var(--border); background: var(--bg-2);
}
.hist-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  color: var(--text); padding: 9px 11px; margin-bottom: 4px;
}
.hist-item:hover { background: var(--bg-3); }
.hist-item.active { background: var(--bg-3); border-color: var(--accent); }
.hist-row-top { display: flex; align-items: center; gap: 7px; }
.hist-rel { font-weight: 700; font-size: 13px; }
.hist-badge {
  font-size: 10px; font-weight: 700; color: #fff; background: var(--accent-2);
  padding: 1px 6px; border-radius: 999px;
}
.hist-abs { color: var(--muted); font-size: 11px; margin-top: 2px; }
.hist-meta { color: var(--muted); font-size: 11px; margin-top: 3px; }
.history-preview { flex: 1; overflow-y: auto; min-width: 0; }

/* ---------- share modal / admin modal (2-5) — reuse .modal-overlay + .history-head ---------- */
.simple-modal {
  width: min(480px, 96vw); max-height: min(640px, 90vh);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.simple-modal-body { padding: 14px 18px; overflow-y: auto; }
.share-add-form { display: flex; gap: 6px; margin-bottom: 14px; position: relative; }
.share-add-form input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); font-size: 13.5px;
}
.share-add-form select {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 12.5px; padding: 0 6px;
}
.share-user-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 5;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  max-height: 200px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.share-user-suggestions .mention-menu-item { padding: 8px 10px; }
.share-row, .admin-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.share-row:last-child, .admin-row:last-child { border-bottom: none; }
.share-row .avatar, .admin-row .avatar { width: 26px; height: 26px; border-radius: 50%; }
.share-row-name, .admin-row-name { flex: 1; font-size: 13.5px; }
.share-row select { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12px; }
.admin-role-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-2); color: #fff;
}

/* "채널에 보내기" picker (4-2) — reuses .simple-modal */
#send-channel-search {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); font-size: 13.5px; margin-bottom: 10px;
}
.channel-pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.channel-pick-item {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--text); padding: 8px 10px; border-radius: 7px; font-size: 13.5px; cursor: pointer;
}
.channel-pick-item:hover { background: var(--bg-3); }

/* "문서 구독 관리" (4-3) — reuses .simple-modal + .share-row + .channel-pick-list */
.doc-sub-add-label { margin: 14px 0 6px; font-size: 12px; color: var(--muted); }
#doc-sub-search {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); font-size: 13.5px; margin-bottom: 8px;
}
.doc-sub-children-toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.doc-sub-badge {
  font-size: 10px; font-weight: 700; color: var(--muted); background: var(--bg-3);
  padding: 1px 6px; border-radius: 999px; margin-left: 6px;
}
.admin-disabled-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--danger); color: #fff;
}
.viewer-badge { font-size: 12px; color: var(--muted); background: var(--bg-3); padding: 4px 10px; border-radius: 999px; }
.admin-transfer-form { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.admin-transfer-form input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); font-size: 12.5px;
}

/* admin modal tabs: 감사 로그 · 통계 (5-4) */
.admin-modal { width: min(620px, 96vw); max-height: min(720px, 90vh); }
.workspace-invite-form { display: flex; gap: 7px; margin-bottom: 8px; }
.workspace-invite-form input { min-width: 0; flex: 1; }
.workspace-invite-form input, .workspace-invite-form select, .member-role-select {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px;
}
.member-role-select { margin-left: auto; font-size: 12px; }
.workspace-settings-form { display: grid; gap: 10px; }
.workspace-settings-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.workspace-settings-form input, .workspace-danger-zone select {
  width: 100%; box-sizing: border-box; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 8px 9px;
}
.workspace-danger-zone { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }
.workspace-danger-zone h4 { margin: 12px 0 7px; }
.workspace-danger-zone form { display: flex; gap: 8px; }
.admin-tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.admin-tab {
  background: transparent; border: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 10px 12px; cursor: pointer; border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-audit-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-audit-filters select, .admin-audit-filters input {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; color: var(--text); font-size: 12.5px;
}
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.audit-row:last-child { border-bottom: none; }
.audit-row-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.audit-row-time { margin-left: auto; }
.audit-action-badge {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-3); color: var(--accent);
}
.audit-row-detail { margin-top: 2px; }
.admin-stats-grid, #admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.admin-stat-card { background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.admin-stat-value { font-size: 24px; font-weight: 700; color: var(--accent); }
.admin-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-hint { padding: 24px; }
.history-preview-inner { display: flex; flex-direction: column; min-height: 100%; }
.preview-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.preview-title { font-weight: 700; font-size: 15px; }
.preview-bar .btn-primary:disabled { opacity: .5; cursor: default; }
.preview-doc { padding: 18px 22px; line-height: 1.7; }
.preview-doc h1 { font-size: 24px; } .preview-doc h2 { font-size: 20px; }
.preview-doc h3 { font-size: 17px; }
.preview-doc img { max-width: 100%; border-radius: 8px; }
.preview-doc code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; }
.preview-doc .wikilink { color: var(--accent); }

/* ---------- "..." context menu (favorite / offline / duplicate / trash) ---------- */
.ctx-menu {
  position: fixed; z-index: 200; min-width: 220px; max-width: 280px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45); padding: 6px;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13.5px;
}
.ctx-item:hover { background: var(--bg-3); }
.ctx-item.danger { color: var(--danger); }
.ctx-ic { width: 18px; text-align: center; flex-shrink: 0; }
.ctx-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-check { color: var(--accent); font-weight: 700; }
.ctx-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- trash modal ---------- */
.trash-modal {
  width: min(560px, 94vw); max-height: min(560px, 85vh);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.trash-body { overflow-y: auto; padding: 8px; }
.trash-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  width: 100%; text-align: left; background: transparent; border: none; color: var(--text); font-size: 14px;
}
.trash-row:hover { background: var(--bg-3); }
.trash-row .doc-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-actions { display: flex; gap: 6px; flex-shrink: 0; }
.trash-actions .btn { padding: 7px 10px; white-space: nowrap; }

@media (max-width: 540px) {
  .trash-row { align-items: flex-start; flex-wrap: wrap; }
  .trash-row .doc-title { min-width: 0; }
  .trash-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- toasts ---------- */
.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 300;
  display: flex; flex-direction: column-reverse; gap: 8px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 11px 12px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
  animation: toast-in .15s ease-out;
}
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--danger); }
.toast-msg { flex: 1; font-size: 13px; line-height: 1.5; white-space: pre-line; word-break: break-word; }
.toast-close {
  flex-shrink: 0; background: transparent; border: none; color: var(--muted);
  font-size: 12px; border-radius: 5px; width: 20px; height: 20px; line-height: 1;
}
.toast-close:hover { background: var(--bg-3); color: var(--text); }
.toast.toast-out { animation: toast-out .18s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- confirm / prompt dialog ---------- */
.dialog-modal {
  width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.dialog-body { margin-bottom: 16px; }
.dialog-msg { margin: 0 0 10px; font-size: 14px; line-height: 1.6; white-space: pre-line; }
.dialog-input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px;
}
.dialog-input:focus { outline: none; border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #33354a; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #444768; }
