/* =============================================
   FreeMode Main Stylesheet
   - Variables: _variables.css
   - Components: _components.css
   - Responsive: _responsive.css
   - Modals: _modals.css
   ============================================= */

/* MyPage Sample View */
.mp-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--ref-bg-base);
    padding: 32px;
}

.table-freemode tr:last-child td {
    border-bottom: none;
}

.table-freemode tr:hover td {
    background-color: var(--k-bg-gray-light);
}

/* Modal styles moved to _modals.css */

/* New Project Card (Dashed) */
.card-freemode.new-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--k-color-slate-300);
    background-color: transparent;
    cursor: pointer;
    min-height: 220px;
    /* Match other cards approx height */
    transition: var(--k-transition-fast);
}

.card-freemode.new-project:hover {
    border-color: var(--k-text-gray);
    background-color: var(--k-bg-white);
    transform: translateY(-2px);
    box-shadow: var(--k-shadow-hover);
}


.card-freemode.new-project p {
    font-weight: 700;
    color: var(--k-text-gray);
    margin: 0;
}

.card-freemode.new-project:hover p {
    color: var(--ref-ink);
}


/* Sidebar / Navigation */
.sidebar-freemode {
    width: var(--k-sidebar-width);
    background-color: var(--k-bg-white);
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100%;
    min-height: 500px;
    border-right: 1px solid var(--fm-color-border);
    box-shadow: none;
    transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-toggle-row {
    display: none;
}

.sidebar-collapse-btn {
    border: none;
    background-color: transparent;
    color: var(--k-color-indigo-500);
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-collapse-btn:hover {
    color: var(--ref-accent-blue);
}

.sidebar-collapse-btn__icon {
    display: block;
    width: 30px;
    height: 30px;
    background-color: currentColor;
    -webkit-mask: url('/images/icons/sidebar.png') center / contain no-repeat;
    mask: url('/images/icons/sidebar.png') center / contain no-repeat;
    mask-mode: luminance;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.sidebar-collapse-btn:focus-visible {
    outline: 2px solid var(--k-color-indigo-500);
    outline-offset: 2px;
}

.sidebar-brand {
    font-family: var(--k-font-primary);
    font-size: 29px;
    font-weight: 600;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ref-ink);
    text-decoration: none;
}

/* 헤더 로고 텍스트 공통 스타일 */
.freemode-logo-text {
    display: inline-block;
    font-family: var(--fm-font-family);
    font-size: inherit;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.4;
}

.freemode-logo-img {
    text-decoration: none; 
    color: inherit; 
    display: flex; 
    align-items: center; 
    gap: 8px;
    font-size: 20px;
    margin-bottom: 0px;
}

.freemode-logo-img img {
    width: 43px;
    height: 43px;
}

.sidebar-brand span:not(.freemode-logo-text) {
    color: var(--k-text-gray);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 사이드바 상단 메뉴 영역: 하단 고정 메뉴를 제외한 메뉴만 스크롤한다. */
.sidebar-main-menu {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

/* 사이드바 하단 메뉴 영역: 공지사항과 문의하기 메뉴를 아래쪽에 고정한다. */
.sidebar-bottom-menu {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 16px;
    border-top: var(--k-border-light);
}

/* 메뉴 상태 변경 시 테두리 두께를 유지하고 색상과 접기 여백만 전환한다. */
.nav-item-freemode {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 12px 8px;
    border-radius: var(--fm-radius-small);
    font-size: 15px;
    font-weight: 400;
    color: var(--k-text-gray);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, padding 0.2s ease;
    border: 1px solid transparent;
}

.nav-item-freemode:hover {
    background-color: var(--k-bg-gray-light);
    color: var(--ref-ink);
}

/* 키보드 포커스는 메뉴 크기에 영향을 주지 않는 공통 디자인으로 표시한다. */
.nav-item-freemode:focus-visible {
    outline: 3px solid var(--fm-color-primary-soft);
    outline-offset: 2px;
}

.nav-item-freemode.active {
    background-color: var(--k-bg-indigo-soft);
    color: var(--k-text-sidebar-black);
    font-weight: 600;
    border-radius: var(--fm-radius-small);
    padding-left: 8px;
    box-shadow: none;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 13px;
    font-size: 18px;
    width: 20px;
    min-width: 20px;
    color: var(--k-text-gray);
}

.nav-icon img {
    opacity: 0.55;
}

.nav-label {
    white-space: nowrap;
}

/* 최근 등록된 공지사항 N 뱃지를 사이드바 메뉴에 표시한다. */
.sidebar-notice-link {
    position: relative;
}

.sidebar-notice-new-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border-radius: var(--fm-radius-pill);
    background: var(--fm-color-danger);
    color: var(--fm-color-surface);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.nav-item-freemode.active .nav-icon {
    color: var(--k-text-sidebar-black);
}

.nav-item-freemode.active .nav-icon img {
    opacity: 1;
}

/* Range Slider */
.range-freemode {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: transparent;
    border: none;
    border-radius: var(--k-radius-sm);
    outline: none;
    margin: 10px 0;
}

.range-freemode::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--k-bg-white);
    border: 2px solid var(--ref-accent-orange);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--k-transition-fast);
    margin-top: -6px;
    box-shadow: 0 0 0 0 var(--k-overlay-point-00);
}

.range-freemode::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px var(--k-overlay-point-10);
}

