/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 헤더 */
.header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    text-align: center;
}

.header h1 {
    color: #333;
    font-size: 2em;
    margin-bottom: 10px;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

/* 통계 카드 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.stat-card .value {
    color: #667eea;
    font-size: 2em;
    font-weight: bold;
}

/* 메인 콘텐츠 */
.content-wrapper {
    display: block;
}

/* 거래 추가 버튼 */
.add-transaction-btn-container {
    margin-bottom: 30px;
    text-align: center;
}

.btn-add-transaction {
    padding: 18px 40px;
    font-size: 1.2em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-add-transaction:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-add-transaction:active {
    transform: translateY(-1px);
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 10;
}

.modal-header .section-title {
    margin: 0;
    padding: 0;
    border: none;
}

.modal-close {
    font-size: 2em;
    font-weight: bold;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: #667eea;
    background: #f0f0f0;
    transform: rotate(90deg);
}

.modal-content form {
    padding: 30px;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.list-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
}

.section-title {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 체크박스 그룹 */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #e8eaf6;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 0.95em;
    color: #333;
}

.checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

/* 버튼 스타일 */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* 검색 및 필터 */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1em;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
}

.filter-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.month-selector {
    min-width: 150px;
}

.month-selector select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    color: #667eea;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.month-selector select:hover {
    background: #f0f4ff;
}

.month-selector select:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

/* 거래 목록 */
.transaction-list {
    max-height: 600px;
    overflow-y: auto;
}

.transaction-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
    border-left: 4px solid #667eea;
}

.transaction-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.customer-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.transaction-date {
    color: #667eea;
    font-weight: 500;
    font-size: 0.95em;
}

.transaction-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    color: #555;
}

.summary-item .icon {
    font-size: 1.1em;
}

.transaction-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 8px;
    margin-top: 12px;
}

.amount-label {
    font-size: 0.9em;
    color: #666;
}

.amount-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.profit-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #4CAF50;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

/* 로딩 */
.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.2em;
}

/* 스크롤바 스타일 */
.transaction-list::-webkit-scrollbar {
    width: 8px;
}

.transaction-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.transaction-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.transaction-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .transaction-details {
        grid-template-columns: 1fr;
    }

    .cost-info {
        flex-wrap: wrap;
        gap: 10px;
    }

    .cost-item {
        flex: 1 1 45%;
    }

    .btn-add-transaction {
        width: 100%;
        padding: 15px;
        font-size: 1.1em;
    }

    .modal-content {
        width: 100%;
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        border-radius: 0;
    }
}

/* 통계 표 스타일 */
.stats-table-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stats-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-tab {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.stats-tab.active {
    background: #667eea;
    color: white;
}

.stats-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.stats-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
}

.stats-table-container.hidden {
    display: none;
}

/* 표 전용 가로 스크롤 래퍼.
   데스크탑에서는 display:contents 로 아무 영향을 주지 않고,
   모바일에서만 표 자체가 제자리에서 좌우로 스크롤되게 한다. */
.stats-table-scroll {
    display: contents;
}

/* 기존 고객 검색 자동완성 드롭다운 */
.customer-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
}

.customer-suggestions-title {
    padding: 8px 14px;
    font-size: 0.78em;
    font-weight: 600;
    color: #667eea;
    background: #f5f7ff;
    border-bottom: 1px solid #e0e4ff;
    position: sticky;
    top: 0;
}

.customer-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.customer-suggestion-item:hover,
.customer-suggestion-item:active {
    background: #f5f7ff;
}

.customer-suggestion-item:last-child {
    border-bottom: none;
}

.customer-suggestion-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.customer-suggestion-info {
    font-size: 0.82em;
    color: #888;
    margin-top: 2px;
}

/* 차트 컨테이너 - 표와 함께 스크롤 (부모 .stats-table-container가 스크롤 담당) */
.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    position: relative;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

/* 차트 실제 크기 래퍼 - JS가 표 폭에 맞춰 width를 동기화 */
.chart-scroll-inner {
    position: relative;
    height: 430px;
    min-width: 640px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    table-layout: auto;
}

.stats-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 표 머리글의 색 점 — 아래 그래프의 선 색과 짝을 이룬다 */
.th-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

.stats-table th {
    padding: 15px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 0.95em;
    white-space: nowrap;
}

.stats-table th:first-child {
    text-align: left;
    padding-left: 20px;
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    text-align: right;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
}

