* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --bg: #ffffff;
  --sidebar-bg: #f7f6f3;
  --text: #37352f;
  --text-light: #9b9a97;
  --accent: #2563eb; /* haru 포인트 컬러 — 로고 네이비(#06142F)와 같은 색상군(hue ~221°) */
  --accent-rgb: 37, 99, 235; /* rgba() 틴트용 */
  --hover: rgba(55, 53, 47, 0.06);
  --border: rgba(55, 53, 47, 0.09);
  --code-bg: #f6f5f4;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; }

/* ---------- 사이드바 ----------
   항상 position: fixed — 접힘·펼침·플로팅 전환이 모두 left 값 변화(고정 위치끼리)라
   부드럽게 애니메이션된다. 펼침일 때의 자리는 #main의 margin-left가 확보한다. */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  width: 250px;
  min-width: 250px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 0 0 0 0 rgba(15, 15, 15, 0);
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 15px; /* 하단 여백 — 로고와 첫 내비(주제 정비) 사이 간격 */
}

.logo { height: 15px; width: auto; display: block; }

/* ---------- 사이드바 접기·펼치기 ---------- */
/* 세 토글 버튼(접기 · 고정 · 열기)의 공통 룩 — 은은한 아이콘 버튼 */
.sidebar-header-actions { display: flex; align-items: center; gap: 2px; }
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--hover); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; display: block; }

/* 상태별 버튼 노출: 펼침=접기 / 열기=열기 / 플로팅=고정 */
#sidebar-open, #sidebar-pin { display: none; }
#app.sidebar-collapsed #sidebar-collapse { display: none; }
#app.sidebar-collapsed #sidebar-open { display: inline-flex; }
#app.sidebar-collapsed.sidebar-peek #sidebar-pin { display: inline-flex; }

/* 접힘 — 사이드바를 폭(250px)만큼 좌측 밖으로 밀고(애니메이션), 메인이 자리를 회수해 폭을 채운다 */
#app.sidebar-collapsed #sidebar { left: -250px; }
#app.sidebar-collapsed #main { margin-left: 0; }
/* 플로팅 프리뷰 — 여는 버튼 호버 시 좌측에서 미끄러져 들어오며 그림자로 떠오른다.
   메인의 margin-left는 0 그대로라 밀리지 않고 콘텐츠 위에 겹쳐 뜬다(오버레이). */
#app.sidebar-collapsed.sidebar-peek #sidebar {
  left: 0;
  box-shadow: 4px 0 28px rgba(15, 15, 15, 0.16);
}
@media (prefers-reduced-motion: reduce) {
  #sidebar, #main { transition: none; }
}

/* 사이드바 상단 내비 (주제 정비) — 핵심 AI 기능 진입점이라 내비 항목이 아닌 카드형 버튼.
   쉬는 상태는 반투명 화이트로 주변과 섞이고, 호버에서 완전한 흰색으로 떠오른다 */
#sidebar-nav { padding: 0 8px; }
#inbox-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
#inbox-btn:hover {
  background: var(--bg);
  border-color: rgba(var(--accent-rgb), 0.4);
  box-shadow: 0 2px 6px rgba(15, 15, 15, 0.09);
}
#inbox-btn:active { box-shadow: 0 1px 1px rgba(15, 15, 15, 0.05); } /* 눌림 — 그림자 얕아짐 */
#inbox-btn.active { /* 주제 정비 페이지 열림 상태 */
  background: rgba(var(--accent-rgb), 0.06);
  border-color: rgba(var(--accent-rgb), 0.45);
}
#inbox-btn .nav-ai { /* 텍스트 아이콘 — AI 패널 타이틀과 같은 어휘 */
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--accent);
  flex-shrink: 0;
}
#inbox-btn .nav-label { flex: 1; }
#inbox-count {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  padding: 1px 7px;
  flex-shrink: 0;
}

/* 섹션 (Workspace) — 비인터랙티브 라벨 (접힘 없음). 라벨 좌측을 상단 내비 아이콘(16px)과 정렬 */
.section { margin-top: 12px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 16px;
  user-select: none;
}
.section-header:hover .add-btn { visibility: visible; }

.section-header .section-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-light);
}

.section-header .add-btn {
  visibility: hidden;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 4px;
}
.section-header .add-btn:hover { background: var(--hover); color: var(--text); }

/* 정렬 방식 토글 (＋ 좌측) — ＋와 같은 호버 노출 규칙. 수동 정렬 활성 시 항상 표시(상태 표시) */
.section-header .sort-btn {
  visibility: hidden;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-header:hover .sort-btn { visibility: visible; }
.section-header .sort-btn:hover { background: var(--hover); color: var(--text); }
.section-header .sort-btn.active { visibility: visible; color: var(--accent); }
.section-header .sort-btn svg { width: 15px; height: 15px; }
/* 문서 검색 버튼 — 정렬 버튼과 동일한 호버 노출 톤 (⌘K 진입점) */
.section-header .search-btn {
  visibility: hidden;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-header:hover .search-btn { visibility: visible; }
.section-header .search-btn:hover { background: var(--hover); color: var(--text); }
.section-header .search-btn svg { width: 14px; height: 14px; }

.file-list { list-style: none; padding: 0 8px 4px; }

.file-list li {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  color: rgba(55, 53, 47, 0.75);
  user-select: none;
}
.file-list li:hover { background: var(--hover); }
.file-list li.active { background: rgba(55, 53, 47, 0.09); color: var(--text); font-weight: 500; }

.file-list li .file-icon { margin-right: 7px; font-size: 13px; opacity: 0.6; }
.file-list li .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-list li .delete-btn {
  visibility: hidden;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13px;
  padding: 1px 4px;
  border-radius: 3px;
}
.file-list li:hover .delete-btn { visibility: visible; }
.file-list li .delete-btn:hover { background: rgba(0,0,0,0.08); color: #d44; }

/* Workspace 디렉토리 */
.file-list li.folder { font-weight: 500; color: rgba(55, 53, 47, 0.85); }
.file-list li.folder .folder-chevron {
  width: 18px;
  text-align: center;
  font-size: 10px;
  color: var(--text-light);
  margin-right: 3px;
  flex-shrink: 0;
}
.file-list li.folder .file-icon { margin-right: 5px; }
/* 트리 들여쓰기 (디렉토리 뎁스별) */
.file-list li.ind-1 { padding-left: 30px; }
.file-list li.ind-2 { padding-left: 52px; }
.file-list li.ind-3 { padding-left: 74px; }
.file-list li.ind-4 { padding-left: 96px; } /* 주제 1 + 디렉토리 3 안의 문서 */

/* ---------- 주제(Topic) 행 ---------- */
.file-list li.topic { font-weight: 600; }
.file-list li.topic .file-name { font-weight: 600; }
.topic-badge {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent, #6b7cff);
  width: 14px;
  text-align: center;
}
.topic-badge.spin { animation: topic-spin 1.2s linear infinite; display: inline-block; }
@keyframes topic-spin { to { transform: rotate(360deg); } }
.file-list li.topic-empty-cta {
  color: var(--text-dim, #888);
  cursor: pointer;
  padding: 8px 10px;
  border: 1px dashed var(--border, #ddd);
  border-radius: 8px;
  margin: 6px 8px;
  text-align: center;
  font-size: 12.5px;
}
.file-list li.topic-empty-cta:hover { color: var(--text, #333); border-color: var(--text-dim, #999); }
.file-list li.list-empty {
  color: var(--text-light);
  font-size: 13px;
  cursor: default;
}
.file-list li.list-empty:hover { background: transparent; }

/* 행 호버 ＋ 버튼 (디렉토리에 새 문서/디렉토리) */
.file-list li .row-add-btn {
  visibility: hidden;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}
.file-list li:hover .row-add-btn { visibility: visible; }
.file-list li .row-add-btn:hover { background: rgba(0, 0, 0, 0.08); color: var(--text); }

/* 드래그 이동 */
.file-list li.dragging { opacity: 0.45; }
.file-list li.drop-target {
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.55);
}
.section-header.drop-target {
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: inset 0 0 0 1.5px rgba(var(--accent-rgb), 0.55);
  border-radius: 5px;
}
/* 수동 정렬 드래그: 행 위/아래 경계에 삽입 위치 표시선 */
.file-list li.reorder-before { box-shadow: inset 0 2px 0 0 var(--accent); }
.file-list li.reorder-after { box-shadow: inset 0 -2px 0 0 var(--accent); }

.file-list li input.rename-input {
  flex: 1;
  font: inherit;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  outline: none;
  min-width: 0;
}

/* 사이드바 하단 (휴지통 · 커넥터 · 플랜 + 계정 바) — 상단 내비와 같은 라운드 아이템.
   sticky bottom — 문서가 많아 사이드바가 스크롤돼도 최하단에 고정(고정·플로팅 동일 요소라 둘 다 적용) */
#sidebar-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--border);
  padding: 6px 8px 0;
  background: var(--sidebar-bg);
}

#connectors-btn,
#plan-btn,
#trash-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: rgba(55, 53, 47, 0.72);
  text-align: left;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  user-select: none;
}
#connectors-btn:hover,
#plan-btn:hover,
#trash-btn:hover { background: var(--hover); color: var(--text); }
#connectors-btn svg,
#plan-btn svg,
#trash-btn svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.footer-label { flex: 1; }
#trash-count {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--text-light);
  border-radius: 9px;
  padding: 1px 7px;
  flex-shrink: 0;
}

/* 플랜 버튼 — 현재 플랜 이름 + 잔여 사용량 링 */
#plan-name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(55, 53, 47, 0.07);
  border-radius: 9px;
  padding: 1px 7px;
  flex-shrink: 0;
}
#plan-btn.paid #plan-name {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}
#plan-btn #usage-ring { /* 공용 아이콘 규칙(#plan-btn svg)을 이기도록 구체도를 올린다 */
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 1;
  transform: rotate(-90deg); /* 12시 방향에서 시작 */
}
#usage-ring circle { fill: none; stroke-width: 3; }
.usage-ring-track { stroke: rgba(55, 53, 47, 0.13); }
#usage-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 100; /* pathLength=100 — offset = 사용한 % */
  transition: stroke-dashoffset 0.25s;
}
#plan-btn.exhausted .usage-ring-track { stroke: rgba(212, 68, 68, 0.35); }
#plan-btn.exhausted #usage-ring-fill { stroke: #d44; }
#plan-btn.exhausted #plan-name { color: #b43b3b; background: rgba(212, 68, 68, 0.1); }

#account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 5px -8px 0;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-light);
}
#account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#logout-btn {
  font: inherit;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
#logout-btn:hover { background: var(--hover); color: var(--text); }

/* 게스트 바 — 비로그인 상태의 사이드바 하단 (account-bar 자리, /login·/signup 진입점) */
#guest-bar {
  display: flex;
  gap: 6px;
  margin: 5px -8px 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
#guest-bar button {
  flex: 1;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
}
#guest-login {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}
#guest-login:hover { background: var(--hover); }
#guest-signup {
  border: none;
  background: var(--accent);
  color: #fff;
}
#guest-signup:hover { filter: brightness(0.95); }