.range-freemode::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: linear-gradient(to right, var(--ref-accent-orange) 0%, var(--ref-accent-orange) var(--slider-progress, 0%), var(--k-color-gray-e0) var(--slider-progress, 0%), var(--k-color-gray-e0) 100%);
    border-radius: var(--k-radius-sm);
    border: none;
}

.range-freemode::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--k-bg-white);
    border: 2px solid var(--ref-accent-orange);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--k-transition-fast);
    box-shadow: 0 0 0 0 var(--k-overlay-point-00);
}

.range-freemode::-moz-range-thumb:hover {
    box-shadow: 0 0 0 4px var(--k-overlay-point-10);
}

.range-freemode::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: var(--k-color-gray-e0);
    border-radius: var(--k-radius-sm);
    border: none;
}

.range-freemode::-moz-range-progress {
    height: 8px;
    background: var(--ref-accent-orange);
    border-radius: var(--k-radius-sm);
    border: none;
}

.range-freemode:focus {
    outline: none;
}

.range-freemode:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px var(--k-overlay-point-20);
}

/* Dashboard Layout Styles */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--ref-bg-base);
    max-width: 1920px;
    margin: 0 auto;
}

.app-main {
    display: flex;
    flex: 1;
    margin-top: 60px;
    /* Fixed Header Height */
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--k-sidebar-width);
    /* Fixed Sidebar Width - Gap removed */
    padding: 20px var(--fm-content-desktop-gutter) 24px;
    min-width: 0;
    overflow-y: auto;
    height: calc(100vh - 60px);
    /* app-content는 세로 스크롤 동작은 유지하고 스크롤바 UI만 숨긴다. */
    -ms-overflow-style: none;
    scrollbar-width: none;
    transition: margin-left 0.2s ease;
}

/* 전역 스크롤바 화살표 버튼: 협업 화면 전체에서 브라우저 기본 위/아래 버튼을 상태별 선택자까지 포함해 숨긴다. */
*::-webkit-scrollbar-button,
*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:vertical:decrement,
*::-webkit-scrollbar-button:vertical:increment,
*::-webkit-scrollbar-button:horizontal:decrement,
*::-webkit-scrollbar-button:horizontal:increment {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* app-content 세로 스크롤바 영역만 숨긴다. */
.app-content::-webkit-scrollbar {
    width: 0;
}

/* app-content 세로 스크롤바 영역만 숨긴다. */
.app-content::-webkit-scrollbar:vertical {
    width: 0;
}

/* Sidebar Specific Override for Layout */
.app-main .sidebar-freemode {
    position: fixed;
    top: 60px;
    left: 0;
    width: var(--k-sidebar-width);
    height: calc(100vh - 60px);
    overflow-y: hidden;
    z-index: var(--k-z-sticky);
    background-color: var(--k-bg-white);
    padding-bottom: 20px;
}

@media (min-width: 1024px) {
    .sidebar-toggle-row {
        display: flex;
        justify-content: flex-end;
        margin-top: -12px;
    }

    .sidebar-collapsed .app-main .sidebar-freemode {
        width: var(--k-sidebar-collapsed-width);
        padding-left: 12px;
        padding-right: 12px;
    }

    .sidebar-collapsed .app-content {
        margin-left: var(--k-sidebar-collapsed-width);
    }

    /* 축소 상태에서 토글 버튼을 메뉴 아이콘과 같은 기준으로 가운데 정렬한다. */
    .sidebar-collapsed .sidebar-freemode .sidebar-toggle-row {
        justify-content: center;
        margin-top: -12px;
        margin-bottom: 0;
    }

    /* 축소 상태에서 토글 버튼의 크기와 정렬을 메뉴 아이템과 동일한 흐름으로 맞춘다. */
    .sidebar-collapsed .sidebar-freemode .sidebar-collapse-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        padding: 0;
        margin-bottom: 4px;
    }

    /* 축소 상태에서는 동일한 사이드바 이미지를 반대 방향으로 표시한다. */
    .sidebar-collapsed .sidebar-freemode .sidebar-collapse-btn__icon {
        transform: rotate(180deg);
    }

    .sidebar-collapsed .sidebar-freemode .nav-item-freemode {
        justify-content: center;
        padding-left: 12px;
        padding-right: 12px;
    }

    .sidebar-collapsed .sidebar-freemode .nav-icon {
        margin-right: 0;
    }

    .sidebar-collapsed .sidebar-freemode .nav-label {
        display: none;
    }

    /* 축소 상태에서도 공지사항 아이콘 우측 상단에 N 뱃지를 유지한다. */
    .sidebar-collapsed .sidebar-freemode .sidebar-notice-new-badge {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 14px;
        height: 14px;
        margin-left: 0;
        font-size: 9px;
    }

}


/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--k-bg-white);
    padding: 0 32px;
    position: fixed;
    top: 0;
    left: 0;
    height: 60px;
    z-index: var(--k-z-overlay);
    border-bottom: 1px solid var(--fm-color-border);
    box-shadow: none;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
}

.dashboard-header-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* 헤더 프로필 버튼의 정렬과 상호작용 영역을 정의한다. */
.header-profile-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

/* 헤더 프로필 이름의 글자 위계를 정의한다. */
.header-profile-name {
    margin: 0;
    color: var(--fm-color-text-primary);
    font-size: var(--fm-font-size-body-large);
    font-weight: 500;
    letter-spacing: var(--fm-letter-spacing-ui);
}

