* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Pretendard', sans-serif; background: #fff; color: #222; overflow: hidden; }

/* ── 로그인 ── */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f0f1a; }
.login-box { width: 360px; background: #fff; padding: 48px 36px 40px; border-radius: 2px; }
.login-box h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; color: #0f0f1a; letter-spacing: -0.5px; }
.login-box p { font-size: 13px; color: #aaa; margin-bottom: 32px; }
.login-box input { width: 100%; padding: 14px 16px; border: 1px solid #e0e0e0; font-size: 14px; font-family: inherit; outline: none; background: #fafafa; }
.login-box input:focus { border-color: #0f0f1a; background: #fff; }
.login-box button { width: 100%; margin-top: 14px; padding: 14px; background: #0f0f1a; color: #fff; border: none; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; letter-spacing: 1px; }
.login-box button:hover { background: #1a1a3e; }
.login-error { margin-top: 12px; font-size: 12px; color: #e74c3c; display: none; }

/* ── 프로젝트 선택 ── */
.project-page { display: none; height: 100vh; height: 100dvh; min-height: 0; background: #f7f8fa; flex-direction: column; }
.project-page.show { display: flex; }
.project-header {
    padding: 40px 48px 0; display: flex; align-items: flex-end; justify-content: space-between;
    border-bottom: 1px solid #e8e8e8; padding-bottom: 24px; background: #fff;
    flex-shrink: 0;
}
.project-header h1 { font-size: 26px; font-weight: 800; color: #0f0f1a; letter-spacing: -0.5px; }
.project-header .ph-sub { font-size: 13px; color: #999; margin-left: 12px; font-weight: 400; }
.project-header .btn-new {
    padding: 11px 28px; background: #0f0f1a; color: #fff; border: none;
    font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; letter-spacing: 0.5px;
}
.project-header .btn-new:hover { background: #1a1a3e; }
.project-grid {
    flex: 1; min-height: 0; overflow-y: auto; padding: 32px 48px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px; align-content: start; align-items: start; grid-auto-rows: max-content;
    -webkit-overflow-scrolling: touch;
}
.project-card {
    background: #fff; border: 1px solid #e8e8e8; padding: 0;
    cursor: pointer; position: relative; transition: all 0.2s;
    overflow: hidden; display: flex; flex-direction: column; min-width: 0; height: auto; align-self: start;
}
.project-card:hover { border-color: #0f0f1a; box-shadow: 0 8px 32px rgba(0,0,0,0.08); transform: translateY(-2px); }
.pc-preview {
    width: 100%; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; flex: 0 0 auto;
}
.pc-preview.c0 { background: linear-gradient(135deg, #667eea, #764ba2); }
.pc-preview.c1 { background: linear-gradient(135deg, #f093fb, #f5576c); }
.pc-preview.c2 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.pc-preview.c3 { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.pc-preview.c4 { background: linear-gradient(135deg, #fa709a, #fee140); }
.pc-preview.c5 { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.pc-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; position: absolute; inset: 0; z-index: 1; }
.pc-preview .pc-initial { font-size: 40px; font-weight: 900; color: rgba(255,255,255,0.25); letter-spacing: 2px; position: relative; z-index: 0; }
.pc-body {
    display: block; flex: 0 0 auto; min-height: 78px;
    padding: 14px 16px 15px; background: #fff; border-top: 1px solid #e8e8e8;
}
.pc-body .pc-title {
    font-size: 16px; font-weight: 800; color: #111827; margin-bottom: 7px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere;
}
.pc-body .pc-meta {
    font-size: 11.5px; color: #6b7280; display: flex; flex-wrap: wrap;
    gap: 5px 10px; line-height: 1.35; min-width: 0;
}
.pc-body .pc-meta span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card .pc-delete {
    position: absolute; top: 10px; right: 10px;
    width: 30px; height: 30px; background: rgba(0,0,0,0.4); border: none;
    color: #fff; font-size: 16px; cursor: pointer; display: none;
    align-items: center; justify-content: center; border-radius: 2px;
}
.project-card:hover .pc-delete { display: flex; }
.project-card .pc-delete:hover { background: #e74c3c; }

/* ── 에디터 ── */
.app { display: none; height: 100vh; }
.app.show { display: flex; }

.sidebar {
    width: 260px; min-width: 260px; background: #f5f5f7;
    display: flex; flex-direction: column;
    transition: margin-left 0.25s ease, opacity 0.25s ease; z-index: 10;
    border-right: 1px solid #e0e0e0;
}
.sidebar.collapsed { margin-left: -260px; opacity: 0; pointer-events: none; }

.sidebar-head {
    padding: 10px 12px; border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; gap: 8px;
}
.sidebar-head .back-btn, .sidebar-head .close-btn {
    background: none; border: none; color: #888; font-size: 14px; cursor: pointer; padding: 4px 6px; flex-shrink: 0;
}
.sidebar-head .back-btn:hover, .sidebar-head .close-btn:hover { color: #333; }
.sidebar-head .title { font-size: 12px; font-weight: 700; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.ctrl { display: flex; border-bottom: 1px solid #e0e0e0; }
.ctrl button {
    flex: 1; padding: 8px 0; background: none; color: #555; border: none;
    font-size: 11px; font-family: inherit; cursor: pointer;
    border-right: 1px solid #e0e0e0;
}
.ctrl button:last-child { border-right: none; }
.ctrl button:hover { background: rgba(0,0,0,0.04); color: #222; }
.ctrl button.active { color: #4f46e5; background: rgba(79,70,229,0.08); }

.edit-tools {
    display: flex; border-bottom: 1px solid #e0e0e0;
}
.edit-tools button {
    flex: 1; padding: 7px 0; background: none; color: #666; border: none;
    font-size: 10px; font-family: inherit; cursor: pointer;
    border-right: 1px solid #e0e0e0;
}
.edit-tools button:last-child { border-right: none; }
.edit-tools button:hover { background: rgba(0,0,0,0.04); color: #222; }

/* 슬라이드 썸네일 */
.slide-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.slide-thumb {
    position: relative; background: #eee; border: 2px solid transparent;
    cursor: pointer; width: 100%; aspect-ratio: 16/9; overflow: hidden;
    transition: border-color 0.12s; flex-shrink: 0;
}
.slide-thumb:hover { border-color: rgba(79,70,229,0.4); }
.slide-thumb.active { border-color: #4f46e5; }
.slide-thumb canvas, .slide-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #fff; }
.slide-thumb .thumb-num {
    position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,0.55);
    color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px;
}
.slide-thumb .thumb-actions {
    position: absolute; top: 2px; right: 2px; display: none; gap: 2px;
}
.slide-thumb:hover .thumb-actions { display: flex; }
.thumb-actions button {
    width: 20px; height: 20px; background: rgba(0,0,0,0.5); border: none;
    color: #fff; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.thumb-actions button:hover { background: rgba(0,0,0,0.75); }

.slide-add-btn {
    width: 100%; aspect-ratio: 16/9; flex-shrink: 0;
    background: rgba(0,0,0,0.02); border: 2px dashed #ccc;
    color: #999; font-size: 11px; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.slide-add-btn:hover { background: rgba(0,0,0,0.04); color: #555; border-color: #4f46e5; }

.sidebar-foot { display: flex; border-top: 1px solid #e0e0e0; }
.sidebar-foot button {
    flex: 1; padding: 8px 4px; background: none; color: #666; border: none;
    font-size: 10px; font-family: inherit; cursor: pointer;
    border-right: 1px solid #e0e0e0;
}
.sidebar-foot button:last-child { border-right: none; }
.sidebar-foot button:hover { background: rgba(0,0,0,0.04); color: #222; }

.main { flex: 1; min-width: 0; min-height: 0; position: relative; background: #e8eaed; display: flex; flex-direction: column; overflow: hidden; }
.main iframe { flex: 1; width: 100%; border: none; background: #fff; }

.open-btn {
    position: fixed; top: 8px; left: 8px; z-index: 20;
    width: 32px; height: 32px; background: rgba(0,0,0,0.06); border: 1px solid #ddd;
    color: #666; font-size: 16px; cursor: pointer;
    display: none; align-items: center; justify-content: center;
}
.open-btn:hover { background: #fff; color: #222; border-color: #bbb; }
.sidebar.collapsed ~ .main .open-btn { display: flex; }

.app.present .sidebar { margin-left: -260px; opacity: 0; pointer-events: none; }
.app.present .open-btn { display: none !important; }

.dl-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; color: #fff; font-size: 14px;
}

.slide-thumb.dragging { opacity: 0.4; }
.slide-thumb.drop-target { border-color: #f59e0b; }

/* ── AI 플로팅 채팅창 ── */
.ai-panel {
    position: fixed; z-index: 60;
    width: 460px; height: 580px; min-width: 320px; min-height: 360px;
    bottom: 20px; right: 20px;
    background: #1a1a2e; color: #e0e0e0;
    display: none; flex-direction: column;
    border: 1px solid #3a3a5a; border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    font-family: 'Pretendard', sans-serif;
    overflow: hidden; resize: both;
}
.ai-panel.show { display: flex; }
.ai-panel.files-open { width: 700px; }
.ai-files-toggle:hover { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.ai-panel.files-open .ai-files-toggle { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.ai-body { display: flex; flex: 1; overflow: hidden; }
.ai-chat-area { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* 참고파일 패널 — 채팅창 안 왼쪽 */
.ai-files-panel {
    width: 0; overflow: hidden; background: #16162a; border-right: 1px solid #2a2a4a;
    display: flex; flex-direction: column; transition: width 0.2s; flex-shrink: 0;
}
.ai-panel.files-open .ai-files-panel { width: 240px; }
.ai-files-head {
    padding: 10px 12px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #2a2a4a; font-size: 13px; font-weight: 700; color: #e0e0e0; flex-shrink: 0;
}
.ai-files-list { flex: 1; overflow-y: auto; padding: 4px; }
.ai-files-info { padding: 8px 10px; font-size: 11px; color: #888; border-top: 1px solid #2a2a4a; flex-shrink: 0; }

#aiImageToggle { border-color: #10b981; color: #6ee7b7; }
#aiImageToggle:hover { background: rgba(16,185,129,0.2); }
#aiImageToggle.active { background: #10b981; color: #fff; border-color: #10b981; }
#aiAuthRefresh { display: none; border-color: #f59e0b; color: #fbbf24; }
#aiAuthRefresh.visible { display: inline-flex; align-items: center; justify-content: center; }
#aiAuthRefresh:hover { background: rgba(245,158,11,0.2); }
.ai-auth-card {
    align-self: stretch; max-width: 100%;
    display: flex; flex-direction: column; gap: 8px;
}
.ai-auth-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-auth-actions button, .ai-auth-actions a {
    min-height: 30px; padding: 5px 10px; border-radius: 5px;
    border: 1px solid #4f46e5; background: #4f46e5; color: #fff;
    font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer;
    font-family: inherit;
}
.ai-auth-actions button.secondary {
    background: #2a2a4a; color: #c7d2fe; border-color: #6366f1;
}
.ai-auth-code-row { display: flex; gap: 6px; }
.ai-auth-code-row input {
    flex: 1; min-width: 0; height: 32px; padding: 6px 8px;
    border-radius: 5px; border: 1px solid #3a3a5a;
    background: #16162a; color: #fff; font-size: 12px;
}
.ai-auth-code-row button {
    min-width: 48px; height: 32px; padding: 0 10px;
    border-radius: 5px; border: 0; background: #6366f1;
    color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
    font-family: inherit;
}
.ai-file-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer;
    border-radius: 4px; font-size: 12px; color: #ccc; margin-bottom: 2px;
}
.ai-file-item:hover { background: #2a2a4a; color: #fff; }
.ai-file-item.selected { background: #4f46e5; color: #fff; }
.ai-file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-item .file-dl { display: none; color: #6366f1; font-size: 14px; cursor: pointer; flex-shrink: 0; text-decoration: none; }
.ai-file-item .file-del { display: none; color: #f87171; font-size: 14px; cursor: pointer; flex-shrink: 0; }
.ai-file-item:hover .file-dl, .ai-file-item:hover .file-del { display: block; }
.ai-files-toggle {
    padding: 4px 12px; background: #2a2a4a; border: 1px solid #6366f1; color: #a5b4fc;
    font-size: 11px; font-weight: 700; font-family: inherit; cursor: pointer; border-radius: 4px;
}

.ai-panel-head {
    display: flex; align-items: center; padding: 10px 14px;
    background: #16162a; border-bottom: 1px solid #2a2a4a;
    gap: 8px; flex-shrink: 0; cursor: grab; user-select: none;
}
.ai-panel-head:active { cursor: grabbing; }
.ai-panel-head .ai-logo {
    width: 24px; height: 24px; border-radius: 5px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.ai-panel-head .ai-title { font-size: 14px; font-weight: 700; color: #fff; flex: 1; }
.ai-panel-head .ai-close {
    background: none; border: none; color: #888; font-size: 18px;
    cursor: pointer; padding: 2px 6px; flex-shrink: 0;
}
.ai-panel-head .ai-close:hover { color: #fff; }

.ai-messages {
    flex: 1; overflow-y: auto; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.ai-msg {
    max-width: 90%; padding: 10px 14px; border-radius: 8px;
    font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.ai-msg.user {
    align-self: flex-end; background: #6366f1; color: #fff; border-bottom-right-radius: 2px;
}
.ai-msg.assistant {
    align-self: flex-start; background: #2a2a4a; color: #e0e0e0; border-bottom-left-radius: 2px;
}
.ai-msg.system {
    align-self: center; background: rgba(99,102,241,0.15); color: #a5a5c0;
    font-size: 13px; padding: 6px 12px; border-radius: 6px;
}
.ai-msg .apply-btn {
    margin-top: 6px; padding: 4px 12px;
    background: #6366f1; color: #fff; border: none;
    font-size: 11px; font-weight: 700; cursor: pointer;
    border-radius: 4px; font-family: inherit;
}
.ai-msg .apply-btn:hover { background: #4f46e5; }

.ai-input-area {
    display: flex; flex-direction: column; padding: 10px 14px; gap: 6px;
    background: #16162a; border-top: 1px solid #2a2a4a; flex-shrink: 0;
}
.ai-attach-preview {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-attach-preview:empty { display: none; }
.ai-attach-item {
    position: relative; width: 56px; height: 56px; border-radius: 6px;
    overflow: hidden; border: 1px solid #3a3a5a; background: #2a2a4a;
    display: flex; align-items: center; justify-content: center;
}
.ai-attach-item img { width: 100%; height: 100%; object-fit: cover; }
.ai-attach-item .ai-attach-pdf {
    font-size: 10px; color: #f87171; font-weight: 700; text-align: center;
    line-height: 1.3; padding: 2px;
}
.ai-attach-item .ai-attach-pdf .pdf-icon { font-size: 20px; display: block; }
.ai-attach-item .ai-attach-remove {
    position: absolute; top: -2px; right: -2px; width: 18px; height: 18px;
    background: #ef4444; color: #fff; border: none; border-radius: 50%;
    font-size: 11px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; line-height: 1; padding: 0;
}
.ai-input-row {
    display: flex; gap: 6px; align-items: flex-end;
}
.ai-attach-btn {
    width: 36px; height: 36px; background: #2a2a4a; border: 1px solid #3a3a5a;
    color: #888; font-size: 18px; cursor: pointer; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
}
.ai-attach-btn:hover { border-color: #6366f1; color: #6366f1; }
.ai-input-row textarea {
    flex: 1; padding: 9px 13px; background: #2a2a4a; border: 1px solid #3a3a5a;
    color: #fff; font-size: 14px; font-family: inherit; resize: none;
    border-radius: 6px; outline: none; min-height: 40px; max-height: 100px;
}
.ai-input-row textarea::placeholder { color: #666; }
.ai-input-row textarea:focus { border-color: #6366f1; }
.ai-input-row button.ai-send-btn {
    padding: 0 16px; height: 40px; background: #6366f1; color: #fff; border: none;
    font-size: 13px; font-weight: 700; cursor: pointer; border-radius: 6px;
    font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.ai-input-row button.ai-send-btn:hover { background: #4f46e5; }
.ai-input-row button.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-panel.drag-over::after {
    content: '파일을 놓으세요'; position: absolute; inset: 0; z-index: 10;
    background: rgba(99,102,241,0.85); color: #fff; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; border-radius: 12px;
    pointer-events: none;
}
.ai-msg.user .ai-msg-attachments {
    display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px;
}
.ai-msg.user .ai-msg-attachments img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(255,255,255,0.2);
}
.ai-msg.user .ai-msg-attachments .msg-pdf-badge {
    display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px;
    background: rgba(255,255,255,0.15); border-radius: 4px; font-size: 10px; color: #fca5a5;
}

	.ai-loading {
	    display: inline-flex; align-items: center; gap: 4px; padding: 6px 0;
	}
.ai-loading span {
    width: 5px; height: 5px; background: #6366f1; border-radius: 50%;
    animation: aiBounce 1.2s infinite ease-in-out;
}
.ai-loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading span:nth-child(3) { animation-delay: 0.4s; }
	@keyframes aiBounce {
	    0%, 80%, 100% { transform: scale(0); }
	    40% { transform: scale(1); }
	}
	.ai-progress {
	    min-width: 210px; max-width: 100%;
	    display: flex; flex-direction: column; gap: 7px;
	}
	.ai-progress-head {
	    display: flex; align-items: center; gap: 8px;
	    color: #f5f5ff; font-weight: 800;
	}
	.ai-progress-head .ai-loading { padding: 0; flex-shrink: 0; }
	.ai-progress-title {
	    min-width: 0; overflow-wrap: anywhere;
	}
	.ai-progress-detail {
	    font-size: 12px; line-height: 1.5; color: #b8b8d4;
	}
	.ai-progress-meta {
	    display: flex; flex-wrap: wrap; gap: 5px;
	}
	.ai-progress-chip {
	    padding: 3px 7px; border-radius: 4px;
	    background: rgba(99,102,241,0.16); border: 1px solid rgba(99,102,241,0.28);
	    color: #c7d2fe; font-size: 10.5px; font-weight: 700;
	}
	.ai-progress-bar {
	    position: relative; height: 3px; overflow: hidden;
	    background: rgba(99,102,241,0.18); border-radius: 999px;
	}
	.ai-progress-bar span {
	    position: absolute; top: 0; bottom: 0; left: -40%;
	    width: 40%; background: #6366f1; border-radius: inherit;
	    animation: aiProgressSweep 1.35s ease-in-out infinite;
	}
	@keyframes aiProgressSweep {
	    0% { transform: translateX(0); }
	    100% { transform: translateX(350%); }
	}

/* ── 허브 (로그인 직후 슬라이드/보고서 분기) ── */
.hub-page { display: none; height: 100vh; height: 100dvh; min-height: 0; background: #f7f8fa; flex-direction: column; }
.hub-page.show { display: flex; }
.hub-head {
    padding: 28px 48px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #e8e8e8; background: #fff; flex-shrink: 0;
}
.hub-head .hub-title { font-size: 22px; font-weight: 800; color: #0f0f1a; letter-spacing: -0.5px; }
.hub-head .hub-sub { font-size: 12px; color: #999; margin-left: 12px; font-weight: 400; }
.hub-head .hub-logout {
    padding: 9px 18px; background: #fff; color: #555; border: 1px solid #ddd;
    font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.hub-head .hub-logout:hover { color: #0f0f1a; border-color: #0f0f1a; }
.hub-grid {
    flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center;
    gap: 32px; padding: 40px 24px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.hub-card {
    width: 360px; height: 480px; cursor: pointer;
    display: flex; flex-direction: column; padding: 0;
    text-align: left; font-family: inherit; border: none;
    color: #fff; position: relative; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.hub-card[data-target="slide"]  { background: #4f46e5; }
.hub-card[data-target="report"] { background: #0e7490; }
.hub-card:hover { transform: translateY(-6px); box-shadow: 0 22px 50px rgba(15, 15, 26, 0.24); }
.hub-card-mockwrap {
    height: 340px; padding: 22px 26px 0;
    display: flex; align-items: stretch; justify-content: center;
    box-sizing: border-box;
}
.hub-card[data-target="slide"] .hub-card-mockwrap {
    flex-direction: column; gap: 14px; align-items: center;
}
.hub-card-text {
    height: 140px; padding: 18px 26px 22px; box-sizing: border-box;
    display: flex; flex-direction: column; justify-content: center;
}
.hub-card-mark {
    font-size: 10.5px; color: rgba(255, 255, 255, 0.65);
    font-weight: 700; letter-spacing: 2px; margin-bottom: 8px;
}
.hub-card-label { font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -0.5px; margin-bottom: 6px; }
.hub-card-meta {
    font-size: 12px; color: rgba(255, 255, 255, 0.78); line-height: 1.55;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── 슬라이드 미리보기 mockup (16:9 × 2장 위아래) ── */
.slide-mock {
    width: 260px; aspect-ratio: 16 / 9; background: #fff;
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
    padding: 11px 13px; box-sizing: border-box;
    color: #1e1b4b;
    display: flex; flex-direction: column;
    transform: translateY(6px); transition: transform 0.2s;
}
.hub-card:hover .slide-mock { transform: translateY(0); }
.hub-card:hover .slide-mock:nth-child(2) { transform: translateY(-2px); }

/* 표지 슬라이드 */
.slide-mock.cover { justify-content: center; align-items: flex-start; padding: 14px 18px; }
.slide-mock.cover .slide-mock-bar { width: 28px; height: 3px; background: #4f46e5; margin-bottom: 8px; }
.slide-mock.cover .slide-mock-title { font-size: 13px; font-weight: 800; color: #1e1b4b; letter-spacing: -0.3px; line-height: 1.15; }
.slide-mock.cover .slide-mock-sub   { font-size: 7.5px; color: #64748b; margin-top: 4px; font-weight: 600; }
.slide-mock.cover .slide-mock-org   { font-size: 7px; color: #4f46e5; font-weight: 700; margin-top: 10px; letter-spacing: 0.5px; }

/* 본문 KPI + 차트 슬라이드 */
.slide-mock.body .slide-mock-bar { width: 24px; height: 2.5px; background: #4f46e5; }
.slide-mock.body .slide-mock-title { font-size: 9px; font-weight: 800; color: #1e1b4b; margin-top: 4px; line-height: 1.15; }
.slide-mock-chart {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 6px; height: 38px; margin-top: 5px; padding: 0 4px;
    border-bottom: 1px solid #e2e8f0;
}
.slide-mock-chart-bar {
    flex: 1; background: #4f46e5; border-radius: 1px 1px 0 0; position: relative;
}
.slide-mock-chart-bar::after {
    content: attr(data-q); position: absolute; bottom: -9px; left: 0; right: 0;
    text-align: center; font-size: 5.5px; color: #94a3b8; font-weight: 700;
}
.slide-mock-chart-bar.faded { background: #c7d2fe; }
.slide-mock-kpis  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 14px; }
.slide-mock-kpi   { background: #eef2ff; border-top: 2px solid #4f46e5; padding: 3px 5px; }
.slide-mock-kpi-num { font-size: 8.5px; font-weight: 800; color: #4f46e5; line-height: 1; }
.slide-mock-kpi-lab { font-size: 5px; color: #475569; margin-top: 1px; font-weight: 600; }
.slide-mock-foot  { display: flex; gap: 3px; justify-content: space-between; align-items: center; margin-top: 4px; }
.slide-mock-foot-tag { font-size: 5.5px; color: #94a3b8; font-weight: 700; letter-spacing: 0.5px; }
.slide-mock-foot-dots { display: flex; gap: 2.5px; }
.slide-mock-foot-dots span { width: 3.5px; height: 3.5px; background: #cbd5e1; border-radius: 50%; }
.slide-mock-foot-dots span.on { background: #4f46e5; }

/* ── 한글 보고서 mockup (A4 세로 — 카드 가득) ── */
.report-mock {
    width: 240px; aspect-ratio: 1 / 1.414; background: #fff;
    box-shadow: 0 14px 28px rgba(0,0,0,0.22);
    padding: 14px 16px 12px; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 5px;
    color: #1f2937; transform: translateY(6px); transition: transform 0.2s;
    overflow: hidden;
}
.hub-card:hover .report-mock { transform: translateY(0); }
.report-mock-boxhead {
    border-top: 2px solid #0f172a; border-bottom: 2px solid #0f172a;
    padding: 5px 4px; text-align: center;
    font-size: 8px; font-weight: 800; color: #0f172a; letter-spacing: 0.3px;
}
.report-mock-box {
    font-size: 7.5px; font-weight: 700; color: #0f172a; margin-top: 3px;
}
.report-mock-circle {
    font-size: 6.5px; color: #334155; padding-left: 8px; line-height: 1.4;
}
.report-mock-star {
    font-size: 6px; color: #64748b; padding-left: 16px; line-height: 1.4;
}
.report-mock-table {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
    border: 1px solid #0f172a; margin-top: 3px;
}
.report-mock-table > div {
    border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1;
    height: 9px; font-size: 5.5px; padding: 1px 3px;
    display: flex; align-items: center; color: #475569;
}
.report-mock-table > div:nth-child(-n+4) {
    background: #0f172a; color: #fff; font-weight: 700; border-bottom-color: #0f172a;
}
.report-mock-table > div:nth-child(4n) { border-right: none; }
.report-mock-table > div:nth-last-child(-n+4) { border-bottom: none; }

/* ── 보고서 목록 (project-page 와 동일 톤) ── */
.report-page { display: none; height: 100vh; height: 100dvh; min-height: 0; background: #f7f8fa; flex-direction: column; }
.report-page.show { display: flex; }
.report-grid {
    flex: 1; min-height: 0; overflow-y: auto; padding: 32px 48px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px; align-content: start; align-items: start; grid-auto-rows: max-content;
    -webkit-overflow-scrolling: touch;
}
.report-card {
    background: #fff; border: 1px solid #e8e8e8; padding: 0;
    cursor: pointer; position: relative; transition: all 0.2s; overflow: hidden;
    display: flex; flex-direction: column; min-width: 0; height: auto; align-self: start;
}
.report-card:hover { border-color: #6366f1; box-shadow: 0 8px 32px rgba(0,0,0,0.08); transform: translateY(-2px); }
.report-card .rc-preview {
    width: 100%; aspect-ratio: 16 / 9; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
    border-bottom: 1px solid #e8e8e8; flex: 0 0 auto;
}
.report-card .rc-preview.ready { background: #eef2ff; color: #6366f1; }
.report-card .rc-body { padding: 14px 16px 15px; min-height: 78px; background: #fff; }
.report-card .rc-title {
    font-size: 16px; font-weight: 800; color: #111827; margin-bottom: 7px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere;
}
.report-card .rc-meta { font-size: 11.5px; color: #6b7280; line-height: 1.35; overflow-wrap: anywhere; }
.report-card .rc-delete {
    position: absolute; top: 10px; right: 10px;
    width: 30px; height: 30px; background: rgba(0,0,0,0.4); border: none;
    color: #fff; font-size: 16px; cursor: pointer; display: none;
    align-items: center; justify-content: center;
}
.report-card:hover .rc-delete { display: flex; }
.report-card .rc-delete:hover { background: #e74c3c; }

/* ── 보고서 뷰 (A4 백지 + 우측 AI 채팅) ── */
.report-app { display: none; height: 100vh; background: #ececf0; flex-direction: column; }
.report-app.show { display: flex; }
.report-head {
    padding: 12px 24px; display: flex; align-items: center; gap: 14px;
    background: #fff; border-bottom: 1px solid #e0e0e0;
}
.report-head .ra-back {
    background: none; border: none; color: #555; font-size: 16px; cursor: pointer;
    padding: 6px 10px; font-family: inherit;
}
.report-head .ra-back:hover { color: #0f0f1a; }
.report-head .ra-title {
    font-size: 14px; font-weight: 700; color: #0f0f1a; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.report-head .ra-status { font-size: 11px; color: #999; font-weight: 600; }
.report-head .ra-status.ready { color: #16a34a; }
.report-head .ra-status.error { color: #e74c3c; }
.report-head .ra-download {
    padding: 8px 16px; background: #0f0f1a; color: #fff; border: none;
    font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.report-head .ra-download:disabled { background: #cbd5e1; color: #fff; cursor: not-allowed; }
.report-head .ra-download:not(:disabled):hover { background: #1a1a3e; }
.report-body {
    flex: 1; display: flex; overflow: hidden;
}
.report-paper-area {
    flex: 1; overflow-y: auto; padding: 40px;
    display: flex; align-items: flex-start; justify-content: center;
}
.report-paper {
    width: 794px; max-width: 100%; min-height: 1123px;
    background: #fff; box-shadow: 0 6px 30px rgba(15,15,26,0.08);
    padding: 80px 70px; box-sizing: border-box;
    color: #475569; font-size: 13px; line-height: 1.7;
}
.report-paper-empty {
    color: #cbd5e1; font-size: 14px; text-align: center; padding: 200px 0;
    letter-spacing: 0.5px;
}

/* ── 보고서 생성 모달 ── */
#newReportOverlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
    align-items: center; justify-content: center;
}
#newReportForm {
    width: 520px; max-height: 90vh; background: #fff;
    display: flex; flex-direction: column; border: 1px solid #0f0f1a; overflow: hidden;
}
#newReportForm .nr-head {
    padding: 18px 24px; border-bottom: 1px solid #e8e8e8;
    display: flex; align-items: center; justify-content: space-between;
}
#newReportForm .nr-head-title { font-size: 16px; font-weight: 800; color: #0f0f1a; }
#newReportForm .nr-body { padding: 18px 24px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
#newReportForm label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #555; font-weight: 700; }
#newReportForm input[type="text"], #newReportForm input[type="file"] {
    padding: 10px 12px; border: 1px solid #ddd; font-size: 14px; font-family: inherit; outline: none;
}
#newReportForm input[type="text"]:focus { border-color: #6366f1; }
#newReportForm .nr-hint { font-size: 11px; color: #999; line-height: 1.55; }
#newReportForm .nr-error { font-size: 12px; color: #e74c3c; display: none; }
#newReportForm .nr-foot {
    padding: 14px 24px; border-top: 1px solid #e8e8e8;
    display: flex; justify-content: flex-end; gap: 8px;
}
#newReportForm .nr-cancel { padding: 9px 18px; background: #fff; color: #666; border: 1px solid #ddd; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; }
#newReportForm .nr-submit { padding: 9px 22px; background: #0f0f1a; color: #fff; border: none; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; }
#newReportForm .nr-submit:disabled { background: #cbd5e1; cursor: not-allowed; }

/* 보고서 모드: A4 영역 우측 가장자리에 채팅 패널이 떠있을 자리 비워둠 */
.report-app.show .report-paper-area { padding-right: 480px; }

/* ═══════════ 모바일 (≤768px) — 데스크톱 동작에는 영향 없음 ═══════════ */
@media (max-width: 768px) {
    /* 로그인 */
    html, body { height: 100%; overflow: hidden; }
    .login-box { width: calc(100vw - 32px); max-width: 360px; padding: 36px 24px 32px; }

    /* 허브 */
    .hub-page, .project-page, .report-page { height: 100vh; height: 100dvh; min-height: 0; }
    .hub-head {
        padding: 16px 14px; gap: 10px; align-items: center;
    }
    .hub-head .hub-title { font-size: 19px; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
    .hub-head .hub-sub { display: block; margin-left: 0; margin-top: 3px; }
    .hub-head .hub-logout { flex-shrink: 0; padding: 8px 12px; }
    .hub-grid {
        flex-direction: column; justify-content: flex-start; align-items: stretch;
        padding: 14px; gap: 14px;
    }
    .hub-card {
        width: 100%; height: auto; min-height: 0; flex-shrink: 0;
    }
    .hub-card-mockwrap {
        height: auto; min-height: 178px; padding: 16px 16px 0;
        align-items: center; overflow: hidden;
    }
    .hub-card[data-target="slide"] .hub-card-mockwrap {
        flex-direction: row; gap: 10px; justify-content: center;
    }
    .slide-mock { width: min(42vw, 154px); }
    .report-mock { width: min(62vw, 176px); }
    .hub-card-text {
        height: auto; min-height: 104px; padding: 15px 18px 17px;
        justify-content: center;
    }
    .hub-card-label { font-size: 22px; }
    .hub-card-meta { white-space: normal; overflow: visible; text-overflow: clip; }

    /* 프로젝트 선택 */
    .project-header {
        padding: 14px 12px 12px; flex-direction: column; align-items: stretch; gap: 10px;
    }
    .project-header h1 { font-size: 21px; line-height: 1.2; }
    .project-header .ph-sub { margin-left: 0; font-size: 12px; }
    .project-header > div:first-child { justify-content: space-between; align-items: center !important; min-width: 0; }
    .project-header > div:last-child {
        display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px; width: 100%;
    }
    .project-header .btn-new {
        width: 100%; min-width: 0; min-height: 38px; padding: 0 10px;
        font-size: 12px; flex: none; white-space: nowrap;
    }
    .project-grid, .report-grid {
        min-height: 0; padding: 12px; gap: 12px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .project-card, .report-card { min-width: 0; }
    .pc-preview, .report-card .rc-preview { width: 100%; aspect-ratio: 16 / 9; }
    .pc-body, .report-card .rc-body { min-height: 72px; padding: 10px 10px 11px; }
    .pc-body .pc-title, .report-card .rc-title {
        font-size: 13px; line-height: 1.35; margin-bottom: 5px;
    }
    .pc-body .pc-meta, .report-card .rc-meta { font-size: 10.5px; line-height: 1.35; }
    .pc-body .pc-meta { gap: 3px 6px; flex-direction: column; align-items: flex-start; }
    .project-card .pc-delete, .report-card .rc-delete {
        display: flex; width: 28px; height: 28px; top: 6px; right: 6px;
        background: rgba(0,0,0,0.55);
    }

    /* 모바일 모달 */
    #newProjectOverlay, #newReportOverlay, #designGuidePasteOverlay, .backup-overlay {
        padding: 12px; align-items: flex-start !important; overflow-y: auto;
    }
    #newProjectForm, #newReportForm, #designGuidePasteOverlay > div, .backup-modal {
        width: calc(100vw - 24px) !important;
        max-width: 560px; max-height: calc(100dvh - 24px) !important;
    }
    #newProjectForm > div, #newReportForm .nr-body { padding-left: 16px !important; padding-right: 16px !important; }
    #designGuideProjectGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

    /* 에디터: 사이드바를 오버레이 드로어로 전환 */
    .app.show { position: relative; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        width: 260px; min-width: 260px; height: 100vh; height: 100dvh;
        z-index: 50; box-shadow: 2px 0 16px rgba(0,0,0,0.25);
    }
    .sidebar.collapsed { margin-left: -280px; opacity: 0; pointer-events: none; }

    /* 메인 영역: 풀폭 (iframe 스케일은 viewer.js setupCanvasFit 가 inline style 로 처리) */
    .main { width: 100%; overflow: hidden; }

    /* 햄버거 버튼: 항상 표시(사이드바 열려있을 땐 사이드바가 덮음) */
    .open-btn {
        display: flex !important;
        top: 8px; left: 8px;
        width: 36px; height: 36px; font-size: 18px;
        background: rgba(255,255,255,0.95); border-color: #ccc;
    }
    /* 발표 모드에서는 기존 규칙대로 숨김 */
    .app.present .open-btn { display: none !important; }

    /* 사이드바 열렸을 때 밖 어두운 백드롭(뒤 탭 영역 구분 명확화) */
    .sidebar:not(.collapsed)::after {
        content: ''; position: fixed; left: 260px; top: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.35); z-index: -1;
    }

    /* 모바일에서 불필요한 버튼 숨김: 다운로드 2행 + 포인터 */
    .sidebar-foot { display: none !important; }
    #tbLaser { display: none !important; }
    /* 상단 ctrl 에 발표만 남기면 공간 어색 → 남은 발표 버튼이 row 를 꽉 채움 */
    .ctrl #tbPresent { border-right: none; }

    /* 슬라이드 썸네일: 사이드바 안 스크롤 드로어 — 현재 flex 구조 그대로 잘 작동 */
    .slide-list { padding: 10px; gap: 8px; }

    /* AI 패널: 거의 풀스크린 */
    .ai-panel {
        width: calc(100vw - 16px) !important; height: calc(100vh - 24px) !important;
        max-width: none; min-width: 0; min-height: 0;
        left: 8px; right: 8px; top: 12px; bottom: 12px;
        border-radius: 10px; resize: none;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .ai-panel-head { cursor: default; padding: 10px 12px; }
    .ai-panel-head .ai-title { font-size: 13px; }
    .ai-panel-head .ai-files-toggle { padding: 4px 8px; font-size: 10px; }

    /* 참고파일 드로어: 채팅 옆이 아니라 채팅 위를 덮도록 */
    .ai-panel.files-open {
        width: calc(100vw - 16px) !important;
    }
    .ai-files-panel {
        position: absolute; inset: 48px 0 0 0; z-index: 2;
        width: 0; border-right: none;
    }
    .ai-panel.files-open .ai-files-panel {
        width: 100%;
    }

    /* 메시지/입력 영역 소폭 조정 */
    .ai-messages { padding: 10px 12px; gap: 8px; }
    .ai-msg { max-width: 94%; font-size: 14px; padding: 9px 12px; }
    .ai-input-area { padding: 8px 10px; }
    .ai-input-row textarea { min-height: 42px; max-height: 120px; padding: 10px 12px; }
    .ai-input-row button.ai-send-btn { height: 42px; padding: 0 14px; }
    .ai-attach-btn { width: 38px; height: 38px; font-size: 18px; }
    .ai-attach-item { width: 48px; height: 48px; }
}

@media (max-width: 340px) {
    .project-grid, .report-grid { grid-template-columns: 1fr; }
    .hub-card[data-target="slide"] .hub-card-mockwrap { flex-direction: column; }
    .slide-mock { width: min(72vw, 210px); }
}
