/* ============================================================
   needforai workspace — 흰/검 미니멀 앱 UI
   ============================================================ */
:root {
  --bg: #FFFFFF;
  --bg-soft: #F6F6F6;
  --panel: #FFFFFF;
  --ink: #111111;
  --ink-soft: #333333;
  --muted: #767676;
  --border: #E6E6E6;
  --accent: #111111;
  --accent-hover: #000000;
  --accent-soft: #F0F0F0;
  --danger: #C0392B;
  --ok: #2E7D4F;
  --serif: 'Pretendard Variable', Pretendard, -apple-system, 'Noto Sans KR', sans-serif;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, 'Noto Sans KR', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); }

.app { display: flex; min-height: 100vh; }

/* ---------- 사이드바 ---------- */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
}
.side-logo { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; padding: 4px 12px 18px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 800;
}
.logo-mark-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.side-nav { flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; color: var(--ink-soft); padding: 9px 12px;
  border-radius: 9px; margin-bottom: 2px; transition: background .12s;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 8px; }

/* 사이드바 폴더 (+ 버튼 / 하위 폴더 목록) */
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row .nav-item { flex: 1; min-width: 0; }
.nav-add {
  flex-shrink: 0; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--muted); border-radius: 7px; cursor: pointer;
  font-size: 12px; opacity: 0; transition: opacity .12s;
}
.nav-row:hover .nav-add { opacity: 1; }
.nav-add:hover { background: var(--bg-soft); color: var(--ink); }
.nav-subitem {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted);
  padding: 6px 8px 6px 34px; border-radius: 8px; margin-bottom: 1px;
}
.nav-subitem:hover { background: var(--bg-soft); color: var(--ink); }
.nav-subitem > i { font-size: 12px; }
.nav-subitem span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-del {
  border: none; background: none; color: var(--muted); cursor: pointer;
  width: 20px; height: 20px; border-radius: 6px; font-size: 11px; opacity: 0;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-subitem:hover .sub-del { opacity: 1; }
.sub-del:hover { color: var(--danger); background: #fff; }
.nav-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 4px 12px 6px; }

.side-bottom { border-top: 1px solid var(--border); padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.side-user img { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-soft); }
.side-user-meta { display: flex; flex-direction: column; min-width: 0; }
.side-user-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-badge {
  align-self: flex-start; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border);
  padding: 0 7px; border-radius: 99px;
}
.plan-badge.pro { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-logout {
  width: 100%; font-size: 13px; color: var(--muted); background: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 7px; cursor: pointer;
}
.btn-logout:hover { background: var(--bg-soft); color: var(--ink); }

/* ---------- 콘텐츠 ---------- */
.content { flex: 1; padding: 40px 48px; max-width: 1100px; }
.page-title { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 28px; }

/* 카드/패널 */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.card h3 { font-size: 15.5px; margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.stat-card .num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.stat-card .label { font-size: 13px; color: var(--muted); }

/* 폼 */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="password"], .form-row textarea, .search-input {
  font-family: var(--sans); font-size: 14.5px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .12s;
}
.form-row input:focus, .form-row textarea:focus, .search-input:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12.5px; color: var(--muted); }
.form-hint a { color: var(--accent-hover); text-decoration: underline; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: all .13s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--ink-soft); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ink-soft); }
.btn-danger { background: none; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: #FBF0EE; border-color: var(--danger); }
.btn-sm { font-size: 12.5px; padding: 5px 11px; border-radius: 7px; }

/* 테이블 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .file-name { font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }

/* 빈 상태 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .empty-icon { font-size: 34px; margin-bottom: 10px; }

/* 검색 */
.search-bar { display: flex; gap: 10px; margin-bottom: 24px; }
.search-bar .search-input { flex: 1; font-size: 16px; padding: 13px 18px; }
.result-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 8px; }
.result-group h4 i { margin-right: 4px; }
.card h3 i { margin-right: 4px; }

/* 탭 (Messaging) */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 9px;
  background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--accent-soft); border-color: var(--ink); color: var(--ink); }

/* 메시지 목록 */
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-item { display: flex; justify-content: space-between; gap: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.msg-item .status-sent { color: var(--ok); font-size: 12px; }
.msg-item .status-failed { color: var(--danger); font-size: 12px; }

/* 음성 업로드 사용량 게이지 */
.quota-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; }
.quota-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.quota-label strong { color: var(--ink); font-size: 13.5px; }
.quota-track { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; background: var(--ink); border-radius: 99px; transition: width .3s ease; }
.quota-fill.quota-warn { background: var(--danger); }