/* ---------- 로그인 / 회원가입 ---------- */
#auth-screen {
  position: fixed;
  inset: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 500;
}
.auth-wrap {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.08);
  padding: 36px 32px 28px;
  width: 360px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-logo { height: 26px; width: auto; align-self: flex-start; }
.auth-tagline { font-size: 14px; font-weight: 500; color: var(--text); margin-top: -2px; }
.auth-sub { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
#auth-form { display: flex; flex-direction: column; gap: 8px; }
#auth-form input {
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  outline: none;
}
#auth-form input:focus { border-color: var(--accent); }
#auth-form input[readonly] { background: var(--sidebar-bg); color: var(--text-light); }
#auth-error {
  font-size: 12.5px;
  color: #d44;
  padding: 2px 2px 0;
}
#auth-submit {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 9px;
  cursor: pointer;
  margin-top: 4px;
}
#auth-submit:hover { filter: brightness(0.95); }
#auth-submit:disabled { opacity: 0.6; cursor: default; }
.auth-alt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 8px;
}
.auth-alt button {
  font: inherit;
  font-size: 12.5px;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}
.auth-hint { font-size: 12px; color: var(--text-light); margin-top: 2px; }
/* 비밀번호 재설정 진입 링크 — 로그인 모드에서만 노출, 전환 링크보다 옅게 */
.auth-forgot-row { margin-top: 2px; }
.auth-forgot-row button { color: var(--text-light); text-decoration: underline; text-underline-offset: 2px; }
.auth-forgot-row button:hover { color: var(--accent); }

/* 가입 동의 체크박스 — [필수] 이용약관·개인정보처리방침, [선택] 마케팅 수신 */
#auth-consents {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 2px 0;
}
.consent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
}
.consent-row input {
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.consent-row em { font-style: normal; font-weight: 600; color: var(--text); }
.consent-row em.optional { color: var(--text-light); font-weight: 500; }
.consent-row a { color: var(--accent); text-decoration: none; }
.consent-row a:hover { text-decoration: underline; }

/* ---------- 사이트 footer (구 HARU 이식 — 정책 링크 + 사업자 정보) ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 40px 30px; flex-shrink: 0; }
.sf-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  text-align: center;
}
.sf-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12.5px;
}
.sf-links a { color: var(--text-light); font-weight: 600; text-decoration: none; transition: color 0.13s; }
.sf-links a:hover { color: var(--text); }
.sf-links a.sf-strong { color: var(--text); }
.sf-biz {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11.5px;
  color: var(--text-light);
}
.sf-biz a { color: var(--text-light); text-decoration: none; }
.sf-biz a:hover { color: var(--text); }
.sf-sep { color: var(--text-light); opacity: 0.55; }
.sf-copy { font-size: 11px; color: var(--text-light); opacity: 0.8; margin-top: 2px; }

/* ---------- 법적 문서 페이지 (/terms · /privacy · /refund) ---------- */
#legal-root { min-height: 100vh; display: flex; flex-direction: column; }
.legal-top { padding: 18px 28px; border-bottom: 1px solid var(--border); }
.legal-top .logo { height: 22px; display: block; }
.legal-main { flex: 1 0 auto; display: flex; flex-direction: column; }
.legal-article {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 40px 24px 64px;
  font-size: 14.5px;
  line-height: 1.75;
  flex: 1 0 auto;
}
.legal-article h1 { font-size: 24px; line-height: 1.4; margin-bottom: 14px; }
.legal-article h2 { font-size: 17px; margin: 28px 0 8px; }
.legal-article h3 { font-size: 15px; margin: 20px 0 6px; }
.legal-article p { margin: 8px 0; }
.legal-article ul, .legal-article ol { margin: 8px 0; padding-left: 22px; }
.legal-article li { margin: 3px 0; }
.legal-article li > ul { margin: 3px 0; }
.legal-article hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.legal-article a { color: var(--accent); }
.legal-error { color: var(--text-light); text-align: center; padding: 60px 0; }

/* ---------- 플랜 모달 ---------- */
#plan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#plan-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 720px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none;
}
.plan-head { display: flex; align-items: center; justify-content: space-between; }
.plan-head h3 { font-size: 16px; }
#plan-close {
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
#plan-close:hover { background: var(--hover); color: var(--text); }
#plan-notice {
  font-size: 13px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  line-height: 1.5;
}
#plan-notice.error { background: rgba(212, 68, 68, 0.07); border-color: rgba(212, 68, 68, 0.3); color: #b43b3b; }
#plan-usage { display: flex; flex-direction: column; gap: 6px; }
.plan-usage-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-light); }
#plan-usage-pct { font-weight: 600; color: var(--text); }
.plan-usage-bar { height: 6px; border-radius: 3px; background: rgba(55, 53, 47, 0.09); overflow: hidden; }
#plan-usage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.25s; }
#plan-usage.exhausted #plan-usage-fill { background: #d44; }
#plan-usage.exhausted #plan-usage-pct { color: #b43b3b; }
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 720px) { .plan-cards { grid-template-columns: 1fr; } }
.plan-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-card.active { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25); }
.plan-card-head { display: flex; align-items: center; justify-content: space-between; }
.plan-name { font-size: 14px; font-weight: 700; }
.plan-current {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 10px;
  padding: 2px 8px;
}
.plan-price { font-size: 20px; font-weight: 700; }
.plan-per { font-size: 12px; font-weight: 500; color: var(--text-light); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text); }
.plan-features li { padding-left: 16px; position: relative; }
.plan-features li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.plan-detail-link { font-size: 11.5px; color: var(--text-light); text-decoration: none; }
.plan-detail-link:hover { color: var(--text); text-decoration: underline; }
#plan-cta-pro,
#plan-cta-max {
  margin-top: auto;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 8px;
  cursor: pointer;
}
#plan-cta-pro:hover,
#plan-cta-max:hover { filter: brightness(0.95); }
#plan-cta-pro:disabled,
#plan-cta-max:disabled { opacity: 0.55; cursor: default; }
#plan-manage { border-top: 1px solid var(--border); padding-top: 10px; }
.plan-manage-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-light); }
.plan-manage-line button {
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.plan-manage-line button:hover { background: var(--hover); }
.plan-manage-line button:disabled { opacity: 0.55; cursor: default; }
.plan-foot { font-size: 11.5px; color: var(--text-light); text-align: center; }
.plan-foot a { color: var(--text-light); }
/* ---------- 요금제 페이지 (/pricing) ---------- */
#pricing-root { min-height: 100vh; display: flex; flex-direction: column; }
.pricing-body {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 44px 24px 64px;
  flex: 1 0 auto;
}
.pricing-title { font-size: 26px; margin-bottom: 8px; }
.pricing-sub { font-size: 14px; color: var(--text-light); margin-bottom: 28px; line-height: 1.6; }
.pricing-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .pricing-cards { grid-template-columns: 1fr; } }
.pricing-card { gap: 10px; }
.pricing-card.highlight { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25); }
.pricing-price { font-size: 22px; font-weight: 700; }
.pricing-price.big { font-size: 30px; margin: 6px 0 2px; }
.pricing-tagline { font-size: 13px; color: var(--text-light); }
.pricing-desc { font-size: 14px; line-height: 1.7; margin: 6px 0; }
.pricing-h2 { font-size: 16px; margin: 22px 0 8px; }
.pricing-back { display: inline-block; font-size: 12.5px; color: var(--text-light); text-decoration: none; margin-bottom: 14px; }
.pricing-back:hover { color: var(--text); }
.pricing-detail-btn {
  margin-top: auto;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  text-decoration: none;
}
.pricing-detail-btn:hover { background: var(--hover); }
.pricing-cta {
  display: inline-block;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 22px;
  text-decoration: none;
}
.pricing-cta:hover { filter: brightness(0.95); }
.pricing-note { font-size: 12px; color: var(--text-light); margin-top: 10px; }

/* ---------- 공유 뷰어 (/s/<id>) ---------- */
#share-root { min-height: 100vh; overflow-y: auto; }
#share-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 800px;
  margin: 0 auto;
  padding: 18px 40px 0;
}
#share-topbar .share-doc-title { font-weight: 600; font-size: 15px; }
#share-topbar .readonly-badge {
  font-size: 11px;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
}
#share-editor {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 40px 20vh;
}
#share-editor .content { cursor: default; }
#share-error {
  max-width: 800px;
  margin: 80px auto;
  text-align: center;
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 메인 ---------- */
/* 펼침일 땐 margin-left로 사이드바(고정) 자리를 확보 — 접힘 시 0으로 애니메이션되며 메인이 넓어진다 */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 250px;
  transition: margin-left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  font-size: 13px;
  color: var(--text-light);
}
#topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
#doc-title {
  font-weight: 500;
  color: var(--text);
  cursor: text;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 4px;
}
#doc-title:not(:empty):hover { background: var(--hover); }
#doc-title .title-input {
  font: inherit;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  min-width: 200px;
}
/* 문서 정보 ⓘ — 클릭 동작 없는 호버 트리거 */
#doc-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--text-light);
  flex-shrink: 0;
  user-select: none;
}
#doc-info-btn:hover { background: var(--hover); color: var(--text); }
#doc-info-btn svg { width: 15px; height: 15px; display: block; }

/* 문서 정보 호버 패널 (링크된 문서 · 백링크 · Last Edited) */
#doc-info-popover {
  position: fixed;
  z-index: 150;
  width: 300px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text);
}
#doc-info-popover .info-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-light);
  margin-bottom: 3px;
}
#doc-info-popover .info-count { font-weight: 500; }
#doc-info-popover ul {
  list-style: none;
  max-height: 168px;
  overflow-y: auto;
}
#doc-info-popover .info-doc {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 5px;
  cursor: pointer;
}
#doc-info-popover .info-doc:hover { background: var(--hover); }
#doc-info-popover .info-doc .file-icon { font-size: 13px; opacity: 0.6; }
#doc-info-popover .info-doc-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#doc-info-popover .info-doc-note {
  flex-shrink: 0;
  max-width: 45%;
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#doc-info-popover .info-doc.missing { cursor: default; color: var(--text-light); }
#doc-info-popover .info-doc.missing:hover { background: transparent; }
#doc-info-popover .info-empty { color: var(--text-light); font-size: 12.5px; }

#save-status { font-size: 12px; transition: opacity 0.3s; }

#topbar-right { display: flex; align-items: center; gap: 12px; }

#share-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fff;
  color: rgba(55, 53, 47, 0.8);
  cursor: pointer;
  padding: 3px 12px;
  border-radius: 5px;
}
#share-btn:hover { background: var(--hover); color: var(--text); }
#share-btn.active { color: var(--accent); font-weight: 500; }

#share-popover {
  position: absolute;
  top: 44px;
  right: 20px;
  z-index: 150;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#share-popover .share-row { display: flex; gap: 6px; }
