/* ===================================
   클라이언트 포털 전용 스타일
   =================================== */

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

.cp-wrapper {
    min-height: 100vh;
    background: #f0f2f5;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #2c2c2c;
}

/* ── 로딩/에러 ── */
.cp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
    color: #888;
}

.cp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #a60e16;
    border-radius: 50%;
    animation: cpSpin 0.8s linear infinite;
}

@keyframes cpSpin {
    to {
        transform: rotate(360deg);
    }
}

.cp-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    gap: 0.75rem;
}

.cp-error-icon {
    font-size: 3rem;
}

.cp-error h2 {
    color: #333;
    font-size: 1.3rem;
}

.cp-error p {
    color: #666;
    font-size: 0.95rem;
}

.cp-back-link {
    margin-top: 0.5rem;
    padding: 0.65rem 1.4rem;
    background: #a60e16;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.2s;
}

.cp-back-link:hover {
    background: #c62828;
}

/* ── 헤더 ── */
.cp-header {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.cp-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-home-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.95rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.cp-home-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.cp-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.cp-logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: #e84855;
}

.cp-header-divider {
    color: rgba(255, 255, 255, 0.2);
}

.cp-header-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ── 메인 ── */
.cp-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── 히어로 ── */
.cp-hero {
    margin-bottom: 1.75rem;
}

.cp-hero-top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.cp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.cp-dday {
    font-size: 0.8rem;
    font-weight: 700;
    color: #555;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    background: #e8e8e8;
}

.cp-dday.urgent {
    color: #c62828;
    background: #ffebee;
}

.cp-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.cp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.88rem;
    color: #666;
}

/* ── 진행률 카드 ── */
.cp-progress-card {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    padding: 1.75rem;
    background: white;
    border-radius: 18px;
    border: 1px solid #e0e0e0;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cp-progress-ring-wrap {
    position: relative;
    flex-shrink: 0;
}

.cp-progress-svg {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.cp-progress-center {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cp-progress-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
}

.cp-progress-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.4rem;
}

.cp-progress-info p {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 0.2rem;
}

/* ── 탭 ── */
.cp-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0.3rem;
    background: white;
    border-radius: 14px;
    border: 1px solid #e0e0e0;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.cp-tab {
    flex: 1;
    padding: 0.7rem 0.85rem;
    border: none;
    background: transparent;
    border-radius: 11px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #777;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.cp-tab:hover {
    background: #f5f5f5;
    color: #444;
}

.cp-tab.active {
    background: #a60e16;
    color: white;
    box-shadow: 0 2px 6px rgba(166, 14, 22, 0.25);
}

.cp-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.08);
    padding: 0 5px;
}

.cp-tab.active .cp-tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ── 섹션 ── */
.cp-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: cpFadeIn 0.25s ease;
}

@keyframes cpFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 카드 공통 */
.cp-desc-card,
.cp-log-card,
.cp-tasks-card,
.cp-files-card,
.cp-comments-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cp-desc-card h3,
.cp-log-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.cp-desc-content {
    font-size: 0.92rem;
    color: #444;
    line-height: 1.8;
}

.cp-desc-content img {
    max-width: 100%;
    border-radius: 10px;
}

/* 활동 로그 */
.cp-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-left: 0.85rem;
    border-left: 2px solid #e0e0e0;
}

.cp-log-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    padding: 0.3rem 0;
}

.cp-log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a60e16;
    flex-shrink: 0;
    margin-left: -1.06rem;
}

.cp-log-text {
    flex: 1;
    color: #444;
}

.cp-log-time {
    font-size: 0.75rem;
    color: #999;
    flex-shrink: 0;
}

/* 하위 작업 */
.cp-tasks-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.cp-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.cp-task-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.88rem;
    transition: background 0.15s;
    color: #333;
}

.cp-task-item:hover {
    background: #f5f5f5;
}

.cp-task-item.done {
    color: #999;
}

.cp-task-item.done .cp-task-text {
    text-decoration: line-through;
}

.cp-task-check {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.cp-task-text {
    flex: 1;
}

.cp-task-who {
    font-size: 0.72rem;
    color: #1565c0;
    background: #e3f2fd;
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    font-weight: 500;
}

.cp-task-date {
    font-size: 0.75rem;
    color: #888;
}

/* 첨부파일 */
.cp-files-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
}

.cp-file-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
}

.cp-file-item:hover {
    background: #f5f5f5;
}

.cp-file-icon {
    font-size: 1.4rem;
}

.cp-file-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cp-file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.cp-file-detail small {
    font-size: 0.75rem;
    color: #999;
}