/* 헤더 프로필 펼침 아이콘의 크기와 전환 효과를 정의한다. */
.profile-chevron {
    color: var(--fm-color-text-primary);
    font-size: var(--fm-font-size-caption);
    transition: transform 0.2s ease;
}

.home-header .header-content .header-actions {
    align-self: flex-end;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* 헤더 프로필 드롭다운의 공통 위치와 표면을 정의한다. */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--k-bg-white);
    border: var(--k-border-thin);
    border-radius: var(--k-radius-md);
    box-shadow: var(--k-shadow-box);
    padding: 0;
    z-index: var(--k-z-overlay);
    display: none;
    margin-top: 10px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-dropdown {
    width: 160px;
}

.profile-dropdown.active {
    display: block;
}

/* Profile Chevron Icon */
.profile-chevron {
    transition: transform 0.2s ease;
}

.profile-chevron.rotated {
    transform: rotate(180deg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--ref-ink);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 14px;
}

.dropdown-item:hover {
    background-color: var(--k-bg-blue);
}

.dropdown-item.logout:hover {
    background-color: var(--k-bg-pink);
}

.stat-label {
    font-size: 14px;
    color: var(--k-text-gray);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* --- Utility Classes for Dashboard --- */

/* 5. Empty State */
.empty-state-freemode {
    text-align: center;
    padding: 48px;
    border: 1px dashed var(--k-border-light-color);
    border-radius: var(--k-radius-lg);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-panel.active {
    display: block;
}

/* task-panel만 특별히 flex 레이아웃 적용 */
.tab-panel#task-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

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

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

.card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: var(--k-font-primary);
}

.contact-icon-box {
    width: 45px;
    height: 45px;
    border-radius: var(--k-radius-xl);
    background-color: var(--k-bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--ref-ink);
    flex-shrink: 0;
    border: var(--k-border-gray);
    box-shadow: var(--k-shadow-box);
}

/* Icon specific colors */
.contact-icon-box.purple {
    background-color: var(--k-bg-blue-pale);
}

.contact-icon-box.pink {
    background-color: var(--k-bg-pink-pale);
}

.contact-icon-box.orange {
    background-color: var(--k-bg-orange-pale);
}


/* Form Specifics */
.label-freemode {
    display: block;
    font-weight: 500;
    color: var(--ref-ink);
    font-size: 14px;
}

.form-group-freemode {
    margin-bottom: 24px;
}

.textarea-freemode {
    resize: none;
    padding: 8px;
    min-height: 200px;
}

/* Contact icon box variants */
.contact-icon-box.google {
    background: white;
    border: 1px solid var(--k-border-color);
    color: var(--k-color-blue-google-500);
    box-shadow: none;
}

.contact-icon-box.mail {
    background: var(--k-bg-purple);
    color: white;
    border: none;
    box-shadow: none;
}

.contact-icon-box.security {
    background: var(--k-bg-pink);
    color: var(--ref-accent-orange);
    box-shadow: none;
}

.contact-icon-box.blue {
    background: var(--k-bg-blue);
    color: var(--ref-accent-yellow);
    box-shadow: none;
}

/* Icon size utilities */
.icon-md {
    font-size: 24px;
}

/* Button variants */
.btn-freemode.full {
    width: 100%;
    justify-content: center;
}

.btn-freemode.muted {
    color: grey;
    border-color: grey;
}

/* Card Row Layout (Horizontal with right action) */
.card-freemode.row-layout {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
}

.card-freemode.row-layout .row-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 24px;
    flex: 1;
    /* Take available space */
    min-width: 0;
    /* Prevent flex overflow */
}

.card-freemode.row-layout .row-action {
    flex-shrink: 0;
    /* Prevent button shrinking */
    display: flex;
    align-items: center;
}

/* Static Card (No Hover Effect) */
.card-freemode.static {
    border: none !important;
}

.card-freemode.static:hover {
    transform: none !important;
    box-shadow: none !important;
    /* Resets to default border/shadow if any */
    animation: none !important;
}

/* --- Merged Unique Styles from Bottom --- */
/* 화면 매뉴얼 버튼: 기존 톤을 유지하면서 보조 액션으로 표시한다. */
.screen-manual-help-btn {
    width: 28px;
    height: 28px;
    border: var(--k-border-thin);
    border-radius: 50%;
    background: var(--k-bg-white);
    color: var(--ref-gray-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--k-transition-fast);
}

/* 화면 매뉴얼 버튼 상태: 마우스와 키보드 접근 시 식별 가능하게 한다. */
.screen-manual-help-btn:hover,
.screen-manual-help-btn:focus {
    background: var(--k-bg-gray-light);
    color: var(--ref-ink);
}

/* 화면 매뉴얼 버튼 포커스: 키보드 사용자의 현재 위치를 표시한다. */
.screen-manual-help-btn:focus-visible {
    outline: 2px solid var(--ref-accent-blue);
    outline-offset: 2px;
}

/* 화면 매뉴얼 모달 위치: 화면 왼쪽 상단 기준으로 여백을 둔다. */
.screen-manual-modal {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 50px 0 0 50px;
    box-sizing: border-box;
}

/* 화면 매뉴얼 모달: 안내 내용을 읽기 좋은 너비로 제한한다. */
.screen-manual-modal .screen-manual-modal-container {
    max-width: 640px;
    max-height: calc(100vh - 100px);
}

