/* AIG 웹 — 기본 스타일 */

:root {
  --bg: #f6f8fb;
  --bg-sidebar: #111827;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --text-on-dark: #f1f5f9;
  --primary: #1f5eff;
  --primary-dark: #1949c8;
  --success: #16a34a;
  --warn: #d97706;
  --fail: #dc2626;
  --border: #e2e8f0;
  --border-dark: #334155;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Pretendard", BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width, 260px) 3px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  transition: grid-template-columns 180ms ease;
}
.app.sidebar-collapsed {
  grid-template-columns: 0 0 minmax(0, 1fr);
}
.app.sidebar-dragging {
  transition: none;
}

.sidebar-shell-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: transparent;
  color: #cbd5e1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}
.sidebar-shell-toggle:hover {
  background: rgba(148, 163, 184, 0.16);
  color: #f8fafc;
}
.sidebar-shell-toggle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.sidebar-shell-icon {
  position: relative;
  display: block;
  width: 13px;
  height: 11px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  opacity: 0.95;
}
.sidebar-shell-icon::before {
  content: "";
  position: absolute;
  top: 1.4px;
  bottom: 1.4px;
  left: 3.2px;
  width: 1.4px;
  background: currentColor;
  border-radius: 2px;
}

.sidebar-resizer {
  background: transparent;
  cursor: col-resize;
  position: sticky;
  top: 0;
  width: 12px;
  margin-left: -4px;
  margin-right: -5px;
  z-index: 40;
  height: 100vh;
  transition: background 120ms;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app.sidebar-collapsed .sidebar-resizer {
  opacity: 0;
  pointer-events: none;
}
.sidebar-resizer:hover,
.sidebar-resizer:active {
  background: rgba(37, 99, 235, 0.12);
}
.app.sidebar-collapse-ready .sidebar-resizer {
  background: rgba(148, 163, 184, 0.18);
}
.app.sidebar-dragging .sidebar {
  overflow: hidden;
}
/* === 사이드바 === */
.sidebar {
  background: linear-gradient(180deg, #172033 0%, var(--bg-sidebar) 100%);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  container-type: inline-size;
  container-name: sidebar;
  min-width: 0;
}
.app.sidebar-collapsed .sidebar {
  overflow: hidden;
  pointer-events: none;
}

.sidebar-header {
  padding: 18px 14px;
  border-bottom: 1px solid var(--border-dark);
}
.sidebar-header h1 {
  font-family: "Cinzel", "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.12rem, calc(0.75rem + 3.1cqi), 1.32rem);
  font-weight: 700;
  margin-bottom: 4px;
  padding-left: 28px;
  letter-spacing: 0.065em;
  color: #f1f5f9;
  background: linear-gradient(135deg, #ffffff 0%, #bfdbfe 65%, #e5e7eb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
.sidebar-header h1 .yonsei {
  letter-spacing: 0.06em;  /* 'Yonsei' 만 살짝 더 좁게 */
}
.sidebar-header h1 .brand-link {
  color: inherit;
  text-decoration: none;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}
/* 학과명 — 학술 분위기 (Cormorant Garamond / Georgia italic, 골드 톤) */
.sidebar-dept {
  font-family: -apple-system, "Pretendard", BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(0.68rem, 2.7cqi, 0.78rem);
  font-style: normal;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0;
  line-height: 1.35;
  margin-bottom: 16px;
  text-align: left;
  word-break: keep-all;
  overflow-wrap: anywhere;     /* 좁을 때 한 단어가 컨테이너보다 길면 글자 단위 wrap 허용 */
  text-shadow: none;
}
.sidebar-generation-modes {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}
.sidebar-mode-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 38px;
  padding: 7px 10px 7px 12px;
  color: #cbd5e1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
}
.sidebar-mode-link:hover {
  background: rgba(148, 163, 184, 0.10);
  color: #ffffff;
}
.sidebar-mode-link.is-active {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(147, 197, 253, 0.22);
  box-shadow: inset 3px 0 0 #60a5fa;
  color: #f8fafc;
}

.history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 16px;
}
.history.history-empty {
  display: block;
  padding: 0;
}
.history.history-empty > * {
  display: none;
}
.history h2 {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 8px;
  letter-spacing: 0;
  font-weight: 700;
}

/* === 사이드바 다중 삭제 (그룹 A, 2026-04-26) === */
.sidebar-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 6px;
  font-size: 0.81rem;
}
.sidebar-bulk-all {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #cbd5e1;
  cursor: pointer;
}
.sidebar-bulk-all input { cursor: pointer; }
.sidebar-bulk-btn {
  margin-left: auto;
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.81rem;
  transition: background 0.1s;
}
.sidebar-bulk-btn:disabled {
  background: transparent;
  color: var(--text-light);
  border-color: rgba(255,255,255,0.08);
  opacity: 0.5;
  cursor: not-allowed;
}
.sidebar-bulk-btn:not(:disabled):hover { background: rgba(239, 68, 68, 0.32); }
.session-check {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 1;
  opacity: 0.6;
  transition: opacity 0.1s;
}
.session-check:hover, .session-check:checked { opacity: 1; }
.session-item:has(.session-check:checked) a { background: rgba(96, 165, 250, 0.15); }
.session-item:has(.session-check) a { padding-left: 26px !important; padding-right: 32px !important; }

.session-list { list-style: none; }
.session-item a {
  display: block;
  padding: 8px 10px;
  color: var(--text-on-dark);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.87rem;
  margin-bottom: 4px;
}
.session-item .subject-badge { font-size: 0.78rem; }
.history-mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.history-mode-similar {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}
.history-mode-item-model {
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
}
.history-mode-legacy {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.session-item .standard { font-size: 0.91rem; color: var(--text-on-dark); }
.session-item .type { font-size: 0.87rem; color: #cbd5e1; }
.session-item a:hover { background: rgba(255,255,255,0.08); }
.session-item .subject-badge { margin-right: 4px; }
.session-item .grade-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 4px;
  background: rgba(148, 163, 184, 0.28);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.session-item .count { color: #cbd5e1; font-size: 0.78rem; }
.session-item .created-at {
  display: inline;
  color: #cbd5e1;
  font-size: 0.74rem;
  opacity: 0.95;
  margin-left: 6px;
}
.empty,
.session-empty {
  color: #cbd5e1;
  font-size: 0.87rem;
  padding: 8px 10px;
}

/* === 사이드바 그룹 (오늘·일·월) === */
.session-group {
  margin: 4px 0;
}
.session-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  list-style: none;
  color: #e2e8f0;
  font-size: 0.81rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  user-select: none;
}
.session-group-header::-webkit-details-marker { display: none; }
.session-group-header:hover { background: rgba(255,255,255,0.05); color: #f8fafc; }
.session-group-caret {
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 0.74rem;
  opacity: 0.85;
}
.session-group[open] > .session-group-header > .session-group-caret { transform: rotate(0deg); }
.session-group:not([open]) > .session-group-header > .session-group-caret { transform: rotate(-90deg); }
.session-group-label { flex: 1; }
.session-group-count {
  font-size: 0.74rem;
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.28);
  padding: 1px 7px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.session-group-month > .session-group-header { opacity: 0.92; }

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-dark);
  font-size: 0.8rem;
  color: var(--text-light);
}
.sidebar-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  width: 100%;
}

/* === 메인 영역 === */
.main {
  padding: 28px 40px;
  max-width: 1480px;  /* 1000px → 1600px (2026-04-26: 우측 여백 축소) */
  min-width: 0;
}

.input-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.generate-workbench {
  overflow: visible;
}
.input-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}
.panel-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.input-panel h2 {
  font-size: 1.12rem;
  color: #0f172a;
}
.btn-mode-toggle {
  flex: 0 0 auto;
  font-weight: 700;
  white-space: nowrap;
}
.btn-mode-toggle.is-active:not(.sidebar-mode-link) {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.input-form { display: flex; flex-direction: column; gap: 0; }
.generation-form,
.similar-generation-form {
  padding: 0 22px 22px;
}
.form-section { padding: 0; border-top: 0; }
.generation-form .form-section + .form-section,
.similar-generation-form .form-section + .form-section {
  margin-top: 14px;
}
.form-section:first-of-type {
  border-top: 0;
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.form-section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  color: #64748b;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
}
.form-section h3 {
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 700;
}
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.form-row-standards {
  grid-template-columns: minmax(0, 3fr) minmax(160px, 1fr);
  align-items: start;
  margin-top: 14px;
}
.foundation-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}
.foundation-item-count {
  min-width: 0;
}
.form-row-type { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.form-row select { min-width: 0; }
.form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
}
.form-row select, .form-row input {
  padding: 0 10px;
  height: 38px;
  font-size: 0.95rem;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #ffffff;
}
.similar-upload-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.similar-upload-panel[hidden] {
  display: none;
}
.similar-source-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.86rem;
}
.similar-source-label {
  color: #64748b;
  font-weight: 700;
}
.similar-source-standards {
  color: #64748b;
  font-size: 0.8rem;
}
.source-condition-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #f8fbff;
  color: #334155;
  font-size: 0.86rem;
}
.source-condition-label {
  color: #1d4ed8;
  font-weight: 700;
}
.similar-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: start;
}
.similar-input-grid-model-only {
  grid-template-columns: minmax(180px, 240px);
  justify-content: end;
}
.similar-model-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
}
.similar-model-field select {
  padding: 0 10px;
  height: 42px;
  font-size: 0.95rem;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #ffffff;
}
.item-model-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.item-model-panel[hidden] {
  display: none;
}
.item-model-config-body {
  margin-top: 14px;
  animation: item-model-config-expand 0.16s ease-out;
  transform-origin: top;
}
.item-model-config-body[hidden] {
  display: none;
}
@keyframes item-model-config-expand {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.item-model-required-grid {
  display: grid;
  grid-template-columns: minmax(120px, 170px);
  gap: 12px;
  margin-bottom: 12px;
}
.item-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.item-model-required-grid label,
.item-model-grid label,
.item-model-length-row label,
.item-model-point-list label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
}
.item-model-required-grid select,
.item-model-grid select,
.item-model-grid input,
.item-model-length-row input,
.item-model-point-list input,
.kdot-item-row select,
.kdot-item-row input {
  padding: 0 10px;
  height: 38px;
  font-size: 0.95rem;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #ffffff;
}
.form-row select:focus,
.form-row input:focus,
.item-model-required-grid select:focus,
.item-model-grid select:focus,
.item-model-grid input:focus,
.item-model-length-row input:focus,
.item-model-point-list input:focus,
.kdot-item-row select:focus,
.kdot-item-row input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.32);
  border-color: #93c5fd;
}
.item-model-length-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, minmax(90px, 130px));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.item-model-point-block {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 2fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.item-model-point-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.item-model-recommend-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.item-model-recommend-actions .btn-secondary {
  margin-right: 0;
}
.item-model-recommend-actions .btn-history-shelf {
  margin-left: auto;
  margin-right: 0;
  white-space: nowrap;
}
.item-model-recommend-actions .btn-history-shelf:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.item-model-recommendation-panel {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #cfe0f5;
  border-radius: 6px;
  background: #f8fbff;
}
.item-model-recommendation-panel[hidden] {
  display: none;
}
.item-model-recommendation-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: #1e293b;
  margin-bottom: 10px;
}
.item-model-recommendation-header span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
}
.item-model-candidate-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.item-model-candidate-card {
  display: grid;
  grid-template-columns: 78px minmax(160px, 1fr) minmax(78px, 0.3fr) minmax(180px, 1fr) minmax(78px, 0.3fr) minmax(150px, 0.7fr);
  align-items: end;
  gap: 12px;
  min-height: auto;
  padding: 10px 14px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  text-align: left;
  cursor: pointer;
}
.item-model-candidate-card:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.item-model-candidate-card.is-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb inset;
}
.item-model-candidate-index {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  align-self: center;
}
.item-model-candidate-card label,
.item-model-candidate-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}
.item-model-candidate-field-label {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}
.item-model-candidate-card input,
.item-model-candidate-card select {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 650;
}
.item-model-candidate-card input:focus,
.item-model-candidate-card select:focus {
  outline: 2px solid rgba(96, 165, 250, 0.32);
  border-color: #93c5fd;
}
.material-type-field,
.question-type-field {
  position: relative;
}
.material-type-picker > summary,
.question-type-picker > summary {
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 6px;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 650;
}
.material-type-picker > summary > span:first-child,
.question-type-picker > summary > span:first-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 34px;
}
.material-type-picker[open],
.question-type-picker[open] {
  z-index: 180;
}
.material-type-picker .material-type-list,
.question-type-picker .question-type-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 180;
  width: max(100%, 260px);
  max-width: min(420px, 72vw);
  max-height: 220px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}