.cp-file-dl {
    font-size: 1.1rem;
    color: #aaa;
    transition: color 0.15s;
}

.cp-file-item:hover .cp-file-dl {
    color: #1565c0;
}

/* ── 코멘트 ── */
.cp-comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.cp-comment {
    padding: 1rem 1.15rem;
    border-radius: 14px;
}

.cp-comment.admin {
    background: #f0f0f0;
}

.cp-comment.client {
    background: #e3f2fd;
}

.cp-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.cp-comment-author {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1a1a;
}

.cp-comment-time {
    font-size: 0.72rem;
    color: #999;
}

.cp-comment-text {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
}

.cp-no-comments {
    text-align: center;
    padding: 2.5rem;
    color: #bbb;
}

.cp-no-comments span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.6rem;
}

.cp-no-comments p {
    font-size: 0.88rem;
}

.cp-comment-form {
    padding-top: 1.25rem;
    border-top: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cp-form-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1a1a1a;
}

.cp-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cp-form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
}

.cp-comment-author-input {
    padding: 0.7rem 0.95rem;
    border: 1.5px solid #d8d8d8;
    border-radius: 12px;
    font-size: 0.88rem;
    outline: none;
    max-width: 280px;
    background: #f9fafb;
    color: #333;
    transition: all 0.2s;
}

.cp-comment-author-input:focus {
    border-color: #a60e16;
    background: white;
    box-shadow: 0 0 0 3px rgba(166, 14, 22, 0.08);
}

.cp-comment-textarea {
    width: 100%;
    padding: 0.75rem 0.95rem;
    border: 1.5px solid #d8d8d8;
    border-radius: 12px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    background: #f9fafb;
    color: #333;
    min-height: 100px;
    transition: all 0.2s;
    line-height: 1.6;
}

.cp-comment-textarea:focus {
    border-color: #a60e16;
    background: white;
    box-shadow: 0 0 0 3px rgba(166, 14, 22, 0.08);
}

.cp-comment-textarea::placeholder {
    color: #b0b0b0;
}

.cp-comment-submit {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #a60e16, #c62828);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 2px 8px rgba(166, 14, 22, 0.2);
}

.cp-comment-submit:hover {
    background: linear-gradient(135deg, #c62828, #e53935);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(166, 14, 22, 0.3);
}

.cp-comment-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── 관리자 메시지 카드 ── */
.cp-admin-message {
    display: flex;
    gap: 0.85rem;
    padding: 1.15rem 1.35rem;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border: 1px solid #c8e6c9;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    animation: cpFadeIn 0.3s ease;
}

.cp-admin-msg-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.cp-admin-msg-content strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 0.3rem;
}

.cp-admin-msg-content p {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.7;
    white-space: pre-line;
}

/* ── 푸터 ── */
.cp-footer {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #aaa;
    font-size: 0.8rem;
}

/* ══════════════════════════════════════
   다크 모드
   ══════════════════════════════════════ */
[data-theme="dark"] .cp-wrapper {
    background: #12141e;
    color: #d8d8d8;
}

[data-theme="dark"] .cp-loading {
    color: #888;
}

[data-theme="dark"] .cp-spinner {
    border-color: #333;
    border-top-color: #e84855;
}

[data-theme="dark"] .cp-error h2 {
    color: #ddd;
}

[data-theme="dark"] .cp-error p {
    color: #888;
}

