* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: #f3f4f7;
  color: #1f2937;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.left-nav {
  width: 92px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 16px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  /* 본문(content-area)이 flex 오버플로로 겹칠 때에도 좌측 메뉴 클릭이 먹도록 위에 둠 */
  z-index: 2;
}

/* 로고 ~ 구분선 간격: 기존 8px 대비 1.5배(12px), 구분선 ~ 채팅은 flex gap(8px)+보정으로 전체 약 1.5배 */
.nav-logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 3px;
  flex-shrink: 0;
}

.nav-logo-divider {
  width: 72%;
  max-width: 64px;
  height: 1px;
  background: #e5e7eb;
  margin: 0 auto;
  flex-shrink: 0;
}

.logo-link {
  display: block;
  margin: 0 auto;
  text-align: center;
}

.logo-img {
  max-width: 168px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.nav-item {
  font-size: 12px;
  color: #374151;
  text-decoration: none;
  text-align: center;
  border-radius: 10px;
  padding: 8px 4px;
  display: block;
  cursor: pointer;
}

.nav-item:hover {
  background: #f3f4f6;
}

.nav-item.active {
  background: #e8f0fe;
  color: #1d4ed8;
}

.nav-item.nav-item-ghost {
  color: #9ca3af;
  font-size: 11px;
}

.nav-footer {
  margin-top: auto;
  padding-top: 8px;
}

.nav-separator {
  height: 1px;
  background: #e5e7eb;
  margin-bottom: 8px;
}

button.nav-item {
  background: none;
  border: none;
  width: 100%;
  font: inherit;
}

/* 좁은 화면: 좌측 메뉴는 햄버거로 열기 (하단·관리자 구분선 바로 위에 배치) */
.nav-mobile-toggle {
  display: none;
  position: fixed;
  top: auto;
  left: max(12px, env(safe-area-inset-left, 0px));
  /* nav-footer: 관리자(~48px) + 구분선 아래 여백(8px) + 구분선(1px) + 햄버거와의 간격(8px) */
  bottom: calc(48px + 8px + 1px + 8px + env(safe-area-inset-bottom, 0px));
  z-index: 102;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  color: #374151;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.nav-mobile-toggle:hover {
  background: #f9fafb;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.nav-mobile-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.content-area {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
}

.top-action {
  border: none;
  background: #f59e0b;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.top-action:disabled,
.top-action.ax-sample-readonly {
  background: #d1d5db !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

.top-action-link {
  text-decoration: none;
  border: none;
  background: #f59e0b;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 14px;
}

.container {
  max-width: 1260px;
  margin: 20px auto 40px;
  padding: 0 22px;
  display: grid;
  gap: 16px;
}

/* AI 탐색: 메인 콘텐츠를 뷰포트 전체 너비로 사용 */
.container.container-ai-full {
  max-width: none;
  width: 100%;
  margin: 20px 0 40px;
  padding: 0 24px;
  box-sizing: border-box;
}

.container-ai-full .search-input {
  max-width: none;
  box-sizing: border-box;
}

.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  border: 1px solid #e5e7eb;
}

.hero {
  background: linear-gradient(135deg, #161b33 0%, #2f3c7e 100%);
  color: #fff;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.hero p {
  margin: 0;
  color: #e5e7eb;
}

.panel h2 {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.count-chip {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 3px 10px;
  font-size: 13px;
  color: #4b5563;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
}

button {
  border: none;
  background: #f59e0b;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  width: fit-content;
}

.lecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.lecture-card {
  display: grid;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lecture-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.lecture-link {
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.lecture-card h3 {
  margin: 0;
}

.lecture-card p {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
}

.lecture-card small {
  color: #6b7280;
}

.success-story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.success-story-card {
  display: grid;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.success-story-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

.success-story-card--locked {
  cursor: not-allowed;
}

.success-story-card--locked:hover {
  transform: none;
  box-shadow: none;
}

.success-story-card--locked .success-story-link {
  cursor: not-allowed;
}

.success-story-link {
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 12px 14px 14px;
}

.success-thumb {
  border-radius: 10px;
  min-height: 72px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.success-thumb-icon {
  font-size: 22px;
  opacity: 0.95;
}

.success-thumb-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.success-badge {
  font-size: 12px;
  color: #6b7280;
}

.success-story-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: #111827;
}

.success-excerpt {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.success-meta {
  color: #9ca3af;
  font-size: 12px;
}

.success-hero h2 {
  margin-top: 0;
}

.success-filter .filter-actions {
  align-self: end;
}

.success-detail-panel {
  max-width: 820px;
}

.success-detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.success-detail-meta {
  margin: 0 0 8px;
  font-size: 14px;
  color: #6b7280;
}

.success-detail-title {
  margin: 0 0 10px;
  font-size: 1.45rem;
  line-height: 1.35;
  color: #111827;
}

.success-detail-lead {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.5;
}

.success-pdf-link {
  margin: 12px 0 0;
}

.ai-case-viewer .ai-case-ppt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ai-case-tool-sep {
  color: #d1d5db;
  margin: 0 2px;
}

.ai-case-inline-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.ai-case-inline-link:hover {
  text-decoration: underline;
}

button.ai-case-inline-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  color: #2563eb;
  text-decoration: none;
}

button.ai-case-inline-link:hover {
  text-decoration: underline;
}

.ai-case-tag-row {
  margin-top: 8px;
  margin-bottom: 4px;
}

.success-detail-body-in-card {
  margin-top: 0;
}

.breadcrumb-detail {
  margin: 0 0 12px;
  font-size: 14px;
}

.breadcrumb-detail a {
  color: #2563eb;
  text-decoration: none;
}

.breadcrumb-detail a:hover {
  text-decoration: underline;
}

.detail-title-short {
  font-size: 1.1rem;
}

.admin-hint {
  font-size: 13px;
  line-height: 1.5;
}

.admin-story-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-story-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

.admin-story-list .btn-sm {
  margin-left: auto;
}

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

.form-message {
  margin-top: 12px;
  font-size: 14px;
  color: #059669;
}

.badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.badge.youtube {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.ppt {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.news {
  background: #ecfdf5;
  color: #047857;
}

.thumb {
  border-radius: 10px;
  padding: 12px;
  min-height: 88px;
  display: grid;
  gap: 3px;
  overflow: hidden;
  position: relative;
}

.thumb.youtube {
  background: linear-gradient(135deg, #7f1d1d, #ef4444);
  color: #fff;
}

.thumb.ppt {
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  color: #fff;
}

.thumb.news {
  background: linear-gradient(135deg, #0f766e, #34d399);
  color: #fff;
}

.lecture-news-desc {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.lecture-news-actions {
  margin: 0 0 12px;
}

.thumb-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.thumb-image-youtube {
  opacity: 1;
}

.infinite-scroll-sentinel {
  height: 1px;
  visibility: hidden;
  pointer-events: none;
}

.thumb-fallback {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.4);
  color: #fff;
  z-index: 1;
}

.thumb-kicker {
  font-size: 11px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.thumb strong {
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.thumb small {
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  border-radius: 999px;
  padding: 2px 8px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
}

.filter-panel,
.admin-panel {
  display: grid;
  gap: 10px;
}

.filter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.filter-grid label {
  display: grid;
  gap: 6px;
}

.filter-row-bottom {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 0;
}

.category-radios {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  align-items: center;
}

.category-radios label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.category-radios input[type="radio"] {
  margin: 0;
}

.category-radios-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.category-radios-inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.category-radios-inline input[type="radio"] {
  margin: 0;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.link-download {
  font-size: 0.9em;
  font-weight: normal;
  color: #1d4ed8;
  text-decoration: underline;
  margin-left: 8px;
}
.link-download:hover {
  color: #1e40af;
}

.link-muted {
  color: #6b7280;
  text-decoration: none;
}

.admin-mode-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-mode-header h2 {
  margin: 0;
}

.admin-mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.admin-status.active {
  background: #dcfce7;
  color: #166534;
}

.admin-status.inactive {
  background: #fef3c7;
  color: #92400e;
}

.btn-admin-off {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
}

.btn-admin-off:hover {
  background: #e5e7eb;
  color: #374151;
}

.admin-activate-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-activate-inline input[type="password"] {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  min-width: 140px;
}

.admin-activate-inline button {
  padding: 6px 14px;
  font-size: 13px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.admin-activate-inline button:hover {
  background: #d97706;
}

.admin-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.queue-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #374151;
  font-size: 13px;
}

.api-hint {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.kpi-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 4px;
}

.kpi-card small {
  color: #6b7280;
}

.kpi-card b {
  font-size: 24px;
}

.mini-panel {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.mini-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.plain-list li {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.bar-chart {
  min-height: 180px;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
}

.bar-item {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.bar-item small {
  font-size: 10px;
  color: #6b7280;
}

.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px;
}

.bar.processed {
  background: #2563eb;
}

.bar.failed {
  background: #dc2626;
}

.inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

.event-table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.event-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #fff;
}

.event-table th,
.event-table td {
  border-bottom: 1px solid #f3f4f6;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.event-table th {
  background: #f9fafb;
  font-weight: 600;
}

.evt-type {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff;
  font-size: 11px;
}

.evt-type.enqueue {
  background: #6b7280;
}

.evt-type.start {
  background: #2563eb;
}

.evt-type.success {
  background: #059669;
}

.evt-type.failed,
.evt-type.worker-error {
  background: #dc2626;
}

.admin-ok {
  color: #166534;
  margin: 0;
}

.admin-warn {
  color: #92400e;
  margin: 0;
}

.admin-error {
  color: #b91c1c;
  margin: 0 0 8px 0;
}

.delete-form {
  display: flex;
  justify-content: end;
}

.lecture-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

.lecture-card-actions .btn-edit {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

.lecture-card-actions .btn-edit:hover {
  background: #dbeafe;
}

.delete-form-inline {
  display: inline;
}

.delete-form-inline button {
  padding: 6px 12px;
  font-size: 13px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.muted {
  color: #9ca3af;
  font-size: 12px;
}

.thumb-state-row {
  display: grid;
  gap: 4px;
}

.state-chip {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.state-chip.ready {
  background: #dcfce7;
  color: #166534;
}

.state-chip.processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.state-chip.pending {
  background: #f3f4f6;
  color: #374151;
}

.state-chip.failed {
  background: #fee2e2;
  color: #b91c1c;
}

.error-text {
  color: #b91c1c;
}

.danger {
  background: #dc2626;
}

.ghost {
  background: #4b5563;
}

.viewer-wrap {
  max-width: 1260px;
  margin: 20px auto;
  padding: 0 24px 32px;
}

.back-link {
  text-decoration: none;
  display: inline-block;
  margin-bottom: 10px;
}

.description {
  color: #4b5563;
}

.youtube-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  background: #000;
}

.youtube-frame iframe {
  width: 100%;
  height: 100%;
}

.ppt-tools {
  margin: 14px 0;
  color: #374151;
}

.slide-list {
  display: grid;
  gap: 12px;
}

.slide-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.slide-card h2 {
  margin: 0;
  font-size: 18px;
}

.slide-card header p {
  margin: 4px 0 0;
  color: #4b5563;
}

.slide-image-wrap {
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}
.slide-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.slide-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.empty {
  color: #6b7280;
}

.list-hint {
  margin: 0 0 12px;
  color: #6b7280;
  font-size: 13px;
}

.list-query-actions {
  margin-top: 12px;
}

.form-hint {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 13px;
}

.subtitle {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 14px;
}

.search-bar-wrap {
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 10px 12px 10px 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-tag {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.filter-tag:hover {
  background: #f3f4f6;
}

.ai-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ai-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

/* 검색 필터: [hidden]이 a.ai-card-link { display: block } 등에 밀리지 않도록 */
.ai-card[hidden] {
  display: none !important;
}

.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ai-card-icon {
  font-size: 24px;
}

.status-chip {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.status-chip.public {
  background: #dcfce7;
  color: #166534;
}

.status-chip.private {
  background: #fef3c7;
  color: #92400e;
}

.ai-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.ai-card p {
  margin: 0 0 8px;
  font-size: 14px;
  color: #4b5563;
}

a.ai-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.ai-card-link:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

a.ai-card-link:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* AI 탐색: DEV·비관리자 — 프롬프트 외 비활성 */
.ai-card.ai-card-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
  user-select: none;
}

.ai-explore-action-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
  user-select: none;
}

body.ai-explore-dev-guest .search-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* AI 프롬프트 라이브러리 (NotebookLM 스타일 빌더 느낌의 히어로 + 카드 + 미리보기) */
.prompts-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #4b5563;
  text-decoration: none;
  margin-bottom: 16px;
}

.prompts-back:hover {
  color: #1f2937;
}

.prompts-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #1e40af 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
}

.prompts-hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prompts-hero .prompts-lead {
  margin: 0 0 12px;
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.5;
  max-width: 720px;
}

.prompts-hero .prompts-stats {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.prompts-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.15fr);
  gap: 20px;
  align-items: start;
}

.prompts-grid-title {
  margin: 0 0 12px;
  font-size: 17px;
  color: #111827;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.prompt-template-card {
  text-align: left;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.prompt-template-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.prompt-template-card.is-selected {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #3b82f6;
}

.prompt-template-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #111827;
}

.prompt-template-card p {
  margin: 0 0 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

.prompt-template-card .prompt-mini-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}

.prompts-preview-panel {
  position: sticky;
  top: 88px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  background: #fafafa;
  min-height: 320px;
}

.prompts-preview-panel h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.prompts-preview-empty {
  margin: 0;
  color: #9ca3af;
  font-size: 14px;
}

.prompts-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.prompts-copy-btn {
  border: none;
  background: #f59e0b;
  color: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.prompts-copy-btn:hover {
  background: #ea580c;
}

.prompts-copy-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}

.prompts-body-textarea {
  width: 100%;
  min-height: 280px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  resize: vertical;
  box-sizing: border-box;
  background: #fff;
}

.prompts-body-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.prompts-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6b7280;
}

@media (max-width: 960px) {
  .prompts-layout {
    grid-template-columns: 1fr;
  }

  .prompts-preview-panel {
    position: static;
  }
}

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

.chat-api-warning {
  margin: 0 24px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 13px;
  line-height: 1.45;
}

.chat-api-warning code {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.6);
  padding: 1px 4px;
  border-radius: 4px;
}

.chat-msg-streaming .chat-msg-content {
  min-height: 1.5em;
}

.chat-typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: #9ca3af;
  font-weight: 700;
}

.chat-typing-dots span {
  animation: chatTypingDot 1.1s ease-in-out infinite;
  opacity: 0.35;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatTypingDot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-send-btn.is-busy {
  opacity: 0.85;
  cursor: wait;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px 24px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.chat-welcome {
  padding: 40px 0;
  text-align: center;
}

.chat-welcome h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #1f2937;
}

.chat-welcome p {
  margin: 0;
  color: #6b7280;
  font-size: 15px;
}

.chat-msg {
  margin-bottom: 16px;
  max-width: 85%;
}

.chat-msg-user {
  align-self: flex-end;
  width: fit-content;
  max-width: 85%;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-msg-user .chat-msg-content {
  background: #e5e7eb;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  text-align: right;
  border: 1px solid #d1d5db;
}

.chat-msg-assistant .chat-msg-content {
  background: #f3f4f6;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
}

/** 어시스턴트 메시지: marked + DOMPurify 렌더 결과 */
.chat-msg-assistant .chat-md-body {
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-msg-assistant .chat-md-body > *:first-child {
  margin-top: 0;
}

.chat-msg-assistant .chat-md-body > *:last-child {
  margin-bottom: 0;
}

.chat-msg-assistant .chat-md-body h1,
.chat-msg-assistant .chat-md-body h2,
.chat-msg-assistant .chat-md-body h3,
.chat-msg-assistant .chat-md-body h4 {
  margin: 12px 0 8px;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}

.chat-msg-assistant .chat-md-body h1 {
  font-size: 1.2rem;
}

.chat-msg-assistant .chat-md-body h2 {
  font-size: 1.1rem;
}

.chat-msg-assistant .chat-md-body h3,
.chat-msg-assistant .chat-md-body h4 {
  font-size: 1.02rem;
}

.chat-msg-assistant .chat-md-body p {
  margin: 8px 0;
}

.chat-msg-assistant .chat-md-body hr {
  border: none;
  border-top: 1px solid #d1d5db;
  margin: 14px 0;
}

.chat-msg-assistant .chat-md-body ul,
.chat-msg-assistant .chat-md-body ol {
  margin: 8px 0;
  padding-left: 1.35em;
}

.chat-msg-assistant .chat-md-body li {
  margin: 4px 0;
}

.chat-msg-assistant .chat-md-body ul {
  list-style: disc;
}

.chat-msg-assistant .chat-md-body ol {
  list-style: decimal;
}

.chat-msg-assistant .chat-md-body blockquote {
  margin: 8px 0;
  padding: 6px 0 6px 12px;
  border-left: 3px solid #d1d5db;
  color: #4b5563;
}

.chat-msg-assistant .chat-md-body strong {
  font-weight: 700;
  color: #111827;
}

.chat-msg-assistant .chat-md-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.chat-msg-assistant .chat-md-body a:hover {
  color: #1d4ed8;
}

.chat-msg-assistant .chat-md-body pre {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
}

.chat-msg-assistant .chat-md-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.chat-msg-assistant .chat-md-body :not(pre) > code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  font-size: 0.9em;
}

.chat-msg-assistant .chat-md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0;
}

.chat-msg-assistant .chat-md-body th,
.chat-msg-assistant .chat-md-body td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}

.chat-msg-assistant .chat-md-body th {
  background: #f9fafb;
  font-weight: 600;
}

.chat-status-line {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.chat-sources {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  line-height: 1.45;
}

.chat-sources-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.chat-sources-list {
  margin: 0;
  padding-left: 1.1em;
  color: #4b5563;
}

.chat-sources-list a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-sources-list a:hover {
  color: #1d4ed8;
}

.chat-input-wrap {
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-model-select {
  flex-shrink: 0;
  width: 160px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

.chat-model-select:focus {
  outline: none;
  border-color: #f59e0b;
}

.chat-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  resize: none;
  font: inherit;
}

.chat-form textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f59e0b;
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: #d97706;
}

.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-disclaimer {
  margin: 12px 0 0;
  font-size: 12px;
  color: #9ca3af;
}

.chat-placeholder {
  padding: 24px;
  text-align: center;
}

.chat-placeholder .muted {
  color: #9ca3af;
  font-size: 13px;
  margin-top: 8px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-ghost {
  background: #fff !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
}

.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: #f59e0b;
  background: #fffbeb;
}

.breadcrumb {
  margin: 0 0 16px;
  font-size: 14px;
  color: #6b7280;
}

.breadcrumb a {
  color: #1d4ed8;
  text-decoration: none;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

@media (max-width: 900px) {
  .nav-mobile-toggle {
    display: flex;
  }

  .left-nav {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 101;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
  }

  .left-nav.nav-drawer-open {
    transform: translateX(0);
  }

  body.nav-mobile-open {
    overflow: hidden;
    touch-action: none;
  }

  .topbar {
    height: auto;
    padding: 14px 16px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .top-action {
    padding: 8px 12px;
  }
  .top-action-link {
    padding: 8px 12px;
  }
  .container,
  .viewer-wrap {
    padding: 0 12px;
  }

  .container.container-ai-full {
    padding: 0 12px;
  }
}

/* Admin token modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-content h3 {
  margin: 0 0 8px;
  font-size: 20px;
}
.modal-desc {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 14px;
}
.admin-token-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}
.admin-token-form input:focus {
  outline: none;
  border-color: #f97316;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.modal-actions button[type="submit"] {
  background: #f97316;
  color: #fff;
  border: none;
}
.modal-actions button[type="submit"]:hover {
  background: #ea580c;
}

.table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.data-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}
.data-table tbody tr:hover {
  background: #f9fafb;
}
.cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-grid h3 {
  grid-column: 1 / -1;
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 15px;
}
.form-grid h3:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.label-text {
  display: inline;
}
.required {
  color: #dc2626;
  font-weight: 600;
  vertical-align: super;
  font-size: 0.85em;
  margin-left: 1px;
}