.material-type-option,
.question-type-option {
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 650;
  min-height: 30px;
  padding: 5px 8px;
  align-items: flex-start;
}
.item-model-candidate-card .material-type-option input[type="checkbox"],
.item-model-candidate-card .question-type-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin-top: 1px;
  border-radius: 4px;
  flex: 0 0 16px;
}
.material-type-option span,
.question-type-option span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.material-link-detail {
  grid-column: 2 / -1;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #f8fbff;
}
.item-model-candidate-kdot {
  grid-column: 2 / -1;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #ffffff;
}
.item-model-candidate-kdot-title {
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
}
.item-model-candidate-kdot-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.item-model-candidate-kdot-row {
  display: grid;
  grid-template-columns: 48px minmax(92px, 118px) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
}
.item-model-candidate-kdot-row span:first-child {
  white-space: nowrap;
}
.item-model-candidate-card .item-model-candidate-kdot-row select {
  height: 30px;
  padding: 0 8px;
  font-size: 0.8rem;
}
.item-model-candidate-kdot-meta {
  min-width: 0;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.item-model-selected-detail {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 2px;
}
.item-model-selected-detail-actions {
  display: flex;
  justify-content: flex-start;
  min-width: 0;
  margin-top: 2px;
}
.item-model-detail-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
.item-model-detail-toggle:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}
.item-model-selected-detail .item-model-advanced {
  margin-top: 8px;
  border-color: #bfdbfe;
  background: #f8fbff;
}
.item-model-selected-detail .item-model-advanced:not([open]) {
  display: none;
}
.material-link-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.material-link-control {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(92px, 0.7fr);
  align-items: center;
  gap: 6px;
  min-width: 260px;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
}
.material-link-label {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.item-model-candidate-card .material-link-control select {
  height: 30px;
  padding: 0 8px;
  font-size: 0.8rem;
}
@media (max-width: 900px) {
  .item-model-candidate-card {
    grid-template-columns: 1fr 1fr;
  }
  .item-model-candidate-index {
    grid-column: 1 / -1;
  }
  .item-model-candidate-kdot,
  .material-link-detail {
    grid-column: 1 / -1;
  }
}
.item-model-evidence-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
}
.item-model-evidence-summary p {
  margin: 3px 0 0;
  color: #475569;
  font-size: 0.8rem;
}
.item-model-evidence-summary ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.item-model-evidence-summary li {
  display: grid;
  gap: 2px;
  color: #334155;
  font-size: 0.8rem;
}
.item-model-evidence-summary strong {
  color: #1d4ed8;
}
.item-model-recommendation-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.item-model-recommendation-summary div {
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}
.item-model-recommendation-summary dt {
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
}
.item-model-recommendation-summary dd {
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 2px;
}
.item-model-recommendation-items {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.item-model-recommendation-items li {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) minmax(180px, 1.3fr) minmax(140px, 1fr);
  gap: 8px;
  align-items: baseline;
  color: #334155;
  font-size: 0.82rem;
}
.item-model-recommendation-items strong {
  color: #0f172a;
}
.item-model-recommendation-items em {
  grid-column: 2 / -1;
  color: #64748b;
  font-size: 0.76rem;
  font-style: normal;
}
.item-model-kdot-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0 8px;
}
.kdot-item-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.kdot-item-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}
.kdot-item-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.kdot-item-index {
  flex: 0 0 auto;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}