[data-theme="dark"] .cp-header {
    background: linear-gradient(135deg, #0d0f18, #181b2a);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .cp-title {
    color: #eee;
}

[data-theme="dark"] .cp-meta {
    color: #999;
}

[data-theme="dark"] .cp-dday {
    background: #252840;
    color: #bbb;
}

[data-theme="dark"] .cp-dday.urgent {
    background: #3a1520;
    color: #ef5350;
}

[data-theme="dark"] .cp-progress-card {
    background: #1a1d2e;
    border-color: #2a2d42;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .cp-progress-num {
    color: #eee;
}

[data-theme="dark"] .cp-progress-info h3 {
    color: #ddd;
}

[data-theme="dark"] .cp-progress-info p {
    color: #999;
}

[data-theme="dark"] .cp-tabs {
    background: #1a1d2e;
    border-color: #2a2d42;
    box-shadow: none;
}

[data-theme="dark"] .cp-tab {
    color: #888;
}

[data-theme="dark"] .cp-tab:hover {
    background: #252840;
    color: #ccc;
}

[data-theme="dark"] .cp-tab.active {
    background: #a60e16;
    color: white;
}

[data-theme="dark"] .cp-tab-count {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .cp-desc-card,
[data-theme="dark"] .cp-log-card,
[data-theme="dark"] .cp-tasks-card,
[data-theme="dark"] .cp-files-card,
[data-theme="dark"] .cp-comments-card {
    background: #1a1d2e;
    border-color: #2a2d42;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .cp-desc-card h3,
[data-theme="dark"] .cp-log-card h3 {
    color: #ddd;
    border-bottom-color: #2a2d42;
}

[data-theme="dark"] .cp-desc-content {
    color: #bbb;
}

[data-theme="dark"] .cp-log-list {
    border-left-color: #2a2d42;
}

[data-theme="dark"] .cp-log-text {
    color: #bbb;
}

[data-theme="dark"] .cp-log-time {
    color: #666;
}

[data-theme="dark"] .cp-tasks-header {
    color: #ccc;
    border-bottom-color: #2a2d42;
}

[data-theme="dark"] .cp-task-item {
    color: #ccc;
}

[data-theme="dark"] .cp-task-item:hover {
    background: #252840;
}

[data-theme="dark"] .cp-task-item.done {
    color: #666;
}

[data-theme="dark"] .cp-task-who {
    background: #1a2a40;
    color: #64b5f6;
}

[data-theme="dark"] .cp-task-date {
    color: #777;
}

[data-theme="dark"] .cp-file-item {
    color: #ccc;
}

[data-theme="dark"] .cp-file-item:hover {
    background: #252840;
}

[data-theme="dark"] .cp-file-name {
    color: #ddd;
}

[data-theme="dark"] .cp-file-detail small {
    color: #777;
}

[data-theme="dark"] .cp-comment.admin {
    background: #1e2136;
}

[data-theme="dark"] .cp-comment.client {
    background: #1a2a3a;
}

[data-theme="dark"] .cp-comment-author {
    color: #ddd;
}

[data-theme="dark"] .cp-comment-time {
    color: #666;
}

[data-theme="dark"] .cp-comment-text {
    color: #bbb;
}

[data-theme="dark"] .cp-no-comments {
    color: #555;
}

[data-theme="dark"] .cp-comment-form {
    border-top-color: #2a2d42;
}

[data-theme="dark"] .cp-form-title {
    color: #ddd;
}

[data-theme="dark"] .cp-form-label {
    color: #888;
}

[data-theme="dark"] .cp-comment-author-input {
    background: #1e2136;
    border-color: #333660;
    color: #ddd;
}

[data-theme="dark"] .cp-comment-author-input:focus {
    background: #252840;
    box-shadow: 0 0 0 3px rgba(232, 72, 85, 0.12);
}

[data-theme="dark"] .cp-comment-textarea {
    background: #1e2136;
    border-color: #333660;
    color: #ddd;
}

[data-theme="dark"] .cp-comment-textarea:focus {
    background: #252840;
    box-shadow: 0 0 0 3px rgba(232, 72, 85, 0.12);
}

[data-theme="dark"] .cp-comment-textarea::placeholder {
    color: #555;
}

[data-theme="dark"] .cp-home-link {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .cp-admin-message {
    background: linear-gradient(135deg, #1a2e1e, #1e2e1a);
    border-color: #2a4030;
}

[data-theme="dark"] .cp-admin-msg-content strong {
    color: #66bb6a;
}

[data-theme="dark"] .cp-admin-msg-content p {
    color: #bbb;
}

[data-theme="dark"] .cp-footer {
    color: #555;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
    .cp-main {
        padding: 1.25rem;
    }

    .cp-title {
        font-size: 1.5rem;
    }

    .cp-progress-card {
        flex-direction: column;
        text-align: center;
    }

    .cp-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        gap: 0;
    }

    .cp-tabs::-webkit-scrollbar {
        display: none;
    }

    .cp-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .cp-meta {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .cp-comment-author-input {
        max-width: 100%;
    }

    .cp-comment-submit {
        width: 100%;
    }

    .cp-home-link span {
        display: none;
    }

    /* 인보이스 모바일 */
    .cp-inv-thead {
        display: none;
    }

    .cp-inv-item {
        grid-template-columns: 28px 1fr;
        gap: 0.4rem 0.6rem;
        padding: 0.85rem 0.75rem;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
        margin-bottom: 0.35rem;
    }

    .cp-inv-name-wrap {
        grid-column: 2;
    }

    .cp-inv-qty,
    .cp-inv-price,
    .cp-inv-total {
        grid-column: 2;
        text-align: left;
        font-size: 0.78rem;
    }

    .cp-inv-qty::before {
        content: '수량: ';
        font-weight: 400;
        color: #999;
    }

    .cp-inv-price::before {
        content: '단가: ';
        font-weight: 400;
        color: #999;
    }

    .cp-inv-total::before {
        content: '소계: ';
        font-weight: 400;
        color: #999;
    }

    .cp-inv-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .cp-inv-summary {
        padding: 0.85rem 1rem;
    }

    /* 리포트 모바일 */
    .cp-report-filters {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .cp-report-filters::-webkit-scrollbar {
        display: none;
    }

    .cp-report-filter {
        flex-shrink: 0;
        font-size: 0.72rem;
    }

    .cp-report-card {
        padding: 0.85rem;
    }

    .cp-report-title {
        font-size: 0.9rem;
    }

    .cp-report-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .cp-metric-value {
        font-size: 0.95rem;
    }

    .cp-report-content {
        font-size: 0.8rem;
    }
}

/* ===================================
   인보이스 섹션
   =================================== */
.cp-invoice-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e8e8e8;
}

.cp-invoice-status {
    margin-bottom: 1rem;
}

.cp-invoice-status-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.cp-invoice-status-badge.draft {
    background: #f5f5f5;
    color: #888;
}

.cp-invoice-status-badge.sent {
    background: #e3f2fd;
    color: #1565c0;
}

.cp-invoice-status-badge.paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.cp-invoice-table {
    margin-bottom: 1rem;
}

.cp-invoice-thead {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #888;
    margin-bottom: 0.25rem;
}

.cp-invoice-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    color: #333;
    border: 1.5px solid transparent;
    border-radius: 10px;
    margin-bottom: 0.2rem;
    background: linear-gradient(white, white) padding-box,
        linear-gradient(135deg, rgba(166, 14, 22, 0.12), rgba(21, 101, 192, 0.12)) border-box;
    transition: all 0.15s ease;
}

.cp-invoice-row:hover {
    background: linear-gradient(#fafafa, #fafafa) padding-box,
        linear-gradient(135deg, rgba(166, 14, 22, 0.3), rgba(21, 101, 192, 0.3)) border-box;
}

.cp-inv-subtotal {
    font-weight: 600;
    color: #1565c0;
}

.cp-invoice-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.cp-inv-sum-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    color: #666;
}

.cp-inv-sum-row.total {
    margin-top: 0.3rem;
    padding-top: 0.5rem;
    border-top: 2px solid #e0e0e0;
    font-size: 1rem;
    font-weight: 700;
    color: #c62828;
}

.cp-invoice-bank-info {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border-radius: 12px;
    border: 1px solid #c8e6c9;
}

.cp-bank-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 0.4rem;
}

.cp-bank-content {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* 인보이스 다크 모드 */
[data-theme="dark"] .cp-invoice-card {
    background: #1a1d2e;
    border-color: #2a2d42;
}

[data-theme="dark"] .cp-invoice-thead {
    background: #1e2136;
    color: #666;
}

[data-theme="dark"] .cp-invoice-row {
    color: #ccc;
    background: linear-gradient(#1a1d2e, #1a1d2e) padding-box,
        linear-gradient(135deg, rgba(232, 72, 85, 0.18), rgba(100, 181, 246, 0.18)) border-box;
}

[data-theme="dark"] .cp-invoice-row:hover {
    background: linear-gradient(#252840, #252840) padding-box,
        linear-gradient(135deg, rgba(232, 72, 85, 0.35), rgba(100, 181, 246, 0.35)) border-box;
}

[data-theme="dark"] .cp-inv-subtotal {
    color: #64b5f6;
}

[data-theme="dark"] .cp-invoice-summary {
    background: #1e2136;
}

[data-theme="dark"] .cp-inv-sum-row {
    color: #999;
}

[data-theme="dark"] .cp-inv-sum-row.total {
    border-top-color: #333660;
    color: #ef5350;
}

[data-theme="dark"] .cp-invoice-bank-info {
    background: linear-gradient(135deg, #1a2e1e, #1e2e1a);
    border-color: #2a4030;
}

[data-theme="dark"] .cp-bank-label {
    color: #66bb6a;
}

[data-theme="dark"] .cp-bank-content {
    color: #bbb;
}

/* ===================================
   리포트 섹션
   =================================== */
.cp-report-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.cp-report-filter {
    padding: 0.35rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #666;
}

.cp-report-filter:hover {
    border-color: #1565c0;
    color: #1565c0;
}

.cp-report-filter.active {
    background: #1565c0;
    color: white;
    border-color: #1565c0;
}

.cp-report-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cp-report-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.15s;
}

.cp-report-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.cp-report-card-top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.cp-report-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e3f2fd;
    color: #1565c0;
}

.cp-report-date {
    font-size: 0.78rem;
    color: #999;
}

.cp-report-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.75rem 0;
}

.cp-report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.cp-report-metric {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.cp-metric-label {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 0.2rem;
}

.cp-metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #333;
}

.cp-metric-change {
    font-size: 0.72rem;
    font-weight: 600;
    color: #888;
    margin-top: 0.15rem;
}

.cp-metric-change.up {
    color: #2e7d32;
}

.cp-metric-change.down {
    color: #c62828;
}

.cp-report-content {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.65;
    margin: 0;
    white-space: pre-wrap;
}

/* ===================================
   클라이언트 프리미엄 리포트 카드
   =================================== */

/* 접기/펼치기 리포트 카드 */
.cp-rpt-card {
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    background: #fff;
    transition: all 0.25s ease;
    overflow: hidden;
}

.cp-rpt-card:hover {
    border-color: #c0c0c0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.cp-rpt-card.open {
    border-color: #7c3aed;
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.1);
}

/* 카드 헤더 */
.cp-rpt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.cp-rpt-header:hover {
    background: #f8f9fa;
}

.cp-rpt-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.cp-rpt-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e8eaf6, #e3f2fd);
    color: #5c6bc0;
    flex-shrink: 0;
}

.cp-rpt-date {
    font-size: 0.8rem;
    color: #888;
    flex-shrink: 0;
}

.cp-rpt-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-rpt-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cp-rpt-tag {
    font-size: 0.72rem;
    color: #888;
    background: #f0f0f0;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.cp-rpt-arrow {
    font-size: 0.9rem;
    color: #999;
    transition: transform 0.3s ease;
    display: inline-block;
}

.cp-rpt-arrow.open {
    transform: rotate(180deg);
}

/* 카드 본문 */
.cp-rpt-body {
    padding: 0 1.25rem 1.25rem;
    animation: cpRptSlide 0.25s ease;
}

@keyframes cpRptSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 지표 그리드 */
.cp-rpt-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.cp-rpt-metric-card {
    background: linear-gradient(135deg, #f5f7fa, #f0f2f5);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    text-align: center;
    border: 1px solid #eee;
    transition: transform 0.15s;
}

.cp-rpt-metric-card:hover {
    transform: translateY(-2px);
}

.cp-rpt-metric-label {
    font-size: 0.72rem;
    color: #888;
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.cp-rpt-metric-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1a1a2e;
}

.cp-rpt-metric-change {
    font-size: 0.75rem;
    font-weight: 700;
    color: #888;
    margin-top: 0.15rem;
}

.cp-rpt-metric-change.up {
    color: #2e7d32;
}

.cp-rpt-metric-change.down {
    color: #c62828;
}

/* 리치 콘텐츠 영역 */
.cp-rpt-content {
    font-size: 0.88rem;
    color: #333;
    line-height: 1.8;
    overflow-x: auto;
    word-break: break-word;
}

.cp-rpt-content h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 1.25rem 0 0.6rem;
    color: #1a1a2e;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.4rem;
}

.cp-rpt-content h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    color: #2a2a4e;
}

.cp-rpt-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0.8rem 0 0.4rem;
    color: #3a3a5e;
}