/* 화면 매뉴얼 이미지 영역: 화면 구성 샘플을 모달 상단에 배치한다. */
.screen-manual-visual {
    flex-shrink: 0;
    width: 100%;
    border: var(--k-border-light);
    border-radius: var(--k-radius-md);
    background: var(--k-bg-gray-light);
    overflow: hidden;
}

/* 화면 매뉴얼 이미지: 모달 폭에 맞춰 비율을 유지한다. */
.screen-manual-visual img {
    display: block;
    width: 100%;
    height: auto;
}

/* 화면 매뉴얼 본문: 내용이 많을 때 본문 영역만 스크롤한다. */
.screen-manual-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    max-height: calc(100vh - 230px);
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--k-text-body);
}

/* 화면 매뉴얼 섹션: 정보 블록을 시각적으로 구분한다. */
.screen-manual-section {
    padding-bottom: 16px;
    border-bottom: var(--k-border-light);
}

/* 화면 매뉴얼 마지막 섹션: 불필요한 구분선을 제거한다. */
.screen-manual-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

/* 화면 매뉴얼 섹션 제목: 모달 내부 정보 계층을 표시한다. */
.screen-manual-section-title {
    font-size: var(--fm-font-size-label);
    font-weight: 600;
    color: var(--ref-ink);
    margin: 0 0 8px;
}

/* 화면 매뉴얼 설명문: 본문 가독성을 유지한다. */
.screen-manual-text {
    margin: 0;
    color: var(--ref-gray-700);
    line-height: 1.6;
}

/* 화면 매뉴얼 목록: 안내 항목을 간결하게 정렬한다. */
.screen-manual-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ref-gray-700);
    line-height: 1.7;
}

/* 화면 매뉴얼 목록 항목: 항목 사이의 읽기 간격을 확보한다. */
.screen-manual-list li + li {
    margin-top: 4px;
}

/* 화면 매뉴얼 모바일 위치: 작은 화면에서는 가장자리 여백을 줄인다. */
@media (max-width: 768px) {
    .screen-manual-modal {
        padding: 16px;
    }

    .screen-manual-modal .screen-manual-modal-container {
        width: 100%;
        max-height: calc(100dvh - 32px);
    }

    /* 화면 매뉴얼 모바일 본문: 작은 화면에서는 헤더와 푸터를 제외한 영역만 스크롤한다. */
    .screen-manual-modal-body {
        max-height: calc(100dvh - 170px);
    }
}

/* Hide icons for inactive tabs */
.tab-link-freemode:not(.active) .icon {
    display: none;
}

.loading-text {
    margin-top: 16px;
    font-family: var(--k-font-primary);
    font-size: 15px;
    color: var(--ref-ink);
    font-weight: 400;
}

/* ===== Customer Pipeline View (영업 파이프라인) ===== */

.status-badge.lead {
    background: var(--k-overlay-violet-10);
    color: var(--customer-lead);
}

.status-badge.proposal {
    background: var(--k-overlay-amber-10);
    color: var(--k-color-warning);
}

.status-badge.contract {
    background: var(--k-overlay-blue-10);
    color: var(--ref-accent-blue);
}

.status-badge.active {
    background: var(--k-overlay-emerald-10);
    color: var(--ref-accent-green);
}

.status-badge.completed {
    background: var(--k-overlay-slate-500-10);
    color: var(--customer-completed);
}

.status-badge.dormant {
    background: var(--k-overlay-slate-400-10);
    color: var(--k-color-gray-9c);
}

.status-change-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-change-modal-group {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
}

.status-change-modal-label {
    flex: 0 0 92px;
    margin-bottom: 0;
}

.status-change-modal-current {
    display: flex;
    align-items: center;
    flex: 1;
    min-height: 42px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

.status-change-modal-select {
    flex: 1;
    min-width: 0;
}

/* =============================================
   메모 인라인 편집 스타일
   ============================================= */

.memo-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.memo-view-content {
    white-space: pre-wrap;
    color: var(--k-text-gray);
    line-height: 1.5;
    font-size: 14px;
    padding: 8px 4px;
    border-radius: 8px;
    min-height: 40px;
    transition: background-color 0.15s;
}

.memo-edit-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.memo-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* =============================================
   팔로업(후속 조치) 스타일
   ============================================= */

/* 팔로업 리스트 */
.followup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
}

.followup-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--k-radius-md);
    border: 1px solid var(--k-border-color-light);
    background: var(--k-bg-white);
    transition: var(--k-transition-fast);
}

.followup-item:hover {
    border-color: var(--ref-accent-blue);
    box-shadow: var(--k-shadow-hover2);
}

.followup-item.overdue {
    border-left: 3px solid var(--ref-accent-orange-soft);
    background: var(--ref-accent-orange-bg-soft);
}

.followup-item.today {
    border-left: 3px solid var(--k-color-warning);
    background: var(--k-bg-warning-soft);
}

.followup-item.upcoming {
    border-left: 3px solid var(--ref-accent-yellow);
}

.followup-item.completed {
    opacity: 0.72;
    border-left: 3px solid var(--ref-accent-green);
}

.followup-item.cancelled {
    opacity: 0.5;
}

/* 취소 상태에서는 제목 텍스트에만 취소선을 적용한다. */
.followup-item.cancelled .followup-title {
    text-decoration: line-through;
}

/* 팔로업 콘텐츠 */
.followup-content {
    flex: 1;
    min-width: 0;
}

.followup-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--k-text-body);
    margin-bottom: 4px;
}

