* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: #f2f4f7; color: #222; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: #1c3f77; color: #fff;
  position: sticky; top: 0; z-index: 100; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.topbar nav a { color: #cdd9ee; text-decoration: none; margin-right: 16px; }
.topbar nav a:hover { color: #fff; }
.container { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
.messages { max-width: 1000px; margin: 12px auto 0; padding: 0 16px; }
.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; }
.msg-success { background: #e2f4e5; border: 1px solid #7bc48a; }
.msg-info { background: #e5eefb; border: 1px solid #86aede; }
.msg-warning { background: #fdf3d8; border: 1px solid #e3c25e; }
.msg-error { background: #fbe4e4; border: 1px solid #dd8b8b; }
.panel { background: #fff; border: 1px solid #dde3ec; border-radius: 8px;
  padding: 18px 22px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.hint { color: #667; font-size: 13px; }
input[type=text], input[type=file] { padding: 7px 10px; border: 1px solid #bbc4d0;
  border-radius: 5px; font-size: 14px; }
button, .btn { display: inline-block; padding: 7px 13px; border: 1px solid #9fb0c6;
  border-radius: 5px; background: #f6f8fb; cursor: pointer; font-size: 13px;
  text-decoration: none; color: #223; }
button:hover, .btn:hover { background: #e8eef7; }
button.primary { background: #1c3f77; border-color: #1c3f77; color: #fff; }
button.primary:hover { background: #2a55a0; }
button.primary:disabled { background: #9aa7bb; border-color: #9aa7bb; cursor: not-allowed; }
button.danger { color: #a02020; border-color: #cf9d9d; }
.chapter-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.chapter-table th, .chapter-table td { border-bottom: 1px solid #e4e8ee;
  padding: 8px 10px; text-align: left; vertical-align: middle; }
.chapter-table .actions { display: flex; gap: 6px; align-items: center; }
.chapter-table .actions form { display: inline; margin: 0; }
.warn { color: #b07800; cursor: help; }
code { background: #eef1f5; padding: 2px 5px; border-radius: 4px; font-size: 12px; }

/* 동기화 진행 오버레이 */
#sync-overlay { position: fixed; inset: 0; background: rgba(18, 28, 46, .55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; }
#sync-overlay[hidden] { display: none; }
.sync-box { background: #fff; border-radius: 12px; padding: 32px 40px; max-width: 420px;
  text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.3); }
.sync-spinner { width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%;
  border: 5px solid #dbe4f0; border-top-color: #1c3f77; animation: sync-spin 0.9s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.sync-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.sync-desc { font-size: 13px; color: #556; margin-bottom: 12px; line-height: 1.6; }
.sync-elapsed { font-size: 22px; font-weight: 700; color: #1c3f77; margin-bottom: 10px;
  font-variant-numeric: tabular-nums; }
.sync-steps { font-size: 12px; color: #778; min-height: 2.4em; }

/* 사용법 문서 페이지 */
.doc-page { max-width: 1180px; }
.doc-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.doc-tab { padding: 8px 16px; border: 1px solid #dde3ec; border-bottom: none;
  border-radius: 8px 8px 0 0; background: #e8ecf3; color: #445;
  text-decoration: none; font-size: 14px; }
.doc-tab.active { background: #fff; color: #1c3f77; font-weight: 700; }
.prompt-box { display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; }
.prompt-box p { margin: 4px 0 0; }
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px;
  align-items: start; }
.doc-toc { position: sticky; top: 68px; font-size: 13px; line-height: 1.5;
  max-height: calc(100vh - 90px); overflow-y: auto; }
.doc-toc-title { font-weight: 700; color: #445; margin-bottom: 8px; }
.doc-toc a { display: block; padding: 3px 0; color: #566; text-decoration: none;
  border-left: 2px solid transparent; padding-left: 8px; }
.doc-toc a:hover { color: #1c3f77; border-left-color: #1c3f77; }
.doc-toc a.lv3 { padding-left: 20px; font-size: 12px; color: #778; }

.doc { line-height: 1.75; font-size: 15px; overflow-wrap: break-word; }
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: 24px; margin: 0 0 6px; }
.doc h2 { font-size: 19px; margin: 32px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid #e4e8ee; color: #1c3f77; scroll-margin-top: 68px; }
.doc h3 { font-size: 16px; margin: 24px 0 8px; scroll-margin-top: 68px; }
.doc p { margin: 10px 0; }
.doc ul, .doc ol { margin: 10px 0; padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc hr { border: none; border-top: 1px solid #e4e8ee; margin: 28px 0; }
.doc blockquote { margin: 14px 0; padding: 10px 16px; background: #fdf8e8;
  border-left: 4px solid #e3c25e; color: #554; }
.doc blockquote p { margin: 4px 0; }
.doc table { border-collapse: collapse; font-size: 13.5px; margin: 14px 0;
  display: block; overflow-x: auto; max-width: 100%; }
.doc th, .doc td { border: 1px solid #dde3ec; padding: 7px 11px;
  text-align: left; vertical-align: top; }
.doc th { background: #eef1f6; white-space: nowrap; }
.doc pre { background: #f6f8fb; border: 1px solid #dde3ec; border-radius: 6px;
  padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.doc pre code { background: none; padding: 0; font-size: inherit; }
.doc a { color: #1c3f77; }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; max-height: none; }
}