.cp-rpt-content p {
    margin: 0.5rem 0;
}

.cp-rpt-content strong {
    font-weight: 700;
    color: #1a1a2e;
}

.cp-rpt-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
    border-radius: 10px;
    overflow: hidden;
}

.cp-rpt-content th {
    background: linear-gradient(135deg, #f0f2f5, #e8eaf6);
    font-weight: 700;
    color: #333;
    padding: 0.65rem 0.85rem;
    text-align: left;
    border: 1px solid #ddd;
}

.cp-rpt-content td {
    padding: 0.55rem 0.85rem;
    border: 1px solid #e8e8e8;
    color: #444;
}

.cp-rpt-content tr:nth-child(even) td {
    background: #fafafa;
}

.cp-rpt-content blockquote {
    border-left: 4px solid #7c3aed;
    margin: 1rem 0;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #f5f0ff, #f8f9ff);
    border-radius: 0 10px 10px 0;
    color: #444;
    font-style: italic;
}

.cp-rpt-content hr {
    border: none;
    border-top: 2px solid #e8e8e8;
    margin: 1.25rem 0;
}

.cp-rpt-content ul,
.cp-rpt-content ol {
    margin: 0.5rem 0;
    padding-left: 1.75rem;
}

.cp-rpt-content li {
    margin: 0.3rem 0;
}

.cp-rpt-content a {
    color: #7c3aed;
    text-decoration: underline;
}

.cp-rpt-content a:hover {
    color: #5b21b6;
}

.cp-rpt-content img {
    max-width: 100%;
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.cp-rpt-content code {
    background: #f0f0f0;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    color: #e53935;
}

/* 하단 작성일/수정일 */
.cp-rpt-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.75rem;
    color: #aaa;
}

/* 다크모드 리포트 카드 */
[data-theme="dark"] .cp-rpt-card {
    background: #1e2136;
    border-color: #2a2d42;
}

[data-theme="dark"] .cp-rpt-card:hover {
    border-color: #3a3d52;
}

[data-theme="dark"] .cp-rpt-card.open {
    border-color: #7c3aed;
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .cp-rpt-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .cp-rpt-badge {
    background: linear-gradient(135deg, #252850, #1e2a44);
    color: #7c8cf8;
}

[data-theme="dark"] .cp-rpt-title {
    color: #e0e0e0;
}

[data-theme="dark"] .cp-rpt-tag {
    background: #333660;
    color: #888;
}

[data-theme="dark"] .cp-rpt-metric-card {
    background: linear-gradient(135deg, #252840, #1e2136);
    border-color: #333;
}

[data-theme="dark"] .cp-rpt-metric-value {
    color: #e0e0e0;
}

[data-theme="dark"] .cp-rpt-content {
    color: #ccc;
}

[data-theme="dark"] .cp-rpt-content h1,
[data-theme="dark"] .cp-rpt-content h2,
[data-theme="dark"] .cp-rpt-content h3 {
    color: #e0e0e0;
}

[data-theme="dark"] .cp-rpt-content h1 {
    border-bottom-color: #333;
}

[data-theme="dark"] .cp-rpt-content strong {
    color: #e0e0e0;
}

[data-theme="dark"] .cp-rpt-content th {
    background: #252840;
    color: #ddd;
    border-color: #333;
}

[data-theme="dark"] .cp-rpt-content td {
    border-color: #333;
    color: #bbb;
}

[data-theme="dark"] .cp-rpt-content tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .cp-rpt-content blockquote {
    background: rgba(124, 58, 237, 0.1);
    color: #ccc;
}

[data-theme="dark"] .cp-rpt-content hr {
    border-top-color: #333;
}

[data-theme="dark"] .cp-rpt-content a {
    color: #a78bfa;
}

[data-theme="dark"] .cp-rpt-content code {
    background: #333660;
    color: #ef9a9a;
}

[data-theme="dark"] .cp-rpt-footer {
    border-top-color: #333;
    color: #666;
}

/* 다크모드 - 인보이스 */
[data-theme="dark"] .cp-invoice-card {
    background: #1e2136;
    border-color: #2a2d42;
}

[data-theme="dark"] .cp-invoice-thead {
    background: #252840;
    color: #888;
}

[data-theme="dark"] .cp-invoice-row {
    color: #ccc;
    border-bottom-color: #2a2d42;
}

[data-theme="dark"] .cp-inv-subtotal {
    color: #5c7cfa;
}

[data-theme="dark"] .cp-invoice-summary {
    background: #252840;
}

[data-theme="dark"] .cp-inv-sum-row {
    color: #aaa;
}

[data-theme="dark"] .cp-inv-sum-row.total {
    border-top-color: #333660;
    color: #ff6b6b;
}

[data-theme="dark"] .cp-invoice-bank-info {
    background: linear-gradient(135deg, #1a2e1a, #1e2a1a);
    border-color: #2e5530;
}

[data-theme="dark"] .cp-bank-label {
    color: #66bb6a;
}

[data-theme="dark"] .cp-bank-content {
    color: #ddd;
}

[data-theme="dark"] .cp-invoice-status-badge.draft {
    background: #252840;
    color: #888;
}

[data-theme="dark"] .cp-invoice-status-badge.sent {
    background: #1a2744;
    color: #5c7cfa;
}

[data-theme="dark"] .cp-invoice-status-badge.paid {
    background: #1a3a2a;
    color: #66bb6a;
}

/* 다크모드 - 리포트 필터 */
[data-theme="dark"] .cp-report-filter {
    background: #1e2136;
    border-color: #2a2d42;
    color: #888;
}

[data-theme="dark"] .cp-report-filter:hover {
    border-color: #5c7cfa;
    color: #5c7cfa;
}

[data-theme="dark"] .cp-report-filter.active {
    background: #1565c0;
    border-color: #1565c0;
    color: white;
}

/* ===================================
   포털 이메일 인증 화면
   =================================== */
.cp-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8ebf0 100%);
    padding: 1rem;
}

.cp-auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.cp-auth-header {
    margin-bottom: 1.5rem;
}

.cp-auth-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.cp-auth-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 0.4rem;
}

.cp-auth-header p {
    font-size: 0.88rem;
    color: #888;
    line-height: 1.5;
}

.cp-auth-project-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    background: #f0f7ff;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1565c0;
    margin-bottom: 1.5rem;
}

.cp-auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
}

