/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #1B3A6B;
  --navy-dark:  #122850;
  --navy-light: #2a5298;
  --accent:     #E8EEF7;
  --accent2:    #D0DCF0;
  --text:       #1a1a1a;
  --text-muted: #555;
  --border:     #d0d5dd;
  --warn-bg:    #FFFBEB;
  --warn-border:#F59E0B;
  --warn-text:  #78350F;
  --tip-bg:     #EFF6FF;
  --tip-border: #3B82F6;
  --sidebar-w:  280px;
  --header-h:   56px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: #f8f9fb;
}

/* ===== Layout ===== */
#app { display: flex; min-height: 100vh; }

/* ===== Header ===== */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#header .logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#header .logo span { opacity: 0.7; font-weight: 400; font-size: 13px; }

/* 헤더 메타: 버전(왼쪽) + PMS 바로가기(오른쪽) */
#header .manual-ver {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,0.3);
  font-size: 12px;
  color: #fff;
  opacity: 0.9;
  white-space: nowrap;
}
#header .manual-ver strong { font-weight: 700; }
#header .pms-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: background 0.15s;
}
#header .pms-link:hover { background: #E8EEF7; }
@media (max-width: 480px) {
  #header .manual-ver { margin-left: 8px; padding-left: 8px; font-size: 10px; }
  #header .pms-link { font-size: 11px; padding: 6px 10px; }
}
#hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  margin-right: 12px;
  padding: 4px;
}

/* ===== Sidebar ===== */
#sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.25s ease;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 4px; }

.sidebar-search {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--accent2);
}
.sidebar-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  color: var(--text);
}
.sidebar-search input:focus { border-color: var(--navy-light); }

/* ── Role filter buttons ── */
.role-filter {
  display: flex;
  gap: 4px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--accent2);
  flex-wrap: wrap;
}
.rf-btn {
  flex: 1;
  padding: 5px 4px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}
.rf-btn:hover { border-color: var(--navy); color: var(--navy); }
.rf-btn.active.rf-all  { background: var(--navy);    color: #fff; border-color: var(--navy); }
.rf-btn.active.rf-user { background: #059669;        color: #fff; border-color: #059669; }
.rf-btn.active.rf-admin { background: #3730A3;       color: #fff; border-color: #3730A3; }
.rf-btn.active.rf-eval  { background: #7C3AED;       color: #fff; border-color: #7C3AED; }

.nav-section { padding: 10px 0; }
.nav-section-title {
  padding: 6px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-item {
  display: block;
  padding: 8px 16px 8px 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover {
  background: var(--accent);
  color: var(--navy);
}
.nav-item.active {
  background: var(--accent);
  border-left-color: var(--navy);
  color: var(--navy);
  font-weight: 600;
}
.nav-sub {
  display: none;
  padding-left: 8px;
}
.nav-sub.open { display: block; }
.nav-sub .nav-item {
  font-size: 12.5px;
  padding: 5px 16px 5px 28px;
}
.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-parent .caret {
  font-size: 10px;
  transition: transform 0.2s;
}
.nav-parent.open .caret { transform: rotate(90deg); }

/* ===== Main Content ===== */
#content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 900px;
}

/* ===== Index / TOC page ===== */
.toc-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 48px 40px;
  border-radius: 12px;
  margin-bottom: 40px;
}
.toc-hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.toc-hero p  { opacity: 0.8; font-size: 14px; }

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.toc-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
  display: block;
}
.toc-card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 16px rgba(27,58,107,0.12);
  transform: translateY(-2px);
}
.toc-card .num {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.toc-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.toc-card p  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* ===== Section Page ===== */
.section-header {
  border-bottom: 3px solid var(--navy);
  margin-bottom: 32px;
  padding-bottom: 16px;
}
.section-header .breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.section-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}

h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent2);
}
h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 24px 0 10px;
}
p { margin-bottom: 12px; }

