:root {
  --accent: #6c5ce7;
  --accent-light: #efecfd;
  --border: #e5e5ea;
  --sidebar-bg: #f7f7f9;
  --text: #1f1f28;
  --text-muted: #86868f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: #fff;
}

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

/* 헤더 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--sidebar-bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: var(--sidebar-bg);
  color: var(--text);
}

.btn-login {
  margin-left: 8px;
  padding: 7px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.btn-login:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 본문 레이아웃 */
.body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* 사이드바 */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  overflow-y: auto;
}

.btn-new-doc {
  width: 100%;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 22px;
}

.btn-new-doc:hover {
  background: #5b4bd6;
}

.sidebar-section {
  margin-bottom: 22px;
}

.sidebar-section h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 8px;
}

.doc-list, .shortcut-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.doc-item:hover {
  background: #ececf1;
}

.doc-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.shortcut-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.shortcut-list kbd {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
}

/* 메인 */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  gap: 4px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar button {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.toolbar button:hover {
  background: var(--sidebar-bg);
}

.toolbar button.is-active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.canvas-wrap {
  flex: 1;
  overflow-y: auto;
  background: #f0f0f3;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
}

.page {
  width: 100%;
  max-width: 794px;
  min-height: 1123px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  border-radius: 4px;
  padding: 64px 72px;
}

#editor {
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100%;
}

#editor .ProseMirror { outline: none; }

#editor p { margin: 0 0 12px; }

#editor h1 { font-size: 28px; margin: 0 0 16px; }
#editor h2 { font-size: 22px; margin: 24px 0 12px; }

#editor blockquote {
  border-left: 3px solid var(--accent);
  margin: 12px 0;
  padding: 4px 16px;
  color: var(--text-muted);
}

#editor pre {
  background: #1f1f28;
  color: #f4f4f5;
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
}

#editor ul, #editor ol {
  padding-left: 22px;
  margin: 0 0 12px;
}

/* 인쇄 시 .page 내용만 출력 */
@media print {
  body * {
    visibility: hidden;
  }

  .page, .page * {
    visibility: visible;
  }

  .page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .canvas-wrap {
    padding: 0;
    background: #fff;
  }

  @page {
    margin: 20mm;
  }
}