#share-link {
  flex: 1;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  outline: none;
  min-width: 0;
}
#share-copy,
#share-off {
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
}
#share-copy:hover, #share-off:hover { background: var(--hover); }
#share-off { color: #d44; align-self: flex-start; border: none; padding: 3px 4px; }

/* 블록 핸들·드롭 라인·선택 오버레이의 기준. z-index:0 = 오버레이(z:-1)가 밖으로 새지 않게 하는 스태킹 컨텍스트 */
#editor-scroll { flex: 1; overflow-y: auto; position: relative; z-index: 0; }

#editor {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 40px 40vh;
}

#empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 15px;
}

/* ---------- Inbox 페이지 (AI 제안 검토) ---------- */
#inbox-page { flex: 1; overflow-y: auto; }
.inbox-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 40px 20vh;
}
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inbox-title { font-size: 26px; font-weight: 700; line-height: 1.3; }
.inbox-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#maintain-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
#maintain-btn:hover:not(:disabled) { filter: brightness(0.95); }
#maintain-btn:disabled { opacity: 0.55; cursor: default; }
#routine-btn { /* 정비 실행 옆 보조 버튼 — 루틴 관리 모달 진입 */
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
#routine-btn:hover { background: var(--hover); }
.inbox-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-light);
  margin: 14px 0 24px; /* 타이틀·실행 버튼 행과 확실히 분리 */
}
.mlog-box { /* 정비 로그·루틴 콜아웃 공용 토글 박스 — 요약 헤드 + 펼침 본문 */
  font-size: 13px;
  line-height: 1.5;
  color: rgba(55, 53, 47, 0.78);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 16px;
}
#routine-log { margin-bottom: 10px; } /* 바로 아래 정비 로그와 한 묶음으로 보이게 간격 축소 */
.mlog-box .mlog-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 9px 13px;
}
.mlog-box button.mlog-head { cursor: pointer; }
.mlog-caret {
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.mlog-box.open .mlog-caret { transform: rotate(90deg); }
.mlog-body {
  border-top: 1px solid var(--border);
  padding: 10px 13px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mlog-note { margin: 0; }
.mlog-src-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.mlog-src-line b { flex-shrink: 0; }
.mlog-status { color: rgba(55, 53, 47, 0.62); }
.mlog-err, .mlog-status.mlog-err { color: #c0392b; }
.mlog-read { margin: 3px 0 0; color: rgba(55, 53, 47, 0.62); }
.mlog-assess { /* 모델의 판단 경위 — 인용 톤 */
  margin: 5px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  color: rgba(55, 53, 47, 0.66);
  white-space: pre-wrap;
}
.mlog-box.error {
  background: rgba(224, 49, 49, 0.06);
  border-color: rgba(224, 49, 49, 0.22);
  color: #c0392b;
}
.mlog-box.error .mlog-body { border-top-color: rgba(224, 49, 49, 0.22); }

#inbox-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
#inbox-list li.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 72px 0;
  color: var(--text-light);
}
.inbox-empty .inbox-empty-icon { font-size: 30px; opacity: 0.45; }
.inbox-empty .inbox-empty-main { font-size: 14.5px; font-weight: 500; color: rgba(55, 53, 47, 0.75); }
.inbox-empty .inbox-empty-sub { font-size: 13px; }

/* 제안 카드 */
#inbox-list li.sugg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
li.sugg .sugg-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
li.sugg .sugg-icon {
  color: var(--accent);
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  padding-top: 1px;
  user-select: none;
}
li.sugg .sugg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
li.sugg .sugg-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.sugg-kind {
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.sugg-kind.k-edit { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.sugg-kind.k-create { background: rgba(26, 127, 55, 0.12); color: #1a7f37; }
.sugg-kind.k-delete { background: rgba(212, 68, 68, 0.1); color: #d44; }
.sugg-kind.k-move { background: rgba(55, 53, 47, 0.08); color: rgba(55, 53, 47, 0.75); }
li.sugg .sugg-meta {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
li.sugg .sugg-summary { font-size: 13px; color: rgba(55, 53, 47, 0.75); line-height: 1.5; }
li.sugg .sugg-actions { display: flex; gap: 6px; flex-shrink: 0; }
li.sugg .sugg-actions button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
li.sugg .sugg-actions button:hover:not(:disabled) { background: var(--hover); }
li.sugg .sugg-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
li.sugg .sugg-actions button.primary:hover:not(:disabled) { filter: brightness(0.95); }
li.sugg .sugg-actions button.danger { color: #d44; border: none; }
li.sugg .sugg-actions button.danger:hover:not(:disabled) { background: rgba(224, 49, 49, 0.08); }
li.sugg .sugg-actions button:disabled { opacity: 0.5; cursor: default; }

/* 카드 펼침 — 변경 내용(diff) */
li.sugg .sugg-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
li.sugg .sugg-note { font-size: 13px; color: var(--text-light); padding: 2px 2px; }
li.sugg .sugg-note.warn { color: #d44; }
li.sugg .sugg-detail-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
li.sugg .open-doc {
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 4px 11px;
  cursor: pointer;
  color: rgba(55, 53, 47, 0.8);
}
li.sugg .open-doc:hover { background: var(--hover); color: var(--text); }

.sugg-diff {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.55;
}
.sugg-diff .diff-row {
  display: flex;
  padding: 1px 10px 1px 0;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 21px;
}
.sugg-diff .diff-sign {
  width: 26px;
  flex-shrink: 0;
  text-align: center;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-light);
  user-select: none;
}
.sugg-diff .diff-text { flex: 1; min-width: 0; }
.sugg-diff .diff-row.add { background: rgba(26, 127, 55, 0.09); }
.sugg-diff .diff-row.add .diff-sign { color: #1a7f37; }
.sugg-diff .diff-row.del { background: rgba(212, 68, 68, 0.08); }
.sugg-diff .diff-row.del .diff-sign { color: #d44; }
.sugg-diff .diff-row.del .diff-text { color: rgba(55, 53, 47, 0.65); }
.sugg-diff .diff-skip {
  padding: 3px 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-light);
  background: var(--sidebar-bg);
  user-select: none;
}

/* ---------- 블록 ---------- */
.block {
  display: flex;
  align-items: flex-start;
  position: relative;
  border-radius: 4px;
}

.block .marker {
  flex-shrink: 0;
  user-select: none;
  color: var(--text);
}

.block .content {
  flex: 1;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
  min-width: 0;
}

.block .content:empty::before {
  content: attr(data-placeholder);
  color: rgba(55, 53, 47, 0.3);
  pointer-events: none;
}

/* 문단 placeholder는 캐럿이 있는 블록에서만 표시 */
.block[data-type="p"] .content:empty:not(:focus)::before {
  content: none;
}

/* 타입별 스타일 (패딩으로 블록 리듬 형성) */
.block[data-type="p"] { padding: 3px 2px; font-size: 16px; line-height: 1.6; }

.block[data-type="h1"] { padding: 22px 2px 6px; }
.block[data-type="h1"] .content { font-size: 30px; font-weight: 700; line-height: 1.3; }

.block[data-type="h2"] { padding: 16px 2px 4px; }
.block[data-type="h2"] .content { font-size: 24px; font-weight: 600; line-height: 1.3; }

.block[data-type="h3"] { padding: 12px 2px 3px; }
.block[data-type="h3"] .content { font-size: 19px; font-weight: 600; line-height: 1.3; }

.block[data-type="bullet"],
.block[data-type="number"],
.block[data-type="todo"] { padding: 3px 2px; font-size: 16px; line-height: 1.6; }

.block[data-type="bullet"] .marker { width: 24px; text-align: center; font-size: 17px; }
.block[data-type="number"] .marker { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }

.block[data-type="todo"] .marker { width: 24px; display: flex; justify-content: center; padding-top: 5px; }
.block[data-type="todo"] .marker input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.block[data-type="todo"].checked .content {
  text-decoration: line-through;
  color: var(--text-light);
}

.block[data-type="quote"] { padding: 4px 2px; margin: 2px 0; font-size: 16px; line-height: 1.6; }
.block[data-type="quote"] .content {
  border-left: 3px solid var(--text);
  padding-left: 14px;
}

/* 토글 블록 — 삼각형 마커 + 제목. 접힘 시 하위 블록은 .toggle-hidden 로 숨긴다 */
.block[data-type="toggle"] { padding: 3px 2px; font-size: 16px; line-height: 1.6; }
.block[data-type="toggle"] .marker.toggle-arrow {
  width: 24px;
  text-align: center;
  font-size: 17px;
  line-height: 25.6px; /* 제목 첫 줄 높이(16px × 1.6)와 동일 → 삼각형이 제목 세로 중앙에 정렬 */
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.12s ease, transform 0.12s ease;
}
.block[data-type="toggle"] .marker.toggle-arrow:hover { color: var(--text); }
.block[data-type="toggle"] .content { font-weight: 600; }
.block.toggle-hidden { display: none; }

/* 2열(컬럼) 블록 — '::: cols'/'::: next'/':::' 마커 사이 블록을 좌우로 배치.
   마커 블록 자체는 보이지 않지만 blocks↔blockEls 인덱스 정렬을 위해 DOM에 남는다. */
.block.colmark { display: none; }
.cols-row { display: flex; gap: 28px; align-items: flex-start; }
.cols-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 768px) {
  .cols-row { display: block; } /* 좁은 화면에선 열을 세로로 쌓는다 */
}

.block[data-type="code"] { padding: 4px 2px; margin: 4px 0; }
.block[data-type="code"] .content {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 16px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  tab-size: 2;
}

/* 표 */
.block[data-type="table"] { padding: 8px 2px; display: block; outline: none; }
.table-wrap { position: relative; padding: 14px 16px 16px 0; } /* 위 14px = 열 삭제 칩 자리 */
.table-scroll { overflow-x: auto; }
.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
  line-height: 1.5;
}
.md-table th,
.md-table td {
  border: 1px solid rgba(55, 53, 47, 0.16);
  padding: 6px 10px;
  min-width: 64px;
  text-align: left;
  vertical-align: top;
  outline: none;
  word-break: break-word;
}
.md-table th {
  background: var(--sidebar-bg);
  font-weight: 600;
}
.md-table td:focus,
.md-table th:focus {
  box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), 0.35);
}

/* 표 컨트롤 — 호버 시 표시 */
.table-add,
.table-del {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(55, 53, 47, 0.45);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.table-wrap:hover .table-add { opacity: 1; }
.table-add:hover { background: var(--hover); color: rgba(55, 53, 47, 0.8); }
.table-add-row { left: 0; right: 16px; bottom: 0; height: 13px; }
.table-add-col { top: 14px; bottom: 16px; right: 0; width: 13px; }
/* 행/열 삭제 칩 — 셀 호버 시 JS가 위치를 잡고 .show를 붙인다 (표시는 wrap:hover와 AND) */
.table-del { visibility: hidden; z-index: 1; }
.table-wrap:hover .table-del.show { opacity: 1; visibility: visible; }
.table-del:hover { background: rgba(212, 68, 68, 0.12); color: #d44; }
.table-del-row { left: -20px; width: 20px; height: 20px; }
.table-del-col { top: 0; width: 22px; height: 13px; }
.block[data-type="table"].selected .md-table { outline: 2px solid rgba(var(--accent-rgb), 0.55); }
.block[data-type="table"].selected .md-table th,
.block[data-type="table"].selected .md-table td { background: rgba(var(--accent-rgb), 0.12); }

/* HTML 박스 — 콜아웃 형태, 코드/렌더 탭 */
.block[data-type="html"] { padding: 6px 2px; display: block; outline: none; }
.html-box {
  border: 1px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}
.html-box-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.html-box-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-light);
}
.html-box-tabs { margin-left: auto; display: flex; gap: 2px; }
.html-box-tabs button {
  border: none;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 4px;
  color: var(--text-light);
  cursor: pointer;
}
.html-box-tabs button:hover { background: var(--hover); color: var(--text); }
.html-box-tabs button.active { background: var(--hover); color: var(--text); font-weight: 500; }
.html-box .content.html-box-code {
  background: var(--code-bg);
  padding: 14px 16px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  tab-size: 2;
  min-height: 48px;
}
.html-box-view { background: var(--bg); position: relative; }
.html-box-frame {
  display: block;
  width: 100%;
  height: 120px; /* 내부 리포터의 postMessage로 콘텐츠 높이에 맞춰짐 (h= 고정 시 그 값) */
  border: none;
  background: var(--bg);
}

/* 높이 조절 핸들 — 렌더 뷰 하단, 호버 시 그립 표시 */
.html-box-resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9px;
  cursor: ns-resize;
}
.html-box-resize::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: rgba(55, 53, 47, 0.28);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.html-box-view:hover .html-box-resize::after { opacity: 1; }
.block[data-type="html"].selected .html-box { outline: 2px solid rgba(var(--accent-rgb), 0.55); }
.block[data-type="html"].selected .html-box-head { background: rgba(var(--accent-rgb), 0.12); }
.html-box-bare .html-box-frame { border-radius: 8px; } /* 공유 뷰어: 헤더 없이 렌더 뷰만 */

.block[data-type="divider"] { padding: 10px 2px; cursor: pointer; }
.block[data-type="divider"] hr {
  border: none;
  border-top: 1px solid rgba(55, 53, 47, 0.18);
  width: 100%;
}
.block[data-type="divider"].selected { background: rgba(var(--accent-rgb), 0.15); }

/* 이미지 블록 */
.block[data-type="image"] { padding: 4px 2px; }
.block[data-type="image"]:focus { outline: none; }
.image-figure { margin: 0; }
.image-el {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.block[data-type="image"].selected .image-el { outline: 2px solid rgba(var(--accent-rgb), 0.55); outline-offset: 2px; }
.image-caption {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-light);
  outline: none;
  min-height: 1.2em;
}
.image-caption:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  opacity: 0.6;
  pointer-events: none;
}

/* 업로드 드롭존 (빈 이미지 블록) */
.image-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 22px 16px;
  border: 1.5px dashed rgba(55, 53, 47, 0.22);
  border-radius: 8px;
  background: var(--sidebar-bg);
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.image-drop:hover { border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.04); }
.image-drop.dragover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.image-drop-icon { font-size: 22px; line-height: 1; }
.image-drop-label { font-size: 14px; font-weight: 500; color: var(--text); }
.image-drop-hint { font-size: 12px; }
.block[data-type="image"].selected .image-drop { border-color: var(--accent); }

/* 업로드 중 — 드롭존/이미지를 흐리고 입력을 막는다 */
.block.image-uploading .image-drop,
.block.image-uploading .image-figure { opacity: 0.55; pointer-events: none; }

/* ---------- 캘린더 블록 ----------
   월 그리드 + 날짜별 메모 + 기간 bar. 주(.cal-week)가 --lanes(그 주의 bar 레인 수)를 갖고,
   날짜 칸이 그만큼 위 여백을 확보한 자리에 bar가 absolute로 겹쳐 그려진다. */
/* .block 기본이 flex라 자식이 내용 폭으로 수축한다 — 표처럼 block으로 강제해 항상 에디터 폭을 채운다 */
.block[data-type="calendar"] { padding: 8px 2px; display: block; }
.block[data-type="calendar"]:focus { outline: none; }
.cal-box {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  user-select: none;
}
.block[data-type="calendar"].selected .cal-box { outline: 2px solid rgba(var(--accent-rgb), 0.55); }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 7px;
}
.cal-title { font-size: 14.5px; font-weight: 600; }
.cal-nav { display: flex; gap: 2px; }
.cal-nav button {
  background: none;
  border: none;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 20px;
  color: var(--text-light);
  cursor: pointer;
}
.cal-nav button:hover { background: var(--hover); color: var(--text); }
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding: 3px 0 4px;
}
.cal-week {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day {
  position: relative;
  min-height: 84px;
  /* bar가 그 날짜 위를 지날 때만 JS가 padding-top을 레인 깊이만큼 키운다 (겹침 없으면 이 기본값) */
  padding: 26px 3px 4px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
}
.cal-day + .cal-day { border-left: 1px solid var(--border); }
.cal-day:hover { background: var(--hover); }
.cal-day.other .cal-daynum { opacity: 0.4; }
.cal-day.other .cal-memo { opacity: 0.55; }
.cal-daynum {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  color: var(--text-light);
}
.cal-day.today .cal-daynum { background: var(--accent); color: #fff; font-weight: 600; }
/* 항목 컬러 — 팔레트 클래스(.cal-cc-*)가 --cal-rgb/--cal-ink 변수를 심고,
   bar·메모·칩이 var(폴백=액센트)로 소비한다. 키 목록은 app.js CAL_COLOR_KEYS와 동기. */
.cal-cc-gray { --cal-rgb: 120, 119, 116; --cal-ink: #6f6e6a; }
.cal-cc-red { --cal-rgb: 205, 60, 53; --cal-ink: #b3382f; }
.cal-cc-orange { --cal-rgb: 211, 105, 14; --cal-ink: #a95a08; }
.cal-cc-yellow { --cal-rgb: 186, 128, 30; --cal-ink: #8f6408; }
.cal-cc-green { --cal-rgb: 60, 125, 88; --cal-ink: #2f7d54; }
.cal-cc-purple { --cal-rgb: 134, 88, 183; --cal-ink: #7a4bbd; }
.cal-cc-pink { --cal-rgb: 190, 66, 130; --cal-ink: #ad3a76; }

.cal-memo {
  /* bar와 같은 20px 격자(높이 17 + 갭 3) — 같은 주에서 bar와 메모의 행이 픽셀 단위로 맞는다 */
  height: 17px;
  line-height: 17px;
  margin: 3px 2px 0;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(var(--cal-rgb, var(--accent-rgb)), 0.09);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more { margin: 2px 4px 0; font-size: 11px; color: var(--text-light); }
.cal-bar {
  position: absolute;
  z-index: 1;
  height: 17px;
  line-height: 17px;
  padding: 0 6px;
  background: rgba(var(--cal-rgb, var(--accent-rgb)), 0.16);
  color: var(--cal-ink, var(--accent));
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-bar:hover { background: rgba(var(--cal-rgb, var(--accent-rgb)), 0.24); }
.cal-bar.b-start { border-top-left-radius: 4px; border-bottom-left-radius: 4px; border-left: 3px solid rgb(var(--cal-rgb, var(--accent-rgb))); }
.cal-bar.b-end { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

/* 날짜 팝오버 — 그날 항목 목록 + 추가/수정 폼 */
.cal-popover {
  position: absolute;
  z-index: 30;
  width: 264px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 15, 15, 0.14);
  padding: 10px 12px;
  cursor: default;
}
.cal-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
}
.cal-pop-close {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-light);
  font-size: 11px;
  padding: 2px 5px;
  cursor: pointer;
}
.cal-pop-close:hover { background: var(--hover); color: var(--text); }
.cal-pop-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.cal-pop-item { display: flex; align-items: flex-start; gap: 7px; }
.cal-chip {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 5.5px;
  border-radius: 50%;
  background: rgb(var(--cal-rgb, var(--accent-rgb)));
}
.cal-chip.range { width: 14px; border-radius: 3px; background: rgba(var(--cal-rgb, var(--accent-rgb)), 0.55); }
.cal-pop-body { flex: 1; min-width: 0; }
.cal-pop-text { font-size: 13px; line-height: 1.45; word-break: break-word; }
.cal-pop-range { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.cal-pop-actions { display: flex; gap: 1px; opacity: 0; }
.cal-pop-item:hover .cal-pop-actions { opacity: 1; }
.cal-pop-actions button {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-light);
  font-size: 11.5px;
  padding: 2px 4px;
  cursor: pointer;
}
.cal-pop-actions button:hover { background: var(--hover); color: var(--text); }
.cal-pop-empty { font-size: 12.5px; color: var(--text-light); padding: 1px 0 5px; }
.cal-pop-form { display: flex; flex-direction: column; gap: 7px; }
.cal-pop-formrow { display: flex; align-items: center; gap: 7px; }
/* 컬러 칩 버튼 — 현재 색을 보여 주는 동그라미, 클릭하면 팔레트 */
.cal-color-btn {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(55, 53, 47, 0.14);
  background: rgb(var(--cal-rgb, var(--accent-rgb)));
  cursor: pointer;
  padding: 0;
}
.cal-color-btn:hover { box-shadow: 0 0 0 3px rgba(var(--cal-rgb, var(--accent-rgb)), 0.18); }
.cal-palette {
  position: absolute;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 15, 15, 0.14);
}
.cal-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(55, 53, 47, 0.14);
  background: rgb(var(--cal-rgb, var(--accent-rgb)));
  cursor: pointer;
  padding: 0;
}
.cal-dot:hover { transform: scale(1.15); }
.cal-dot.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgb(var(--cal-rgb, var(--accent-rgb))); }
.cal-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
}
.cal-input:focus { border-color: rgba(var(--accent-rgb), 0.6); }
.cal-pop-dates { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-light); }
.cal-pop-dates input,
.cal-pop-dates select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
}
.cal-pop-dates input:focus,
.cal-pop-dates select:focus { border-color: rgba(var(--accent-rgb), 0.6); }
.cal-pop-btns { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.cal-pop-btns button {
  border-radius: 6px;
  padding: 4px 11px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
/* 반복 UI — 정비 루틴과 같은 매주/매월 세그먼트 + 요일/날짜 칩(팝오버 소형판) */
.cal-pop-repeat { display: flex; flex-direction: column; gap: 7px; }
.cal-seg { display: flex; flex: none; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.cal-seg button {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-light);
  cursor: pointer;
}
.cal-seg button + button { border-left: 1px solid var(--border); }
.cal-seg button.on { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); font-weight: 500; }
.cal-chiprow { display: flex; gap: 4px; }
.cal-daygrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-chip-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 5px;
  padding: 3px 0;
  font-size: 11.5px;
  font-family: inherit;
  color: var(--text-light);
  text-align: center;
  cursor: pointer;
}
.cal-chiprow .cal-chip-btn { flex: 1; }
.cal-chip-btn:hover { background: var(--hover); color: var(--text); }
.cal-chip-btn.sel {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
  font-weight: 500;
}

.cal-repeat-btn {
  margin-right: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
}
.cal-repeat-btn:hover { background: var(--hover); color: var(--text); }
.cal-repeat-btn.on {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
}
.cal-cancel-btn { background: none; border: 1px solid var(--border); color: var(--text-light); }
.cal-cancel-btn:hover { background: var(--hover); color: var(--text); }
.cal-save-btn { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.cal-save-btn:hover { filter: brightness(1.06); }

@media (max-width: 768px) {
  /* 좁은 화면: 메모 미리보기는 도트로, 팝오버는 하단 시트처럼 */
  .cal-day { min-height: 58px; }
  .cal-memo {
    display: inline-block;
    width: 6px;
    height: 6px;
    padding: 0;
    margin: 3px 1px 0 3px;
    border-radius: 50%;
    background: rgb(var(--cal-rgb, var(--accent-rgb)));
    font-size: 0;
  }
  .cal-more { font-size: 10px; margin: 2px 2px 0; }
  .cal-popover {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 12px !important;
    width: auto;
    z-index: 200;
    max-height: 76vh; /* 날짜 칩 그리드가 열려도 화면을 넘지 않게 */
    overflow-y: auto;
  }
}

/* 여러 블록 선택 — 줄 박스 높이로 정규화한 오버레이 사각형 (renderCharSel).
   글자 뒤에 깔리도록 z-index -1 (아래 #editor-scroll의 z-index:0이 스태킹 컨텍스트를 만든다) */
#sel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
}
#sel-overlay .sel-line {
  position: absolute;
  background: rgba(var(--accent-rgb), 0.32);
}

/* 블록 안 브라우저 기본 선택도 charSel 오버레이와 같은 색으로 (한 블록/여러 블록 선택 UI 통일) */
#editor ::selection {
  background-color: rgba(var(--accent-rgb), 0.32);
}

/* 여러 블록 선택 — 문자 하이라이트가 보이지 않는 블록(원자·빈 블록)의 표시 겸 폴백 */
.block.block-selected,
.block.block-selected .content code {
  background: rgba(var(--accent-rgb), 0.16);
}
#editor.noselect,
#editor.noselect .content {
  user-select: none;
  cursor: default;
}