.followup-desc {
    font-size: 13px;
    color: var(--ref-gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.followup-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--k-radius-sm);
    background: transparent;
    color: var(--ref-gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--k-transition-fast);
}

.followup-action-btn:hover {
    background: var(--k-bg-gray-light);
    color: var(--k-text-body);
}

.followup-action-btn.complete:hover {
    color: var(--ref-accent-green);
}

.followup-action-btn.cancel:hover {
    color: var(--ref-accent-orange-soft);
}

.followup-action-btn.delete:hover {
    color: var(--ref-accent-orange-soft);
}

/* 팔로업 빈 상태 */
.followup-empty {
    text-align: center;
    padding: 24px;
    color: var(--ref-gray-700);
    font-size: 14px;
}

/* ===== 통합 타임라인 (Phase 4) ===== */
.timeline-filter-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.timeline-filter-btn {
    padding: 6px 11px;
    border: 1px solid var(--k-border-color-light);
    border-radius: var(--k-radius-pill);
    background: var(--k-bg-white);
    color: var(--ref-gray-700);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--k-transition-fast);
}

.timeline-filter-btn:hover {
    background: var(--k-bg-gray-light);
    color: var(--k-text-body);
}

.timeline-filter-btn.active {
    background: var(--k-text-body);
    color: var(--k-bg-white);
    border-color: var(--ref-accent-yellow);
}

/* 타임라인 아이템 */
.unified-timeline {
    position: relative;
    padding-left: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.unified-timeline::before {
    content: none;
}

.timeline-item {
    position: relative;
    padding: 0 0 18px 20px;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 14px;
    bottom: -2px;
    width: 1px;
    background: var(--k-border-color);
}

.timeline-dot {
    position: absolute;
    left: -14px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--k-border-color);
    background: var(--k-bg-white);
}

/* 타임라인 본문 영역을 내용 뒤에 날짜가 이어지도록 배치한다. */
.timeline-body {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

/* 타임라인 본문 행을 좌측 내용 영역으로 유연하게 배치한다. */
.timeline-main-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.timeline-dot.STATUS {
    border-color: var(--customer-lead);
    background: var(--customer-lead);
}

.timeline-dot.FOLLOWUP {
    border-color: var(--ref-accent-green);
    background: var(--ref-accent-green);
}

.timeline-dot.PROJECT {
    border-color: var(--k-color-warning);
    background: var(--k-color-warning);
}

.timeline-dot.SETTLEMENT {
    border-color: var(--ref-accent-green);
    background: var(--ref-accent-green);
}

.timeline-type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--k-radius-sm);
    line-height: 1.5;
    vertical-align: top;
    flex-shrink: 0;
}

.timeline-type-badge.STATUS {
    background: var(--k-bg-violet-soft-strong);
    color: var(--k-color-violet-700);
}

.timeline-type-badge.FOLLOWUP {
    background: var(--k-bg-green-soft-strong);
    color: var(--k-color-emerald-800);
}

.timeline-type-badge.PROJECT {
    background: var(--k-bg-warning-soft-strong);
    color: var(--k-color-amber-800);
}

.timeline-type-badge.SETTLEMENT {
    background: var(--k-bg-green-soft-strong);
    color: var(--k-color-emerald-700);
}

.timeline-content-text {
    font-size: 14px;
    font-weight: 400;
    color: var(--k-text-body);
    line-height: 1.4;
    word-break: break-word;
    display: inline-block;
    vertical-align: top;
}

/* 타임라인 날짜를 본문 내용 바로 뒤에 한 줄로 표시한다. */
.timeline-date {
    font-size: 12px;
    font-weight: 400;
    color: var(--ref-gray-700);
    margin-top: 0;
    padding-left: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

.timeline-amount {
    font-weight: 700;
    color: var(--ref-accent-green);
}

/* 타임라인 더보기 */
.timeline-load-more {
    text-align: center;
    padding: 12px;
}

.timeline-empty {
    text-align: center;
    padding: 24px;
    color: var(--ref-gray-700);
    font-size: 14px;
}

/* ============================================
   프로젝트 정보 요약 (3열 그리드)
   ============================================ */
.project-info-summary-titles {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    width: 100%;
    margin-bottom: 0;
}

.project-info-summary-titles .info-section-title {
    margin: 0 0 12px 0;
}

.project-info-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 24px;
}

.info-card-summary {
    background: var(--k-bg-white);
    border: var(--k-border-light);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-radius: var(--k-radius-md);
}

.info-card-summary .info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0;
}

.info-card-summary .info-label {
    font-weight: 500;
    color: var(--k-text-gray);
    font-size: 14px;
    min-width: auto;
}

.info-card-summary .info-value {
    font-weight: 400;
    color: var(--ref-ink);
    font-size: 14px;
    text-align: right;
}

.amount-highlight {
    color: var(--ref-accent-orange) !important;
    font-weight: 600 !important;
}

/* 프로젝트 내용 / 메모사항 섹션 */
.info-section {
    background: var(--k-bg-white);
    border: var(--k-border-light);
    border-radius: var(--k-radius-md);
    padding: 20px 24px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 24px;
}

.info-section-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--ref-ink);
    margin: 0 0 12px 0;
}

.info-section .info-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
}

.info-section .info-label {
    min-width: 120px;
    font-weight: 500;
    color: var(--k-text-gray);
    font-size: 14px;
}

