/* 자소서랩 — 디자인 시스템 (라이트 전용) */
:root {
  --bg: #f8f7fc;
  --bg-card: #ffffff;
  --bg-elev: #f0eef8;
  --text: #1a1723;
  --text-dim: #635e75;
  --border: #e2ddf0;
  --accent: #8b5cf6;
  --accent-deep: #6d3ee0;
  --ok: #34c179;
  --warn: #e5a04f;
  --danger: #e5604f;
  --radius: 14px;
  --shadow: rgba(60, 40, 120, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
button, input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }

/* ── 공통 레이아웃 (문서 페이지용) ── */
#app { max-width: 720px; margin: 0 auto; padding: 0 16px; min-height: 100dvh; display: flex; flex-direction: column; }
.header { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.12rem; color: var(--text); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a, .nav button {
  color: var(--text-dim); font-weight: 700; font-size: 0.88rem;
  padding: 7px 11px; border-radius: 8px; background: none; border: none; cursor: pointer;
}
.nav a:hover, .nav a.active, .nav button:hover { background: var(--bg-elev); color: var(--text); }
.main { flex: 1; padding: 18px 0 30px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 12px var(--shadow); }
h1.page-title { font-size: 1.3rem; font-weight: 900; line-height: 1.35; }
.page-desc { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }
.crumb { font-size: 0.8rem; color: var(--text-dim); display: flex; gap: 6px; flex-wrap: wrap; }
.crumb a { color: var(--text-dim); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 0.92rem; font-weight: 800; padding: 10px 16px; cursor: pointer;
  transition: filter 0.15s, transform 0.08s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; border-radius: 8px; }
.btn-danger { background: none; color: var(--danger); border: none; }

.input, textarea.input, select.input {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 0.95rem; padding: 10px 12px; width: 100%;
  outline: none; transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }

/* ── 워크스페이스 레이아웃 ── */
.ws { max-width: 1200px; margin: 0 auto; padding: 0 16px; min-height: 100dvh; display: flex; flex-direction: column; }
.ws-body { flex: 1; display: grid; grid-template-columns: 280px 1fr; gap: 16px; padding: 16px 0 28px; min-height: 0; }
.sidebar { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.editor-pane { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* 회사 트리 */
.company { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); overflow: hidden; }
.company-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  cursor: pointer; font-weight: 800; font-size: 0.92rem;
}
.company-head:hover { background: var(--bg-elev); }
.company-head .dday { font-size: 0.68rem; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--bg-elev); color: var(--text-dim); white-space: nowrap; }
.company-head .dday.soon { background: var(--danger); color: #fff; }
.company-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-list { border-top: 1px solid var(--border); }
.q-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px 8px 22px; font-size: 0.85rem; cursor: pointer;
  color: var(--text-dim); border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.q-item:hover { background: var(--bg-elev); }
.q-item.active { color: var(--accent-deep); font-weight: 800; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.q-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .n { font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.add-row { padding: 8px 12px; }

/* 에디터 */
.editor-top { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.editor-top > .input { flex: 1 1 200px; min-width: 0; font-weight: 800; }
.limit-box { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 100%; min-width: 0; }
.limit-box .input { flex: 0 1 auto; width: auto; min-width: 0; }
.limit-box input.input { width: 90px; text-align: right; }
.limit-box select.input { max-width: 150px; }
#q-preset { max-width: 210px; }
textarea.editor {
  width: 100%; min-height: 46vh; resize: vertical;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; font-size: 1rem; line-height: 1.7; outline: none;
}
textarea.editor:focus { border-color: var(--accent); }

/* 카운터 바 */
.counter-bar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 -2px 12px var(--shadow);
  font-size: 0.82rem; font-variant-numeric: tabular-nums;
}
.counter-bar b { font-size: 0.95rem; }
.counter-bar .over b { color: var(--danger); }
.progress { flex-basis: 100%; height: 6px; border-radius: 999px; background: var(--bg-elev); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width 0.15s; }
.progress span.warn { background: var(--warn); }
.progress span.over { background: var(--danger); }

/* 스냅샷 패널 */
.snap-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.snap-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 8px 10px; background: var(--bg-elev); border-radius: 8px; }
.snap-item .ts { color: var(--text-dim); white-space: nowrap; }
.snap-item .preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }

/* 검색 결과 */
.search-hit { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 0.83rem; }
.search-hit:hover { background: var(--bg-elev); }
.search-hit .path { font-weight: 800; }
.search-hit .ex { color: var(--text-dim); }

.empty { color: var(--text-dim); font-size: 0.88rem; padding: 16px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.hint { font-size: 0.78rem; color: var(--text-dim); }

/* 토스트 */
.toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--text); color: #fff; font-weight: 800; font-size: 0.9rem; padding: 11px 18px; border-radius: 9px; animation: toast-in 0.18s; }
.toast.out { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* SEO/푸터/광고 (공통 체계) */
.seo-content { border-top: 1px solid var(--border); padding: 22px 0 8px; }
.seo-content h2 { font-size: 1rem; margin: 16px 0 8px; }
.seo-content p, .seo-content li, .seo-content dd { font-size: 0.88rem; color: var(--text-dim); }
.seo-content dt { font-weight: 800; font-size: 0.9rem; margin-top: 10px; color: var(--text); }
.seo-content ol, .seo-content ul { padding-left: 20px; }
.footer { border-top: 1px solid var(--border); padding: 14px 0 24px; font-size: 0.78rem; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.footer a { color: var(--text-dim); font-weight: 700; }
.promo { margin: 16px 0; text-align: center; }
.coupang-wrap { display: flex; justify-content: center; margin: 8px 0; min-height: 90px; max-width: 100%; overflow-x: hidden; }
.promo-disclosure { font-size: 0.72rem; color: var(--text-dim); margin-top: 6px; line-height: 1.5; text-align: center; }
.side-rail { position: fixed; top: 90px; width: 160px; display: none; z-index: 5; }
@media (min-width: 1120px) { .side-rail { display: block; } }
.side-l { left: calc(50% - 544px); }
.side-r { left: calc(50% + 384px); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; text-align: left; }
.tbl th { color: var(--text-dim); font-size: 0.78rem; }
.tbl tr:hover td { background: var(--bg-elev); }
.rel-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-link { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; color: var(--text); font-size: 0.85rem; font-weight: 700; padding: 8px 14px; }
.rel-link:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 760px) {
  .ws-body { grid-template-columns: 1fr; }
  .sidebar.collapsed { display: none; }
  textarea.editor { min-height: 38vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