/* 블록 핸들 — 호버한 블록 왼쪽 ⠿ (클릭=선택, 드래그=이동). 위치는 JS가 잡는다 */
#block-handle {
  position: absolute;
  width: 18px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(55, 53, 47, 0.4);
  cursor: grab;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, background 0.12s ease;
  z-index: 5;
}
#block-handle.show { opacity: 1; visibility: visible; }
#block-handle:hover { background: var(--hover); color: rgba(55, 53, 47, 0.8); }
#block-handle:active { cursor: grabbing; }

/* 블록 드래그 이동 중 드롭 위치 표시 라인 */
#drop-indicator {
  position: absolute;
  height: 3px;
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.5);
  display: none;
  z-index: 4;
  pointer-events: none;
}
#drop-indicator.show { display: block; }

/* 인라인 렌더링 */
.content code {
  background: var(--code-bg);
  color: #eb5757;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
}
.content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.content strong { font-weight: 700; }

/* 문서 링크 [[문서]] — 클릭하면 해당 문서로 이동
   (공유 뷰어에선 대상이 공유 중일 때만 이동, 아니면 권한 안내 토스트) */
a.doc-link {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid rgba(55, 53, 47, 0.28);
  transition: background 60ms ease-in;
}
a.doc-link::before {
  content: '📄';
  margin-right: 3px;
  font-size: 0.82em;
}
a.doc-link:hover { background: rgba(var(--accent-rgb), 0.07); }
a.doc-link.missing {
  color: var(--text-light);
  border-bottom-style: dashed;
  cursor: default;
}