/* 파일 툴바 / 브레드크럼 */
.files-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.breadcrumb { display: flex; align-items: center; gap: 2px; font-size: 14px; color: var(--muted); flex-wrap: wrap; min-height: 32px; }
.breadcrumb a { color: var(--muted); padding: 5px 9px; border-radius: 7px; cursor: pointer; }
.breadcrumb a:hover { background: var(--bg-soft); color: var(--ink); }
.breadcrumb .crumb-current { color: var(--ink); font-weight: 700; padding: 5px 9px; }
.breadcrumb i.sep { font-size: 10px; margin: 0 2px; }
.file-name i { width: 18px; text-align: center; margin-right: 4px; color: var(--ink-soft); }
.folder-row .file-name { cursor: pointer; }
.folder-row .file-name:hover { text-decoration: underline; }

/* 수신 채널 선택 카드 */
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.channel-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 20px 16px;
  cursor: pointer; text-align: center; background: #fff; transition: all .13s;
}
.channel-card:hover { border-color: var(--ink); }
.channel-card.selected { border-color: var(--ink); background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.channel-card i { font-size: 24px; margin-bottom: 10px; display: block; }
.channel-card .ch-name { font-weight: 700; font-size: 14.5px; }
.channel-card .ch-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* 요약 상태 뱃지 */
.badge-summary {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--muted); background: #fff; white-space: nowrap;
}
.badge-summary.done { color: var(--ok); border-color: var(--ok); }
a.badge-summary.done:hover { background: #EDF5F0; }
.badge-summary.processing { color: var(--ink-soft); }
.badge-summary.failed { color: var(--danger); border-color: var(--danger); }

/* 업로드 드롭존 */
.dropzone {
  border: 2px dashed var(--border); border-radius: 14px; padding: 34px;
  text-align: center; color: var(--muted); font-size: 14.5px; cursor: pointer;
  transition: all .15s; margin-bottom: 18px; background: #fff;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ink); background: var(--bg-soft); color: var(--ink); }
.dropzone i { margin-right: 6px; }
.dropzone-hint { font-size: 12.5px; color: var(--muted); display: inline-block; margin-top: 6px; }

/* Notion 페이지 (리스트 + 뷰) */
.folder-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.folder-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); border: 1px solid var(--border); border-radius: 99px;
  padding: 7px 8px 7px 14px; background: #fff; transition: border-color .13s;
}
.folder-pill:hover { border-color: var(--ink); }
.pill-del {
  border: none; background: none; color: var(--muted); cursor: pointer;
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pill-del:hover { background: var(--bg-soft); color: var(--danger); }

.note-item {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  margin-bottom: 10px; transition: border-color .13s; color: inherit;
}
.note-item:hover { border-color: var(--ink); }
.note-main { flex: 1; min-width: 0; }
.note-title { font-weight: 700; font-size: 15px; }
.note-title i { color: var(--ink-soft); margin-right: 4px; }
.note-summary { font-size: 13.5px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.note-view-top { display: flex; justify-content: space-between; margin-bottom: 18px; }
.note-content { font-size: 14.5px; white-space: pre-wrap; line-height: 1.75; }
.note-src { text-decoration: underline; color: var(--ink); font-size: 12.5px; margin-left: 6px; }

/* ---------- 로그인 게이트 ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.gate-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 44px 38px; text-align: center; max-width: 380px; width: 100%; box-shadow: 0 24px 60px -24px rgba(0,0,0,.12); }
.gate-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.gate-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.gate-card p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.gate-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 15px; font-weight: 600; background: #fff; border: 1px solid var(--border);
  border-radius: 11px; padding: 12px; transition: background .13s;
}
.gate-btn:hover { background: var(--bg-soft); }
.gate-demo {
  width: 100%; margin-top: 10px; cursor: pointer;
  font-family: var(--sans); background: var(--ink); color: #fff; border: 1px solid var(--ink);
}
.gate-demo:hover { background: #000; }
.gate-back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }
.gate-back:hover { color: var(--ink); }

/* 폴더 선택 모달 (이동) */
.picker-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(17, 17, 17, .4);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.picker {
  background: #fff; border-radius: 14px; width: 100%; max-width: 360px; max-height: 70vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.picker-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 15px;
}
.picker-head i { margin-right: 4px; }
.picker-close { border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.picker-list { overflow-y: auto; padding: 8px; }
.picker-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: none; font-family: var(--sans); font-size: 14px;
  color: var(--ink-soft); padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
.picker-item:hover { background: var(--bg-soft); color: var(--ink); }
.picker-item i { color: var(--muted); }

/* 토스트 */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 14px; padding: 12px 22px;
  border-radius: 10px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

/* 반응형 */
@media (max-width: 800px) {
  .sidebar { width: 64px; padding: 18px 8px; }
  .side-logo { font-size: 0; justify-content: center; }
  .side-logo .logo-mark { font-size: 13px; }
  .nav-add, .nav-subitem { display: none; }
  .nav-item span, .nav-label, .side-user-meta, .btn-logout { display: none; }
  .nav-item { justify-content: center; }
  .side-user { justify-content: center; padding-bottom: 0; }
  .content { padding: 28px 20px; }
  .stat-row { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: 1fr; }
  .files-toolbar { flex-direction: column; align-items: stretch; }
}