.cp-auth-form label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #555;
}

.cp-auth-input {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
    font-family: inherit;
}

.cp-auth-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: white;
}

.cp-auth-code-input {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
    padding: 1rem;
}

.cp-auth-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.25);
    margin-top: 0.25rem;
}

.cp-auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.35);
}

.cp-auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cp-auth-resend {
    background: none;
    border: none;
    color: #888;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.4rem;
    transition: color 0.2s;
    text-align: center;
}

.cp-auth-resend:hover {
    color: #7c3aed;
}

.cp-auth-sent-info {
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #15803d;
    text-align: center;
}

.cp-auth-error {
    margin-top: 0.75rem;
    padding: 0.65rem 1rem;
    background: #fef2f2;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #b91c1c;
    text-align: center;
}

.cp-auth-success {
    margin-top: 0.75rem;
    padding: 0.65rem 1rem;
    background: #f0fdf4;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #15803d;
    text-align: center;
}

.cp-auth-footer {
    margin-top: 1.25rem;
    color: #bbb;
    font-size: 0.78rem;
}

/* 다크모드 인증 화면 */
[data-theme="dark"] .cp-auth-wrapper {
    background: linear-gradient(135deg, #0d0f1a 0%, #151728 100%);
}

[data-theme="dark"] .cp-auth-card {
    background: #1a1d2e;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .cp-auth-header h2 {
    color: #e0e0e0;
}

[data-theme="dark"] .cp-auth-header p {
    color: #777;
}

[data-theme="dark"] .cp-auth-project-info {
    background: #1e2a3a;
    color: #64b5f6;
}

[data-theme="dark"] .cp-auth-form label {
    color: #999;
}

[data-theme="dark"] .cp-auth-input {
    background: #252840;
    border-color: #333660;
    color: #ddd;
}

[data-theme="dark"] .cp-auth-input:focus {
    border-color: #7c3aed;
    background: #2a2d48;
}

[data-theme="dark"] .cp-auth-input::placeholder {
    color: #555;
}

[data-theme="dark"] .cp-auth-sent-info {
    background: #1a2e1a;
    color: #66bb6a;
}

[data-theme="dark"] .cp-auth-error {
    background: #2e1a1a;
    color: #ef5350;
}

[data-theme="dark"] .cp-auth-success {
    background: #1a2e1a;
    color: #66bb6a;
}

[data-theme="dark"] .cp-auth-footer {
    color: #555;
}

/* ===================================
   클라이언트 포털 채팅 대화 UI
   =================================== */
.cp-chat-container {
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: white;
}

.cp-chat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.2rem;
    background: linear-gradient(135deg, #f8f9fa, #f0f2f5);
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.92rem;
    font-weight: 700;
    color: #333;
}

.cp-chat-count {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 500;
    color: #999;
    background: #eee;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
}

.cp-chat-messages {
    padding: 1rem;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: #f5f6f8;
}

.cp-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.cp-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.cp-chat-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #bbb;
}