/* 공유 뷰어 하단 토스트 (열람 권한 안내) */
#share-toast, #sync-toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  background: rgba(15, 15, 15, 0.88);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 6px;
  z-index: 300;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
#share-toast.show, #sync-toast.show { opacity: 1; }

/* ---------- 커넥터 관리 모달 ---------- */
#connectors-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#connectors-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  /* 8종 커넥터 + Teams처럼 상태 문구가 길고 버튼이 3개(관리자 동의·다시 연결·해제)인
     행을 말줄임 없이 담도록 480px에서 확장. 좁은 화면은 max-width 가드가 담당. */
  width: 600px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: none;
}

.connectors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.connectors-head h3 { font-size: 15px; font-weight: 600; }
#connectors-close {
  font: inherit;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
#connectors-close:hover { background: var(--hover); color: var(--text); }

.connectors-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

#connectors-notice {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}
#connectors-notice.error { background: rgba(224, 49, 49, 0.08); color: #c0392b; }

#connector-list { list-style: none; display: flex; flex-direction: column; }
#connector-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-top: 1px solid var(--border);
  /* 좁은 화면에서 버튼 묶음(최대 3개)이 상태 문구를 한 글자 폭까지 짓누르지 않도록,
     정보 영역이 최소 폭(.conn-info min-width)을 못 받으면 버튼을 아랫줄로 내린다 */
  flex-wrap: wrap;
}
#connector-list li.conn-loading {
  color: var(--text-light);
  font-size: 13px;
  justify-content: center;
}

.conn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.conn-icon svg { width: 22px; height: 22px; }
/* 래스터 브랜드 로고(gchat·teams·jira — public/icons/, 64px 원본을 22px로) */
.conn-icon img { width: 22px; height: 22px; object-fit: contain; }

.conn-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.conn-name { font-size: 14px; font-weight: 600; }
.conn-status {
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.45;
  /* 말줄임 대신 줄바꿈 — Teams("채팅만 수집 — 팀 채널은 관리자 동의 후")·GitHub(설치 경고)처럼
     행동을 안내하는 긴 상태 문구가 잘리면 안 된다. 버튼 3개인 행도 두 줄로 전부 보인다. */
  overflow-wrap: anywhere;
}
.conn-status.connected { color: #1a7f37; }
.conn-status.warn { color: #b0771a; }
/* 연결 상태 뒤에 붙는 필요 안내(Teams "관리자 동의 필요") — 에러(#c0392b)보다 옅은 붉은 톤 */
.conn-status .conn-hint { color: #c0655c; }

.conn-actions { display: flex; gap: 6px; flex-shrink: 0; }
.conn-actions button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.conn-actions button:hover:not(:disabled) { background: var(--hover); }
.conn-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.conn-actions button.primary:hover:not(:disabled) { filter: brightness(0.95); }
.conn-actions button:disabled { opacity: 0.45; cursor: default; }

/* ---------- 개선 의견 · 오류 제보 ---------- */
/* 플로팅 프롬프트 — 우측 하단, AI 오브 바로 위에 얹힌다. 클릭하면 아래 모달을 연다. */
#feedback-pill {
  position: fixed;
  right: 22px;
  bottom: 78px; /* AI 오브(44px, bottom:22) 위 */
  z-index: 118; /* 오브(120)보다 살짝 아래 */
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  max-width: 280px;
  animation: fb-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes fb-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
#feedback-pill-open {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 6px 11px 13px;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
#feedback-pill-open:hover { background: var(--hover); }
.fb-pill-emoji { font-size: 18px; line-height: 1; flex-shrink: 0; }
.fb-pill-text { font-size: 13px; font-weight: 600; line-height: 1.25; display: flex; flex-direction: column; gap: 2px; }
.fb-pill-text small { font-size: 11.5px; font-weight: 400; color: var(--text-light); }
#feedback-pill-x {
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 12px;
  padding: 0 10px;
  flex-shrink: 0;
}
#feedback-pill-x:hover { background: var(--hover); color: var(--text); }
/* AI 패널이 열리면 오브처럼 비켜난다 */
#app.ai-open #feedback-pill { opacity: 0; pointer-events: none; }

/* 모달 — 커넥터·휴지통 모달과 같은 오버레이 패턴 */
#feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#feedback-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 440px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none;
}
.feedback-head { display: flex; align-items: center; justify-content: space-between; }
.feedback-head h3 { font-size: 15px; font-weight: 600; }
#feedback-close {
  font: inherit; font-size: 13px; border: none; background: transparent;
  color: var(--text-light); cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
#feedback-close:hover { background: var(--hover); color: var(--text); }
.feedback-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.feedback-kind { display: flex; gap: 8px; }
.fb-kind {
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text-light); cursor: pointer;
}
.fb-kind:hover { background: var(--hover); }
.fb-kind.active {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
#feedback-text {
  font: inherit; font-size: 14px; line-height: 1.5; resize: vertical;
  min-height: 110px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
#feedback-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
#feedback-notice {
  font-size: 13px; padding: 8px 10px; border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.08); color: var(--text);
}
#feedback-notice.error { background: rgba(224, 49, 49, 0.08); color: #c0392b; }
.feedback-actions { display: flex; justify-content: flex-end; gap: 8px; }
.feedback-actions button {
  font: inherit; font-size: 13px; padding: 8px 16px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}
.feedback-actions button:hover:not(:disabled) { background: var(--hover); }
.feedback-actions button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.feedback-actions button.primary:hover:not(:disabled) { filter: brightness(0.95); }
.feedback-actions button:disabled { opacity: 0.5; cursor: default; }

/* ---------- 휴지통 모달 ---------- */
/* 문서 검색(퀵오픈) — 상단 스포트라이트 스타일. 목록 행은 이름 + 위치 라벨 */
#qopen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.3);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  z-index: 210;
}
#qopen-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
}
#qopen-input {
  width: 100%;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15.5px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
#qopen-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
.qopen-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.qopen-row.selected, .qopen-row:hover { background: var(--hover); }
.qopen-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qopen-loc {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}
.qopen-empty { padding: 18px 12px; font-size: 13px; color: var(--text-light); text-align: center; }

#trash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#trash-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 480px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: none;
}
.trash-head { display: flex; align-items: center; justify-content: space-between; }
.trash-head h3 { font-size: 15px; font-weight: 600; }
.trash-head-actions { display: flex; align-items: center; gap: 6px; }
#trash-empty {
  font: inherit;
  font-size: 12.5px;
  border: none;
  background: transparent;
  color: #d44;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 5px;
}
#trash-empty:hover { background: rgba(224, 49, 49, 0.08); }
#trash-close {
  font: inherit;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
#trash-close:hover { background: var(--hover); color: var(--text); }
.trash-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