.kdot-item-row select {
  flex: 0 1 148px;
  min-width: 118px;
  max-width: 160px;
}
.kdot-item-meta {
  color: var(--text-light);
  font-size: 0.76rem;
  line-height: 1.25;
}
.item-model-advanced {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.item-model-advanced > summary {
  cursor: pointer;
  color: #1e293b;
  font-weight: 700;
  list-style: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.item-model-advanced > summary::-webkit-details-marker {
  display: none;
}
.item-model-advanced-summary-title {
  flex: 0 1 auto;
}
.item-model-advanced-toggle-text {
  color: var(--text-light);
  font-weight: 600;
}
.item-model-toggle-open {
  display: none;
}
.item-model-advanced[open] > summary {
  margin-bottom: 10px;
}
.item-model-advanced[open] .item-model-toggle-closed {
  display: none;
}
.item-model-advanced[open] .item-model-toggle-open {
  display: inline;
}
@media (max-width: 760px) {
  .main {
    padding: 20px 16px;
  }
  .input-panel-header,
  .generation-form {
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-row,
  .form-row-type {
    grid-template-columns: 1fr;
  }
  .item-model-required-grid,
  .item-model-point-block,
  .item-model-length-row {
    grid-template-columns: 1fr;
  }
  .item-model-kdot-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .item-model-recommendation-items li {
    grid-template-columns: 1fr;
  }
  .item-model-evidence-summary {
    grid-template-columns: 1fr;
  }
  .item-model-recommendation-items em {
    grid-column: auto;
  }
  .kdot-item-row-head {
    gap: 8px;
  }
  .kdot-item-row select {
    min-width: 112px;
  }
  .form-actions-buttons {
    width: 100%;
  }
  .form-actions-buttons {
    justify-content: flex-end;
  }
  .similar-input-grid {
    grid-template-columns: 1fr;
  }
}
.pdf-upload-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
}
.pdf-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #ffffff;
}
.pdf-upload-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}
.pdf-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #d8e0eb;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}
.pdf-picker-button:hover {
  background: #eef4ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.pdf-upload-native:focus-visible + .pdf-picker-button {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.pdf-file-name {
  min-width: 0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-help {
  color: var(--text-light);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
}

.source-pdf-set-selection .card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.set-selection-summary {
  color: #475569;
  font-size: 0.93rem;
  font-weight: 600;
}
.source-set-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.source-set-options {
  display: grid;
  gap: 10px;
}
.source-set-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}
.source-set-option:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.source-set-option input {
  margin-top: 3px;
}
.source-set-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.4;
}
.source-set-option-body strong {
  color: #0f172a;
  font-size: 0.95rem;
}
.source-set-standards {
  color: #475569;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.btn-primary {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  align-self: flex-start;
}
.btn-primary:hover { background: var(--primary-dark); }