.cp-chat-empty span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.cp-chat-empty p {
    font-size: 0.9rem;
    margin: 0 0 0.25rem;
}

.cp-chat-empty small {
    font-size: 0.78rem;
    color: #ccc;
}

.cp-chat-bubble {
    max-width: 82%;
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    animation: cpChatIn 0.2s ease;
}

@keyframes cpChatIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cp-chat-bubble.client {
    align-self: flex-end;
    background: #e3f2fd;
    border-bottom-right-radius: 4px;
    border-right: 3px solid #42a5f5;
}

.cp-chat-bubble.admin {
    align-self: flex-start;
    background: #fce4ec;
    border-bottom-left-radius: 4px;
    border-left: 3px solid #e84855;
}

.cp-chat-bubble-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.cp-chat-avatar {
    font-size: 0.85rem;
}

.cp-chat-author {
    font-size: 0.78rem;
    font-weight: 700;
    color: #333;
}

.cp-chat-time {
    font-size: 0.68rem;
    color: #999;
    margin-left: auto;
}

.cp-chat-text {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #444;
    white-space: pre-wrap;
    word-break: break-word;
}

.cp-chat-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    padding: 0.35rem 0.65rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #1565c0;
    text-decoration: none;
    transition: background 0.15s;
}

.cp-chat-attachment:hover {
    background: rgba(0, 0, 0, 0.1);
}