#trash-list { list-style: none; display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; }
#trash-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border-top: 1px solid var(--border);
}
#trash-list li.trash-empty {
  color: var(--text-light);
  font-size: 13px;
  justify-content: center;
  padding: 28px 2px;
  border-top: none;
}
.trash-icon { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; opacity: 0.75; }
.trash-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trash-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-meta {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-actions { display: flex; gap: 6px; flex-shrink: 0; }
.trash-actions button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.trash-actions button:hover:not(:disabled) { background: var(--hover); }
.trash-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.trash-actions button.primary:hover:not(:disabled) { filter: brightness(0.95); }
.trash-actions button.danger { color: #d44; border: none; }
.trash-actions button.danger:hover:not(:disabled) { background: rgba(224, 49, 49, 0.08); }
.trash-actions button:disabled { opacity: 0.5; cursor: default; }

/* ---------- 정비 상태 — 주제별 행 ---------- */
.mlog-topic { border-top: 1px solid var(--border); }
.mlog-topic:first-child { border-top: none; }
.mlog-topic .mlog-head { align-items: center; }
.mlog-topic-name {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
}
.mlog-topic .mlog-status { margin-left: auto; text-align: right; }
.mlog-chip-running { color: var(--accent); }
.mlog-chip-err { color: #d44; }
.mlog-chip-never { color: rgba(55, 53, 47, 0.45); }
.mlog-spin { display: inline-block; animation: topic-spin 1.2s linear infinite; }
.inbox-group { /* 제안함 주제 그룹 헤더 */
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-light);
  padding: 14px 2px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  list-style: none;
}

/* ---------- 루틴 관리 모달 (주제 정비 예약 실행) · 정비 실행 모달(강도·지침) · 주제 모달 ---------- */
#routine-overlay,
#maintain-overlay,
#topic-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#topic-modal,
#routine-modal,
#maintain-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 460px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: none;
}
.routine-head { display: flex; align-items: center; justify-content: space-between; }
.routine-head h3 { font-size: 15px; font-weight: 600; }
#routine-close,
#maintain-close {
  font: inherit;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
#routine-close:hover,
#maintain-close:hover { background: var(--hover); color: var(--text); }
.routine-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

#routine-list { list-style: none; display: flex; flex-direction: column; max-height: 34vh; overflow-y: auto; }
#routine-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border-top: 1px solid var(--border);
}
#routine-list li.routine-empty {
  color: var(--text-light);
  font-size: 13px;
  justify-content: center;
  padding: 20px 2px;
  border-top: none;
}
.routine-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.routine-item-desc { font-size: 14px; font-weight: 500; }
.routine-item-meta { font-size: 12px; color: var(--text-light); }
.routine-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.routine-item-actions button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.routine-item-actions button:hover:not(:disabled) { background: var(--hover); }
.routine-item-actions button.danger { color: #d44; border: none; }
.routine-item-actions button.danger:hover:not(:disabled) { background: rgba(224, 49, 49, 0.08); }
.routine-item-actions button:disabled { opacity: 0.5; cursor: default; }
#routine-add {
  font: inherit;
  font-size: 13px;
  border: 1px dashed rgba(55, 53, 47, 0.25);
  background: transparent;
  color: var(--text-light);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
}
#routine-add:hover { background: var(--hover); color: var(--text); }

#routine-form { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.routine-freq { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; width: max-content; }
.freq-btn {
  font: inherit;
  font-size: 13px;
  padding: 5px 16px;
  border: none;
  background: #fff;
  color: var(--text-light);
  cursor: pointer;
}
.freq-btn + .freq-btn { border-left: 1px solid var(--border); }
.freq-btn.active { background: rgba(var(--accent-rgb), 0.08); color: var(--accent); font-weight: 600; }
.routine-days { display: flex; flex-wrap: wrap; gap: 5px; }
.routine-days.monthly { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); } /* 1~31 달력꼴 */
.day-chip {
  font: inherit;
  font-size: 12.5px;
  min-width: 36px;
  padding: 5px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.day-chip:hover { background: var(--hover); }
.day-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.routine-time-row { font-size: 13px; display: flex; align-items: center; gap: 8px; }
#routine-time {
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.routine-hint { font-size: 12px; color: var(--text-light); line-height: 1.5; }
.routine-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
.routine-form-actions button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.routine-form-actions button:hover:not(:disabled) { background: var(--hover); }
.routine-form-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.routine-form-actions button.primary:hover:not(:disabled) { filter: brightness(0.95); }
.routine-form-actions button:disabled { opacity: 0.5; cursor: default; }
.routine-foot { font-size: 12px; color: var(--text-light); }

/* 정비 실행 모달 — 강도 세그먼트(3분할)·지침 입력. 공통 골격(head·actions)은 루틴 모달과 공유 */
.maint-strength { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.strength-btn {
  font: inherit;
  font-size: 13px;
  flex: 1;
  padding: 7px 0;
  border: none;
  background: #fff;
  color: var(--text-light);
  cursor: pointer;
  text-align: center;
}
.strength-btn + .strength-btn { border-left: 1px solid var(--border); }
.strength-btn.active { background: rgba(var(--accent-rgb), 0.08); color: var(--accent); font-weight: 600; }
.maint-strength-desc { font-size: 12.5px; color: var(--text-light); line-height: 1.5; min-height: 2.8em; }
.maint-instr-label { font-size: 13px; font-weight: 500; }
#maintain-instructions,
#routine-instructions {
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  resize: vertical;
  min-height: 60px;
}
#maintain-instructions { min-height: 72px; }
#maintain-instructions:focus,
#routine-instructions:focus { outline: none; border-color: var(--accent); }
.maint-hint { font-size: 12px; color: var(--text-light); line-height: 1.5; }
/* 로그 본문의 지침 행 — 사용자가 쓴 지침 원문이라 줄이 길 수 있다 */
.mlog-instr { white-space: pre-wrap; word-break: break-word; }

/* ---------- 슬래시 메뉴 · 문서 링크 피커 · 생성 메뉴 ---------- */
#slash-menu,
#link-menu,
#add-menu,
#ctx-menu {
  position: absolute;
  z-index: 100;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  width: 220px;
  max-height: 320px;
  overflow-y: auto;
}
#slash-menu .item,
#link-menu .item,
#add-menu .item,
#ctx-menu .item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}
#slash-menu .item.selected,
#link-menu .item.selected,
#add-menu .item:hover,
#ctx-menu .item:hover { background: var(--hover); }
#slash-menu .item .icon,
#link-menu .item .icon,
#add-menu .item .icon,
#ctx-menu .item .icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-light);
  background: #fff;
  flex-shrink: 0;
}
#add-menu, #ctx-menu { position: fixed; width: 180px; }
#link-menu { width: 280px; }
#link-menu .item .item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#link-menu .item .item-note {
  flex-shrink: 0;
  max-width: 45%;
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 운영 대시보드 (/ops) ---------- */
#ops-root { min-height: 100vh; background: var(--bg); }

.ops-page { max-width: 1120px; margin: 0 auto; padding: 36px 40px 80px; }

.ops-head { display: flex; align-items: baseline; gap: 12px; }
.ops-head .logo { height: 15px; }
.ops-title { font-size: 21px; font-weight: 700; }

.ops-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 26px;
  font-size: 12.5px;
  color: var(--text-light);
}
#ops-refresh {
  font: inherit;
  font-size: 12.5px;
  color: rgba(55, 53, 47, 0.75);
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 9px;
  cursor: pointer;
}
#ops-refresh:hover { background: var(--hover); }

.ops-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
.ops-card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.ops-card-label { font-size: 12.5px; color: var(--text-light); margin-bottom: 6px; }
.ops-card-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.ops-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.ops-table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.ops-table th, .ops-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.ops-table thead th {
  background: var(--sidebar-bg);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(55, 53, 47, 0.75);
}
.ops-table tbody tr:last-child td { border-bottom: none; }
.ops-table tbody tr:hover td { background: var(--hover); }
.ops-table th.num, .ops-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ops-email { font-weight: 500; }
.ops-sub-num { color: var(--text-light); font-size: 12px; }
.ops-chip {
  display: inline-block;
  font-size: 11.5px;
  color: rgba(55, 53, 47, 0.75);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
}
.ops-chip + .ops-chip { margin-left: 4px; }
.ops-chip-pro {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.35);
  font-weight: 600;
}
.ops-dim { color: var(--text-light); }
.ops-empty { text-align: center; color: var(--text-light); padding: 28px 0 !important; }

/* 개선 의견 · 오류 제보 섹션 */
.ops-fb-head { margin: 40px 0 14px; }
.ops-chip-bug {
  color: #c0392b;
  background: rgba(224, 49, 49, 0.08);
  border-color: rgba(224, 49, 49, 0.3);
  font-weight: 600;
}
.ops-chip-idea {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.3);
  font-weight: 600;
}
#ops-feedback { display: flex; flex-direction: column; gap: 10px; }
.ops-fb-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.ops-fb-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ops-fb-email { font-size: 13px; font-weight: 600; }
.ops-fb-when { font-size: 12.5px; color: var(--text-light); font-variant-numeric: tabular-nums; }
.ops-fb-ctx {
  font-size: 11.5px; color: var(--text-light);
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 7px; font-family: ui-monospace, monospace;
}
.ops-fb-msg { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 사용량 지급 (운영자) — 표의 지급 버튼·지급분 표기·지급 모달 */
.ops-bonus {
  margin-left: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #1d7a46;
}
.ops-grant {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 9px;
  cursor: pointer;
}
.ops-grant:hover { background: var(--hover); }
.ops-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ops-modal {
  width: 380px;
  max-width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 22px 18px;
  box-shadow: 0 12px 40px rgba(15, 15, 15, 0.2);
}
.ops-modal h3 { font-size: 16px; margin-bottom: 12px; }
.ops-modal-target { font-size: 14px; font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.ops-modal-state { font-size: 12.5px; color: var(--text-light); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.ops-modal-presets { display: flex; gap: 6px; margin-bottom: 12px; }
.ops-modal-presets button {
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ops-modal-presets button:hover { background: var(--hover); }
.ops-modal-label { display: block; font-size: 12.5px; color: var(--text-light); margin-bottom: 10px; }
.ops-modal-label input {
  display: block;
  width: 100%;
  margin-top: 4px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
}
.ops-modal-label input:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.5); }
.ops-modal-err { min-height: 18px; font-size: 12.5px; color: #c0392b; margin-bottom: 8px; }
.ops-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ops-modal-actions #ops-grant-cancel {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}
.ops-modal-actions #ops-grant-cancel:hover { background: var(--hover); }
.ops-modal-actions .ops-btn { cursor: pointer; }
.ops-modal-actions .ops-btn:disabled { opacity: 0.6; cursor: default; }

.ops-loading { padding: 120px 0; text-align: center; color: var(--text-light); }

.ops-notice { max-width: 400px; margin: 140px auto 0; padding: 0 24px; text-align: center; }
.ops-notice .auth-logo { align-self: auto; }
.ops-notice h2 { font-size: 18px; margin: 20px 0 8px; }
.ops-notice p { font-size: 14px; line-height: 1.65; color: var(--text-light); margin-bottom: 22px; }
.ops-btn {
  display: inline-block;
  font: inherit;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  cursor: pointer;
  text-decoration: none;
}
.ops-btn:hover { opacity: 0.9; }

/* ---------- AI 어시스턴트 (오브 · 우측 패널 · 검토 모달 · AI 블록) ---------- */

/* 오브 — 우측 하단 진입점. 아이콘은 haru 로고 마크(호버 시 AI 그라데이션으로 물든다).
   호버: 그라데이션 링이 12시에서 시계 방향으로 버튼을 샤라락 감싸고(선두에 혜성 글로우),
   다 감기면 은은하게 색이 흐르는 링으로 남는다. 클릭(패널 열림): 패널 쪽으로 빨려들며 사라진다. */
#ai-orb {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: rgba(55, 53, 47, 0.66);
  cursor: pointer;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease,
    border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
#ai-orb .orb-logo { width: 18px; height: 18px; }
#ai-orb .orb-mark-grad { opacity: 0; transition: opacity 0.28s ease; }
#ai-orb:hover .orb-mark-grad { opacity: 1; } /* 로고 마크가 그라데이션으로 물든다 */
#ai-orb:hover {
  transform: scale(1.06);
  border-color: transparent; /* 회색 보더 대신 그라데이션 링이 감싼다 */
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.24), 0 4px 20px rgba(6, 182, 212, 0.16);
}
/* 그라데이션 링 — SVG stroke draw-on: 12시에서 시계 방향으로 감싸고(0.7s),
   다 감기면 링이 천천히 돌며 그라데이션 색이 흐른다. (dasharray = 2π×23.5 ≈ 147.7) */
#ai-orb .orb-ring {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
#ai-orb .orb-ring circle {
  fill: none;
  stroke: url(#orb-ring-grad);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 147.7;
  stroke-dashoffset: 147.7;
  transform: rotate(-90deg);
  transform-origin: center;
}
#ai-orb:hover .orb-ring {
  opacity: 1;
  animation: orb-ring-spin 7s linear 0.7s infinite;
}
#ai-orb:hover .orb-ring circle {
  animation: orb-ring-draw 0.7s cubic-bezier(0.3, 1, 0.4, 1) forwards;
}
/* 스윕 선두의 혜성 글로우 — 링과 같은 타이밍으로 한 바퀴 돌고 스르르 사라진다 */
#ai-orb::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(139, 92, 246, 0.85) 45%, transparent 75%);
  box-shadow: 0 0 10px 3px rgba(139, 92, 246, 0.5), 0 0 20px 7px rgba(6, 182, 212, 0.28);
  opacity: 0;
  pointer-events: none;
}
#ai-orb:hover::after { animation: orb-head 0.7s cubic-bezier(0.3, 1, 0.4, 1) both; }
@keyframes orb-ring-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes orb-ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes orb-head {
  0% { opacity: 0; transform: rotate(0deg) translateY(-25px) scale(0.5); }
  10% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; transform: rotate(360deg) translateY(-25px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #ai-orb { transition: none; }
  #ai-orb:hover { transform: none; }
  /* 모션 없이 완성된 링만 바로 보여 준다 */
  #ai-orb:hover .orb-ring { animation: none; }
  #ai-orb:hover .orb-ring circle { animation: none; stroke-dashoffset: 0; }
  #ai-orb:hover::after { animation: none; }
}
/* 패널 열림 — 오브가 패널 쪽으로 빨려들며 사라진다 */
#app.ai-open #ai-orb {
  opacity: 0;
  transform: translateX(34px) scale(0.4);
  pointer-events: none;
}

