/* =========================================
   한솔 RFP Wiki - 디자인 시스템
   ========================================= */
:root {
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-sidebar: #ffffff;
  --color-border: #e6e8ee;
  --color-border-strong: #d4d7de;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-text-soft: #9ca3af;
  --color-primary: #2563eb;
  --color-primary-soft: #eff4ff;
  --color-primary-hover: #1d4ed8;
  --color-accent: #0ea5e9;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-code-bg: #f3f4f6;
  --color-code-border: #e5e7eb;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
  --sidebar-w: 280px;
  --max-content: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.88em;
}

/* =========================================
   레이아웃 셸
   ========================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* =========================================
   사이드바
   ========================================= */
.wiki-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 16px;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand i { color: var(--color-primary); font-size: 18px; }

.sidebar-search {
  padding: 12px 16px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}
.sidebar-search i {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-soft);
  font-size: 13px;
}
.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: #f9fafb;
  outline: none;
  transition: all 0.15s;
}
.sidebar-search input:focus {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section { padding: 8px 12px; }

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.sidebar-section-title i {
  font-size: 11px;
  color: var(--color-text-soft);
  width: 14px;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0 0;
}

.sidebar-link {
  display: block;
  padding: 7px 10px 7px 30px;
  color: var(--color-text);
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  margin: 1px 0;
  transition: all 0.12s;
  position: relative;
}
.sidebar-link:hover {
  background: var(--color-primary-soft);
  text-decoration: none;
}
.sidebar-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}
.sidebar-link.is-active::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 2px;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-soft);
  font-size: 11px;
}

/* 모바일 토글 버튼 */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/* =========================================
   메인 컨텐츠
   ========================================= */
.wiki-main {
  flex: 1;
  min-width: 0;
  padding: 36px 48px 80px;
}

.wiki-article {
  max-width: var(--max-content);
  margin: 0 auto;
}

.wiki-article-header {
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
}

.wiki-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.wiki-breadcrumb i.fa-chevron-right { font-size: 9px; color: var(--color-text-soft); }
.wiki-breadcrumb a { color: var(--color-text-muted); }
.wiki-breadcrumb a:hover { color: var(--color-primary); }

.wiki-title {
  margin: 0 0 6px 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.wiki-subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
}

.wiki-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.wiki-meta-item i { margin-right: 4px; }

.wiki-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--color-text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-tier {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* =========================================
   문서 본문 (마크다운)
   ========================================= */
.wiki-content { font-size: 15px; line-height: 1.78; }

.wiki-content .md-h1,
.wiki-content .md-h2,
.wiki-content .md-h3,
.wiki-content .md-h4 {
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text);
  margin: 1.6em 0 0.6em;
}
.wiki-content .md-h1 { font-size: 26px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.wiki-content .md-h2 { font-size: 22px; }
.wiki-content .md-h3 { font-size: 18px; }
.wiki-content .md-h4 { font-size: 16px; }
.wiki-content .md-h1:first-child { margin-top: 0; }

.wiki-content .md-p { margin: 0.7em 0; }
.wiki-content .md-bq {
  margin: 1em 0;
  padding: 10px 16px;
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.wiki-content .md-hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 2em 0;
}
.wiki-content .md-list { padding-left: 1.4em; margin: 0.7em 0; }
.wiki-content .md-list li { margin: 0.25em 0; }
.wiki-content .md-checklist { list-style: none; padding-left: 0; }
.wiki-content .md-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0.35em 0;
}
.wiki-content .md-check-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 700;
}
.wiki-content .md-check.is-checked .md-check-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.wiki-content .md-check.is-checked > span:last-child {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.wiki-content .md-table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.wiki-content .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.wiki-content .md-table th,
.wiki-content .md-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.wiki-content .md-table th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border-strong);
}
.wiki-content .md-table tbody tr:last-child td { border-bottom: 0; }
.wiki-content .md-table tbody tr:hover { background: #fafbfc; }

.wiki-content .md-code {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1em 0;
  font-size: 13px;
}
.wiki-content .md-code code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}