.cp-chat-attachment small {
    color: #999;
}

/* 입력바 */
.cp-chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.7rem 0.9rem;
    border-top: 1px solid #e8e8e8;
    background: white;
}

.cp-chat-attach-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.cp-chat-attach-btn:hover {
    background: #f0f0f0;
}

.cp-chat-input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid #d8d8d8;
    border-radius: 12px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.45;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.cp-chat-input:focus {
    border-color: #1565c0;
    background: white;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.08);
}

.cp-chat-input::placeholder {
    color: #b0b0b0;
}

.cp-chat-send {
    padding: 0.6rem 1.1rem;
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.2);
}

.cp-chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(21, 101, 192, 0.3);
}

.cp-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cp-chat-file-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: #f0f7ff;
    border-top: 1px solid #e0e8f0;
    font-size: 0.82rem;
    color: #1565c0;
}

.cp-chat-file-preview button {
    margin-left: auto;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
}

.cp-chat-file-preview button:hover {
    color: #c62828;
}

/* 다크모드 채팅 */
[data-theme="dark"] .cp-chat-container {
    border-color: #2a2d42;
    background: #1a1d2e;
}

[data-theme="dark"] .cp-chat-header {
    background: linear-gradient(135deg, #1e2136, #252840);
    border-bottom-color: #2a2d42;
    color: #ddd;
}

[data-theme="dark"] .cp-chat-count {
    background: #333660;
    color: #888;
}

[data-theme="dark"] .cp-chat-messages {
    background: #12141e;
}

[data-theme="dark"] .cp-chat-messages::-webkit-scrollbar-thumb {
    background: #444;
}

[data-theme="dark"] .cp-chat-empty {
    color: #555;
}

[data-theme="dark"] .cp-chat-bubble.client {
    background: #1a2a3a;
    border-right-color: #42a5f5;
}

[data-theme="dark"] .cp-chat-bubble.admin {
    background: #2e1a22;
    border-left-color: #e84855;
}

[data-theme="dark"] .cp-chat-author {
    color: #ddd;
}

[data-theme="dark"] .cp-chat-time {
    color: #666;
}

[data-theme="dark"] .cp-chat-text {
    color: #bbb;
}

[data-theme="dark"] .cp-chat-attachment {
    background: rgba(255, 255, 255, 0.05);
    color: #64b5f6;
}

[data-theme="dark"] .cp-chat-input-bar {
    border-top-color: #2a2d42;
    background: #1a1d2e;
}

[data-theme="dark"] .cp-chat-attach-btn:hover {
    background: #252840;
}

[data-theme="dark"] .cp-chat-input {
    background: #1e2136;
    border-color: #333660;
    color: #ddd;
}

[data-theme="dark"] .cp-chat-input:focus {
    border-color: #5c7cfa;
    background: #252840;
}

[data-theme="dark"] .cp-chat-input::placeholder {
    color: #555;
}

[data-theme="dark"] .cp-chat-file-preview {
    background: #1e2a3a;
    border-top-color: #2a2d42;
    color: #64b5f6;
}

/* ===================================
   카카오톡 스타일 추가 요소
   =================================== */

/* 날짜 구분선 */
.cp-chat-date-sep {
    text-align: center;
    font-size: 0.72rem;
    color: #999;
    padding: 0.6rem 0;
    position: relative;
}

.cp-chat-date-sep::before,
.cp-chat-date-sep::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25%;
    height: 1px;
    background: #ddd;
}