/* === 결과 카드 === */
.workarea { display: flex; flex-direction: column; gap: 16px; }
.hint { color: var(--text-light); font-size: 0.9rem; text-align: center; padding: 24px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-running { border-color: var(--warn); }
.card-done { border-color: var(--success); }
.card-failed { border-color: var(--fail); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-meta time { color: var(--text-light); font-size: 0.8rem; }

.subject-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
}
/* 결과 카드 헤더 — 학년 라벨 (light bg) */
.grade-badge-light {
  display: inline-block;
  padding: 3px 12px;
  margin-left: 4px;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  vertical-align: middle;
}
.subject-korean { background: #dbeafe; color: #1e40af; }
.subject-english { background: #fce7f3; color: #9d174d; }
.subject-math { background: #dcfce7; color: #166534; }
.subject-science { background: #f3e8ff; color: #6b21a8; }  /* 보라 — 과학 (2026-04-26) */

.standard { font-size: 0.98rem; display: inline-flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.std-entry { display: flex; gap: 6px; align-items: baseline; }
.std-entry strong { font-family: monospace; font-weight: 600; color: var(--text); }
.std-desc {
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.type { color: var(--text-light); font-size: 1.05rem; }

.progress-bar-wrap {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0 8px 0;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}
.step-text { font-size: 0.85rem; color: var(--text-light); }
.generation-progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.generation-progress-head .status-text { flex: 1; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-body { margin-bottom: 12px; }
.card-body pre {
  background: #f1f5f9;
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.error {
  background: #fef2f2;
  color: var(--fail);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
}

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: #f8fafc; }
.btn.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.btn-primary:hover { background: var(--primary-dark); }

/* === 성취기준 체크박스 목록 === */
.field-standards { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.9rem; color: var(--text-light); font-weight: 500; }
.standards-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}
.standards-list .checkbox-row,
.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}
.checkbox-row:hover { background: #e2e8f0; }
.checkbox-row input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.checkbox-row span { line-height: 1.2; }
.checkbox-row .std-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.checkbox-row .std-row > strong { flex-shrink: 0; }
.checkbox-row .std-desc { flex: 1; min-width: 0; }
.checkbox-row strong { color: var(--primary); margin-right: 4px; }

/* === 성취기준 추천 유형 배지 === */
.rec-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
}
.rec-badge.rec-strong {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.rec-badge.rec-medium {
  background: #fef3c7;
  color: #854d0e;
  border: 1px solid #fcd34d;
}
.rec-badge .rec-alt-count {
  margin-left: 4px;
  font-weight: 500;
  opacity: 0.7;
}
.rec-badge .rec-warn {
  margin-left: 4px;
  color: #b91c1c;
}

/* === 드롭다운 (성취기준 복수 선택) === */
.dropdown { position: relative; }
.dropdown > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  line-height: 1.4;
  user-select: none;
}
.dropdown > summary > span:first-child {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-chip {
  background: #eef2ff;
  color: #1e40af;
  padding: 3px 8px 3px calc(8px + 8em);
  text-indent: -8em;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.35;
  display: inline-block;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { background: #f8fafc; }
.dropdown[open] > summary { border-color: var(--primary); }
.dropdown .caret {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transform: scale(1.7);
  transform-origin: center;
  transition: transform 0.15s;
}
.dropdown[open] .caret { transform: scale(1.7) rotate(180deg); }

.standards-dropdown[open] {
  z-index: 120;
}

.standards-dropdown .standards-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 120;
  background: white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  max-height: 320px;
}

/* === 중지 버튼 === */
.btn-stop {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.btn-stop:hover { background: #fecaca; }

.card-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-header .status-text { flex: 1; }

/* === 사이드바 이력 삭제 버튼 === */
.session-item { position: relative; }
.session-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  color: var(--text-light);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { background: rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* 결과 JSON 인라인 표시 */
.result-json {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: none;
  overflow-x: auto;
}

/* === 문항 렌더링 === */
.render-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  background: #f1f5f9;
  color: var(--text);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.78rem;
}
.chip-warning {
  background: #fef3c7;
  color: #92400e;
}
.render-section { margin-bottom: 24px; font-size: 1.56em; }
.render-instruction { font-size: 12pt; }
.render-h {
  font-size: 14pt;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
}

/* 대화 화자 표시 — A1 (▶/▷ 텍스트 마커) + B1 (색상 칩, 웹 한정).
   DOCX 는 wrap 없이 ▶/▷ 마커만 plain text 로 살아남음. */
.speaker {
  display: inline-block;
  padding: 1px 9px 2px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92em;
  margin-right: 5px;
  line-height: 1.4;
}
.speaker-1 { background: #d6ecff; color: #16407a; }
.speaker-2 { background: #ffd8e2; color: #8a1c4d; }
.speaker-n { background: #e8e8e8; color: #555; }
.render-passage, .render-question {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.render-passage-head, .render-q-head {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.render-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 11px;
  font-size: 1.02rem;
  border-radius: 5px;
  font-weight: 600;
}
.tag-muted { background: #f1f5f9; color: var(--text-light); font-weight: 500; }
.tag-q { background: #dcfce7; color: #166534; }
.tag-r { background: #fef3c7; color: #92400e; }

.btn-resync {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 0.92rem;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  animation: resync-pulse 2s ease-in-out infinite;
}
.btn-resync:hover { background: #fed7aa; border-color: #fb923c; }
@keyframes resync-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(251, 146, 60, 0); }
}
.render-passage-title { font-weight: 600; margin-left: 4px; }
/* 결과 렌더 본문 텍스트 — 웹 화면에서 1pt 축소 (2026-05-06 사용자 요청) */
.render-exemplar {
  /* 예시답안 — `1) ... 2) ... 3) ...` 번호 단계가 줄바꿈으로 분리되도록 \n 보존.
     format_numbered_steps 필터가 박은 \n 을 화면에 그대로 반영. (2026-04-27) */
  white-space: pre-wrap;
}
.render-body {
  line-height: 1.7;
  font-size: 1rem;  /* ≈12pt — 제시자료 본문 */
  padding: 6px 0;
}
.render-note { font-size: 0.82rem; color: var(--text-light); margin: 4px 0; }
.render-sub {
  background: #f8fafc;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  overflow-x: auto;
}
.render-keypoints {
  margin-left: 20px;
  font-size: 0.85rem;
  color: var(--text-light);
}
.render-stem {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
  margin: 6px 0 10px 0;
  white-space: pre-wrap;
}
.render-stem-cont {
  margin-top: 0.4em;
  background: #f1f5f9;
  border-left: 3px solid #94a3b8;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 400;
}
.render-blank {
  display: inline-block;
  width: 40px;
}
.render-conditions-block {
  background: #fafafa;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.render-conditions-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.867rem;
}
.render-conditions {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
  background: transparent;
}
/* 인라인 편집 모드 — bullets 숨기고 raw 줄바꿈 보존 */
.render-conditions.inline-edit-active {
  list-style: none;
  padding-left: 8px;
}
.render-q-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.btn-edit-q {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 0.88rem;
  border-radius: 5px;
  cursor: pointer;
}
.btn-edit-q:hover {
  background: #e2e8f0;
}
.render-q-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff7ed;
  border: 1px dashed #fdba74;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
}
.render-q-edit-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #9a3412;
}
.render-q-edit-stem,
.render-q-edit-conds {
  width: 100%;
  font-family: inherit;
  font-size: 0.917rem;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid #fdba74;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}
.render-q-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}
.render-q-edit-hint {
  font-size: 0.85rem;
  color: #9a3412;
  margin: 0;
}
.render-rubric-edit {
  gap: 12px;
}
.rubric-edit-elem {
  border: 1px solid #fdba74;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0;
  background: #fffbeb;
}
.rubric-edit-elem legend {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9a3412;
  padding: 0 6px;
}
.rubric-edit-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rubric-edit-col {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  color: #475569;
}
.rubric-edit-col-narrow {
  flex: 0 0 80px;
}
.rubric-edit-col input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 5px 8px;
  border: 1px solid #fdba74;
  border-radius: 4px;
  box-sizing: border-box;
}
.rubric-edit-level {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  padding: 6px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 4px;
}
.rubric-edit-level label {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  color: #475569;
}
.rubric-edit-level textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 6px 8px;
  border: 1px solid #fdba74;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}
.render-hint-muted {
  font-size: 0.767rem;
  color: #64748b;
  font-style: italic;
  margin: 4px 0 10px;
}
.render-answer {
  background: #dcfce7;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 0.95rem;
}
.render-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.render-block > strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 0.9rem; }
.render-block ol { margin-left: 22px; line-height: 1.7; font-size: 0.9rem; }
.render-block ol li { margin-bottom: 6px; }
.render-expr { font-family: monospace; color: var(--primary); padding: 2px 0; font-size: 0.9rem; }
.render-expr-result { font-family: monospace; color: var(--success); font-size: 0.9rem; }

.render-rubric {
  background: #fffbeb;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  border: 1px solid #fde68a;
}
.render-rubric > header { margin-bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.render-rubric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 6px;
}
.render-rubric-table th, .render-rubric-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.render-rubric-table th { background: white; font-size: 0.8rem; color: var(--text-light); }
.render-rubric-lvl { width: 50px; font-weight: 600; color: var(--primary); text-align: center !important; }

/* 채점 기준 — docx 와 동일 4컬럼 표 */
.render-rubric-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 10px;
  background: white;
  table-layout: auto;
}
.render-rubric-grid th,
.render-rubric-grid td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  vertical-align: middle;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.render-rubric-grid th {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
}
.render-rubric-grid tbody td:last-child {
  text-align: left;
}
.render-rubric-eval { font-weight: 600; min-width: 90px; }
.render-rubric-elem { font-weight: 600; min-width: 90px; }
.render-rubric-lvl { width: 44px; }

.render-rubric-ex {
  margin-top: 4px;
  padding: 4px 8px;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  font-size: 0.717rem;
}
.render-rubric-ex-tag {
  display: inline-block;
  font-weight: 600;
  color: var(--primary);
  margin-right: 6px;
}

.render-raw { margin-top: 20px; }
.render-raw > summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-light);
  padding: 4px 0;
}
.render-raw > pre {
  background: #f1f5f9;
  padding: 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow: auto;
  margin-top: 6px;
}

/* 문항 이미지 */
.render-image {
  margin: 10px 0;
  text-align: center;
  background: white;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.render-image img {
  /* landscape 3:2 (1536x1024) 표시 폭 cap. 좁은 화면에선 100% 까지 자연 축소 (2026-04-26) */
  width: min(640px, 100%);
  height: auto;
  display: block;
  margin: 0 auto;
}
.render-image .render-note { text-align: center; margin-top: 6px; }

/* 이미지 후보 UI */
.render-image-actions { display: flex; justify-content: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.btn-sm { padding: 3px 10px; font-size: 0.78rem; }
.render-image-img { transition: opacity 0.2s; }
.render-image-placeholder {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 24px;
}
.render-image-note { font-weight: 600; }
.render-image-meta { color: #6b7280; font-size: 0.85em; margin-left: 4px; }
.render-image-selected { color: #059669; font-weight: 700; margin-left: 6px; }
.render-image-desc { font-style: italic; color: #9ca3af; }
.render-image-caption {
  font-style: italic;
  color: #6b7280;
  text-align: left;
  margin: 10px auto 4px;
  max-width: 95%;
  line-height: 1.55;
  font-size: 0.917rem;
  white-space: pre-line;
}
.btn-primary { background: #2563eb; color: white; border-color: #2563eb; }
.btn-primary:disabled { background: #9ca3af; border-color: #9ca3af; cursor: not-allowed; }

/* 재생성 패널 */
.regenerate-panel { display: inline-block; position: relative; }
.regenerate-panel summary { cursor: pointer; list-style: none; }
.regenerate-panel summary::-webkit-details-marker { display: none; }
.regenerate-form {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 320px;
}
.regenerate-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
.regenerate-feedback {
  width: 100%;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 8px;
}

/* 전단지·표 스타일 렌더 */
.render-flyer {
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  border: 2px dashed #f59e0b;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 10px 0;
}
.render-flyer-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #b45309;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.render-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
}
.render-data-table th, .render-data-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: center;
}
.render-data-table th {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
.render-structure-table {
  overflow-x: auto;
}
.render-structure-table .render-data-table {
  min-width: 640px;
}
.render-flyer-unit {
  text-align: right;
  font-size: 0.697rem;
  color: var(--text-light);
  margin-top: 6px;
}

/* render-body 안의 markdown 변환 결과 표 */
.render-body table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9rem;
  background: white;
}
.render-body th,
.render-body td {
  border: 1px solid var(--border);
  padding: 8px 16px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.render-body th {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.form-section-run {
  padding-bottom: 0;
}

/* 폼 하단 액션 */
.form-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 0; }
.form-actions-buttons { display: flex; gap: 8px; align-items: center; flex: 1 1 auto; justify-content: flex-end; }

.custom-input {
  margin-top: 6px;
  padding: 0 10px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fffef5;
}

/* 직접 입력 옵션 강조 */
select option[value="__custom__"] {
  color: #7c3aed;
  font-weight: 600;
}

/* 추천 옵션 강조 */
select option[data-recommended="true"] {
  color: #059669;
  font-weight: 600;
}

.jb-result-alerts .render-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #78350f;
  font-size: 0.95rem;
}
.jb-result-alerts .render-warning ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* === 인트로 (랜딩) 페이지 — Editorial Magazine Cover (2026-04-26 v2) === */
/* 군청 (ultramarine) 팔레트 */
:root {
  --ultramarine-deep: #0E1366;
  --ultramarine: #1B1F8C;
  --ultramarine-light: #2D33B0;
}
.intro-body {
  margin: 0;
  background: #050828;
  color: #f1f5f9;
  font-family: -apple-system, "Pretendard", BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}
.intro-page {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  box-sizing: border-box;
  /* 다크 군청 메쉬 그라데이션 — 사진 없이 깊이감만으로 표지 느낌 */
  background:
    radial-gradient(ellipse 80% 70% at 22% 28%, rgba(45, 51, 176, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 78% 78%, rgba(40, 30, 130, 0.55) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(27, 31, 140, 0.25) 0%, transparent 70%),
    linear-gradient(180deg, #050828 0%, #0A0E3F 40%, #0E1366 100%);
}
/* ambient 라이팅 — 부드러운 빛 무리 천천히 드리프트 */
.intro-bg-overlay {
  position: absolute;
  inset: -10%;
  z-index: 1;
  background:
    radial-gradient(circle at 30% 35%, rgba(140, 150, 255, 0.18) 0%, transparent 28%),
    radial-gradient(circle at 70% 65%, rgba(80, 70, 200, 0.22) 0%, transparent 32%),
    radial-gradient(circle at 50% 90%, rgba(45, 51, 176, 0.30) 0%, transparent 35%);
  pointer-events: none;
  animation: ambient-drift 24s ease-in-out infinite alternate;
}
@keyframes ambient-drift {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.85; }
  50%  { transform: translate(-2%, 1.5%) scale(1.06); opacity: 1; }
  100% { transform: translate(2%, -1.5%) scale(0.96); opacity: 0.9; }
}
/* 미세 노이즈/그리드 텍스처 (선택적) — 추후 실험 시 활성화 가능 */
.intro-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(0, 0, 0, 0.6), transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(0, 0, 0, 0.6), transparent 80%);
}
/* 상단 라벨 바 — 좌측 "Yonsei University", 우측 "Est. 1885" */
.intro-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 36px 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  opacity: 0;
  animation: intro-fade 1.4s ease-out 0.3s forwards;
}
.intro-topbar-left::before { content: "—  "; opacity: 0.65; letter-spacing: 0; }
.intro-topbar-right::after { content: "  —"; opacity: 0.65; letter-spacing: 0; }
/* 메인 hero — 가운데 정렬 */
.intro-hero {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 920px;
  padding: 16px 24px;
  margin: 0 auto;
}
/* 데코 라인 — 타이틀 위·아래 가는 가로선 (그라데이션 페이드) */
.intro-decoline {
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), transparent);
  margin: 16px auto;
  opacity: 0;
  animation: deco-draw 1.2s ease-out 0.9s forwards;
}
.intro-decoline:nth-of-type(2) { animation-delay: 1.1s; }
@keyframes deco-draw {
  0%   { opacity: 0; width: 0; }
  100% { opacity: 1; width: 90px; }
}
/* 타이틀 — 다크 배경 위 라이트 그라데이션 + 빛 sweep (shine) + 미세 글로우 */
.intro-title {
  position: relative;
  display: inline-block;
  font-family: "Cinzel", "Playfair Display", Georgia, serif;
  font-size: clamp(2.8rem, 9vw, 5.6rem);
  font-weight: 900;
  letter-spacing: 0.085em;
  margin: 0;
  /* 두 레이어 합성: (1) 좌→우 빛 띠, (2) 베이스 라이트 그라데이션 */
  background:
    linear-gradient(110deg,
      transparent 38%,
      rgba(255, 255, 255, 0.55) 47%,
      rgba(255, 255, 255, 0.95) 50%,
      rgba(255, 255, 255, 0.55) 53%,
      transparent 62%
    ),
    linear-gradient(180deg, #ffffff 0%, #c9cefc 55%, #6f7adf 100%);
  background-size: 250% 100%, 100% 100%;
  background-position: -150% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* 부드러운 군청 글로우 */
  text-shadow:
    0 0 28px rgba(120, 130, 240, 0.45),
    0 0 8px rgba(80, 90, 200, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(28px);
  /* 등장(2.4s) 후 4.5s 부터 5s 주기 shine 반복 */
  animation:
    title-rise 2.4s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards,
    title-shine 5s ease-in-out 4.5s infinite;
}
@keyframes title-shine {
  0%   { background-position: -150% 0, 0 0; }
  18%  { background-position: 250% 0, 0 0; }
  100% { background-position: 250% 0, 0 0; }
}
@keyframes title-rise {
  0%   { opacity: 0; transform: translateY(28px); letter-spacing: 0.18em; }
  100% { opacity: 1; transform: translateY(0); letter-spacing: 0.085em; }
}
.intro-yonsei { letter-spacing: inherit; }
.intro-aig { letter-spacing: 0.11em; }
/* 독수리 엠블럼 — .intro-title 박스(이미 position:relative)의 우상단에 절대 위치
   span 들엔 position 안 박아 그라데이션 클립 보존 */
.intro-eagle-mark {
  position: absolute;
  right: -3.6cm;
  top: -5.0cm;
  width: 3.36em;
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 14px rgba(140, 150, 255, 0.45));
  opacity: 0;
  animation: eagle-mark-in 4s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}
@keyframes eagle-mark-in {
  0%   { opacity: 0; transform: translateY(-3.5cm) scale(0.92); }
  100% { opacity: 0.92; transform: translateY(0) scale(1); }
}
@media (max-width: 540px) {
  .intro-eagle-mark { width: 2.8em; right: -2.0cm; top: -2.6cm; opacity: 0.75; }
}
/* 영문 부제 — Cormorant Garamond italic, pale ultramarine */
.intro-dept {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  font-style: italic;
  font-weight: 600;
  color: #c9cefc;
  letter-spacing: 0.03em;
  margin: 18px 0 28px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  animation: intro-fade-up 1.4s ease-out 1.3s forwards;
}
.intro-tagline {
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
  color: #ffffff;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.55;
  word-break: keep-all;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  opacity: 0;
  animation: intro-fade-up 1.4s ease-out 1.5s forwards;
}
.intro-sub {
  font-size: clamp(0.88rem, 1.45vw, 1.05rem);
  color: rgba(201, 206, 252, 0.85);
  font-weight: 500;
  margin: 0 0 44px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  opacity: 0;
  animation: intro-fade-up 1.4s ease-out 1.7s forwards;
}
@keyframes intro-fade-up {
  0%   { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* CTA — outlined pill (다크 배경에 어울리는 라이트 outline + glow) */
.intro-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 15px 40px;
  background: linear-gradient(135deg, rgba(45, 51, 176, 0.25) 0%, rgba(14, 19, 102, 0.4) 100%);
  color: #ffffff;
  text-decoration: none;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1.5px solid rgba(201, 206, 252, 0.55);
  box-shadow:
    0 0 0 4px rgba(45, 51, 176, 0.08),
    0 0 38px rgba(45, 51, 176, 0.45),
    0 6px 22px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  opacity: 0;
  animation: intro-fade-up 1.4s ease-out 1.9s forwards;
}
.intro-cta:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(135deg, rgba(45, 51, 176, 0.4) 0%, rgba(27, 31, 140, 0.55) 100%);
  box-shadow:
    0 0 0 4px rgba(45, 51, 176, 0.16),
    0 0 56px rgba(45, 51, 176, 0.65),
    0 10px 32px rgba(0, 0, 0, 0.55);
}
.intro-cta-arrow {
  display: inline-block;
  font-size: 1.15rem;
  transition: transform 0.22s ease;
}
.intro-cta:hover .intro-cta-arrow { transform: translateX(6px); }
/* 푸터 — 작은 caps, 페이드 인 */
.intro-footer {
  position: relative;
  z-index: 3;
  width: 100%;
  text-align: center;
  padding: 14px 16px 18px;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(201, 206, 252, 0.65);
  opacity: 0;
  animation: intro-fade 1.4s ease-out 2.1s forwards;
}
@keyframes intro-fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
/* 모션 감소 선호 — 모든 인트로 애니메이션 비활성, 즉시 정착 상태 */
@media (prefers-reduced-motion: reduce) {
  .intro-page { animation: none; background-size: 110%; }
  .intro-topbar, .intro-decoline, .intro-title, .intro-dept, .intro-tagline,
  .intro-sub, .intro-cta, .intro-footer {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .intro-decoline { width: 90px; }
  .intro-eagle-mark { animation: none; opacity: 0.92; transform: none; }
}

/* 새 생성 — primary 모양, 파란색, 오른쪽 끝 */
.btn-new-input {
  padding: 10px 24px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-block;
  margin-left: auto;
}
.btn-new-input:hover { background: #1d4ed8; }

/* 변경된 조건으로 생성 — 기본 제출 버튼이 이 클래스 가질 때 초록 */
.btn-primary.btn-changed {
  background: var(--success);
  border-color: var(--success);
}
.btn-primary.btn-changed:hover { background: #15803d; border-color: #15803d; }

/* 사회 교과 배지 */
.subject-social { background: #fef3c7; color: #92400e; }

/* ═════ 추천 템플릿 카드 (Phase 5 Step 2) ═════ */

.btn-recommend {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-recommend:hover { background: #ddd6fe; }

.rec-spinner {
  display: none;
  color: var(--text-light);
  font-size: 0.9rem;
  align-self: center;
}
.rec-spinner.htmx-request,
.htmx-request .rec-spinner { display: inline-block; }

.rec-panel {
  margin-top: 16px;
}
.rec-panel:empty { display: none; }

.rec-warnings {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rec-warning {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}
.rec-warning-info { background: #dbeafe; color: #1e40af; }
.rec-warning-notice { background: #fef3c7; color: #92400e; }
.rec-warning-error { background: #fee2e2; color: #991b1b; }

.rec-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rec-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}
.rec-card-primary {
  border-color: var(--success);
  background: #f0fdf4;
}
.rec-card-primary:hover { border-color: var(--success); box-shadow: 0 2px 10px rgba(22,163,74,0.12); }

.rec-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.rec-card-title { display: flex; flex-direction: column; gap: 4px; }
.rec-card-title h4 { font-size: 1.02rem; font-weight: 600; color: var(--text); }

.rec-card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  width: fit-content;
  letter-spacing: 0.02em;
}
.rec-tag-primary { background: #16a34a; color: #fff; }
.rec-tag-preset  { background: #e0e7ff; color: #3730a3; }
.rec-tag-cell    { background: #fce7f3; color: #9d174d; }
.rec-tag-form    { background: #ccfbf1; color: #115e59; }

.rec-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-light);
}
.rec-card-meta span {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 10px;
}

.rec-card-rationale {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
}

.rec-item-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rec-item {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.rec-card-primary .rec-item { background: #ffffff; border-color: #bbf7d0; }

.rec-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.rec-item-code { color: var(--primary); font-size: 0.88rem; }
.rec-item-type { background: #eef2ff; color: #3730a3; padding: 1px 7px; border-radius: 8px; font-size: 0.78rem; }
.rec-item-suit {
  padding: 1px 6px; border-radius: 8px; font-size: 0.72rem; font-weight: 600;
}
.rec-suit-강 { background: #dcfce7; color: #166534; }
.rec-suit-중 { background: #fef3c7; color: #92400e; }
.rec-item-preset {
  color: var(--text-light);
  font-size: 0.82rem;
  margin-left: auto;
}
.rec-item-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  margin: 4px 0 6px;
  line-height: 1.45;
}
.rec-item-preset-desc {
  font-size: 0.8rem;
  color: #475569;
  margin: 0 0 6px;
}

.rec-materials {
  list-style: none;
  padding: 0;
  margin: 4px 0 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rec-material {
  display: flex;
  gap: 4px;
  font-size: 0.78rem;
  background: #f8fafc;
  padding: 2px 8px;
  border-radius: 10px;
  align-items: baseline;
}
.rec-mat-role { color: var(--text-light); }
.rec-mat-form { font-weight: 600; }
.rec-medium-text   { color: #1e40af; }
.rec-medium-table  { color: #7c2d12; }
.rec-medium-graph  { color: #115e59; }
.rec-medium-image  { color: #7e22ce; }
.rec-medium-mixed  { color: #9d174d; }
.rec-medium-video  { color: #991b1b; }
.rec-medium-audio  { color: #854d0e; }

.rec-item-foot {
  font-size: 0.78rem;
  color: var(--text-light);
  border-top: 1px dashed var(--border);
  padding-top: 4px;
  margin-top: 4px;
}

.rec-card-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}
.rec-select-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.rec-select-btn:disabled {
  background: #cbd5e1;
  color: #475569;
  cursor: not-allowed;
}

.rec-empty {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 6px;
}

/* "추천 받기" 버튼 — 보조 액션, 폼 제출 옆에 배치 (Phase 5 Step 3) */
.btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #d8e0eb;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  margin-right: 0;
}
.btn-secondary:hover { background: #f8fafc; }

/* "🤖 LLM 추천" 버튼 (그룹 F, 2026-04-26) — Claude 직접 분석 강조 */
.btn-llm {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  color: white;
  border: 1px solid #4338ca;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  margin-right: 8px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(76, 29, 149, 0.2);
}
.btn-llm:hover { background: linear-gradient(135deg, #5b21b6 0%, #4338ca 100%); }
.htmx-indicator { display: none; opacity: 0.8; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.btn-llm { opacity: 0.7; cursor: wait; }

/* 추천 카드 영역 — 폼 아래, 결과 위 (Phase 5 Step 3) */
.rec-area {
  margin-top: 12px;
}
.rec-area:empty { display: none; }

/* 추천 디스클레이머 — Phase 5 Step 3 미완 정직 표시 (2026-04-28) */
.rec-disclaimer {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #78350f;
}
.rec-disclaimer-icon { font-size: 1rem; flex-shrink: 0; }
.rec-disclaimer-body { flex: 1; }
.rec-disclaimer-body strong { color: #78350f; }
.rec-disclaimer-body code {
  background: rgba(120, 53, 15, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ============================================================
   로그인 페이지 — intro 와 같은 다크 군청 배경 위에 글래스 카드
   ============================================================ */
.login-hero {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 460px;
  padding: 16px 24px;
  margin: 0 auto;
}
.login-title {
  font-family: "Cinzel", "Playfair Display", Georgia, serif;
  font-size: clamp(2.0rem, 5.5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0.085em;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #ffffff 0%, #c9cefc 55%, #6f7adf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 22px rgba(120, 130, 240, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.55);
  opacity: 0;
  animation: intro-fade-up 1.0s ease-out 0.3s forwards;
}
.login-sub {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: #c9cefc;
  margin: 0 0 32px;
  letter-spacing: 0.02em;
  opacity: 0;
  animation: intro-fade-up 1.0s ease-out 0.5s forwards;
}
.login-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 32px 28px;
  background: linear-gradient(135deg, rgba(45, 51, 176, 0.20) 0%, rgba(14, 19, 102, 0.32) 100%);
  border: 1.5px solid rgba(201, 206, 252, 0.35);
  border-radius: 18px;
  box-shadow:
    0 0 0 4px rgba(45, 51, 176, 0.06),
    0 0 38px rgba(45, 51, 176, 0.30),
    0 10px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: intro-fade-up 1.0s ease-out 0.7s forwards;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.login-label {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(201, 206, 252, 0.78);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
}
.login-field input {
  padding: 11px 14px;
  font-size: 1rem;
  color: #ffffff;
  background: rgba(5, 8, 40, 0.55);
  border: 1px solid rgba(201, 206, 252, 0.30);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  font-family: -apple-system, "Pretendard", BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.login-field input:focus {
  border-color: rgba(201, 206, 252, 0.85);
  background: rgba(5, 8, 40, 0.75);
  box-shadow: 0 0 0 3px rgba(140, 150, 255, 0.18);
}
.login-error {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: #ffd9d9;
  background: rgba(180, 40, 40, 0.20);
  border: 1px solid rgba(255, 120, 120, 0.45);
  border-radius: 8px;
  text-align: left;
}
.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 24px;
  margin-top: 6px;
  background: linear-gradient(135deg, rgba(45, 51, 176, 0.55) 0%, rgba(14, 19, 102, 0.75) 100%);
  color: #ffffff;
  border: 1.5px solid rgba(201, 206, 252, 0.55);
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    0 0 0 4px rgba(45, 51, 176, 0.08),
    0 0 26px rgba(45, 51, 176, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.40);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.login-submit:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(135deg, rgba(45, 51, 176, 0.70) 0%, rgba(27, 31, 140, 0.85) 100%);
  box-shadow:
    0 0 0 4px rgba(45, 51, 176, 0.16),
    0 0 42px rgba(45, 51, 176, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.50);
}
.login-submit-arrow {
  font-size: 1.05rem;
  transition: transform 0.18s ease;
}
.login-submit:hover .login-submit-arrow { transform: translateX(5px); }

/* 인라인 편집 — 더블클릭으로 contenteditable 진입 (2026-04-28) */
.inline-edit {
  cursor: text;
  border-radius: 4px;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
.inline-edit:hover:not(.inline-edit-active):not(.inline-edit-saving) {
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.18);
}
.inline-edit-active {
  background-color: #fffbeb !important;
  box-shadow: inset 0 0 0 2px #f59e0b !important;
  outline: none;
  white-space: pre-wrap;
  cursor: text;
}
.inline-edit-active:focus {
  outline: none;
}
.inline-edit-saving {
  background-color: rgba(34, 197, 94, 0.10) !important;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.30) !important;
  opacity: 0.7;
  pointer-events: none;
}
/* 표 셀 인라인 편집은 padding 이 작아 hover 시각 단서가 답답하지 않도록 약하게 */
td.inline-edit:hover:not(.inline-edit-active):not(.inline-edit-saving) {
  background-color: rgba(59, 130, 246, 0.06);
}
li.inline-edit {
  padding: 2px 6px;
  margin-left: -6px;
}

/* ============================================================
   휴지통 페이지 (2026-04-27) — /trash
   ============================================================ */
.page-header {
  margin: 8px 0 18px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.7) 0%, rgba(226, 232, 240, 0.6) 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.page-header h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  color: #1e293b;
}
.page-sub {
  margin: 0 0 4px;
  color: #475569;
  font-size: 0.92rem;
}
.page-sub strong { color: #1e293b; }
.page-sub em { font-style: normal; color: #2563eb; font-weight: 600; }
.back-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.88rem;
}
.back-link:hover { text-decoration: underline; }

.trash-page { padding: 0 4px; }
.trash-list-wrap { background: #ffffff; border-radius: 10px; border: 1px solid #e2e8f0; }

.trash-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
  gap: 10px;
}
.trash-bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.trash-empty-btn { margin-left: 8px; }

.btn-restore {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}
.btn-restore:not(:disabled):hover {
  background: #d1fae5;
  border-color: #34d399;
}
.btn-restore:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.btn-danger:not(:disabled):hover {
  background: #fee2e2;
  border-color: #f87171;
}
.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.trash-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.trash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}
.trash-item:last-child { border-bottom: none; }
.trash-item:hover { background: #f8fafc; }

.trash-check { cursor: pointer; flex-shrink: 0; }
.trash-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.trash-meta .standard {
  font-weight: 600;
  color: #1e293b;
}
.trash-meta .type {
  color: #64748b;
  font-size: 0.85rem;
}
.trash-deleted-at {
  color: #94a3b8;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.trash-days-left {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.trash-days-warn {
  background: #fef3c7;
  color: #92400e;
}
.trash-days-urgent {
  background: #fee2e2;
  color: #b91c1c;
}

.trash-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.trash-empty {
  padding: 40px 16px;
  text-align: center;
  color: #94a3b8;
  font-style: italic;
}

/* 사이드바 footer 휴지통 아이콘 — aig 사용자명 반대편 우측, 아이콘만 (2026-04-27) */
.sidebar-trash-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  font-size: 1rem;
  line-height: 1;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-trash-link:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #f1f5f9;
}
.sidebar-logout-link {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 4px 8px;
  font-size: 0.82rem;
  line-height: 1;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.sidebar-logout-link:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #f1f5f9;
}
.sidebar-trash-link .trash-count-badge {
  margin-left: auto;
  padding: 1px 7px;
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* === 이전 생성내역 모달 (업로드 문항생성 화면) — 교과·학교급 책등 서가 === */
.btn-history-shelf {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-history-shelf:hover { background: rgba(31, 94, 255, 0.08); }
.btn-history-shelf[hidden] { display: none; }
.btn-refresh {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  padding: 10px 16px;
  background: var(--bg-card);
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-refresh:hover { background: rgba(148, 163, 184, 0.12); color: var(--text); }

.history-shelf-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.history-shelf-overlay[hidden] { display: none; }
.history-shelf-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.history-shelf-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
  overflow: hidden;
}
.history-shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.history-shelf-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.history-shelf-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-light);
  padding: 4px 9px;
  border-radius: 6px;
}
.history-shelf-close:hover { background: rgba(148, 163, 184, 0.16); color: var(--text); }
.history-shelf-body {
  padding: 18px 22px 22px;
  background: #f8fafc;
  overflow-y: auto;
}
.hist-loading {
  color: var(--text-light);
  font-size: 0.9rem;
  text-align: center;
  padding: 28px 8px;
}

.quality-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}
.quality-rating-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-light);
}
.quality-rating-btn {
  min-width: 42px;
  padding: 7px 9px;
}
.quality-rating-btn.active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}
