* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Pretendard', sans-serif; background: #f8fafc; color: #1e293b; line-height: 1.6; }
.header { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: white; padding: 32px 20px; position: relative; }
.header-content { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.header-titles h1 { font-size: 1.9rem; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.header-titles p { font-size: 0.95rem; opacity: 0.9; }
.auth-box { display: flex; align-items: center; gap: 10px; }
.auth-btn { background: rgba(255, 255, 255, 0.2); color: white; border: 1px solid rgba(255, 255, 255, 0.4); padding: 8px 18px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; cursor: pointer; backdrop-filter: blur(8px); transition: all 0.2s; }
.auth-btn:hover { background: rgba(255, 255, 255, 0.35); }
.user-tag { background: rgba(255, 255, 255, 0.2); padding: 8px 14px; border-radius: 10px; font-size: 0.9rem; font-weight: 600; }

.container { max-width: 1280px; margin: 20px auto 40px auto; padding: 0 20px; }
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 16px; padding: 20px; text-align: center; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); border: 1px solid #e2e8f0; }
.stat-card .num { font-size: 1.8rem; font-weight: 700; color: #4f46e5; }
.stat-card .label { font-size: 0.85rem; color: #64748b; margin-top: 4px; font-weight: 500; }

.viewer-section { background: white; border-radius: 20px; padding: 24px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; min-height: 600px; }
.viewer-nav { display: flex; gap: 8px; border-bottom: 2px solid #f1f5f9; padding-bottom: 14px; margin-bottom: 24px; overflow-x: auto; }
.tab-btn { background: none; border: none; font-size: 0.95rem; font-weight: 600; padding: 10px 20px; border-radius: 10px; cursor: pointer; color: #64748b; transition: all 0.2s; white-space: nowrap; }
.tab-btn.active { background: #e0e7ff; color: #4338ca; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* 대시보드 차트 그리드 */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-card { background: #f8fafc; border-radius: 14px; padding: 20px; border: 1px solid #e2e8f0; }
.chart-card h4 { font-size: 1.05rem; font-weight: 700; color: #1e293b; margin-bottom: 14px; }
.chart-wrapper { position: relative; height: 260px; width: 100%; }

/* 세션 뷰어 */
.session-viewer-box { display: grid; grid-template-columns: 300px 1fr; gap: 20px; border-top: 1px solid #e2e8f0; padding-top: 20px; margin-top: 10px; }
.session-list { background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; max-height: 450px; overflow-y: auto; padding: 10px; }
.session-item { padding: 12px; border-radius: 8px; cursor: pointer; margin-bottom: 6px; font-size: 0.85rem; border: 1px solid transparent; transition: all 0.2s; }
.session-item:hover { background: #e2e8f0; }
.session-item.active { background: #e0e7ff; border-color: #4f46e5; color: #3730a3; font-weight: 600; }
.chat-window { background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; padding: 16px; max-height: 450px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; }
.bubble-user { align-self: flex-end; background: #4f46e5; color: white; border-bottom-right-radius: 4px; }
.bubble-bot { align-self: flex-start; background: white; border: 1px solid #e2e8f0; color: #1e293b; border-bottom-left-radius: 4px; }
.bubble-time { font-size: 0.75rem; opacity: 0.7; margin-top: 4px; text-align: right; }

/* 문서 관리자 스타일 */
.upload-dropzone { border: 2px dashed #cbd5e1; border-radius: 16px; padding: 36px 20px; text-align: center; background: #f8fafc; cursor: pointer; transition: all 0.2s; margin-bottom: 20px; }
.upload-dropzone:hover { border-color: #4f46e5; background: #f5f3ff; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.9rem; }
.doc-table th, .doc-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.doc-table th { background: #f8fafc; font-weight: 600; color: #475569; }
.doc-table tr:hover { background: #f8fafc; }
.btn-sm { padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none; }
.btn-delete { background: #fee2e2; color: #dc2626; }
.btn-delete:hover { background: #fca5a5; color: white; }
.btn-view { background: #e0e7ff; color: #4338ca; margin-right: 6px; }
.btn-view:hover { background: #c7d2fe; }

/* 모달 */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); display: none; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal-card { background: white; width: 100%; max-width: 440px; border-radius: 20px; padding: 32px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.5rem; color: #94a3b8; cursor: pointer; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 4px; }
.form-input { width: 100%; padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 0.9rem; outline: none; }
.form-input:focus { border-color: #4f46e5; }
.login-submit-btn { width: 100%; background: #4f46e5; color: white; border: none; padding: 14px; border-radius: 10px; font-size: 0.95rem; font-weight: 700; cursor: pointer; margin-top: 10px; }
.login-submit-btn:hover { background: #4338ca; }

/* 비로그인 시 전체화면 로그인 카드 스타일 */
            .login-container { max-width: 460px; margin: 60px auto 40px auto; padding: 0 20px; }
            .login-card-main { background: white; border-radius: 24px; padding: 40px 32px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04); border: 1px solid #e2e8f0; }
            .login-card-main h2 { font-size: 1.7rem; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
            .login-card-main p { font-size: 0.95rem; color: #64748b; margin-bottom: 28px; }
            .sns-divider { display: flex; align-items: center; text-align: center; margin: 24px 0 16px 0; color: #94a3b8; font-size: 0.85rem; }
            .sns-divider::before, .sns-divider::after { content: ''; flex: 1; border-bottom: 1px solid #e2e8f0; }
            .sns-divider span { padding: 0 12px; }
            .sns-btn { width: 100%; padding: 13px; border-radius: 12px; font-size: 0.95rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; border: 1px solid transparent; transition: all 0.2s; }
            .sns-google { background: white; border-color: #cbd5e1; color: #1e293b; }
            .sns-google:hover { background: #f8fafc; }
            .sns-kakao { background: #FEE500; color: #191919; }
            .sns-kakao:hover { background: #FDD835; }
            .sns-naver { background: #03C75A; color: white; }
            .sns-naver:hover { background: #02b350; }

/* --------------------------------------------------------------------------
   시스템 프롬프트 에디터 스타일
   -------------------------------------------------------------------------- */
.prompt-editor {
    width: 100%;
    min-height: 520px;
    height: 60vh;
    padding: 16px 18px;
    font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.prompt-editor:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}