/* =========================================
   기사 푸터
   ========================================= */
.wiki-article-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary {
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}
.btn-secondary:hover { background: #f9fafb; }

/* =========================================
   홈 페이지
   ========================================= */
.home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 0 0 32px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--color-text); }
.stat-label { font-size: 12.5px; color: var(--color-text-muted); }

.home-categories { display: flex; flex-direction: column; gap: 32px; }

.home-category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--color-text);
}
.home-category-title i { color: var(--color-primary); }
.home-category-count {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.home-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  color: var(--color-text);
  text-decoration: none !important;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.home-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.home-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}
.home-card-excerpt {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--color-text-soft);
}
.home-card-date i { margin-right: 3px; }

/* =========================================
   검색 결과 패널
   ========================================= */
.search-results {
  position: fixed;
  top: 60px;
  left: calc(var(--sidebar-w) + 24px);
  width: 480px;
  max-width: calc(100vw - 48px);
  max-height: 60vh;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow-y: auto;
}
.search-results-inner { padding: 8px; }
.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none !important;
}
.search-result-item:hover { background: var(--color-primary-soft); }
.search-result-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.search-result-excerpt { font-size: 12px; color: var(--color-text-muted); }
.search-empty { padding: 16px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* =========================================
   반응형
   ========================================= */
@media (max-width: 900px) {
  .wiki-main { padding: 24px 20px 60px; }
  .wiki-title { font-size: 26px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .wiki-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .wiki-sidebar.is-open { transform: translateX(0); }
  .wiki-main { padding-top: 64px; }
  .search-results { left: 12px; right: 12px; width: auto; }
  .home-stats { grid-template-columns: 1fr; }
  .home-card-grid { grid-template-columns: 1fr; }
}

/* =========================================
   ITO Bidding - 추가 컴포넌트
   ========================================= */

/* main-area = topbar + main 컨테이너 (Layout) */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: 56px;
  padding: 0 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-app-name { font-weight: 600; color: var(--color-text); font-size: 14.5px; letter-spacing: 0.2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user-info { text-align: right; line-height: 1.25; }
.topbar-user-name { font-weight: 600; font-size: 13px; }
.topbar-user-meta { font-size: 11.5px; color: var(--color-text-muted); display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.topbar-actions { display: flex; gap: 6px; }
.topbar-action {
  width: 34px; height: 34px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.topbar-action:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Sidebar brand block */
.sidebar-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--color-border);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  font-family: 'Noto Sans KR', sans-serif;
}
.brand-text { line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 15px; color: var(--color-text); }
.brand-sub { font-size: 11.5px; color: var(--color-text-muted); }

/* Sidebar sections */
.sidebar-nav { padding: 14px 8px; flex: 1; overflow-y: auto; }
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-soft);
  font-weight: 600;
  padding: 6px 12px;
  margin: 0;
}
.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.sidebar-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}
.sidebar-link.is-indent { padding-left: 36px; font-size: 13px; color: var(--color-text-muted); }
.sidebar-link.is-indent.is-active { color: var(--color-primary); }
.sidebar-link-icon {
  width: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-soft);
  font-size: 12px;
}
.sidebar-link.is-active .sidebar-link-icon { color: var(--color-primary); }
.sidebar-link-label { flex: 1; }
.sidebar-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--color-border);
  font-size: 12.5px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
}
.sidebar-login {
  display: inline-flex; gap: 6px; align-items: center;
  color: var(--color-primary);
  text-decoration: none;
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.role-badge.role-super_admin { background: #fee2e2; color: #b91c1c; }
.role-badge.role-affiliate_admin { background: #ede9fe; color: #6d28d9; }
.role-badge.role-editor { background: #dbeafe; color: #1d4ed8; }
.role-badge.role-viewer { background: #f3f4f6; color: #4b5563; }

/* Page wrapper */
.page-wrap { padding: 28px 36px 60px; max-width: 1200px; margin: 0 auto; }
.page-wrap.content-narrow { max-width: 880px; }
.page-header { margin-bottom: 26px; }
.page-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.page-title i { color: var(--color-primary); }
.page-subtitle { color: var(--color-text-muted); font-size: 14px; margin: 0; }
.breadcrumb {
  font-size: 12.5px;
  color: var(--color-text-muted);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb i { font-size: 9px; color: var(--color-text-soft); }

/* Section title */
.section-title { font-size: 16px; font-weight: 700; margin: 0; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-link { font-size: 12.5px; color: var(--color-primary); text-decoration: none; font-weight: 500; }
.section-link:hover { text-decoration: underline; }

.dashboard-section { margin-top: 32px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-icon-blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon-green { background: #d1fae5; color: #065f46; }
.stat-icon-amber { background: #fef3c7; color: #92400e; }
.stat-icon-purple { background: #ede9fe; color: #6d28d9; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--color-text); line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; }

/* Quick actions */
.quick-actions { margin: 26px 0; }
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.action-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.15s;
}
.action-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.action-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.action-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.action-desc { font-size: 12.5px; color: var(--color-text-muted); }

/* Tables */
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  text-align: left;
  padding: 11px 14px;
  background: #f9fafb;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table a { color: var(--color-primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.link-strong { font-weight: 600; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: 12px;
}
.empty-state.large { padding: 60px 20px; }
.empty-state h2 { color: var(--color-text); margin: 12px 0 8px; font-size: 18px; }
.empty-state p { margin: 4px 0; }
.empty-icon { font-size: 36px; color: var(--color-text-soft); margin-bottom: 8px; }

/* Activity list */
.activity-list { list-style: none; padding: 0; margin: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; }
.activity-item {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  align-items: center;
}
.activity-item:last-child { border-bottom: none; }
.activity-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  min-width: 56px;
  text-align: center;
}
.activity-summary { flex: 1; font-size: 13px; }
.activity-meta { font-size: 11.5px; color: var(--color-text-muted); }
.action-create, .activity-badge.action-create { background: #d1fae5; color: #065f46; }
.action-update, .activity-badge.action-update { background: #dbeafe; color: #1d4ed8; }
.action-delete, .activity-badge.action-delete { background: #fee2e2; color: #b91c1c; }
.action-restore, .activity-badge.action-restore { background: #fef3c7; color: #92400e; }
.action-login, .activity-badge.action-login { background: #f3f4f6; color: #4b5563; }
.action-logout, .activity-badge.action-logout { background: #f3f4f6; color: #4b5563; }
.action-password_change, .activity-badge.action-password_change { background: #ede9fe; color: #6d28d9; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f3f4f6;
  color: #4b5563;
}
.badge-stage { background: #e0e7ff; color: #3730a3; }
.status-draft { background: #f3f4f6; color: #4b5563; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-archived { background: #fef3c7; color: #92400e; }
.variant-standard { background: #f3f4f6; color: #4b5563; }
.variant-manufacturing { background: #fef3c7; color: #92400e; }
.variant-distribution { background: #dbeafe; color: #1d4ed8; }
.variant-holding { background: #ede9fe; color: #6d28d9; }
.variant-customized { background: #d1fae5; color: #065f46; }
.tier-1 { background: #fef3c7; color: #92400e; }
.tier-2 { background: #e0e7ff; color: #3730a3; }

/* Forms */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-card-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 18px;
  margin-top: 26px;
}
.form-card-danger h3 { color: #b91c1c; margin: 0 0 6px; font-size: 14px; }
.form-card-danger p { color: #7f1d1d; font-size: 13px; margin: 0 0 12px; }
.form-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.form-label { font-weight: 600; font-size: 13px; color: var(--color-text); }
.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.form-field textarea { resize: vertical; min-height: 100px; font-family: 'Monaco', 'Consolas', monospace; font-size: 13px; line-height: 1.5; }
.form-hint { font-size: 11.5px; color: var(--color-text-muted); }
.form-hint code { background: var(--color-code-bg); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px;
  margin: 0;
}
.form-fieldset legend { font-weight: 600; font-size: 13px; padding: 0 6px; color: var(--color-text); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
.btn-secondary:hover { background: #f9fafb; border-color: var(--color-text-muted); }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; gap: 4px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

/* Alerts */
.alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert i { font-size: 14px; margin-top: 1px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Login Shell */
.login-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #eff4ff 0%, #f0f9ff 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.login-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 22px;
}
.login-title { font-size: 18px; font-weight: 700; margin: 0; }
.login-subtitle { font-size: 12px; color: var(--color-text-muted); margin: 0; }
.login-heading { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-desc { font-size: 13.5px; color: var(--color-text-muted); margin: 0 0 18px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint {
  margin-top: 22px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 10px;
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  align-items: flex-start;
}
.login-hint i { color: var(--color-primary); font-size: 14px; margin-top: 2px; }
.login-hint ul { margin: 4px 0 0 0; padding-left: 16px; }
.login-hint li { margin-bottom: 3px; }
.login-hint code { background: var(--color-surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--color-border); }
.login-footer { margin-top: 28px; color: var(--color-text-muted); }

/* Library Layout */
.library-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}
.library-tree {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.library-tree-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
}
.library-tree-header h2 { font-size: 13px; margin: 0; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.library-tree details { margin: 4px 0; }
.library-tree summary {
  list-style: none;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.library-tree summary::-webkit-details-marker { display: none; }
.library-tree summary:hover { background: #f9fafb; }
.library-tree-root i { color: var(--color-primary); width: 14px; font-size: 11px; }
.library-tree-root a { color: var(--color-text); text-decoration: none; flex: 1; }
.library-tree-root a:hover { color: var(--color-primary); }
.library-tree-root a.is-active { color: var(--color-primary); }
.library-tree-children {
  list-style: none;
  padding: 0;
  margin: 2px 0 6px 22px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.library-tree-link {
  display: flex;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 12.5px;
  align-items: center;
  gap: 6px;
}
.library-tree-link:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.library-tree-link.is-active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.library-tree-link.is-excluded { opacity: 0.5; text-decoration: line-through; }

.library-content { min-width: 0; }
.library-content-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.library-section-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.library-section-title { font-size: 20px; margin: 2px 0 6px; font-weight: 700; }
.library-section-desc { font-size: 13px; color: var(--color-text-muted); margin: 0; }

.template-list { display: flex; flex-direction: column; gap: 14px; }
.template-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
}
.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.template-card-title { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.template-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.template-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.template-card-content details summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--color-text-muted);
  padding: 6px 0;
}
.template-raw {
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
  margin: 8px 0 0;
  font-family: 'Monaco', 'Consolas', monospace;
}

/* Project Layout */
.project-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 8px;
}
.project-tree {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.project-tree details { margin: 4px 0; }
.project-tree summary {
  list-style: none;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.project-tree summary::-webkit-details-marker { display: none; }
.project-tree summary:hover { background: #f9fafb; }
.project-content { min-width: 0; }
.project-section-actions { display: flex; gap: 6px; }
.project-section-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap; gap: 10px;
}
.project-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--color-text-muted); margin-top: 8px; }
.project-meta i { color: var(--color-primary); }

/* Progress bar */
.progress-block { margin-top: 18px; }
.progress-info {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--color-text-muted); margin-bottom: 6px;
}
.progress-info strong { color: var(--color-text); }
.progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
  border-radius: 999px;
  transition: width 0.3s;
}

/* Variables bar */
.vars-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-top: 16px;
}
.vars-bar > i { color: var(--color-primary); }
.var-chip {
  display: inline-flex;
  padding: 2px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--color-text-muted);
}
.var-chip strong { color: var(--color-text); margin-left: 3px; }

/* Dots */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}
.dot-blue { background: var(--color-primary); }
.dot-gray { background: var(--color-text-soft); }

/* Template picker */
.template-picker {
  margin-bottom: 18px;
  background: var(--color-primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}
.template-picker summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-primary);
  list-style: none;
}
.template-picker summary::-webkit-details-marker { display: none; }
.template-picker-list { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.template-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  gap: 10px;
}
.template-picker-info { display: flex; gap: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  flex-wrap: wrap;
}
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.filter-bar label span { font-size: 11.5px; color: var(--color-text-muted); font-weight: 600; }
.filter-bar input, .filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--color-surface);
  min-width: 120px;
}

/* Wiki article (legacy compatibility) */
.wiki-article-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 32px; }
.page-footer-actions { margin-top: 24px; display: flex; gap: 10px; }

/* Muted */
.muted { color: var(--color-text-muted); }

/* Responsive overrides */
@media (max-width: 900px) {
  .page-wrap { padding: 22px 18px 60px; }
  .library-layout, .project-layout { grid-template-columns: 1fr; }
  .library-tree, .project-tree { position: static; max-height: none; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 18px; }
  .topbar-user-info { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
}

/* === [추가] 사이드바 사용자 정보 / 메뉴 뱃지 === */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  color: #e2e8f0;
}
.sidebar-user > i {
  font-size: 24px;
  color: #94a3b8;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.sidebar-link-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
}

/* === [추가] 통계 그리드 3열 변형 === */
.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 900px) {
  .stats-grid-3 { grid-template-columns: 1fr !important; }
}

/* === [추가] 트리 카운트 뱃지 === */
.library-tree-root {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}
.library-tree-root::-webkit-details-marker { display: none; }
.library-tree-root > a {
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.tree-count {
  font-size: 11px;
  padding: 1px 7px;
  background: #2563eb;
  color: #fff;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.tree-count-empty {
  background: transparent;
  color: #cbd5e1;
  font-weight: normal;
}
.library-tree-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: #475569;
  font-size: 13px;
  margin: 2px 0;
}
.library-tree-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.library-tree-link.is-active {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}
.tree-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.library-tree-link.is-active .tree-code {
  background: #bfdbfe;
  color: #1e3a8a;
}
.tree-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === [추가] 정보 카드 그리드 (안내 메시지) === */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
  text-align: left;
}
.info-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}
.info-card > i {
  font-size: 20px;
  color: #2563eb;
  margin-bottom: 8px;
}
.info-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
}
.info-card p {
  font-size: 13px;
  color: #475569;
  margin: 0;
  line-height: 1.6;
}
.info-card code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #1e293b;
}

/* === [추가] 위험(삭제) 버튼 - 부드러운 스타일 === */
.btn-danger-soft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.btn-danger-soft:hover {
  background: #fef2f2;
  border-color: #f87171;
}

/* === [추가] 템플릿 미리보기 === */
.template-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.7;
}
.template-preview h1,
.template-preview h2,
.template-preview h3 {
  margin-top: 12px;
  margin-bottom: 6px;
}
.template-preview ul,
.template-preview ol {
  padding-left: 22px;
}
.template-preview code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.template-preview pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
}

/* === [추가] 템플릿 카드 정리 === */
.template-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.template-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.template-card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #0f172a;
}
.template-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.template-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.template-card-content details summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  user-select: none;
}
.template-card-content details summary:hover {
  text-decoration: underline;
}

/* === [추가] empty state 보강 === */
.empty-state.large {
  padding: 60px 30px;
  text-align: center;
}
.empty-state.large h2 {
  margin: 16px 0 8px;
  color: #0f172a;
}
.empty-icon {
  font-size: 40px;
  color: #94a3b8;
  margin-bottom: 12px;
}