/* 우측 패널 — #app 플렉스의 세 번째 자식. 닫힘: 폭 0, 열림: 380px (콘텐츠를 민다) */
#ai-panel {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: 0 solid var(--border);
  background: var(--bg);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
#app.ai-open #ai-panel {
  width: 380px;
  min-width: 380px;
  border-left-width: 1px;
}
.ai-panel-inner {
  width: 380px; /* 트랜지션 중 내용이 찌그러지지 않게 고정 */
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* 열림 스태거 — 헤더→스레드→컴포저→풋노트가 살짝 오른쪽에서 순서대로 미끄러져 들어온다 */
@keyframes ai-panel-enter {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}
#app.ai-open .ai-head { animation: ai-panel-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
#app.ai-open #ai-thread { animation: ai-panel-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.11s both; }
#app.ai-open .ai-composer { animation: ai-panel-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.17s both; }
#app.ai-open .ai-foot { animation: ai-panel-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both; }
@media (prefers-reduced-motion: reduce) {
  #ai-panel { transition: none; }
  #app.ai-open .ai-head, #app.ai-open #ai-thread,
  #app.ai-open .ai-composer, #app.ai-open .ai-foot { animation: none; }
}
.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ai-title-spark {
  background: linear-gradient(120deg, #7c3aed, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 15px;
}
.ai-head-actions { display: flex; gap: 4px; }
.ai-head-actions button {
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.ai-head-actions button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.ai-head-actions button:disabled { opacity: 0.45; cursor: default; }

#ai-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-msg { font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.ai-msg.user {
  align-self: flex-end;
  max-width: 88%;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px 12px 3px 12px;
  padding: 8px 12px;
  white-space: pre-wrap;
}
.ai-msg.assistant { align-self: stretch; padding: 2px 2px 0; }
.ai-msg.assistant .ai-h { font-weight: 700; margin: 6px 0 2px; }
.ai-msg.assistant .ai-li { padding-left: 6px; }
.ai-msg.assistant .ai-quote {
  border-left: 3px solid var(--border);
  padding-left: 10px;
  color: rgba(55, 53, 47, 0.75);
}
.ai-msg.assistant .ai-gap { height: 7px; }
.ai-msg.assistant pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  overflow-x: auto;
  margin: 4px 0;
  white-space: pre;
}
.ai-msg.assistant code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
.ai-msg.assistant .ai-table-wrap { overflow-x: auto; margin: 6px 0; }
.ai-msg.assistant .ai-table {
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.5;
}
.ai-msg.assistant .ai-table th,
.ai-msg.assistant .ai-table td {
  border: 1px solid rgba(55, 53, 47, 0.16);
  padding: 4px 8px;
  min-width: 48px;
  text-align: left;
  vertical-align: top;
}
.ai-msg.assistant .ai-table th {
  background: rgba(55, 53, 47, 0.04);
  font-weight: 600;
}
.ai-msg.assistant .ai-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}
.ai-msg.assistant a { color: var(--accent); }
.ai-msg.assistant a.doc-link { cursor: pointer; text-decoration: none; border-bottom: 1px solid rgba(var(--accent-rgb), 0.35); }
.ai-msg.assistant a.doc-link::before { content: '📄 '; font-size: 11px; }
.ai-sources { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.ai-sources a {
  font-size: 11px;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5px 9px;
  text-decoration: none;
}
.ai-sources a:hover { background: var(--hover); color: var(--text); }

.ai-chip {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
  background: rgba(55, 53, 47, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 11px;
  max-width: 100%;
}
.ai-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-chip-icon { font-size: 11px; opacity: 0.8; flex-shrink: 0; }

.ai-note { font-size: 12.5px; color: var(--text-light); padding: 2px 2px; }
.ai-note.error { color: #b43b3b; }

.ai-card {
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  background: rgba(var(--accent-rgb), 0.05);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-card.applied { border-color: rgba(26, 127, 55, 0.3); background: rgba(26, 127, 55, 0.05); }
.ai-card-label { font-size: 13px; font-weight: 500; line-height: 1.5; }
.ai-card-docs { font-size: 12px; color: var(--text-light); }
/* 파일 산출물 카드 — make_file 결과 다운로드 */
.ai-file-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.ai-file-card .ai-card-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-dl {
  flex-shrink: 0;
  font-size: 12.5px;
  color: #fff;
  background: var(--accent);
  border-radius: 7px;
  padding: 5px 12px;
  text-decoration: none;
}
.ai-file-dl:hover { filter: brightness(0.94); }
.ai-file-dl[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }
.ai-card button {
  align-self: flex-start;
  font-size: 12.5px;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}
.ai-card button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ai-card button:hover { filter: brightness(0.97); }

/* 세션 기록 모달 — 검토 모달과 같은 오버레이 패턴, 목록에 맞는 적당한 크기 */
#ai-sessions-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#ai-sessions-modal {
  background: #fff;
  border-radius: 10px;
  padding: 16px 14px 10px 18px;
  width: 440px;
  max-width: calc(100vw - 40px);
  max-height: min(600px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  outline: none;
}
#ai-sessions-close {
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
#ai-sessions-close:hover { background: var(--hover); color: var(--text); }
#ai-sessions-list { flex: 1; overflow-y: auto; padding: 10px 4px 4px 0; min-height: 120px; }
.ai-sessions-empty { font-size: 12.5px; color: var(--text-light); padding: 16px; text-align: center; }
.ai-session-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
}
.ai-session-row:hover { background: var(--hover); }
.ai-session-row.current { background: rgba(var(--accent-rgb), 0.08); }
.ai-session-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ai-session-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-session-meta { font-size: 11.5px; color: var(--text-light); }
.ai-session-del {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--text-light);
}
.ai-session-row:hover .ai-session-del { opacity: 0.7; }
.ai-session-del:hover { opacity: 1; background: var(--hover); }

.ai-typing { display: flex; gap: 4px; padding: 6px 2px; }
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(55, 53, 47, 0.35);
  animation: ai-typing-bounce 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 첨부 칩 — 컴포저 위 한 줄 (현재 세션의 첨부 파일) */
#ai-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
  border-top: 1px solid var(--border);
}
#ai-attach-chips[hidden] { display: none; }
.ai-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  font-size: 11.5px;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 4px 2px 10px;
  background: var(--bg);
}
.ai-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.ai-attach-chip button {
  border: none;
  background: none;
  color: var(--text-light);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 50%;
}
.ai-attach-chip button:hover { background: var(--hover); color: var(--text); }

.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 6px;
  border-top: 1px solid var(--border);
}
/* 첨부 칩 줄이 보일 때는 컴포저의 상단 경계선을 겹치지 않게 지운다 */
#ai-attach-chips:not([hidden]) + .ai-composer { border-top: none; }
#ai-attach {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-light);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#ai-attach:hover { background: var(--hover); color: var(--text); }
#ai-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  max-height: 140px;
  outline: none;
  background: var(--bg);
}
#ai-input:focus { border-color: rgba(var(--accent-rgb), 0.45); }
#ai-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#ai-send:hover { filter: brightness(0.94); }
#ai-send.stop { background: #d44; font-size: 11px; }
.ai-foot {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding: 0 12px 9px;
}

/* AI 변경 검토 모달 — 기존 모달(z-200) 패턴 */
#ai-review-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#ai-review-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 760px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none;
}
.ai-review-head { display: flex; align-items: center; justify-content: space-between; }
.ai-review-head h3 { font-size: 16px; }
#ai-review-close {
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
#ai-review-close:hover { background: var(--hover); color: var(--text); }
#ai-review-desc { font-size: 13px; color: var(--text-light); }
#ai-review-body { display: flex; flex-direction: column; gap: 14px; }
.ai-review-doc { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.ai-review-doc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ai-review-doc-name { font-size: 13px; font-weight: 500; }
#ai-review-foot { display: flex; justify-content: flex-end; gap: 8px; }
#ai-review-foot button {
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}
#ai-review-foot button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#ai-review-foot button.danger { color: #b43b3b; }
#ai-review-foot button:hover:not(:disabled) { filter: brightness(0.97); }
#ai-review-foot button:disabled { opacity: 0.5; cursor: default; }