.info-section .info-value {
    font-weight: 400;
    color: var(--ref-ink);
    font-size: 14px;
    text-align: left;
    flex: 1;
}

.info-section .info-text {
    color: var(--ref-ink);
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
    white-space: pre-wrap;
}

/* 반응형: 모바일 */
@media (max-width: 1023px) {
    .project-info-summary {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .info-card-summary:first-child {
        border-radius: var(--k-radius-md) var(--k-radius-md) 0 0;
    }

    .info-card-summary:last-child {
        border-radius: 0 0 var(--k-radius-md) var(--k-radius-md);
    }

    .info-section .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-section .info-label {
        min-width: auto;
    }
}

/* ============================================
   계약서 관리 섹션
   ============================================ */
.contract-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contract-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--k-border-color-light);
    border-radius: var(--k-radius-md);
    cursor: pointer;
    transition: var(--k-transition-fast);
}

.contract-item:hover {
    background: var(--fm-color-primary-soft);
    border-color: var(--ref-accent-yellow);
}

.contract-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--k-text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
    max-width: 260px;
    min-width: 0;
}

.contract-meta {
    font-size: 12px;
    color: var(--ref-gray-700);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    flex-shrink: 0;
}

.contract-empty {
    text-align: center;
    color: var(--ref-gray-700);
    font-size: 14px;
    padding: 24px 0;
}

/* 타임라인 계약서 스타일 */
.timeline-dot.CONTRACT { border-color: var(--ref-accent-yellow); background: var(--k-bg-indigo-soft); }
/* 타임라인 계약서 뱃지 대비를 높여 가독성을 개선한다. */
.timeline-type-badge.CONTRACT { background: var(--k-status-warning-bg); color: var(--k-text-body); }

/* ============================================
   계약서 모달 2단 레이아웃
   ============================================ */
.contract-modal-wide {
    width: 75%;
    max-width: 1400px;
    max-height: 92vh;
}

.contract-modal-body {
    padding: 0 !important;
    overflow: hidden !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.contract-modal-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* 좌측 설정 패널 */
.contract-left-panel {
    width: 410px;
    min-width: 380px;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--k-border-color);
    background: var(--fm-color-surface);
}

.contract-left-panel .form-group {
    margin-bottom: 12px;
}

.contract-left-panel .form-label {
    font-size: 12px;
    margin-bottom: 3px;
}

.contract-left-panel .input-freemode {
    font-size: 13px;
    padding: 6px 10px;
}

/* 계약서 메타 필드 영역 */
.contract-meta-fields {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--k-border-color);
}

/* 변수 그룹 (접힘/펼침) */
.var-group {
    border: 1px solid var(--k-border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--k-bg-white);
}

.var-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--fm-color-canvas);
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.var-group-header:hover {
    background: var(--k-bg-hover);
}

.var-group-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--k-text-body);
}

.var-group-header-left i {
    width: 16px;
    text-align: center;
    color: var(--ref-accent-yellow);
    font-size: 12px;
}

.var-group-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.var-group-autofill {
    padding: 6px 8px !important;
    font-size: 10px !important;
    border-radius: 4px !important;
    line-height: 1.4;
}

.var-group-toggle {
    font-size: 11px;
    color: var(--ref-gray-700);
    transition: transform 0.2s;
    width: 16px;
    text-align: center;
}

.var-group.collapsed .var-group-toggle {
    transform: rotate(-90deg);
}

.var-group-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.var-group.collapsed .var-group-body {
    display: none;
}

/* 변수 입력 필드 */
.var-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.var-field .form-group {
    flex: 1;
    margin-bottom: 0 !important;
}

.var-field .var-label {
    font-size: 11px;
    color: var(--ref-gray-700);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.var-insert-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--k-border-color);
    border-radius: 4px;
    background: var(--k-bg-white);
    color: var(--ref-ink);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
    margin-top: 14px;
}

.var-insert-btn:hover {
    background: var(--ref-accent-yellow);
    color: var(--k-bg-white);
    border-color: var(--ref-accent-yellow);
}

/* 에디터 내 변수 칩 */
.ql-variable-chip {
    display: inline-block;
    padding: 1px 6px;
    margin: 0 2px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 400;
    line-height: inherit;
    vertical-align: baseline;
    background: var(--k-bg-blue-soft-google);
    color: var(--k-color-blue-google);
    border: 1px solid var(--k-color-blue-soft-border);
    cursor: default;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.ql-variable-chip.has-value {
    background: var(--k-bg-green-soft-50);
    color: var(--k-color-green-850);
    border-color: var(--k-color-mint-border);
}

/* 계약서 에디터 호환 class 표시 스타일 */
.note-editable .ql-align-left,
.contract-body .ql-align-left {
    text-align: left;
}

.note-editable .ql-align-center,
.contract-body .ql-align-center {
    text-align: center;
}

.note-editable .ql-align-right,
.contract-body .ql-align-right {
    text-align: right;
}

.note-editable .ql-align-justify,
.contract-body .ql-align-justify {
    text-align: justify;
}

.note-editable .ql-size-small,
.contract-body .ql-size-small {
    font-size: 0.75em;
}

.note-editable .ql-size-large,
.contract-body .ql-size-large {
    font-size: 1.5em;
}

.note-editable .ql-size-huge,
.contract-body .ql-size-huge {
    font-size: 2.5em;
}

.note-editable .ql-font-serif,
.contract-body .ql-font-serif {
    font-family: serif;
}

.note-editable .ql-font-monospace,
.contract-body .ql-font-monospace {
    font-family: monospace;
}

.note-editable .ql-direction-rtl,
.contract-body .ql-direction-rtl {
    direction: rtl;
}

.note-editable .ql-indent-1,
.contract-body .ql-indent-1 {
    padding-left: 3em;
}

.note-editable .ql-indent-2,
.contract-body .ql-indent-2 {
    padding-left: 6em;
}

.note-editable .ql-indent-3,
.contract-body .ql-indent-3 {
    padding-left: 9em;
}

.note-editable .ql-indent-4,
.contract-body .ql-indent-4 {
    padding-left: 12em;
}

.note-editable .ql-indent-5,
.contract-body .ql-indent-5 {
    padding-left: 15em;
}

.note-editable .ql-indent-6,
.contract-body .ql-indent-6 {
    padding-left: 18em;
}

.note-editable .ql-indent-7,
.contract-body .ql-indent-7 {
    padding-left: 21em;
}

.note-editable .ql-indent-8,
.contract-body .ql-indent-8 {
    padding-left: 24em;
}

/* 우측 에디터 패널 */
.contract-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--k-bg-white);
}