/* ===== UI Element Highlights ===== */
/* 「」강조 – inline button/menu name */
.btn-name {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}
/* Generic 「」 wrapper in prose (handled via CSS counter-like pattern) */
.ui-label {
  font-weight: 600;
  color: var(--navy);
  background: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ===== Step List ===== */
.steps { list-style: none; counter-reset: step; margin: 14px 0 18px; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.steps li::before {
  content: counter(step);
  min-width: 24px;
  height: 24px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ===== Warning / Note Boxes ===== */
.box {
  border-radius: 8px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.65;
}
.box-warn {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-border);
  color: var(--warn-text);
}
.box-warn .box-title { font-weight: 700; margin-bottom: 4px; }
.box-tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  color: #1e40af;
}
.box-tip .box-title { font-weight: 700; margin-bottom: 4px; }

/* ===== Menu Path ===== */
.menu-path {
  background: var(--accent);
  border-left: 3px solid var(--navy);
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ===== Screen Capture Placeholder ===== */
.capture-box {
  border: 2px dashed #9ca3af;
  border-radius: 8px;
  background: #f3f4f6;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 13px;
  gap: 8px;
  margin: 16px 0;
  padding: 24px;
}
.capture-box .cap-icon { font-size: 32px; opacity: 0.5; }
.capture-box .cap-label { font-weight: 600; font-size: 14px; }
.capture-box .cap-desc  { font-size: 12px; opacity: 0.7; }

/* ── 섹션 이전/다음 네비게이션 ─────────────────────────────── */
.section-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 8px;
}
.section-nav .sec-nav-btn {
  flex: 1 1 0;
  max-width: 48%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #1B3A6B;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.section-nav .sec-nav-btn:hover {
  background: #E8EEF7;
  border-color: #1B3A6B;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.section-nav .sec-nav-next { text-align: right; align-items: flex-end; }
.section-nav .sec-nav-dir { font-size: 12px; font-weight: 700; opacity: 0.65; }
.section-nav .sec-nav-title { font-size: 14px; font-weight: 600; }
@media (max-width: 480px) {
  .section-nav .sec-nav-title { font-size: 12px; }
}

/* ===== Table ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13.5px;
}
th {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:nth-child(even) td { background: var(--accent); }

/* ===== Content Images ===== */
#content img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 16px 0;
  cursor: zoom-in;
  transition: box-shadow 0.2s;
  display: block;
}
#content img:hover {
  box-shadow: 0 4px 20px rgba(27,58,107,0.2);
}

/* ===== Lightbox ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
#lightbox.open {
  display: flex;
}
#lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  cursor: zoom-in;
  object-fit: contain;
  border: none;
  margin: 0;
  transform-origin: center center;
  will-change: transform;
}
#lightbox-guide {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  padding: 8px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1001;
  letter-spacing: 0.2px;
}
#lightbox-guide.visible { opacity: 1; }
#lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  background: none;
  border: none;
  padding: 4px 8px;
}
#lightbox-close:hover { opacity: 1; }

/* ===== Admin Image Path Editor ===== */
#img-editor {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#img-editor.open { display: flex; }
#img-editor .ie-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-size: 14px;
}
#img-editor h3 {
  margin: 0 0 16px;
  font-size: 17px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
#img-editor .ie-admin {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--navy);
  padding: 2px 8px;
  border-radius: 10px;
}
#img-editor label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #475467;
}
#img-editor textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}
#img-editor .ie-preview-wrap {
  margin: 12px 0 16px;
  background: #f2f4f7;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  min-height: 120px;
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#img-editor #ie-preview {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
#img-editor .ie-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#img-editor .ie-spacer { flex: 1; }
#img-editor .ie-btn {
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#img-editor .ie-btn:hover { background: #f9fafb; }
#img-editor .ie-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
#img-editor .ie-primary:hover { background: var(--navy-dark); }
#img-editor .ie-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: #98a2b3;
  line-height: 1.5;
}

/* ===== Role Badges ===== */
.role-legend {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.role-admin     { background: #EEF2FF; color: #3730A3; }
.role-company   { background: #ECFDF5; color: #065F46; }
.role-evaluator { background: #FDF4FF; color: #6B21A8; }

/* ===== Role Group (TOC) ===== */
.role-group { margin-bottom: 36px; }
.role-group-header {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  margin-bottom: 14px;
  display: inline-block;
  letter-spacing: 0.3px;
  border-radius: 0 6px 6px 0;
}
.role-admin-header     { background: #EEF2FF; color: #3730A3; border-left: 3px solid #3730A3; }
.role-company-header   { background: #ECFDF5; color: #065F46; border-left: 3px solid #059669; }
.role-evaluator-header { background: #FDF4FF; color: #6B21A8; border-left: 3px solid #9333EA; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.card-top .num { margin-bottom: 0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #hamburger { display: block; }
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  #content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
}
