/* ICP 코드 브릿지, 회사용이라 hq(앰버)와 구분되는 블루 톤 */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #dc2626;
}
body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── 공통 버튼/필드 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; padding: 9px 16px;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { background: #f3f4f6; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 0.9rem; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.code-input { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.5; resize: vertical; white-space: pre; }

/* ── 로그인 ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box {
  width: 100%; max-width: 360px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06); text-align: center;
}
.login-logo { font-size: 2rem; margin-bottom: 8px; }
.login-box h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { font-size: 0.8rem; color: var(--muted); margin: 4px 0 22px; }
.login-box form { text-align: left; }
.login-note { font-size: 0.72rem; color: #9ca3af; margin-top: 16px; }
.field-label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.member-pick { display: flex; gap: 8px; }
.member-btn {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 12px 10px; font-size: 0.92rem; font-weight: 800; color: var(--muted); cursor: pointer;
  transition: all 0.15s;
}
.member-btn:hover { background: #f3f4f6; }
.member-btn.is-active { border-color: var(--accent); color: var(--accent-dark); background: #eef2ff; }

/* ── 상단바 ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 18px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { display: flex; align-items: center; gap: 8px; font-size: 0.98rem; }
.topbar-sub { font-size: 0.72rem; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 0.82rem; font-weight: 700; color: var(--accent); }

/* ── 작성자 탭 ── */
.author-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.author-tab {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 6px 14px; font-size: 0.82rem; font-weight: 700; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.author-tab:hover { background: #f3f4f6; }
.author-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.author-tab .tab-count { font-size: 0.7rem; opacity: 0.75; margin-left: 3px; }

/* ── 검색 ── */
.search-wrap { position: relative; margin-bottom: 12px; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.8rem; pointer-events: none; opacity: 0.55;
}
.search-wrap input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 38px 10px 36px; font-size: 0.88rem; background: #fff; color: var(--text);
}
.search-wrap input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-wrap input::placeholder { color: #9ca3af; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; font-size: 0.8rem;
  color: var(--muted); padding: 4px 6px; border-radius: 6px;
}
.search-clear:hover { background: #f3f4f6; color: var(--text); }

/* ── 목록 ── */
.container { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.policy-note { margin: -4px 0 14px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #f9fafb; font-size: 0.74rem; color: #6b7280; line-height: 1.6; }
.policy-note strong { color: #374151; }
.list-head-btns { display: flex; gap: 8px; }
.snip-count { font-size: 0.8rem; color: var(--muted); }
.empty-state {
  text-align: center; color: var(--muted); font-size: 0.9rem;
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 44px 20px;
}
.empty-state small { color: #9ca3af; }
.snip-loading { text-align: center; color: var(--muted); padding: 40px; }

.snip-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.snip-card.is-open { border-color: #c7d2fe; }
.snip-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; cursor: pointer; user-select: none;
}
.snip-card-head:hover { background: #fafbff; }
.snip-card-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.snip-caret { color: #9ca3af; font-size: 0.7rem; }
.kind-badge {
  flex: none; font-size: 0.64rem; font-weight: 800; padding: 2px 7px; border-radius: 20px;
  background: #eef2ff; color: var(--accent-dark);
}
.kind-badge.is-tb4 { background: #ecfdf5; color: #047857; }
.kind-badge.is-note { background: #fef3c7; color: #b45309; }
.snip-title-text { font-size: 0.88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snip-author { flex: none; font-size: 0.7rem; color: var(--muted); background: #f3f4f6; padding: 2px 7px; border-radius: 20px; }
.snip-card-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.snip-when { font-size: 0.7rem; color: #9ca3af; }
.icon-btn {
  border: none; background: none; cursor: pointer; font-size: 0.85rem;
  color: var(--muted); padding: 4px 6px; border-radius: 6px;
}
.icon-btn:hover { background: #f3f4f6; color: var(--text); }

.snip-body { border-top: 1px solid var(--line); padding: 10px 12px; background: #fafafa; }
.snip-part { margin-bottom: 10px; }
.snip-part:last-child { margin-bottom: 0; }
.snip-part-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.snip-part-label { font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.snip-pre {
  background: #1e293b; color: #e2e8f0; border-radius: 8px; padding: 10px 12px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.72rem; line-height: 1.5;
  overflow-x: auto; max-height: 320px; overflow-y: auto; white-space: pre;
}
.snip-empty-body { color: #9ca3af; font-size: 0.8rem; }
.snip-note {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 14px;
  font-size: 0.86rem; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
  max-height: 480px; overflow-y: auto;
}
.memo-input { line-height: 1.6; resize: vertical; }
.snip-note-notice { margin-top: 6px; font-size: 0.72rem; color: #b45309; }
.snip-more { width: 100%; margin-top: 6px; }

/* ── 모달 ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal {
  width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--card); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h2 { font-size: 1rem; font-weight: 800; }
.modal-close { border: none; background: none; font-size: 1rem; cursor: pointer; color: var(--muted); }
.modal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal-scroll { overflow-y: auto; padding: 16px 18px; flex: 1; }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-top: 1px solid var(--line); flex: none; background: var(--card);
}
.modal-hint { font-size: 0.72rem; color: #9ca3af; }
.modal-foot-right { display: flex; gap: 8px; }
.kind-toggle { display: flex; gap: 6px; margin-bottom: 14px; }
.kind-btn {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 8px 10px; font-size: 0.8rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.kind-btn.is-active { border-color: var(--accent); color: var(--accent-dark); background: #eef2ff; }

/* ── 토스트 ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; font-size: 0.84rem; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; z-index: 200;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.toast.is-error { background: var(--danger); }

@media (max-width: 560px) {
  .topbar-sub { display: none; }
  .snip-when { display: none; }
  .snip-author { display: none; }
}

/* ── 메모 파일 첨부 / 파일 저장 ── */
.file-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.file-info { font-size: 0.75rem; color: #2563eb; font-weight: 600; }
.file-hint { margin-top: 5px; font-size: 0.7rem; color: #94a3b8; line-height: 1.55; }