.contract-editor-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--k-border-color);
    background: var(--fm-color-surface);
    flex-shrink: 0;
}

.contract-editor-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--k-text-body);
}

.contract-editor-hint {
    font-size: 12px;
    color: var(--ref-gray-700);
}

/* 계약 분쟁 관련 안내 문구를 줄바꿈하고 강조 색상으로 표시한다. */
.contract-editor-warning {
    flex-basis: 100%;
    color: var(--ref-accent-orange);
}

/* Summernote 에디터 커스텀 */
.contract-right-panel .note-editor {
    border: none !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.contract-right-panel .note-toolbar {
    border-bottom: 1px solid var(--k-border-color) !important;
    background: var(--fm-color-surface);
    padding: 6px 12px !important;
    flex-shrink: 0;
}

.contract-right-panel .note-editing-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.contract-right-panel .note-editable {
    flex: 1;
    height: auto !important;
    overflow-y: auto;
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.4;
}

.contract-right-panel .note-editable h1,
.contract-right-panel .note-editable h2,
.contract-right-panel .note-editable h3,
.template-edit-right-panel .note-editable h1,
.template-edit-right-panel .note-editable h2,
.template-edit-right-panel .note-editable h3 {
    font-weight: 400;
}

.contract-right-panel .note-editable h1,
.template-edit-right-panel .note-editable h1 {
    font-size: 20px;
    margin-bottom: 12px;
}

.contract-right-panel .note-editable h2,
.template-edit-right-panel .note-editable h2 {
    font-size: 17px;
    margin-bottom: 10px;
}

.contract-right-panel .note-editable h3,
.template-edit-right-panel .note-editable h3 {
    font-size: 15px;
    margin-bottom: 10px;
}

.contract-right-panel .note-editable p {
    margin: 0 0 10px;
}

.contract-right-panel .note-editable table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.contract-right-panel .note-editable table td,
.contract-right-panel .note-editable table th {
    border: 1px solid var(--k-color-gray-ddd);
    padding: 6px 10px;
    font-size: 13px;
}

.contract-right-panel .note-statusbar {
    display: none;
}

/* 반응형: 모바일에서는 세로 레이아웃 */
@media (max-width: 1023px) {
    .contract-modal-wide {
        width: 100%;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: var(--fm-radius-medium);
    }

    .contract-modal-layout {
        flex-direction: column;
    }

    .contract-left-panel {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--k-border-color);
    }

    .contract-right-panel {
        min-height: 300px;
    }
}

/* =============================================
   계약서 미리보기 (contractPreview)
   ============================================= */

.contract-preview-page {
	margin-top: 70px;
    background: var(--k-color-gray-f0);
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

.contract-preview-page .action-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--k-bg-white);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px var(--k-overlay-dark-10);
    z-index: 100;
}

.contract-page {
    width: 210mm;
    box-sizing: border-box;
    min-height: 297mm;
    margin: 24px auto;
    padding: 5mm 10mm 15mm;
    background: var(--k-bg-white);
    box-shadow: 0 2px 12px var(--k-overlay-dark-12);
}

.in-iframe .contract-page {
    margin-top: 5px;
}

.contract-page h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
}

.contract-body {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 24px;
}

.contract-body h1,
.contract-body h2,
.contract-body h3 {
    font-weight: 400;
    text-align: inherit;
}

.contract-body h1 {
    font-size: 20px;
    margin-bottom: 12px;
}

.contract-body h2 {
    font-size: 17px;
    margin-bottom: 10px;
}

.contract-body h3 {
    font-size: 15px;
    margin-bottom: 10px;
}

.contract-body p {
    margin: 0 0 10px;
}

.contract-body b,
.contract-body strong {
    font-weight: 700;
}

.contract-body ol li,
.contract-body ul li {
    list-style-position: inside;
}

.contract-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.contract-body table td,
.contract-body table th {
    border: 1px solid var(--k-color-gray-ddd);
    padding: 6px 10px;
    font-size: 13px;
}

