/* ─────────────────────────────────────────────────────────────
   AI 소설 팩토리 — 커스텀 스타일
   상용 서비스 수준: 명확한 인터랙션·일관된 깊이·에디토리얼 타이포
   ───────────────────────────────────────────────────────────── */

/* ── 디자인 토큰 ──────────────────────────────────────────── */
:root {
    --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    /* 읽기 본문: 거의 검정에 가깝게 */
    --reader-text: #171717;
    --reader-muted: #44403c;
    /* 파이프라인 상태 색 */
    --phase-idle: #e7e5e4;
    --phase-active: #e11d48;
    --phase-done: #059669;
    /* 그림자 레벨 */
    --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --shadow-hover: 0 4px 12px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.05);
    --shadow-rose: 0 4px 20px rgba(225,29,72,.14);
}

/* ── 태그 뱃지 ────────────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
    border: 1px solid transparent;
    white-space: nowrap;
}
.tag-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 500; font-size: 0.625rem; }

/* 장르·분량·모델 — 밝은 배경용 파스텔 */
.tag-genre-sf       { background:#dbeafe; color:#1e40af; border-color:#bfdbfe; }
.tag-genre-fantasy  { background:#ede9fe; color:#5b21b6; border-color:#ddd6fe; }
.tag-genre-romance  { background:#ffe4e6; color:#be123c; border-color:#fecdd3; }
.tag-genre-mystery  { background:#e0e7ff; color:#3730a3; border-color:#c7d2fe; }
.tag-genre-martial  { background:#fee2e2; color:#b91c1c; border-color:#fecaca; }
.tag-genre-thriller { background:#f1f5f9; color:#475569; border-color:#e2e8f0; }
.tag-genre-modern   { background:#d1fae5; color:#047857; border-color:#a7f3d0; }
.tag-genre-historical { background:#fef3c7; color:#b45309; border-color:#fde68a; }
.tag-genre-horror   { background:#f3e8ff; color:#6b21a8; border-color:#e9d5ff; }
.tag-genre-drama    { background:#cffafe; color:#0e7490; border-color:#a5f3fc; }
.tag-genre-default  { background:#f1f5f9; color:#475569; border-color:#e2e8f0; }
.tag-vol-short      { background:#ccfbf1; color:#0f766e; border-color:#99f6e4; }
.tag-vol-mid        { background:#dbeafe; color:#1d4ed8; border-color:#bfdbfe; }
.tag-vol-long       { background:#ede9fe; color:#6d28d9; border-color:#ddd6fe; }
.tag-vol-default    { background:#f1f5f9; color:#64748b; border-color:#e2e8f0; }
.tag-model-flash    { background:#dcfce7; color:#15803d; border-color:#bbf7d0; }
.tag-model-lite     { background:#ecfccb; color:#4d7c0f; border-color:#d9f99d; }
.tag-model-pro      { background:#fef9c3; color:#a16207; border-color:#fef08a; }
.tag-model-default  { background:#f1f5f9; color:#475569; border-color:#e2e8f0; }

/* ── 사이드바 네비 링크 ───────────────────────────────────── */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #57534e;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
}
.nav-item:hover {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}
.nav-item.active {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
    font-weight: 600;
}
.nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: #f5f5f4;
    transition: background 0.12s;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    background: #ffe4e6;
}

/* ── 메인 상태 카드: 집필 진행 중 ⚙️ 회전 (이모지는 span 래퍼에 transform 적용) ── */
@keyframes status-card-gear-spin {
    to {
        transform: rotate(360deg);
    }
}
#main-status-card .status-gear-spin {
    display: inline-block;
    line-height: 1;
    transform-origin: 50% 53%;
    animation: status-card-gear-spin 1.15s linear infinite;
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
    #main-status-card .status-gear-spin {
        animation: none;
    }
}

/* ── 파이프라인 단계 노드 ─────────────────────────────────── */
.phase-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1.5px solid #e7e5e4;
    background: #fafafa;
    font-size: 0.75rem;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
/* 모든 phase-node: 항상 포인터·선택 방지 (clickable 여부 무관) */
.phase-node {
    cursor: pointer !important;
    user-select: none;
    -webkit-user-select: none;
}
.phase-node * {
    cursor: pointer !important;
}
.phase-node.phase-clickable {
    cursor: pointer !important;
}
.phase-node.phase-clickable:hover {
    background: #fff1f2;
    border-color: #fda4af;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.1);
    transform: translateX(3px);
}
.phase-node.phase-clickable:hover::after {
    content: '›';
    position: absolute;
    right: 8px;
    color: #e11d48;
    font-size: 14px;
    font-weight: 700;
    opacity: 0.7;
}
.phase-node.phase-clickable:active {
    transform: translateX(2px) scale(0.99);
    box-shadow: none;
}
/* 완료 상태 */
.phase-node.done {
    border-color: #a7f3d0;
    background: #f0fdf4;
}
/* 호버에만 !important — base.html/Tailwind 어떤 선언도 뚫고 적용 */
.phase-node.done:hover {
    border-color: #6ee7b7 !important;
    background: #dcfce7 !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12) !important;
    transform: translateX(3px) !important;
}
/* 활성 상태 */
.phase-node.active {
    border-color: #fda4af;
    background: #fff1f2;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.08);
}
.phase-node.active:hover {
    border-color: #fb7185 !important;
    background: #ffe4e6 !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12), 0 2px 8px rgba(225, 29, 72, 0.12) !important;
    transform: translateX(3px) !important;
}
/* 대기(회색) 상태 호버 */
.phase-node:not(.done):not(.active):hover {
    background: #fff1f2 !important;
    border-color: #fda4af !important;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.1) !important;
    transform: translateX(3px) !important;
}

/* Phase 확장 패널 — 챕터 목록 행(링크가 버튼처럼 보이도록) */
.phase-expand-chapter-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.phase-expand-chapter-link:focus-visible {
    outline: 2px solid #fda4af;
    outline-offset: 2px;
}

/* ── 글로벌 버튼 베이스 ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s, transform 0.1s;
    cursor: pointer;
    border: 1.5px solid transparent;
    white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
    background: #e11d48;
    color: #fff;
    border-color: #e11d48;
    box-shadow: 0 1px 4px rgba(225,29,72,.3), 0 4px 16px rgba(225,29,72,.15);
}
.btn-primary:hover {
    background: #be123c;
    border-color: #be123c;
    box-shadow: 0 2px 8px rgba(225,29,72,.35), 0 6px 20px rgba(225,29,72,.2);
}
.btn-secondary {
    background: #fff;
    color: #44403c;
    border-color: #e7e5e4;
    box-shadow: var(--shadow-card);
}
.btn-secondary:hover {
    background: #fafaf9;
    border-color: #d6d3d1;
    color: #1c1917;
}
.btn-ghost {
    background: transparent;
    color: #78716c;
    border-color: transparent;
}
.btn-ghost:hover {
    background: #f5f5f4;
    color: #1c1917;
}
.btn-danger {
    background: #fff;
    color: #b91c1c;
    border-color: #fecaca;
}
.btn-danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 8px;
}
.btn-xs {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 6px;
}
.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: 14px;
}

/* ── 카드 컴포넌트 ─────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1.5px solid #f5f5f4;
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.card:hover { box-shadow: var(--shadow-hover); border-color: #e7e5e4; }
.card-clickable { cursor: pointer; }
.card-clickable:hover { transform: translateY(-2px); }
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1.5px solid #f5f5f4;
}
.card-body { padding: 1.25rem 1.5rem; }
.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1.5px solid #f5f5f4;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

/* ── 폼 요소 ──────────────────────────────────────────────── */
.form-input {
    width: 100%;
    background: #fff;
    border: 1.5px solid #e7e5e4;
    border-radius: 10px;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: #1c1917;
    transition: border-color 0.12s, box-shadow 0.12s;
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.form-input:focus {
    border-color: #fb7185;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}
.form-input::placeholder { color: #a8a29e; }
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #44403c;
    margin-bottom: 0.375rem;
    letter-spacing: -0.01em;
}

/* ── 읽기 화면 본문 ──────────────────────────────────────── */
.reader-sheet.prose {
    font-family: var(--font-body);
    font-size: 1.1875rem;
    line-height: 1.95;
    letter-spacing: -0.01em;
    font-weight: 500;
    color: var(--reader-text);
    max-width: 42rem;
    --tw-prose-body: var(--reader-text);
    --tw-prose-headings: #0a0a0a;
    --tw-prose-bold: #0a0a0a;
    --tw-prose-quotes: var(--reader-muted);
    --tw-prose-bullets: #525252;
    --tw-prose-counters: #525252;
}
.reader-sheet.prose :is(p, li, blockquote, td, th, h1, h2, h3, h4, h5, h6, strong, em, a) {
    font-family: inherit;
}
.reader-sheet.prose :where(p, li, td, em) { color: var(--reader-text); }
.reader-sheet.prose :where(pre) { color: #171717; background: #fafafa; border: 1px solid #e7e5e4; }
.reader-sheet.prose :where(code):not(:where(pre *)) { color: #9f1239; background: #fff1f2; font-weight: 500; }
.reader-sheet.prose p { margin-bottom: 1.15em; text-align: justify; word-break: keep-all; overflow-wrap: break-word; }
.reader-sheet.prose h1, .reader-sheet.prose h2, .reader-sheet.prose h3 {
    font-family: var(--font-body);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #0a0a0a;
}
.reader-sheet.prose blockquote { border-left-width: 3px; font-style: normal; opacity: 1; border-left-color: #fb7185; color: var(--reader-muted); }
.reader-sheet.prose strong { color: #0a0a0a; font-weight: 700; }
.reader-sheet.prose a { color: #e11d48; font-weight: 500; }
.reader-sheet.prose a:hover { color: #be123c; }

/* 읽기 본문 Typography CDN 덮어쓰기 (body 끝에 custom.css 재로드로 CDN 이후 적용) */
#reader-content .reader-sheet.prose {
    --tw-prose-body: #171717 !important;
    --tw-prose-headings: #0a0a0a !important;
    --tw-prose-bold: #0a0a0a !important;
    --tw-prose-quotes: #44403c !important;
    --tw-prose-links: #e11d48 !important;
    color: #171717 !important;
}
#reader-content .reader-sheet.prose :where(p, li, td, th, em) { color: #171717 !important; }
#reader-content .reader-sheet.prose :where(h1, h2, h3, h4, h5, h6) { color: #0a0a0a !important; }
#reader-content .reader-sheet.prose strong { color: #0a0a0a !important; }
#reader-content .reader-sheet.prose a { color: #e11d48 !important; }
#reader-content .reader-sheet.prose blockquote { color: #44403c !important; opacity: 1 !important; }

/* ── 로그 드로어 줄 ───────────────────────────────────────── */
.log-line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(254, 205, 211, 0.5);
}
.log-line:hover { background: rgba(255, 241, 242, 0.65); }

/* ── 스크롤바 ─────────────────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar { width: 5px; height: 5px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(168, 162, 158, 0.4); border-radius: 4px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: rgba(120, 113, 108, 0.5); }

/* ── PDF 다운로드 오버레이 ────────────────────────────────── */
#pdf-download-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(250, 248, 248, 0.88);
    backdrop-filter: blur(8px);
}
#pdf-download-overlay .pdf-dl-panel { animation: pdfDlFadeIn 0.2s ease-out; }
@keyframes pdfDlFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}
#pdf-download-overlay #pdf-dl-bar.pdf-dl-bar-indeterminate {
    width: 100% !important;
    animation: pdfDlShimmer 1.15s linear infinite;
    background: linear-gradient(90deg, rgba(110,196,232,.45) 0%, rgba(225,29,72,.5) 50%, rgba(110,196,232,.45) 100%);
    background-size: 200% 100%;
}
@keyframes pdfDlShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ── 토스트 알림 ──────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    background: #1c1917;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    animation: toastIn 0.2s ease-out;
    pointer-events: auto;
    max-width: 360px;
}
.toast-success { background: #064e3b; }
.toast-error   { background: #7f1d1d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════ 앱 공통 모달 (확인·알림·재작성 등 통일) ═══════════ */
/* 닫힌 모달: [hidden] + .is-open 동시 적용 시 Tailwind보다 우선해 '투명 클릭 덫'이 되는 것을 방지 */
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 550;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(28, 25, 23, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none !important;
    pointer-events: none !important;
}
.app-modal.is-open {
    display: flex !important;
    pointer-events: auto !important;
}
.app-modal__panel {
    width: 100%;
    max-width: 420px;
    border-radius: 1.125rem;
    background: #fff;
    border: 1px solid #e7e5e4;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    overflow: hidden;
    animation: appModalPanelIn 0.22s ease-out;
}
.app-modal__panel--md {
    max-width: 480px;
}
.app-modal__panel--lg {
    max-width: 42rem;
}
/* 경고·삭제 범위 안내 — 살짝 로즈 틴트 */
.app-modal__panel--caution {
    border-color: #fecdd3;
    box-shadow:
        0 24px 48px rgba(225, 29, 72, 0.09),
        0 0 0 1px rgba(255, 241, 242, 0.9) inset;
}
@keyframes appModalPanelIn {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.app-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f5f5f4;
    background: #fff;
}
.app-modal__title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1c1917;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}
.app-modal__close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: #a8a29e;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.app-modal__close:hover {
    background: #f5f5f4;
    color: #57534e;
}
.app-modal__body {
    padding: 1.15rem 1.25rem;
    font-size: 0.8125rem;
    color: #57534e;
    line-height: 1.6;
    background: #fff;
    max-height: min(58vh, 480px);
    overflow-y: auto;
}
.app-modal__body--flush {
    padding-top: 0.85rem;
}
/* 본문만 스크롤 — 패널 높이 큰 모달용 */
.app-modal__panel--scroll .app-modal__body {
    max-height: min(70vh, 560px);
}
.app-modal__prose {
    margin: 0;
    font-size: 0.8125rem;
    color: #57534e;
    line-height: 1.6;
    white-space: pre-line;
}
.app-modal__list {
    margin: 0.65rem 0 0;
    padding-left: 1.15rem;
    color: #57534e;
    font-size: 0.8125rem;
    line-height: 1.55;
}
.app-modal__list li {
    margin-bottom: 0.35rem;
}
.app-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1.2rem 1.05rem;
    border-top: 1px solid #f5f5f4;
    background: #fafaf9;
}
.app-modal__footer--end {
    justify-content: flex-end;
}
.app-modal__footer--stack {
    flex-direction: column;
}
.app-modal__btn {
    padding: 0.55rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.app-modal__btn--secondary {
    background: #fff;
    border-color: #e7e5e4;
    color: #57534e;
}
.app-modal__btn--secondary:hover {
    background: #fafaf9;
    border-color: #d6d3d1;
    color: #1c1917;
}
.app-modal__btn--primary {
    background: #1c1917;
    border-color: #1c1917;
    color: #fff;
}
.app-modal__btn--primary:hover {
    background: #292524;
    border-color: #292524;
}
.app-modal__btn--danger {
    background: #be123c;
    border-color: #be123c;
    color: #fff;
}
.app-modal__btn--danger:hover {
    background: #9f1239;
    border-color: #9f1239;
}
/* 강조 확인(재작성·재생성 등) — 시안 버튼 + 진한 텍스트 */
.app-modal__btn--accent {
    background: #7dd3fc;
    border-color: #38bdf8;
    color: #0c0a09;
}
.app-modal__btn--accent:hover {
    background: #38bdf8;
    border-color: #0ea5e9;
    color: #0c0a09;
}
.app-modal__btn--block {
    width: 100%;
    justify-content: center;
    text-align: center;
}

/* 전역 확인 모달 — 다른 앱 모달보다 위 (중첩 시) */
#global-confirm-modal.app-modal {
    z-index: 560;
}

/* 소설 상세: 정보·재작성 확인 */
#info-modal-overlay.app-modal,
#rewrite-confirm-overlay.app-modal {
    z-index: 540;
}

/* 목록·리더: 브레인스토밍·챕터 재생성 */
#brainstorm-modal.app-modal,
#regen-modal-overlay.app-modal {
    z-index: 530;
}

/* ── 섹션 라벨 ──────────────────────────────────────────── */
.section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #a8a29e;
}

/* ── 전역 AI·서버 통신 표시 (fetch 패치와 연동) ───────────────── */
.ai-busy-bar {
    position: fixed;
    top: 0;
    left: 15.5rem;
    right: 0;
    z-index: 100;
    padding: 0.75rem 1.35rem;
    /* 기존 로즈·라벤더 톤 유지하되 채도·대비만 살짝 올려 한눈에 들어오게 */
    background: linear-gradient(92deg, #ffe4e6 0%, #fce7f3 42%, #e0e7ff 100%);
    border-bottom: 2px solid #fb7185;
    box-shadow:
        0 4px 18px rgba(190, 18, 60, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.65) inset;
    pointer-events: none;
    animation: aiBusyBarPresence 2.8s ease-in-out infinite alternate;
}
@keyframes aiBusyBarPresence {
    from {
        box-shadow:
            0 4px 18px rgba(190, 18, 60, 0.12),
            0 1px 0 rgba(255, 255, 255, 0.65) inset;
    }
    to {
        box-shadow:
            0 6px 22px rgba(190, 18, 60, 0.2),
            0 1px 0 rgba(255, 255, 255, 0.65) inset;
    }
}
.ai-busy-bar__inner {
    display: flex;
    align-items: center;
    justify-content: center; /* 스피너+문구 블록을 메인 영역 가로 중앙 */
    gap: 0.85rem;
    max-width: 72rem;
    margin: 0 auto;
    width: 100%;
}
.ai-busy-bar__spinner {
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    border: 3px solid #fda4af;
    border-top-color: #be123c;
    border-radius: 50%;
    animation: aiBusySpin 0.65s linear infinite;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.ai-busy-bar__text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.ai-busy-bar__text strong {
    font-size: 0.875rem;
    font-weight: 700;
    color: #881337;
    letter-spacing: -0.02em;
    line-height: 1.3;
}
.ai-busy-bar__sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: #44403c;
    line-height: 1.4;
}
@keyframes aiBusySpin {
    to { transform: rotate(360deg); }
}
@media (max-width: 900px) {
    .ai-busy-bar {
        left: 0;
        padding-left: 3.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-busy-bar {
        animation: none;
        box-shadow:
            0 4px 18px rgba(190, 18, 60, 0.14),
            0 1px 0 rgba(255, 255, 255, 0.65) inset;
    }
}

/* 통신 바가 뜰 때 메인 영역이 가려지지 않도록 (바 패딩·글자 크기 증가 반영) */
body.ai-busy-offset main {
    padding-top: 3.35rem;
    transition: padding-top 0.18s ease-out;
}

/* ── 사이드바 생성 중 알림 카드 ─────────────────────────── */
.sidebar-gen-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    text-decoration: none;
    transition: background 0.12s;
    overflow: hidden;
}
.sidebar-gen-item--link {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
    cursor: pointer;
}
.sidebar-gen-item--link:hover {
    background: #ffe4e6;
    border-color: #fda4af;
}
.sidebar-gen-item--current {
    background: #fff8f8;
    color: #c44264;
    border: 1px dashed #fda4af;
    cursor: default;
}
.sidebar-gen-spinner {
    width: 0.7rem;
    height: 0.7rem;
    flex-shrink: 0;
    border: 1.5px solid #fda4af;
    border-top-color: #e11d48;
    border-radius: 50%;
    animation: aiBusySpin 0.8s linear infinite;
}
/* 검토 대기(파이프라인 일시정지) — 회전 스피너 대신 정지 표시 */
.sidebar-gen-pause {
    width: 0.55rem;
    height: 0.7rem;
    flex-shrink: 0;
    border-left: 2.5px solid #b45309;
    border-right: 2.5px solid #b45309;
    box-sizing: content-box;
    opacity: 0.9;
}
.sidebar-gen-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.sidebar-gen-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 500;
}