/* AI 프롬프트 블록 (빈 문단 + Space) — 그라데이션 좌측 보더의 일시적 입력 상태 */
.block.ai-block .ai-block-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  border-radius: 8px;
  padding: 7px 10px;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(120deg, rgba(124, 58, 237, 0.55), rgba(6, 182, 212, 0.55), rgba(236, 72, 153, 0.45)) border-box;
  border: 1.5px solid transparent;
}
.block.ai-block .ai-block-icon {
  background: linear-gradient(120deg, #7c3aed, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 14px;
  line-height: 1.55;
  flex-shrink: 0;
}
.block.ai-block .content.ai-block-input {
  flex: 1;
  min-height: 22px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.block.ai-block .content.ai-block-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
}

/* ---------- 첫 사용자 튜토리얼 (온보딩) ---------- */
/* 오버레이가 뷰포트를 덮어 모든 클릭을 가로챈다(하이라이트된 실제 버튼은 눌러도 실행되지 않음).
   스포트라이트는 #onboard-spot의 거대한 box-shadow로 주변을 어둡게 해 만든다(타깃 자리는 뚫린 듯). */
#onboard-overlay { position: fixed; inset: 0; z-index: 600; }
#onboard-overlay.centered { background: rgba(15, 15, 15, 0.55); }
#onboard-spot {
  position: fixed;
  border-radius: 10px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(15, 15, 15, 0.55),
    0 0 0 3px #fff,
    0 0 0 5px rgba(37, 99, 235, 0.85),
    0 0 26px 6px rgba(139, 92, 246, 0.45);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1), height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}
#onboard-spot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  animation: ob-spot-pulse 1.8s ease-out infinite;
}
@keyframes ob-spot-pulse {
  0% { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.55); opacity: 0.9; }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); opacity: 0; }
  100% { opacity: 0; }
}
#onboard-card {
  position: fixed;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg);
  border-radius: 14px;
  padding: 18px 18px 13px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1), top 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
#onboard-card.ob-open { animation: ob-card-in 0.3s ease both; }
@keyframes ob-card-in { from { opacity: 0; } to { opacity: 1; } }
.onboard-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 7px;
}
#onboard-step-num {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
#onboard-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.35; }
#onboard-desc { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text); opacity: 0.82; }
#onboard-stage { margin: 14px 0 4px; min-height: 96px; overflow: hidden; }
.onboard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}
.onboard-dots { display: flex; gap: 6px; }
.onboard-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: all 0.2s ease; }
.onboard-dots span.on { background: var(--accent); width: 18px; border-radius: 3px; }
.onboard-hint { font-size: 11.5px; color: var(--text-light); text-align: right; }

/* 스텝별 시뮬레이션 — 공통: 인라인 --d를 가진 요소는 순차 등장 */
#onboard-stage [style*="--d"] { animation: ob-rise 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; animation-delay: var(--d); }
@keyframes ob-rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* 환영/완료 */
.ob-welcome { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0; }
.ob-logo { width: 46px; height: 46px; }
.ob-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ob-chips span {
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 11px;
}
.ob-done { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0; }
.ob-done-check {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #8b5cf6, #06b6d4);
  color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center;
  animation: ob-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ob-done .ob-logo { width: 30px; height: 30px; opacity: 0.85; }
@keyframes ob-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }

/* Workspace 문서 */
.ob-doc { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.ob-addmenu {
  align-self: flex-start; font-size: 11.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); margin-bottom: 3px;
}
.ob-addmenu b { color: var(--accent); }
.ob-doc-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ob-line { color: var(--text); opacity: 0.9; padding-left: 2px; }
.ob-line.ob-h { font-weight: 700; }
.ob-check { color: #16a34a; font-weight: 700; margin-right: 3px; }
.ob-line.ob-link { color: var(--accent); }

/* 커넥터 */
.ob-conns { display: flex; flex-direction: column; gap: 7px; }
.ob-conn {
  display: flex; align-items: center; gap: 9px;
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px;
}
.ob-conn-ic { font-size: 15px; line-height: 1; }
.ob-conn-nm { flex: 1; font-weight: 600; color: var(--text); }
.ob-conn-done { font-size: 11.5px; font-weight: 600; color: #16a34a; }
.ob-conn-btn { font-size: 11.5px; font-weight: 600; color: #fff; background: var(--accent); border-radius: 14px; padding: 3px 11px; }
.ob-conn-swap { position: relative; display: inline-flex; min-width: 54px; height: 20px; justify-content: flex-end; }
.ob-conn-swap .ob-c1, .ob-conn-swap .ob-c2 {
  position: absolute; right: 0; top: 0; font-size: 11.5px; font-weight: 600;
  border-radius: 14px; padding: 3px 11px; white-space: nowrap;
}
.ob-conn-swap .ob-c1 { color: #fff; background: var(--accent); animation: ob-swap-out 0.4s ease 1.1s both; }
.ob-conn-swap .ob-c2 { color: #16a34a; opacity: 0; animation: ob-swap-in 0.4s ease 1.35s both; }
@keyframes ob-swap-out { from { opacity: 1; } to { opacity: 0; transform: scale(0.9); } }
@keyframes ob-swap-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.ob-conn-note { font-size: 11px; color: var(--text-light); text-align: center; padding-top: 1px; }

/* 주제 정비 */
.ob-maint { display: flex; flex-direction: column; gap: 8px; }
.ob-run {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(120deg, #2563eb, #8b5cf6); border-radius: 8px; padding: 6px 12px;
}
.ob-run-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); animation: ob-blink 1s ease-in-out infinite; }
@keyframes ob-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.ob-prop {
  background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 9px 11px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}
.ob-prop.is-add { border-left-color: #16a34a; }
.ob-prop-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ob-badge {
  font-size: 10.5px; font-weight: 700; color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1); border-radius: 5px; padding: 2px 7px; flex-shrink: 0;
}
.ob-prop.is-add .ob-badge { color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.ob-prop-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ob-prop-meta { font-size: 11px; color: var(--text-light); margin-bottom: 7px; }
.ob-prop-acts { display: flex; gap: 6px; }
.ob-accept, .ob-reject { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 3px 12px; }
.ob-accept { color: #fff; background: var(--accent); }
.ob-reject { color: var(--text-light); border: 1px solid var(--border); }

/* AI 어시스턴트 채팅 */
.ob-chat { display: flex; flex-direction: column; gap: 9px; }
.ob-msg { font-size: 12.5px; line-height: 1.5; border-radius: 12px; padding: 8px 12px; max-width: 90%; }
.ob-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ob-ai {
  align-self: flex-start; position: relative; min-height: 22px;
  background: var(--sidebar-bg); border: 1px solid var(--border); color: var(--text);
  border-bottom-left-radius: 4px; display: flex; flex-direction: column; gap: 6px;
}
.ob-typing { position: absolute; top: 12px; left: 12px; display: inline-flex; gap: 4px; animation: ob-fade-out 0.2s ease 1.15s forwards; }
.ob-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-light); animation: ob-bounce 1s ease-in-out infinite; }
.ob-typing i:nth-child(2) { animation-delay: 0.15s; }
.ob-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ob-bounce { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-4px); opacity: 1; } }
@keyframes ob-fade-out { to { opacity: 0; } }
.ob-ai-text { opacity: 0; animation: ob-fade-in 0.35s ease 1.3s both; }
.ob-cite {
  align-self: flex-start; opacity: 0; font-size: 11px; font-weight: 600; color: var(--accent);
  background: rgba(var(--accent-rgb), 0.09); border-radius: 6px; padding: 2px 8px;
  animation: ob-fade-in 0.35s ease 1.6s both;
}
@keyframes ob-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  #onboard-card { width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  #onboard-spot, #onboard-card { transition: none; }
  #onboard-spot::after { animation: none; }
}

/* 모바일 편집 툴바 — 소프트키보드 위에 뜨는 둥근 플로팅 툴바(가운데 정렬 · 프로스티드 글래스).
   JS(app.js)가 .show 토글 + top 위치를 잡는다 (좌우 가운데는 CSS translateX). */
#mobile-toolbar {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  gap: 2px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(6, 20, 47, 0.06);
  border-radius: 16px;
  box-shadow: 0 6px 22px rgba(6, 20, 47, 0.16), 0 1px 4px rgba(6, 20, 47, 0.08);
}
#mobile-toolbar.show { display: inline-flex; align-items: center; }
#mobile-toolbar button {
  flex: 0 0 auto;
  width: 46px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: rgba(55, 53, 47, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.13s ease, color 0.13s ease, transform 0.13s ease;
}
#mobile-toolbar button svg { width: 22px; height: 22px; display: block; }
#mobile-toolbar button:active {
  background: rgba(var(--accent-rgb), 0.13);
  color: var(--accent);
  transform: scale(0.93);
}
#mobile-toolbar .mb-divider {
  width: 1px;
  align-self: stretch;
  margin: 7px 4px;
  background: rgba(6, 20, 47, 0.1);
}
/* 데스크톱에선 절대 노출하지 않는다 (좁은 창에서 .show가 남아 있어도) */
@media (min-width: 769px) { #mobile-toolbar.show { display: none; } }

/* ---------- 주제 생성 위저드 · 주제 설정 모달 (본문은 app.js가 렌더) ---------- */
#topic-modal-body { display: flex; flex-direction: column; gap: 8px; }
.topic-label { font-size: 12.5px; font-weight: 600; color: var(--text-light); margin-top: 6px; }
.topic-label-inline { font-size: 13px; color: var(--text-light); flex-shrink: 0; }
.topic-input,
.topic-textarea {
  font: inherit;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  width: 100%;
  resize: vertical;
}
.topic-textarea { min-height: 72px; }
.topic-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 8px;
  cursor: pointer;
}
.topic-hint { font-size: 12.5px; color: var(--text-light); line-height: 1.55; margin: 0; }
.topic-usage-note {
  font-size: 12.5px;
  color: var(--text-light);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  margin-top: 6px;
}
.topic-seg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topic-src-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.topic-src-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
}
.topic-src-item .topic-src-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-src-empty { font-size: 12.5px; color: var(--text-light); padding: 4px 2px; list-style: none; }
.topic-src-add { display: flex; gap: 6px; margin-top: 4px; }
.topic-src-btn {
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.topic-src-btn:hover { background: var(--hover); }
.day-chips { display: flex; flex-wrap: wrap; gap: 5px; }
#topic-modal .topic-btn-primary,
#topic-modal .topic-btn-secondary {
  font: inherit;
  font-size: 13px;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
}
#topic-modal .topic-btn-primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
#topic-modal .topic-btn-primary:hover:not(:disabled) { filter: brightness(0.95); }
#topic-modal .topic-btn-primary:disabled { opacity: 0.55; cursor: default; }
#topic-modal .topic-btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--text); }
#topic-modal .topic-btn-secondary:hover { background: var(--hover); }
.routine-time-row select {
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  max-width: 240px;
}