.cp-chat-date-sep::before {
    left: 5%;
}

.cp-chat-date-sep::after {
    right: 5%;
}

/* 연속 메시지 간격 축소 */
.cp-chat-bubble.continuation {
    margin-top: -0.35rem;
    padding-top: 0.3rem;
}

/* 시간 하단 표시 */
.cp-chat-time-bottom {
    font-size: 0.66rem;
    color: #aaa;
    margin-top: 0.2rem;
    text-align: right;
}

.cp-chat-bubble.admin .cp-chat-time-bottom {
    text-align: left;
}

/* 이미지 썸네일 */
.cp-chat-img-wrap {
    display: block;
    margin-top: 0.35rem;
    border-radius: 10px;
    overflow: hidden;
    max-width: 240px;
}

.cp-chat-thumb {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s;
}

.cp-chat-thumb:hover {
    transform: scale(1.02);
}

/* 파일 미리보기 이미지 */
.cp-chat-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

/* 다크모드 추가 */
[data-theme="dark"] .cp-chat-date-sep {
    color: #666;
}

[data-theme="dark"] .cp-chat-date-sep::before,
[data-theme="dark"] .cp-chat-date-sep::after {
    background: #333;
}

[data-theme="dark"] .cp-chat-time-bottom {
    color: #555;
}
