:root {
  --bg: #FAF8F3;
  --surface: #FFFFFF;
  --surface-soft: #F5F1E8;
  --border: #E5DEC9;
  --text: #2C241B;
  --text-muted: #6E6254;
  --primary: #6D4C2F;
  --primary-dark: #543921;
  --gold: #8C6D46;
  --accent-green: #3D6E52;
  --danger: #B33A3A;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(44, 36, 27, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

h1, h2, h3, .serif {
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  margin: 0;
}

p {
  margin: 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* 사이드바 */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.brand h1 {
  font-size: 20px;
  color: var(--text);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-stats {
  margin-top: auto;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-row strong {
  color: var(--text);
  font-size: 13px;
}

/* 메인 */
.main-content {
  padding: 28px 34px 80px;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.topbar h2 {
  font-size: 26px;
  color: var(--text);
}

.topbar p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-soft);
}

.btn-danger {
  background: #FDF2F2;
  color: var(--danger);
  border-color: #F5CACA;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

/* 카드 & 그리드 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.series-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 6px;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}

.series-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.series-card.selected {
  outline: 2px solid var(--primary);
  background: #FFFDF8;
}

.series-vol {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.series-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.series-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.series-meta {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* 필터 바 */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

/* 설교 개요 리스트 + 1페이지 뷰어 */
.library-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.outline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.outline-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
}

.outline-item:hover {
  border-color: var(--gold);
}

.outline-item.active {
  border-color: var(--primary);
  background: #FFFDF7;
  box-shadow: var(--shadow);
}

.outline-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}

.verse-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.outline-item-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}

.outline-item-msg {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 1페이지 설교 개요 시트 (이미지 디자인 반영) */
.outline-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.sheet-banner {
  color: #fff;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.sheet-week-box {
  text-align: center;
  background: rgba(255, 255, 255, 0.16);
  padding: 8px 14px;
  border-radius: 10px;
  min-width: 64px;
}

.sheet-week-box strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.sheet-week-box span {
  font-size: 11px;
  opacity: 0.9;
}

.sheet-title-wrap {
  flex: 1;
}

.sheet-sub {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.sheet-title {
  font-size: 22px;
  color: #fff;
}

.sheet-verse-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
}

.sheet-body {
  padding: 20px 22px;
  display: grid;
  gap: 14px;
}

.sheet-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: #FFFEFA;
}

.sheet-box.highlight {
  background: var(--surface-soft);
}

.sheet-box-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.point-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.point-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.point-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.point-body {
  font-size: 13px;
  color: var(--text-muted);
}

.sheet-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* 52주 계획표 */
.planner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.week-selector-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.week-chip {
  min-width: 44px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
}

.week-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.week-chip.done {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

tr:hover td {
  background: var(--surface-soft);
}

/* 성경 66권 */
.bible-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: start;
}

.book-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
}

.book-chip {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.book-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.book-chip.filled {
  border-color: var(--accent-green);
}

/* 폼 */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.checkbox-inline input {
  width: auto;
}

/* 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 18, 12, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.points-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.points-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.point-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.point-box input, .point-box textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

/* 안내 카드 */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.step-badge {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

/* 토스트 */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow);
}

.toast.hidden {
  display: none;
}

/* 모바일 하단 내비 */
.mobile-nav {
  display: none;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main-content {
    padding: 18px 16px 90px;
  }
  .library-split, .bible-grid, .sheet-two-col, .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px;
    z-index: 90;
  }
  .mobile-nav-item {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    color: var(--text-muted);
    cursor: pointer;
  }
  .mobile-nav-item.active {
    color: var(--primary);
    font-weight: 700;
  }
}

@media print {
  .sidebar, .topbar, .mobile-nav, .series-grid, .filter-bar, .outline-list, .sheet-actions {
    display: none !important;
  }
  .app-shell, .library-split {
    display: block;
  }
  .outline-sheet {
    border: none;
    box-shadow: none;
  }
}