.stats-table td:first-child {
    text-align: left;
    padding-left: 20px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.stats-table tbody tr:hover {
    background: #f8f9fa;
}

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

.stats-table .loading {
    text-align: center;
    color: #999;
    padding: 40px;
}

.stats-table .total-row {
    background: #f0f4ff;
    font-weight: bold;
    color: #667eea;
    border-top: 2px solid #667eea;
}

.stats-table .percentage {
    color: #4CAF50;
    font-weight: 600;
}

.stats-table .number {
    text-align: right;
    font-family: 'Courier New', monospace;
    padding-right: 20px;
}

@media (max-width: 768px) {
    .stats-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-tabs {
        justify-content: center;
    }

    .stats-tab {
        flex: 1;
        min-width: 100px;
    }

    .stats-table {
        font-size: 0.85em;
    }

    .stats-table th,
    .stats-table td {
        padding: 8px;
    }
}
/* 상세 보기 모달 */
.detail-modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.detail-content {
    padding: 20px 0;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-item-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.detail-item-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.detail-item-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.detail-full {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.detail-cost-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.detail-cost-box {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.detail-cost-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.detail-cost-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.detail-profit {
    background: linear-gradient(135deg, #4CAF5015 0%, #81C78415 100%);
}

.detail-profit .detail-cost-value {
    color: #4CAF50;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.btn-action {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit-action {
    background: #4CAF50;
    color: white;
}

.btn-delete-action {
    background: #f44336;
    color: white;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* 메인 네비게이션 */
.main-nav {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.nav-tab {
    padding: 12px 30px;
    border: none;
    background: white;
    color: #667eea;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 뷰 섹션 */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* ========================================
   모바일 반응형 최적화
======================================== */

/* 태블릿 (1024px 이하) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
    }
    
    .detail-cost-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 모바일 (768px 이하) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    /* 헤더 */
    .header {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .header p {
        font-size: 0.9em;
    }
    
    /* 메인 네비게이션 */
    .main-nav {
        gap: 8px;
        margin-top: 15px;
    }
    
    .nav-tab {
        flex: 1;
    }
    
    /* 통계 헤더 */
    .stats-header {
        padding: 15px;
    }
    
    .section-title {
        font-size: 1.3em;
    }
    
    /* 통계 탭 */
    .stats-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .stats-tab {
        font-size: 0.85em;
        padding: 8px 12px;
        min-width: 80px;
    }
    
    /* 통계 표 */
    .stats-table-container {
        padding: 15px;
    }
    
    .stats-table {
        font-size: 0.8em;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 8px 6px;
    }
    
    .stats-table th:first-child,
    .stats-table td:first-child {
        padding-left: 10px;
    }
    
    /* 통계 화면 자체는 좌우로 밀리지 않게 하고,
       차트와 표가 각자 제자리에서 좌우 스크롤되게 한다 */
    .stats-table-container {
        overflow-x: hidden;
    }

    .stats-table-scroll {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        margin-top: 20px;
        border: 1px solid #e6e8f2;
        border-radius: 10px;
    }

    .stats-table-scroll .stats-table {
        margin-top: 0;
    }

    .chart-container {
        padding: 12px;
        width: auto;
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-scroll-inner {
        height: 340px;
        min-width: 100%;
    }

    /* 좌우로 더 볼 내용이 있다는 걸 알 수 있게 스크롤바를 항상 보여준다 */
    .stats-table-scroll::-webkit-scrollbar,
    .chart-container::-webkit-scrollbar {
        height: 6px;
        -webkit-appearance: none;
    }

    .stats-table-scroll::-webkit-scrollbar-track,
    .chart-container::-webkit-scrollbar-track {
        background: #eef0f7;
        border-radius: 3px;
    }

    .stats-table-scroll::-webkit-scrollbar-thumb,
    .chart-container::-webkit-scrollbar-thumb {
        background: #b9c0d8;
        border-radius: 3px;
    }
    
    /* 거래 등록 버튼 */
    .add-transaction-btn-container {
        padding: 15px;
    }
    
    .btn-add-transaction {
        width: 100%;
        padding: 15px;
        font-size: 1em;
    }
    
    /* 검색 및 필터 */
    .filter-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-btn {
        flex: 1;
        padding: 8px 10px;
        font-size: 0.85em;
    }
    
    .month-selector {
        width: 100%;
        min-width: auto;
    }
    
    /* 거래 카드 */
    .transaction-item {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .customer-name {
        font-size: 1.1em;
    }
    
    .transaction-summary {
        gap: 8px;
    }
    
    .summary-item {
        font-size: 0.85em;
    }
    
    .transaction-amount {
        padding: 10px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .amount-value {
        font-size: 1.1em;
    }
    
    .profit-value {
        font-size: 1em;
    }
    
    /* 모달 */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.2em;
    }
    
    .modal-close {
        font-size: 1.8em;
    }
    
    /* 폼 */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9em;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 0.95em;
    }
    
    /* 상세 모달 */
    .detail-modal-content {
        width: 95%;
        max-width: 95%;
        padding: 15px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .detail-cost-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .detail-cost-box {
        padding: 12px;
    }
    
    .detail-cost-value {
        font-size: 1.1em;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .btn-action {
        padding: 12px;
        font-size: 1em;
    }
}

/* 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .header {
        padding: 15px 10px;
        border-radius: 10px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .header p {
        font-size: 0.85em;
    }
    

    
    .stats-tab {
        font-size: 0.75em;
        padding: 6px 8px;
        min-width: 70px;
    }
    
    .stats-table {
        font-size: 0.75em;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 6px 4px;
    }
    
    .filter-btn {
        padding: 6px 8px;
        font-size: 0.8em;
    }
    
    .transaction-item {
        padding: 12px;
    }
    
    .customer-name {
        font-size: 1em;
    }
    
    .summary-item {
        font-size: 0.8em;
    }
    
    .amount-value {
        font-size: 1em;
    }
    
    .detail-cost-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 10px;
        width: auto;
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-scroll-inner {
        height: 320px;
        min-width: 100%;
    }
}

/* 가로 모드 최적화 */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 85vh;
    }
    
    .detail-modal-content {
        max-height: 85vh;
    }
}

/* ========================================
   작업 일정 토글 섹션 (거래 모달 내)
======================================== */

/* 수금 상태 라디오 */
.payment-status-group {
    display: flex;
    gap: 12px;
}

.payment-radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.payment-radio-label:hover {
    border-color: #667eea;
}

.payment-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.payment-radio-label.paid input:checked ~ .payment-radio-text {
    color: #4CAF50;
    font-weight: 700;
}

.payment-radio-label.paid:has(input:checked) {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.payment-radio-label.unpaid input:checked ~ .payment-radio-text {
    color: #f44336;
    font-weight: 700;
}

.payment-radio-label.unpaid:has(input:checked) {
    border-color: #f44336;
    background: #ffebee;
}

.payment-radio-text {
    font-size: 1em;
    font-weight: 500;
    color: #555;
}

/* 미수금 배지 (거래 카드용) */
.unpaid-badge {
    display: inline-block;
    background: #f44336;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    animation: unpaidPulse 2s infinite;
}

@keyframes unpaidPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.paid-badge {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
}

/* 미수금 거래 카드 강조 */
.transaction-item.unpaid-item {
    border-left: 4px solid #f44336;
}

/* 미수금 통계 카드 */
.unpaid-summary {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    border-left: 5px solid #f44336;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.unpaid-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.25);
}

.unpaid-summary-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.unpaid-summary-icon {
    font-size: 2em;
}

.unpaid-summary-text h3 {
    color: #f44336;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.unpaid-summary-text p {
    color: #666;
    font-size: 0.9em;
}

.unpaid-summary-amount {
    font-size: 1.5em;
    font-weight: bold;
    color: #f44336;
}

@media (max-width: 480px) {
    .payment-status-group {
        flex-direction: column;
        gap: 8px;
    }
    .unpaid-summary {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   지출 내역 스타일
======================================== */
.expense-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.expense-summary-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
    border-top: 4px solid #f44336;
}

.expense-summary-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.expense-summary-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #f44336;
}

.expense-item {
    background: white;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
    border-left: 4px solid #f44336;
}

.expense-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(244, 67, 54, 0.25);
}

.expense-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.expense-item-category {
    background: #ffebee;
    color: #f44336;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}

.expense-item-date {
    color: #999;
    font-size: 0.9em;
}

.expense-item-desc {
    font-size: 1.05em;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
}

.expense-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expense-item-amount {
    font-size: 1.2em;
    font-weight: bold;
    color: #f44336;
}

.expense-item-method {
    font-size: 0.85em;
    color: #888;
}

.expense-filter-btn.active {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.expense-filter-btn {
    border-color: #f44336;
    color: #f44336;
}

/* 지출 상세 모달 */
.expense-detail-amount {
    font-size: 2em;
    font-weight: bold;
    color: #f44336;
    text-align: center;
    padding: 20px;
    background: #ffebee;
    border-radius: 12px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .expense-summary-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .expense-summary-value {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .expense-summary-card {
        padding: 15px;
    }
}
.schedule-toggle-section {
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.schedule-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    cursor: pointer;
    background: #f8f9fa;
    transition: background 0.3s;
}

.schedule-toggle-label:hover {
    background: #e8eaf6;
}

.schedule-toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.schedule-toggle-text {
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
}

.schedule-fields {
    padding: 20px;
    border-top: 2px solid #667eea;
    background: linear-gradient(135deg, #667eea08 0%, #764ba208 100%);
}

.schedule-fields-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #667eea50;
}

/* ========================================
   작업 일정 달력 스타일
======================================== */
.schedule-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.calendar-title {
    font-size: 1.5em;
    color: #333;
    font-weight: bold;
    min-width: 160px;
    text-align: center;
}

.calendar-nav-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 50%;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: #667eea;
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    table-layout: fixed;
}

.calendar-weekday {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 5px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95em;
}

.calendar-weekday:first-child { color: #ffcdd2; }
.calendar-weekday:last-child { color: #bbdefb; }

.calendar-day {
    background: white;
    min-height: 90px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.calendar-day:hover { background: #f0f4ff; }
.calendar-day.other-month { background: #f8f8f8; color: #ccc; }
.calendar-day.today { background: #e8eaf6; border: 2px solid #667eea; }
.calendar-day.selected { background: #667eea15; box-shadow: inset 0 0 0 2px #667eea; }

.calendar-day-number {
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 4px;
}

.calendar-day.sunday .calendar-day-number { color: #f44336; }
.calendar-day.saturday .calendar-day-number { color: #2196F3; }

.calendar-day-schedules {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-width: 0;
}

.calendar-schedule-dot {
    font-size: 0.7em;
    padding: 2px 5px;
    border-radius: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 100%;
    display: block;
}

.calendar-schedule-dot.completed {
    text-decoration: line-through;
    opacity: 0.55;
}

.calendar-schedule-dot.multi-day {
    border-left: 2px solid rgba(255,255,255,0.5);
}

.calendar-more-count {
    font-size: 0.7em;
    color: #667eea;
    font-weight: 600;
    text-align: center;
    margin-top: 2px;
}

/* 일정 목록 섹션 */
.schedule-list-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e0e0e0;
}

.schedule-list-title {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.schedule-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.schedule-item.completed {
    border-left-color: #4CAF50;
    opacity: 0.75;
}

.schedule-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.schedule-item-time {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
}

.schedule-item-service {
    background: #667eea15;
    color: #667eea;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}

.schedule-item-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.schedule-item-info {
    font-size: 0.9em;
    color: #555;
}

.schedule-item-info .label {
    color: #999;
    font-size: 0.85em;
}

/* 일정 상세 */
.schedule-status-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.schedule-status-badge.pending { background: #fff3e0; color: #ff9800; }
.schedule-status-badge.completed { background: #e8f5e9; color: #4CAF50; }

.materials-list {
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.95em;
}

.btn-complete-action { background: #4CAF50; color: white; }

.linked-transaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e8eaf6;
    color: #667eea;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.linked-transaction-badge:hover {
    background: #667eea;
    color: white;
}

/* 모바일 달력 반응형 */
@media (max-width: 768px) {
    .schedule-container { padding: 15px; }
    .calendar-header { gap: 10px; }
    .calendar-title { font-size: 1.2em; min-width: 130px; }
    .calendar-day { min-height: 65px; padding: 4px; }
    .calendar-day-number { font-size: 0.8em; }
    .calendar-schedule-dot { font-size: 0.6em; padding: 1px 3px; }
    .calendar-weekday { padding: 8px 2px; font-size: 0.8em; }
    .schedule-item-body { grid-template-columns: 1fr; }
    .schedule-fields { padding: 15px; }
}

@media (max-width: 480px) {
    .calendar-day { min-height: 50px; padding: 3px; }
    .calendar-day-number { font-size: 0.75em; }
    .calendar-schedule-dot { font-size: 0.55em; padding: 1px 2px; }
    .calendar-more-count { font-size: 0.6em; }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .nav-tab,
    .stats-tab,
    .filter-btn,
    .transaction-item,
    .btn-add-transaction {
        min-height: 44px; /* iOS 권장 터치 타겟 크기 */
    }
    
    .transaction-item:active {
        transform: scale(0.98);
    }
    
    .nav-tab:active,
    .stats-tab:active,
    .filter-btn:active {
        transform: scale(0.95);
    }
}
/* ========================================
   거래명세서 / 견적서 관련 스타일
======================================== */
.invoice-section-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #2196F3;
    padding: 10px 0 8px;
    margin-top: 15px;
    border-bottom: 2px solid #2196F3;
    margin-bottom: 12px;
}

.invoice-item-row {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
}

.btn-add-item {
    width: 100%;
    padding: 10px;
    background: white;
    border: 2px dashed #2196F3;
    color: #2196F3;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-item:hover {
    background: #e3f2fd;
}

.btn-remove-item {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f44336;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 명세서 미리보기 (인쇄/이미지용) */
.invoice-doc {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    padding: 30px 30px;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    color: #333;
    line-height: 1.6;
    box-sizing: border-box;
    position: relative;   /* 워터마크 기준 */
}

/* ========================================
   문서 배경 로고 워터마크 (도용 방지용)

   설계 원칙 두 가지
   1) 이미지 요소를 여러 개 쓰지 않고 배경 이미지 하나를 반복시킨다.
      (요소를 여러 개 쓰면 html2canvas 가 문서를 복제할 때
       이미지 수십 장을 다시 처리하느라 다른 화면의 이미지 저장까지 멈춘다)
   2) 잘라내기(overflow:hidden)는 워터마크 안쪽에서만 한다.
      문서에 걸면 폭이 넓은 품목표가 잘려 보이지 않게 된다.
======================================== */
.doc-watermark {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;     /* 기울인 무늬는 여기서만 잘라낸다 */
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.doc-watermark i {
    position: absolute;
    top: -40%;
    left: -40%;
    right: -40%;
    bottom: -40%;
    display: block;
    transform: rotate(-24deg);
    transform-origin: center center;
    background-repeat: repeat;
    background-position: center center;
    /* 타일에 이미 여백이 들어 있다. 이 값은 타일 전체의 폭 */
    background-size: 300px auto;
    opacity: 0.07;
}

/* 워터마크 위로 본문이 올라오게 한다 */
.invoice-doc > *:not(.doc-watermark),
.receipt-doc > *:not(.doc-watermark) {
    position: relative;
    z-index: 1;
}

.invoice-doc-title {
    text-align: center;
    font-size: 34px;
    font-weight: bold;
    letter-spacing: 8px;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.invoice-doc-title.estimate {
    color: #e65100;
    border-bottom-color: #e65100;
}

.invoice-doc-title.statement {
    color: #1565C0;
    border-bottom-color: #1565C0;
}

.invoice-doc-no {
    text-align: right;
    font-size: 15px;
    color: #555;
    margin-bottom: 15px;
}

.invoice-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 16px;
}

.invoice-info-table th {
    background: #f5f5f5;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #ddd;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    white-space: nowrap;
}

.invoice-info-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    word-break: break-all;
}

/* "아래와 같이 견적합니다" 안내 — 주변 글자보다 크게 */
.invoice-info-table th.inv-guide-note {
    width: auto;
    min-width: 0;
    max-width: none;
    background: #fff;
    text-align: center;
    padding: 14px 10px;
    font-size: 21px;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.5px;
    white-space: normal;
}

.invoice-items-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 15px;
    white-space: nowrap;
}

.invoice-items-table thead th {
    background: #37474f;
    color: white;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 2px solid #fff;
    font-size: 13px;
    word-break: keep-all;
}

.invoice-items-table.estimate thead th {
    background: #e65100;
}

.invoice-items-table.statement thead th {
    background: #1565C0;
}

.invoice-items-table tbody td {
    padding: 8px 6px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 15px;
    white-space: nowrap;
}

.invoice-items-table tbody td:first-child {
    text-align: center;
    width: 35px;
}

/* 품목명은 줄바꿈하지 않고 칸을 늘려 한 줄로 보여준다 */
.invoice-items-table tbody td:nth-child(2) {
    text-align: left;
    white-space: nowrap;
}

/* 소계·경비·합계 칸도 워터마크가 비쳐 보이도록 반투명하게 */
.invoice-items-table tfoot td {
    padding: 10px 6px;
    border: 1px solid #ddd;
    font-weight: bold;
    text-align: center;
    background: rgba(250, 250, 250, 0.45);
    font-size: 15px;
}

.invoice-total-row {
    font-size: 22px;
    text-align: center;
    padding: 15px 0;
    font-weight: bold;
    border-top: 3px solid #333;
    border-bottom: 3px solid #333;
    margin-bottom: 15px;
}

.invoice-notes {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    font-size: 17px;
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 15px;
    font-weight: 600;
}

.invoice-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    font-size: 13px;
}

.invoice-stamp-area {
    text-align: center;
    width: 200px;
}

.invoice-stamp-area .stamp-label {
    padding-top: 50px;
    border-top: 1px solid #333;
    font-weight: 600;
}

@media print {
    @page { size: landscape; margin: 10mm; }
    body * { visibility: hidden; }
    #invoicePreviewArea, #invoicePreviewArea * { visibility: visible; }
    #invoicePreviewArea { position: absolute; left: 0; top: 0; width: 100%; background: white; }
    .invoice-doc { padding: 10px; max-width: 100%; }
}

@media (max-width: 768px) {
    .invoice-doc { padding: 15px 10px; }
}

@media (max-width: 480px) {
    #invoicePreviewArea {
        padding: 5px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #invoicePreviewModal .modal-content {
        padding: 0;
        margin: 5px;
        max-height: 95vh;
    }
    .invoice-doc {
        padding: 20px 15px;
    }
}

/* 저장된 명세서 목록 */
.invoice-list-item {
    display:flex;justify-content:space-between;align-items:center;
    padding:12px 15px;margin:0 15px 8px;border-radius:10px;
    background:#f8f9fa;border:1px solid #e8e8e8;cursor:pointer;
    transition:all 0.2s;
}
.invoice-list-item:hover { background:#e3f2fd;border-color:#90caf9; }
.invoice-list-info { flex:1; }
.invoice-list-info .inv-title { font-weight:600;font-size:0.95em;color:#333; }
.invoice-list-info .inv-meta { font-size:0.8em;color:#888;margin-top:3px; }
.invoice-list-amount { font-weight:700;font-size:1em;color:#1565C0;margin:0 15px; }
.invoice-list-actions { display:flex;gap:5px; }
.invoice-list-actions button {
    border:none;border-radius:6px;padding:5px 10px;font-size:0.75em;cursor:pointer;
}
.inv-btn-load { background:#2196F3;color:white; }
.inv-btn-delete { background:#ef5350;color:white; }
.invoice-list-empty { text-align:center;padding:40px;color:#999;font-size:0.95em; }
.invoice-list-badge {
    display:inline-block;padding:2px 8px;border-radius:10px;font-size:0.7em;font-weight:600;margin-left:6px;
}
.invoice-list-badge.statement { background:#e3f2fd;color:#1565C0; }
.invoice-list-badge.estimate { background:#fff3e0;color:#e65100; }
.invoice-list-badge.receipt { background:#eaf7ec;color:#2e7d32; }

/* 빠른 견적서 플로팅 버튼 */
.floating-estimate-btn {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 999;
    padding: 14px 20px;
    font-size: 0.95em;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.floating-estimate-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

/* 작성 모달과 미리보기 모달 동일 폰트 */

/* 미리보기 모달에서 문서가 테이블 크기에 맞게 자동 확장 */
#invoicePreviewModal .invoice-doc {
    width: auto;
    max-width: none;
    display: inline-block;
    min-width: 100%;
}

/* ── 수량 파악 모달 ── */
.survey-tabs {
    display: flex;
    gap: 0;
    padding: 0 16px;
    border-bottom: 2px solid #f0f0f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.survey-tab {
    flex-shrink: 0;
    padding: 9px 14px;
    border: none;
    background: none;
    font-size: 0.88em;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.survey-tab.active {
    color: #ff9800;
    border-bottom-color: #ff9800;
}

/* 카테고리 블록 */
.survey-cat-block {
    display: none;
}
.survey-cat-block.active {
    display: block;
}
.survey-cat-title {
    font-size: 0.8em;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 10px 0 6px;
}

/* 개별 항목 행 */
.survey-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
}
.survey-item-name {
    flex: 1.4;
    font-size: 0.9em;
    font-weight: 500;
    color: #333;
}
.survey-item-name input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.9em;
}
.survey-qty-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
}
.survey-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #f8f8f8;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    flex-shrink: 0;
}
.survey-qty-val {
    width: 36px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 2px;
    font-size: 0.92em;
    font-weight: 700;
}
.survey-spec-input {
    flex: 1.2;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.82em;
    color: #555;
    min-width: 0;
}
.survey-3ro-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
}

/* 자유 추가 항목 */
.survey-custom-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.88em;
}
.survey-custom-row .custom-name { flex: 1.4; color: #333; font-weight: 500; }
.survey-custom-row .custom-spec { flex: 1; color: #888; }

/* ========================================
   로그인 / 회원가입 화면
   ======================================== */
.auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 3000;
    overflow-y: auto;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 20px;
    padding: 36px 28px 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.auth-logo { font-size: 44px; line-height: 1; }
.auth-title { margin: 12px 0 4px; font-size: 22px; color: #333; }
.auth-sub { margin: 0 0 24px; font-size: 13px; color: #999; }

.auth-tabs {
    display: flex;
    background: #f1f2f6;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all .2s;
}
.auth-tab.active { background: #fff; color: #667eea; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #e4e6ef;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}
.auth-form input:focus { border-color: #667eea; }

.auth-submit {
    margin-top: 6px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.auth-submit:active { opacity: .85; }

.auth-link {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 6px;
}

.auth-message { margin-top: 14px; font-size: 13px; color: #667eea; min-height: 18px; }
.auth-message.error { color: #e74c3c; }



/* 카카오 로그인 */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    color: #bbb;
    font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #eee;
}

.kakao-login-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: #FEE500;
    color: #191919;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.kakao-login-btn:active { background: #f0d800; }
.kakao-icon { font-size: 17px; }

/* 구글 로그인 */
.google-login-btn {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    background: #fff;
    color: #3c4043;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.google-login-btn:active { background: #f7f8f8; }
.g-icon { width: 18px; height: 18px; flex: 0 0 18px; }

/* ========================================
   설정 모달 - 탭 구조
   ======================================== */
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px 0;
    border-bottom: 1px solid #eee;
}
.settings-tab {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.settings-tab.active { color: #667eea; border-bottom-color: #667eea; }

.settings-panel { padding: 18px 20px 20px; }
.settings-hint { font-size: 12.5px; color: #8b8fa3; margin: 0 0 14px; line-height: 1.6; }

.settings-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #eef0f5;
}
.settings-section h4 { margin: 0 0 6px; font-size: 14px; color: #333; }

.settings-kv { margin-bottom: 14px; }
.settings-kv-label { font-size: 12px; color: #999; margin-bottom: 4px; }
.settings-kv code { background: #f7f8fc; padding: 6px 8px; border-radius: 6px; display: inline-block; }

.settings-mini-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.settings-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #666; line-height: 1.9; }

/* 로고 / 인감 업로드 */
.brand-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.brand-box {
    width: 92px;
    height: 92px;
    flex: 0 0 92px;
    border: 1.5px dashed #d8dae5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(45deg, #f4f5f8 25%, transparent 25%, transparent 75%, #f4f5f8 75%),
        linear-gradient(45deg, #f4f5f8 25%, #fff 25%, #fff 75%, #f4f5f8 75%);
    background-size: 14px 14px;
    background-position: 0 0, 7px 7px;
    overflow: hidden;
}
.brand-box img { max-width: 84px; max-height: 84px; object-fit: contain; }
.brand-empty { font-size: 12px; color: #bbb; }

.brand-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-upload {
    padding: 8px 16px;
    border: 1px solid #667eea;
    border-radius: 8px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}
.brand-upload:active { background: #f2f3ff; }
.brand-remove {
    padding: 6px 14px;
    border: 1px solid #f0c4c0;
    border-radius: 8px;
    background: #fff;
    color: #e74c3c;
    font-size: 12px;
    cursor: pointer;
}
.brand-status { font-size: 12px; color: #667eea; min-height: 15px; }

/* 설정 모달이 길어졌으므로 스크롤 허용 */
#settingsModal .modal-content {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
#settingsModal .settings-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   고객 관리
   ======================================== */
.customer-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.customer-toolbar input[type="text"] {
    flex: 1 1 200px;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid #e4e6ef;
    border-radius: 8px;
    font-size: 0.95em;
    outline: none;
}
.customer-toolbar input[type="text"]:focus { border-color: #00897b; }
.customer-toolbar select {
    padding: 10px 12px;
    border: 2px solid #e4e6ef;
    border-radius: 8px;
    font-size: 0.9em;
    background: #fff;
    cursor: pointer;
}
.customer-add-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #00897b;
    color: #fff;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.customer-add-btn:active { background: #00695c; }

.customer-summary {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #e0f2f1;
    border-radius: 8px;
    font-size: 0.9em;
    color: #00695c;
    margin-bottom: 14px;
}
.customer-summary b { color: #00695c; }

.customer-list { display: flex; flex-direction: column; gap: 10px; }

.customer-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border: 1px solid #e4e6ef;
    border-left: 4px solid #00897b;
    border-radius: 10px;
    background: #fff;
}
.customer-card-main { flex: 1; min-width: 0; }
.customer-card-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}
.customer-count {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e0f2f1;
    color: #00695c;
    font-size: 0.72em;
    font-weight: 600;
    vertical-align: middle;
}
.customer-card-row { font-size: 0.88em; color: #666; margin-bottom: 3px; word-break: break-all; }
.customer-card-row a { color: #00897b; text-decoration: none; }
.customer-card-memo {
    margin-top: 6px;
    padding: 7px 10px;
    background: #fafbfc;
    border-radius: 6px;
    font-size: 0.85em;
    color: #777;
    white-space: pre-wrap;
}
.customer-card-stat { margin-top: 7px; font-size: 0.8em; color: #aaa; }

.customer-card-actions { display: flex; flex-direction: column; gap: 6px; }
.customer-card-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    white-space: nowrap;
}
.cust-edit { border: 1px solid #00897b; background: #fff; color: #00897b; }
.cust-del { border: 1px solid #f0c4c0; background: #fff; color: #e74c3c; }

.customer-empty {
    padding: 40px 20px;
    text-align: center;
    color: #aaa;
    font-size: 0.92em;
    line-height: 1.8;
}
.customer-form-msg { font-size: 0.85em; color: #e74c3c; min-height: 18px; margin-bottom: 8px; }

.customer-import-btn {
    padding: 10px 14px;
    border: 1px solid #00897b;
    border-radius: 8px;
    background: #fff;
    color: #00897b;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.customer-import-btn:active { background: #e0f2f1; }
.customer-import-btn:disabled { border-color: #ccc; color: #aaa; cursor: not-allowed; }

/* ========================================
   작업 사진
   ======================================== */
.work-photo-section {
    background: #f7fbf8;
    border: 1px solid #d9ece0;
    border-radius: 10px;
    padding: 12px;
}
.work-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin: 10px 0;
}
.work-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #eef1f5;
    cursor: pointer;
}
.work-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-photo-item.pending img { opacity: 0.55; }
.work-photo-badge {
    position: absolute;
    left: 4px;
    bottom: 4px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 10px;
}
.work-photo-del, .work-photo-cancel {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.work-photo-add {
    display: inline-block;
    padding: 9px 16px;
    border: 1px dashed #4CAF50;
    border-radius: 8px;
    color: #388e3c;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}
.work-photo-add:active { background: #edf7ee; }
.work-photo-status { font-size: 0.82em; color: #4CAF50; min-height: 16px; margin-top: 6px; }

/* 거래 카드 안의 사진 띠 */
.tx-photo-strip {
    display: flex;
    gap: 6px;
    margin: 10px 0 4px;
    align-items: center;
}
.tx-photo-strip img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #e4e6ef;
}
.tx-photo-more {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background: #eef1f5;
    color: #777;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 사진 뷰어 */
.photo-viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 4000;
    align-items: center;
    justify-content: center;
}
.photo-viewer.show { display: flex; }
.photo-viewer img {
    max-width: 94vw;
    max-height: 84vh;
    object-fit: contain;
}
.photo-viewer-close {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}
.photo-prev { left: 12px; }
.photo-next { right: 12px; }
.photo-viewer-count {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9em;
    background: rgba(0,0,0,.5);
    padding: 5px 14px;
    border-radius: 14px;
}

/* ========================================
   지역 선택 (시/도 → 시/군/구)
   ======================================== */
.region-selects {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
}
.region-selects select {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 2px solid #e1e5ee;
    border-radius: 10px;
    font-size: 1em;
    background: #fff;
    cursor: pointer;
}
.region-selects select:focus { border-color: #667eea; outline: none; }

.region-recent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.region-recent:empty { display: none; }
.region-recent-label {
    font-size: 0.78em;
    color: #aaa;
    margin-right: 2px;
}
.region-chip {
    padding: 5px 11px;
    border: 1px solid #dfe3ef;
    border-radius: 14px;
    background: #f7f8fc;
    color: #555;
    font-size: 0.8em;
    cursor: pointer;
    white-space: nowrap;
}
.region-chip:active { background: #667eea; color: #fff; border-color: #667eea; }

@media (max-width: 380px) {
    .region-selects { grid-template-columns: 1fr; }
}

/* ========================================
   서비스 내용 · 항목 관리
   ======================================== */
.service-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8em;
    color: #bbb;
}

.service-item-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.service-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid #e4e6ef;
    border-radius: 8px;
    background: #fff;
}
.service-item-order { display: flex; flex-direction: column; gap: 1px; }
.service-item-order button {
    width: 22px;
    height: 16px;
    padding: 0;
    border: 1px solid #e0e3ec;
    background: #fafbfd;
    color: #888;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    border-radius: 3px;
}
.service-item-order button:disabled { opacity: .35; cursor: default; }
.service-item-name { flex: 1; font-size: 0.95em; color: #333; min-width: 0; }
.service-item-used {
    margin-left: 7px;
    padding: 1px 7px;
    border-radius: 9px;
    background: #eef1fb;
    color: #7a83a8;
    font-size: 0.72em;
}
.service-item button.svc-rename,
.service-item button.svc-del {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78em;
    cursor: pointer;
    white-space: nowrap;
}
.svc-rename { border: 1px solid #ccd2e6; background: #fff; color: #667eea; }
.svc-del { border: 1px solid #f0c4c0; background: #fff; color: #e74c3c; }

.service-item-empty {
    padding: 26px 14px;
    text-align: center;
    color: #bbb;
    font-size: 0.9em;
    line-height: 1.8;
    border: 1px dashed #e0e3ec;
    border-radius: 8px;
}
.service-item-add { display: flex; gap: 8px; }
.service-item-add input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid #e4e6ef;
    border-radius: 8px;
    font-size: 0.95em;
    outline: none;
}
.service-item-add input:focus { border-color: #667eea; }
.service-item-add button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: #fff;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* 서비스 항목 개수 표시 · 목록 스크롤 */
.service-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85em;
    color: #888;
    margin-bottom: 7px;
}
.service-item-count { font-size: 0.95em; font-weight: 600; }

.service-item-list {
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
}
.service-item-add button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 기본설정 - 목록 블록 구분 */
.option-block {
    margin-bottom: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid #eef0f5;
}
.option-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.option-block h4 { margin: 0 0 6px; font-size: 15px; color: #333; }

.service-item-flag {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 9px;
    background: #fff3e0;
    color: #e8a33d;
    font-size: 0.72em;
}
.service-item button.opt-detail,
.service-item button.opt-rename,
.service-item button.opt-del {
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.76em;
    cursor: pointer;
    white-space: nowrap;
}
.opt-detail { border: 1px solid #ffd9a0; background: #fffaf2; color: #d9903a; }
.opt-rename { border: 1px solid #ccd2e6; background: #fff; color: #667eea; }
.opt-del { border: 1px solid #f0c4c0; background: #fff; color: #e74c3c; }

/* ========================================
   1. 헤더 계정 바 (설정 버튼)
   ======================================== */
.account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #eef0f5;
}
.account-who {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.account-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: #eef1fb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.account-email {
    font-size: 13px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.account-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 18px;
    border: 1.5px solid #e1e5ee;
    border-radius: 10px;
    background: #fff;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.account-btn:active { transform: translateY(1px); }
.account-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgba(102,126,234,.3);
}
.account-btn-ico { font-size: 16px; line-height: 1; }

/* ========================================
   2. 저장 버튼 (모달 공통)
   ======================================== */
.submit-btn {
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(102,126,234,.28);
    transition: all .15s;
}
.submit-btn:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(102,126,234,.28); }
.submit-btn:disabled { background: #c8cbd6; box-shadow: none; cursor: not-allowed; }

/* ========================================
   3. 체크박스 라벨 (선금/잔금 등)
   ======================================== */
.check-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 13px;
    margin-top: 4px;
    border: 1.5px solid #ffe0b2;
    border-radius: 9px;
    background: #fffdf8;
    font-size: 0.92em;
    color: #333;
    cursor: pointer;
}
.check-label input[type="checkbox"] {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    margin: 0;
    cursor: pointer;
    accent-color: #e67e22;
}
/* 글자가 한 자씩 세로로 쪼개지지 않도록 */
.check-label span {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    line-height: 1.4;
}

/* ========================================
   4. 메인 네비게이션 탭
   ======================================== */
.nav-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.nav-ico { line-height: 1; }
.nav-label { white-space: nowrap; }

@media (max-width: 768px) {
    .main-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
        margin-top: 16px;
    }
    .nav-tab {
        flex-direction: column;
        gap: 3px;
        padding: 9px 2px;
        min-width: 0;
        border-radius: 10px;
    }
    .nav-ico { font-size: 17px; }
    .nav-label {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: -0.4px;
    }
}

@media (max-width: 480px) {
    .account-bar {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    .account-who { flex: 1 1 100%; order: 2; }
    .account-actions { flex: 1 1 100%; order: 1; }
    .account-btn { flex: 1; justify-content: center; padding: 0 10px; }
    .account-email { font-size: 12px; }

    .nav-label { font-size: 10px; }
    .nav-ico { font-size: 16px; }
}

/* ========================================
   승인 대기 화면
   ======================================== */
.pending-account {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    margin: 18px 0;
    background: #f7f8fc;
    border-radius: 9px;
    font-size: 13px;
    color: #777;
    word-break: break-all;
}

/* ========================================
   관리자 콘솔
   ======================================== */
.admin-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}
.nav-tab[data-view="admin"] .nav-ico { position: relative; }

.admin-counts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.admin-count {
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 0.82em;
    background: #f4f5f8;
    color: #777;
}
.admin-count b { font-size: 1.15em; margin-left: 3px; }
.admin-count.wait { background: #fff4e0; color: #d9903a; }
.admin-count.ok { background: #e6f4ea; color: #2e7d4f; }
.admin-count.pause { background: #eceff1; color: #607d8b; }
.admin-count.no { background: #fdecea; color: #c0392b; }

.admin-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.admin-toolbar input {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 2px solid #e4e6ef;
    border-radius: 9px;
    font-size: 0.95em;
    outline: none;
}
.admin-toolbar input:focus { border-color: #5c6bc0; }
.admin-refresh {
    padding: 11px 15px;
    border: 1px solid #d5daea;
    border-radius: 9px;
    background: #fff;
    color: #5c6bc0;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.admin-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
}
.admin-filter {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1px solid #e0e3ec;
    border-radius: 16px;
    background: #fff;
    color: #888;
    font-size: 0.83em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.admin-filter.active { background: #5c6bc0; border-color: #5c6bc0; color: #fff; }

.admin-user-list { display: flex; flex-direction: column; gap: 10px; }
.admin-user {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border: 1px solid #e4e6ef;
    border-left: 4px solid #5c6bc0;
    border-radius: 10px;
    background: #fff;
    flex-wrap: wrap;
}
.admin-user-main { flex: 1 1 200px; min-width: 0; }
.admin-user-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 5px; }
.admin-user-name { font-size: 1.02em; font-weight: 700; color: #333; }
.admin-user-sub { font-size: 0.83em; color: #999; word-break: break-all; }

.admin-status {
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: 700;
}
.admin-status.wait { background: #fff4e0; color: #d9903a; }
.admin-status.ok { background: #e6f4ea; color: #2e7d4f; }
.admin-status.pause { background: #eceff1; color: #607d8b; }
.admin-status.no { background: #fdecea; color: #c0392b; }

.admin-role-tag {
    padding: 2px 8px;
    border-radius: 10px;
    background: #ede7f6;
    color: #6a4fb0;
    font-size: 0.7em;
    font-weight: 700;
}

.admin-user-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.adm-btn {
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 0.79em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid #d5daea;
    background: #fff;
    color: #5c6bc0;
}
.adm-approve { border-color: #a5d6b7; background: #f2fbf5; color: #2e7d4f; }
.adm-reject { border-color: #f0c4c0; background: #fff; color: #e74c3c; }
.adm-suspend { border-color: #ccd3d8; background: #fff; color: #607d8b; }
.adm-role { border-color: #d3c6ee; background: #fbf9ff; color: #6a4fb0; }
.admin-self { font-size: 0.8em; color: #bbb; padding: 7px 4px; }

.admin-loading { padding: 36px 16px; text-align: center; color: #aaa; font-size: 0.9em; line-height: 1.8; }

/* 관리자 계정 추가 버튼 */
.admin-add {
    padding: 11px 15px;
    border: none;
    border-radius: 9px;
    background: #5c6bc0;
    color: #fff;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.admin-add:active { background: #4a58a8; }
.admin-refresh { min-width: 46px; }

/* 로그인 화면 - 회원가입 유도 */
.auth-signup-cta {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #eef0f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.auth-signup-cta span { font-size: 13px; color: #999; }
.auth-signup-btn {
    width: 100%;
    padding: 13px;
    border: 1.5px solid #667eea;
    border-radius: 10px;
    background: #fff;
    color: #667eea;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.auth-signup-btn:active { background: #f2f3ff; }

.signup-after-note {
    margin: 14px 0 0;
    font-size: 12px;
    color: #aaa;
    text-align: center;
    line-height: 1.6;
}

.inv-name-hint {
    display: block;
    margin-top: 5px;
    font-size: 11.5px;
    line-height: 1.5;
    color: #9aa0b8;
}

.inv-name-hint b { color: #667eea; }

/* 이어지는 행 (품목명 없이 규격만 적는 행) */
.inv-mcard-cont {
    color: #aab;
    font-weight: 500;
}

.inv-mcard-no.cont {
    background: #eceef7;
    color: #99a;
}

/* 데스크탑 표 위 안내문 (모바일에서는 카드를 눌러 열므로 숨긴다) */
.inv-calc-hint {
    margin: 0 0 8px;
    padding: 8px 11px;
    border-radius: 8px;
    background: #f2f3ff;
    border: 1px solid #e0e3f7;
    font-size: 12px;
    color: #5a63a8;
    line-height: 1.5;
}

.inv-calc-hint b { font-size: 14px; }

@media (max-width: 768px) {
    .inv-calc-hint { display: none; }
}

/* ── 노무비 계산기 (품목 입력 모달) ── */
.lab-calc {
    margin: 12px 0;
    border: 1px solid #e3e7f5;
    border-radius: 10px;
    background: #f7f8fd;
    overflow: hidden;
}

.lab-calc-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #42509b;
}

.lab-calc-toggle input { width: 16px; height: 16px; flex: 0 0 auto; }

.lab-calc-body {
    padding: 0 12px 12px;
    border-top: 1px solid #e3e7f5;
}

.lab-calc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.lab-calc-grid.two { grid-template-columns: 1.4fr 1fr; }

.lab-calc-grid .form-group { margin: 0; }

.lab-calc-grid label {
    display: block;
    font-size: 11px;
    color: #7a7f9a;
    margin-bottom: 3px;
    font-weight: 600;
}

.lab-calc-grid input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 9px;
    border: 1px solid #d6dbee;
    border-radius: 7px;
    font-size: 14px;
    text-align: right;
}

.lab-calc-grid.two input:not([type="number"]) { text-align: left; }

.lab-calc-label {
    display: block;
    margin: 12px 0 5px;
    font-size: 11px;
    font-weight: 600;
    color: #7a7f9a;
}

.lab-sur-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lab-sur-presets button {
    padding: 6px 9px;
    border: 1px solid #d6dbee;
    border-radius: 14px;
    background: #fff;
    color: #666;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.lab-sur-presets button.on {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

.lab-calc-result {
    margin-top: 11px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff;
    border: 1px dashed #c5cced;
    font-size: 12.5px;
    line-height: 1.6;
    color: #42509b;
}

.lab-calc-result b { color: #1a237e; }

.lab-calc-note {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: #9aa0b8;
}

.lab-calc-note b { color: #7a82a8; }

/* 모바일 합계 패널의 할증 줄 */
.inv-mtot-sur > span {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.inv-mtot-sur select {
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    padding: 3px 4px;
    max-width: 130px;
}

.inv-mtot-sur input[type="number"] {
    width: 46px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 12px;
    padding: 3px 2px;
}

@media (max-width: 420px) {
    .lab-calc-grid { grid-template-columns: 1fr 1fr; }
    .lab-calc-grid .form-group:nth-child(3) { grid-column: 1 / -1; }
}

/* ── 사용법 영상 보기 (로그인 / 승인 대기 화면) ── */
.auth-guide-btn {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid #ffd9d9;
    border-radius: 10px;
    background: #fff6f6;
    text-decoration: none;
    text-align: left;
}

.auth-guide-btn:active { background: #ffecec; }

.auth-guide-play {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ff0000;
    color: #fff;
    font-size: 12px;
    line-height: 30px;
    text-align: center;
    padding-left: 2px;   /* ▶ 글리프가 왼쪽으로 쏠리는 것 보정 */
    box-sizing: border-box;
}

.auth-guide-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.auth-guide-text b {
    font-size: 14px;
    font-weight: 700;
    color: #d32f2f;
}

.auth-guide-text small {
    font-size: 11.5px;
    color: #a98585;
    line-height: 1.4;
}

/* ========================================
   앱 정보 탭 (제품 소개 스타일)
   ======================================== */
.about-hero {
    text-align: center;
    padding: 8px 0 22px;
}
.about-logo {
    width: 76px;
    height: 76px;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 8px 22px rgba(102,126,234,.35);
}
.about-name { font-size: 22px; font-weight: 800; color: #2b2f42; letter-spacing: -0.5px; }
.about-tagline { font-size: 13px; color: #8b8fa3; margin-top: 3px; }
.about-version {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    background: #eef1fb;
    color: #667eea;
    font-size: 12px;
    font-weight: 600;
}

.about-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.about-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px;
    border: 1px solid #eef0f5;
    border-radius: 12px;
    background: #fafbfe;
}
.about-feat-ico { font-size: 22px; flex: 0 0 auto; }
.about-feature b { display: block; font-size: 13.5px; color: #2b2f42; }
.about-feature small { font-size: 11.5px; color: #9a9eb0; }

.about-actions { display: flex; flex-direction: column; gap: 9px; margin-bottom: 22px; }
.about-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102,126,234,.28);
}
.about-btn:active { transform: translateY(1px); }
.about-btn-ghost {
    background: #fff;
    color: #667eea;
    border: 1.5px solid #d9def0;
    box-shadow: none;
}
.about-btn:disabled { opacity: .6; cursor: default; }

.about-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.about-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid #f2f3f8;
}
.about-list-item:last-child { border-bottom: none; }
.about-list-ico { font-size: 19px; flex: 0 0 auto; margin-top: 1px; }
.about-list-item b { display: block; font-size: 13.5px; color: #2b2f42; margin-bottom: 2px; }
.about-list-item small { font-size: 12px; color: #9a9eb0; line-height: 1.5; }

.about-footer {
    text-align: center;
    padding: 18px 0 6px;
    font-size: 12px;
    color: #b8bcca;
    line-height: 1.7;
}

@media (max-width: 380px) {
    .about-features { grid-template-columns: 1fr; }
}

/* 계정 탭 - 위험 영역 */
.account-danger { border-top-color: #f5d5d0; }
.account-danger h4 { color: #e74c3c; }
.danger-btn {
    padding: 12px 18px;
    border: 1.5px solid #e74c3c;
    border-radius: 10px;
    background: #fff;
    color: #e74c3c;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.danger-btn:active { background: #fdecea; }
.danger-btn:disabled { border-color: #e0b4b0; color: #d9a29e; background: #faf3f2; cursor: not-allowed; }
#deleteAccountConfirm:not(:disabled) {
    background: #e74c3c;
    color: #fff;
}
.delete-confirm-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e74c3c;
    border-radius: 9px;
    font-size: 15px;
    text-align: center;
    outline: none;
    margin-bottom: 6px;
    box-sizing: border-box;
}

/* 회원가입 모달은 로그인 화면(z-index:3000) 위에 떠야 한다 */
#signupModal { z-index: 3500; }

/* 설정 모달 안에서 다시 여는 모달들은 설정 모달 위에 떠야 한다 */
#deleteAccountModal { z-index: 2000; }
#adminAddModal { z-index: 2000; }

/* ========================================
   승인 조건 안내 (승인 대기 화면)
======================================== */
.approve-box {
    text-align: left;
    margin: 4px 0 18px;
    padding: 16px 14px;
    background: #f7f8fc;
    border: 1px solid #e3e6f5;
    border-radius: 12px;
}

.approve-title {
    font-size: 14px;
    font-weight: 700;
    color: #5c6bc0;
    margin-bottom: 8px;
}

.approve-lead {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

.approve-lead b { color: #333; }
.approve-eta { color: #999; font-size: 12px; }

.approve-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.approve-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 9px;
    border: 1px solid #eceefa;
}

.approve-num {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.approve-step-body { flex: 1; min-width: 0; }

.approve-step-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.approve-link {
    display: inline-block;
    padding: 6px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
}

.approve-link.yt { background: #ff0000; }
.approve-link.blog { background: #03c75a; }
.approve-link:active { opacity: .85; }

.approve-ask {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #888;
    text-align: center;
}

.approve-ask b { color: #667eea; }

.approve-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d8dcf0;
}

.approve-form-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.approve-form-desc {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #999;
}

.approve-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.approve-form input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #dcdfe8;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}

.approve-form input:focus { border-color: #667eea; outline: none; }

.approve-save {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.approve-save:active { opacity: .85; }
.approve-save:disabled { opacity: .6; cursor: default; }

.approve-msg {
    margin-top: 8px;
    font-size: 12px;
    min-height: 16px;
    color: #667eea;
    text-align: center;
}

.approve-msg.ok { color: #2e9e5b; }
.approve-msg.error { color: #e74c3c; }

/* 관리자 — 승인 조건 대조 */
.admin-check-links {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-check-link {
    flex: 1;
    padding: 9px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: #fff;
}

.admin-check-link.yt { background: #ff0000; }
.admin-check-link.blog { background: #03c75a; }
.admin-check-link:active { opacity: .85; }

.admin-user-check {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.admin-chk {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    word-break: break-all;
}

.admin-chk.yt { background: #ffecec; color: #d32f2f; }
.admin-chk.blog { background: #e8f8ee; color: #1e8e4e; }
.admin-chk.none { background: #f2f2f2; color: #aaa; font-weight: 500; }

/* ========================================
   견적서 / 거래명세서 — 모바일 품목 입력
   데스크탑에서는 표를, 모바일에서는 카드 목록을 쓴다
======================================== */
.inv-mobile-wrap { display: none; }

@media (max-width: 768px) {
    .inv-mobile-wrap { display: block; margin-bottom: 12px; }
    #invDesktopTableWrap { display: none; }
    #addInvoiceItemBtn { display: none; }
}

.inv-mobile-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    padding: 0 2px 8px;
}

.inv-mobile-count { font-size: 12px; font-weight: 600; color: #888; }

.inv-mobile-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inv-mobile-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 13px;
    color: #aaa;
    background: #fafbff;
    border: 1px dashed #d8dcf0;
    border-radius: 10px;
}

.inv-mcard {
    display: flex;
    align-items: stretch;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e5f0;
    border-radius: 10px;
    padding: 10px 10px 10px 12px;
}

.inv-mcard.section {
    background: #eef0fb;
    border-color: #ccd2f0;
}

.inv-mcard-main {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.inv-mcard-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
}

.inv-mcard-no {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #667eea;
    border-radius: 5px;
    padding: 1px 6px;
}

.inv-mcard-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inv-mcard.section .inv-mcard-name { color: #3f51b5; }

.inv-mcard-sub {
    font-size: 11.5px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inv-mcard-amt {
    font-size: 14px;
    font-weight: 700;
    color: #2196F3;
    margin-top: 4px;
}

.inv-mcard-side {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.inv-mcard-side button {
    width: 30px;
    height: 24px;
    border: 1px solid #e0e3ee;
    background: #f7f8fc;
    border-radius: 6px;
    font-size: 11px;
    color: #777;
    cursor: pointer;
    padding: 0;
}

.inv-mcard-side button:active { background: #e8eaf6; }
.inv-mcard-side button.del { color: #e74c3c; }

.inv-mobile-add {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #667eea;
    background: #f7f8ff;
    color: #667eea;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.inv-mobile-add.secondary {
    margin-top: 6px;
    border-color: #c9cee0;
    background: #fafbfe;
    color: #8890a8;
    font-size: 13px;
    padding: 10px;
}

.inv-mobile-add:active { opacity: .85; }

.inv-mobile-totals {
    margin-top: 14px;
    background: #f7f8fc;
    border: 1px solid #e2e5f0;
    border-radius: 10px;
    padding: 12px 14px;
}

.inv-mtot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #666;
    padding: 5px 0;
}

.inv-mtot-row b { color: #333; font-weight: 700; }

.inv-mtot-row input {
    width: 42px;
    padding: 2px 4px;
    border: 1px solid #dcdfe8;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
}

.inv-mtot-row.grand {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid #d8dcf0;
    font-size: 15px;
    color: #333;
    font-weight: 700;
}

.inv-mtot-row.grand b { color: #2196F3; font-size: 17px; }

/* 품목 입력 모달 */
.inv-item-form { padding: 4px 20px 20px; }

.inv-sec-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: #f7f8fc;
    border: 1px solid #e2e5f0;
    border-radius: 8px;
    font-size: 12.5px;
    color: #666;
    cursor: pointer;
}

.inv-sec-toggle input { width: 16px; height: 16px; accent-color: #667eea; }

.inv-price-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.inv-price-grid .form-group { margin-bottom: 10px; }
.inv-price-grid label { font-size: 12px; }

.inv-amt-hint {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #999;
    text-align: right;
}

.inv-row-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    margin-bottom: 12px;
    background: #eef4ff;
    border-radius: 9px;
    font-size: 13px;
    color: #555;
}

.inv-row-total b { font-size: 17px; color: #2196F3; }

.inv-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inv-item-actions .btn { flex: 1; margin: 0; }

.inv-item-del {
    flex: 0 0 auto;
    padding: 12px 14px;
    border: 1px solid #ffd2d2;
    background: #fff5f5;
    color: #e74c3c;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

#invItemModal { z-index: 3000; }

/* ========================================
   작업일 방식 (연속된 기간 / 날짜 골라서)
======================================== */
.date-mode-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.date-mode-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    border: 2px solid #e0e3ee;
    border-radius: 9px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: all .15s;
}

.date-mode-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.date-mode-btn:has(input:checked),
.date-mode-btn.selected {
    border-color: #667eea;
    background: #f0f2ff;
    color: #4a56c4;
}

.date-mode-hint {
    display: block;
    margin-top: 7px;
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

.date-mode-hint b { color: #667eea; }

.date-pick-row {
    display: flex;
    gap: 6px;
}

.date-pick-row input {
    flex: 1;
    min-width: 0;
}

.date-pick-row button {
    flex: 0 0 auto;
    padding: 0 16px;
    border: 1px solid #667eea;
    background: #f7f8ff;
    color: #667eea;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.date-pick-row button:active { background: #e8ebff; }

.date-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px 7px 12px;
    background: #eef0fb;
    border: 1px solid #ccd2f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #3f51b5;
}

.date-chip .chip-no {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #667eea;
    border-radius: 4px;
    padding: 1px 5px;
}

.date-chip button {
    border: none;
    background: transparent;
    color: #8a92b8;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.date-chip button:active { color: #e74c3c; }

.date-chips-empty {
    width: 100%;
    padding: 16px 12px;
    text-align: center;
    font-size: 13px;
    color: #aaa;
    background: #fafbff;
    border: 1px dashed #d8dcf0;
    border-radius: 9px;
}

/* ========================================
   작업일별 시간 입력
======================================== */
.day-time-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.day-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    background: #fafbfe;
    border: 1px solid #e2e5f0;
    border-radius: 9px;
}

.day-time-row.first { border-color: #ccd2f0; background: #f4f6ff; }

.day-time-label {
    flex: 0 0 auto;
    min-width: 62px;
    font-size: 12.5px;
    font-weight: 700;
    color: #4a56c4;
}

.day-time-row input[type="time"] {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid #dcdfe8;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.day-time-sep { flex: 0 0 auto; color: #bbb; font-size: 12px; }

.day-time-sync {
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    border: 1px dashed #c9cee0;
    background: #fafbfe;
    color: #8890a8;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.day-time-sync:active { background: #f0f2ff; }

.day-time-empty {
    padding: 14px 12px;
    text-align: center;
    font-size: 12.5px;
    color: #aaa;
    background: #fafbff;
    border: 1px dashed #d8dcf0;
    border-radius: 9px;
}

@media (max-width: 420px) {
    .day-time-label { min-width: 54px; font-size: 11.5px; }
    .day-time-row { padding: 6px 7px; gap: 4px; }
    .day-time-row input[type="time"] { font-size: 13px; padding: 7px 4px; }
}

/* 일정 상세 — 작업일 목록 */
.detail-workdays {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.detail-workday {
    padding: 7px 11px;
    background: #eef0fb;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #3f51b5;
    cursor: pointer;
    font-family: inherit;
}

.detail-workday:active { opacity: .8; }
.detail-workday.done { background: #eaf7ec; color: #2e7d32; }

/* 지금 보고 있는 날짜를 표시 */
.detail-workday.focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.15); }
.detail-workday.done.focus { border-color: #2e7d32; box-shadow: 0 0 0 2px rgba(46,125,50,.15); }

.detail-workday-hint {
    margin-top: 7px;
    font-size: 11.5px;
    color: #aaa;
}

/* ========================================
   설정 → 백업
======================================== */
.backup-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 6px;
    background: #f7f8fc;
    border: 1px solid #e2e5f0;
    border-radius: 10px;
}

.backup-status-label { font-size: 12.5px; color: #888; }
.backup-status-value { font-size: 13.5px; font-weight: 700; color: #333; text-align: right; }
.backup-status.stale { background: #fff8e6; border-color: #ffe0a3; }
.backup-status.stale .backup-status-value { color: #d98700; }

.backup-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.backup-count {
    padding: 5px 10px;
    background: #eef0fb;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #4a56c4;
}

.backup-btn {
    width: 100%;
    padding: 13px;
    border: 1px solid #c9cee0;
    background: #fff;
    color: #555;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.backup-btn.primary {
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.backup-btn:active { opacity: .85; }
.backup-btn:disabled { opacity: .55; cursor: default; }

.backup-folder {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #fafbfe;
    border: 1px solid #e2e5f0;
    border-radius: 9px;
    font-size: 13px;
}

.backup-folder span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
    font-weight: 600;
}

.backup-folder button {
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid #667eea;
    background: #f7f8ff;
    color: #667eea;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.backup-folder button:last-child { border-color: #e0c3c3; background: #fff5f5; color: #c0392b; }

/* ========================================
   개선 요청
======================================== */
.fb-type-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.fb-type-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    border: 2px solid #e0e3ee;
    border-radius: 9px;
    background: #fff;
    font-size: 12.5px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.fb-type-btn input { position: absolute; opacity: 0; width: 0; height: 0; }

.fb-type-btn:has(input:checked),
.fb-type-btn.selected {
    border-color: #ff9800;
    background: #fff5e6;
    color: #e65100;
}

.fb-hint {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: #aaa;
    line-height: 1.6;
}

.fb-hint b { color: #888; }

.fb-privacy {
    padding: 11px 13px;
    margin: 12px 0;
    background: #f7f8fc;
    border: 1px solid #e2e5f0;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.6;
    color: #777;
}

.fb-privacy b { color: #4a56c4; }

.fb-my-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fb-card {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e5f0;
    border-radius: 10px;
}

.fb-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.fb-card-body {
    font-size: 13px;
    line-height: 1.65;
    color: #555;
    white-space: pre-wrap;
    word-break: break-word;
}

.fb-card-date { font-size: 11.5px; color: #aaa; margin-top: 6px; }

.fb-reply {
    margin-top: 9px;
    padding: 10px 12px;
    background: #f4faf5;
    border-left: 3px solid #a5d6a7;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #33691e;
    white-space: pre-wrap;
}

.fb-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.fb-badge.type { background: #eef0fb; color: #4a56c4; }
.fb-badge.new       { background: #e8f3fe; color: #1565C0; }
.fb-badge.reviewing { background: #fff5e6; color: #e65100; }
.fb-badge.done      { background: #eaf7ec; color: #2e7d32; }
.fb-badge.hold      { background: #f2f2f2; color: #888; }

.fb-empty {
    padding: 22px 12px;
    text-align: center;
    font-size: 13px;
    color: #aaa;
    background: #fafbff;
    border: 1px dashed #d8dcf0;
    border-radius: 10px;
}

.fb-filter {
    padding: 8px 14px;
    border: 1px solid #dcdfe8;
    background: #fff;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.fb-filter.active { border-color: #ff9800; background: #fff5e6; color: #e65100; }

.fb-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
}

.fb-admin-actions button {
    padding: 6px 11px;
    border: 1px solid #dcdfe8;
    background: #fff;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    font-family: inherit;
}

.fb-admin-actions button.danger { border-color: #ffd2d2; color: #c0392b; background: #fff5f5; }
.fb-admin-actions button:active { opacity: .8; }

.fb-meta {
    margin-top: 7px;
    font-size: 11px;
    color: #bbb;
    word-break: break-all;
}

.backup-restore-warn {
    padding: 11px 13px;
    margin-bottom: 11px;
    background: #fff5f5;
    border: 1px solid #ffd2d2;
    border-radius: 9px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #c0392b;
}

/* ========================================
   견적서 상단 옵션 (문서 유형 / 부가세 · 직인)
======================================== */
.inv-opt-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.inv-type-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.inv-type-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    border: 2px solid #e0e3ee;
    border-radius: 9px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    text-align: center;
    transition: all .15s;
    white-space: nowrap;
}

.inv-type-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.inv-type-btn.statement:has(input:checked) { border-color: #2196F3; background: #e8f3fe; color: #1565C0; }
.inv-type-btn.estimate:has(input:checked)  { border-color: #ff9800; background: #fff5e6; color: #e65100; }
.inv-type-btn.receipt:has(input:checked)   { border-color: #4CAF50; background: #eaf7ec; color: #2e7d32; }

/* :has() 미지원 브라우저 대비 — JS가 selected 클래스를 함께 붙인다 */
.inv-type-btn.statement.selected { border-color: #2196F3; background: #e8f3fe; color: #1565C0; }
.inv-type-btn.estimate.selected  { border-color: #ff9800; background: #fff5e6; color: #e65100; }
.inv-type-btn.receipt.selected   { border-color: #4CAF50; background: #eaf7ec; color: #2e7d32; }

.inv-check-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.inv-check {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 6px;
    border: 1px solid #e0e3ee;
    border-radius: 9px;
    background: #fafbfe;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.inv-check input {
    width: 17px;
    height: 17px;
    accent-color: #667eea;
    margin: 0;
}

@media (max-width: 420px) {
    .inv-type-btn { font-size: 11.5px; padding: 9px 3px; }
    .inv-check { font-size: 12px; }
}

/* 간이영수증 모드에서 감출 요소 */
body.inv-mode-receipt .inv-receipt-hide { display: none !important; }

/* 미리보기 — 간이영수증 */
.receipt-doc {
    max-width: 560px;
    margin: 0 auto;
    padding: 26px 24px 30px;
    background: #fff;
    border: 2px solid #2e7d32;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    color: #222;
    position: relative;   /* 워터마크 기준 */
}

.receipt-title {
    text-align: center;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 14px;
    color: #2e7d32;
    padding-bottom: 12px;
    margin-bottom: 6px;
}

.receipt-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    border-bottom: 3px double #2e7d32;
    padding-bottom: 10px;
    margin-bottom: 18px;
}

.receipt-to {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
}

.receipt-to span { font-size: 14px; font-weight: 500; color: #777; }

.receipt-amount-box {
    background: #f4faf5;
    border: 1px solid #cbe6cf;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
    text-align: center;
}

.receipt-amount-label { font-size: 12px; color: #6c8b70; margin-bottom: 4px; }
.receipt-amount { font-size: 30px; font-weight: 800; color: #2e7d32; }
.receipt-amount-ko { margin-top: 6px; font-size: 14px; font-weight: 600; color: #55705a; }

.receipt-confirm {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin: 18px 0 20px;
    color: #333;
}

.receipt-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    font-size: 13px;
}

.receipt-items th {
    background: #f1f5f2;
    border: 1px solid #dfe6e0;
    padding: 8px;
    font-weight: 600;
    color: #555;
}

.receipt-items td {
    border: 1px solid #e6eae7;
    padding: 8px;
    text-align: right;
}

.receipt-items td:first-child { text-align: left; }

.receipt-supplier {
    border: 1px solid #dfe6e0;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.9;
    position: relative;
}

.receipt-supplier .rs-title {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.receipt-supplier b { display: inline-block; min-width: 74px; color: #888; font-weight: 500; }

.receipt-stamp {
    position: absolute;
    right: 18px;
    bottom: 16px;
    width: 62px;
    height: 62px;
}

.receipt-notes {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fafbfa;
    border-left: 3px solid #cbe6cf;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    white-space: pre-line;
}