.special-terms {
    padding: 4px 0px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.special-terms-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

.seal-section {
    margin-top: 30px;
    padding: 0 40px;
}

.seal-party {
    margin-bottom: 32px;
    padding-left: 60px;
}

.seal-row {
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 2;
    gap: 8px;
    position: relative;
}

.seal-label {
    font-weight: 700;
    font-size: 14px;
    position: absolute;
    left: -45px;
}

.seal-field-label {
    display: inline-block;
    width: 60px;
    font-weight: 400;
    letter-spacing: 3px;
    flex-shrink: 0;
}

.seal-mark {
    display: inline-block;
    font-size: 13px;
    color: var(--k-color-red-800);
    font-weight: 700;
    margin-left: 4px;
}

/* 계약서 PDF 페이지 분할 시 요소 잘림 방지 */
.contract-page p,
.contract-page .seal-section,
.contract-page .seal-party {
    break-inside: avoid;
}

.contract-body table,
.contract-body tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 0;
    }

    .contract-preview-page .action-bar { display: none !important; }
    html,
    body {
        margin: 0;
        padding: 0;
        background: var(--k-bg-white);
    }
    .contract-preview-page { background: var(--k-bg-white); }
    .contract-page {
        width: 210mm;
        margin: 0 auto;
        box-shadow: none;
    }
}

/* 유틸리티 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

/* ===== 브랜드 설정 미리보기 ===== */
.brand-preview-box {
    width: 100%;
    height: 120px;
    border: 2px dashed var(--k-border-color);
    border-radius: var(--k-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--k-bg-hover);
    overflow: hidden;
}

.brand-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 8px;
}

.brand-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--k-text-subtle);
    font-size: 0.85rem;
}

.brand-preview-placeholder i {
    font-size: 2rem;
    color: var(--k-text-subtle);
}

/* 견적 금액 요약 영역의 기본 여백을 정의한다. */
.estimate-distribution {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 10px;
}

/* 특이사항 입력 영역의 레이아웃과 여백을 제어한다. */
.estimate-notice-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 24px;
}

.estimate-notice-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--ref-ink);
}

.estimate-notice-input-wrap {
    width: 100%;
    padding: 14px 16px;
    background: var(--k-bg-white);
    border: 1px solid var(--k-border-light-color);
    border-radius: var(--k-radius-lg);
}

.estimate-notice-input {
    width: 100%;
    min-height: 120px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 0;
    resize: vertical;
    line-height: 1.75;
    color: var(--k-text-body);
}

.estimate-notice-input:focus,
.estimate-notice-input:focus-visible {
    border: none;
    outline: none;
    box-shadow: none;
}

@media (max-width: 1023px) {
    .estimate-notice-title {
        font-size: 18px;
    }

    .estimate-notice-input {
        min-height: 132px;
    }
}

#btnSaveSettlement {
    min-width: 66px;
    height: 38px;
    padding: 0 18px;
    border-radius: 10px;
}

/* ===== Table Footer (tfoot) 합계 행 ===== */
.table-freemode tfoot tr {
    background: var(--k-bg-gray-light);
    border-top: 2px solid var(--k-border-color);
    font-weight: 700;
}

.table-freemode tfoot td {
    height: 50px;
}

.table-freemode tfoot td.total-label {
    text-align: center;
    font-size: 14px;
    color: var(--k-text-body);
}

.table-freemode tfoot td.total-quantity {
    text-align: center;
    color: var(--k-text-body);
}

.table-freemode tfoot td.total-amount {
    text-align: right;
    padding-right: 14px;
    color: var(--ref-accent-orange-hover);
    font-size: 15px;
    font-weight: 600;
}

/* ===== Color Add Form ===== */
.color-add-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== Color Palette List ===== */
.color-palette-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 16px;
}

/* ===== Modal Estimate Preview ===== */
.modal-container.modal-estimate-preview {
    width: 90%;
    max-width: 1024px;
    height: 90vh;
}

.modal-container.modal-estimate-preview .modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
}

.modal-container.modal-estimate-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 삭제 아이콘을 X 표시 휴지통 형태로 통일한다. */
i.fa-trash,
i.fa-trash-alt,
i.fa-trash-can {
    position: relative;
    display: inline-block;
}

/* 그리드/테이블 공통 소형 버튼 스타일을 btn-grid 기준으로 통일한다. */
.btn-grid,
.schedule-btn-delete {
    width: var(--k-btn-grid-size) !important;
    height: var(--k-btn-grid-size) !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--k-btn-grid-bg) !important;
    border: var(--k-btn-grid-border) !important;
    border-radius: var(--k-radius-sm) !important;
    cursor: pointer !important;
    transition: var(--k-transition-fast) !important;
    color: var(--ref-gray-700) !important;
    font-size: var(--k-btn-grid-font-size) !important;
    line-height: var(--k-btn-grid-line-height) !important;
    padding: var(--k-btn-grid-padding) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

/* 그리드/테이블 공통 소형 버튼 hover를 통일한다. */
.btn-grid:hover,
.schedule-btn-delete:hover {
    background-color: transparent !important;
    color: var(--ref-ink) !important;
    transform: scale(1.1);
}

/* 상태 클래스 기반으로 소형 버튼 색상을 관리한다. */
.btn-grid.is-edit {
    color: var(--ref-gray-700) !important;
}

.btn-grid.is-save {
    color: var(--ref-accent-green) !important;
}

.btn-grid.is-delete,
.schedule-btn-delete {
    color: var(--ref-accent-orange) !important;
}

.btn-grid.is-cancel {
    color: var(--ref-gray-700) !important;
}

.btn-grid.is-download {
    color: var(--ref-accent-blue) !important;
}
