* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --tg-viewport-height: 100vh;
    --tg-viewport-stable-height: 100vh;
}

html {
    overflow: auto;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: auto;
    min-height: 100vh;
}

#app {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: visible;
}

#loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #999;
}

#unauthorized {
    text-align: center;
    padding: 40px 20px;
}

#unauthorized h2 {
    color: #e74c3c;
    margin-bottom: 10px;
}

.guest-container {
    text-align: center;
    padding: 40px 20px;
}

.guest-container h2 {
    margin-bottom: 20px;
}

.guest-container code {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.welcome {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    border-radius: 8px;
}

.welcome strong {
    color: var(--tg-theme-button-color, #3390ec);
}

.mode-switch {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-bottom: 1px solid var(--tg-theme-hint-color, #ccc);
}

.mode-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 6px;
    color: var(--tg-theme-text-color, #000);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn.active {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    border-color: var(--tg-theme-button-color, #3390ec);
    font-weight: 600;
}

.tabs {
    display: flex;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-bottom: 1px solid var(--tg-theme-hint-color, #ccc);
    flex-shrink: 0;
    z-index: 10;
}

.tab {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color, #000);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: var(--tg-theme-bg-color, #fff);
    border-bottom: 2px solid var(--tg-theme-button-color, #3390ec);
    font-weight: 600;
}

#partner-view {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: visible;
}

.content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
}

.header {
    margin-bottom: 20px;
}

.header h2 {
    margin-bottom: 15px;
}

.header input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
}

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:hover {
    background: var(--tg-theme-hint-color, #e0e0e0);
}

.list-item-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.list-item-subtitle {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
}

.delete-client-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
    z-index: 10;
}

.delete-client-btn:hover {
    opacity: 1;
}

.detail {
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--tg-theme-button-color, #3390ec);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 12px 0;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-theme-hint-color, #666);
    margin-bottom: 5px;
}

.form input {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    box-sizing: border-box;
}

.form input:disabled {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    color: var(--tg-theme-hint-color, #999);
}

.btn-primary {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.btn-primary:active {
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--tg-theme-hint-color, #999);
    font-size: 15px;
    line-height: 1.6;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-buttons button {
    flex: 1;
}

.btn-secondary {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    color: var(--tg-theme-text-color, #000);
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:active {
    opacity: 0.8;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:active {
    opacity: 0.8;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group button {
    flex: 1;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.modal-content {
    background: var(--tg-theme-bg-color, #fff);
    margin: 50px auto;
    padding: 20px;
    max-width: 500px;
    border-radius: 12px;
    animation: slideIn 0.3s;
}

.photo-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.photo-preview {
    width: 100%;
    max-height: 200px;
    border: 2px dashed var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.photo-preview.empty {
    min-height: 100px;
    color: var(--tg-theme-hint-color, #999);
}

.payment-summary {
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.payment-summary h3,
.payment-summary h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.payment-amount {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.amount-detail {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--tg-theme-hint-color, #666);
}

.amount-total {
    font-size: 24px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
    text-align: right;
    padding-top: 10px;
    border-top: 1px solid var(--tg-theme-hint-color, #ddd);
}

.btn-large {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    margin-bottom: 30px;
}

.payment-history {
    margin-top: 30px;
}

.payment-history h3,
.payment-history h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.payment-history-item {
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.payment-history-item-date {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
    margin-bottom: 5px;
}

.payment-history-item-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
}

.payment-history-item-status {
    font-size: 13px;
    margin-top: 5px;
}

.payment-history-item-status.completed {
    color: #27ae60;
}

.payment-history-item-status.pending {
    color: #f39c12;
}

.form select {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    box-sizing: border-box;
}

/* 서브탭 */
.subtabs {
    display: flex;
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    border-bottom: 1px solid var(--tg-theme-hint-color, #ddd);
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.subtab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color, #000);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.subtab.active {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    font-weight: 600;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* 폴더 그리드 */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.folder-card {
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.folder-card:hover {
    border-color: var(--tg-theme-button-color, #3390ec);
    transform: translateY(-2px);
}

.folder-card .folder-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.folder-card .folder-icon.default-icon {
    filter: brightness(0.85) saturate(0.7) hue-rotate(90deg);
}

.folder-card .folder-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--tg-theme-text-color, #000);
}

.folder-card .folder-count {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
}

/* 기본 폴더 (Photos/Info) - 파스텔 민트 녹색 */
.folder-card.default-folder {
    background: #E8F5E9;
    border-color: #C8E6C9;
}

.folder-card.default-folder:hover {
    border-color: #C8E6C9;
    background: #C8E6C9;
}

/* 사진 그리드 */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.photo-card img[loading="lazy"] {
    opacity: 0;
}

.photo-card img[loading="lazy"].loaded,
.photo-card img {
    opacity: 1;
}

.photo-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.photo-delete-btn:hover {
    background: rgba(231, 76, 60, 1);
    transform: scale(1.1);
}

/* 선택 모드 */
.select-mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--tg-theme-bg-color, #fff);
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
    margin: 0 -16px;
    margin-top: 8px;
}

.select-mode-header button {
    background: none;
    border: none;
    color: var(--tg-theme-link-color, #2481cc);
    font-size: 14px;
    padding: 4px 8px;
    cursor: pointer;
}

.select-mode-header span {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
}

.photo-card.select-mode {
    cursor: pointer;
}

.photo-card.select-mode .photo-delete-btn {
    display: none;
}

.photo-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 10;
}

.photo-card.selected .photo-checkbox {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.photo-card.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* 작은 버튼 */
.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* 전체 너비 버튼 */
.btn-full {
    width: 100%;
    margin-top: 20px;
}

/* 헤더 정렬 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h4 {
    margin: 0;
}

/* 폴더 상세 헤더 */
.folder-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.folder-detail-header .back-btn {
    flex: 1;
}

/* 폴더 메뉴 */
.folder-menu {
    position: relative;
}

.kebab-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    color: var(--tg-theme-text-color, #000);
}

.folder-menu-popup {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--tg-theme-bg-color, #fff);
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    min-width: 150px;
    overflow: hidden;
}

.folder-menu-popup .menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: var(--tg-theme-text-color, #000);
    transition: background 0.2s;
}

.folder-menu-popup .menu-item:hover {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

.folder-menu-popup .menu-item:not(:last-child) {
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

/* 모달 내 텍스트 */
.modal-content p {
    margin: 15px 0;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #000);
}

/* 토스트 메시지 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* 로딩 스피너 */
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(var(--tg-theme-button-color, #3390ec), 0.3);
    border-top-color: var(--tg-theme-button-color, #3390ec);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
}

.loading-container .spinner {
    margin-bottom: 10px;
}

/* 저장 상태 표시 */
.save-status {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    margin-top: 10px;
    border-radius: 6px;
    transition: all 0.3s;
}

.save-status.saved {
    color: var(--tg-theme-hint-color, #999);
    background: transparent;
}

.save-status.saving {
    color: var(--tg-theme-button-color, #3390ec);
    background: rgba(var(--tg-theme-button-color, 51, 144, 236), 0.1);
    font-weight: 600;
}

.save-status.completed {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    font-weight: 600;
}

/* 폴더 카드 메뉴 */
.folder-card {
    position: relative;
}

.folder-card-content {
    flex: 1;
    cursor: pointer;
}

.folder-card-menu {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.folder-card-menu-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--tg-theme-hint-color, #ddd);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--tg-theme-text-color, #000);
    transition: background 0.2s;
}

.folder-card-menu-btn:hover,
.folder-card-menu-btn:active {
    background: rgba(255, 255, 255, 1);
}

.folder-card-menu-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--tg-theme-bg-color, #fff);
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    overflow: hidden;
}

.folder-card-menu-popup .menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: var(--tg-theme-text-color, #000);
    transition: background 0.2s;
}

.folder-card-menu-popup .menu-item:hover,
.folder-card-menu-popup .menu-item:active {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

.folder-card-menu-popup .menu-item:not(:last-child) {
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

/* 검색창 */
.search-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
}

.search-input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color, #3390ec);
}

/* 거래처 목록 스크롤 */
#partner-clients-list {
    max-height: calc(var(--tg-viewport-stable-height) - 300px);
    overflow-y: auto;
}

/* 사진 팝업 모달 */
.photo-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.photo-popup-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.photo-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.photo-popup-close:hover,
.photo-popup-close:active {
    background: rgba(255, 255, 255, 1);
}

.photo-thumbnail {
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-thumbnail:hover,
.photo-thumbnail:active {
    opacity: 0.8;
}

/* 거래처 신규 등록 & 정보 수정 - 컴팩트 레이아웃 공통 스타일 */
#client-add-screen,
#client-info-tab {
    padding: 16px;
}

#client-add-screen .back-btn {
    margin-bottom: 8px;
    padding: 8px 0;
}

#client-add-screen h3,
#client-info-tab h3 {
    font-size: 16px;
    margin-bottom: 16px;
    font-weight: 600;
}

#client-add-screen .form,
#client-info-tab .form {
    gap: 10px;
}

#client-add-screen .form label,
#client-info-tab .form label {
    margin-bottom: 3px;
}

#client-add-screen .form input,
#client-add-screen .form select,
#client-add-screen .form textarea,
#client-info-tab .form input,
#client-info-tab .form select,
#client-info-tab .form textarea {
    margin-bottom: 5px;
}

#client-add-screen .field-hint,
#client-info-tab .field-hint {
    margin-top: -8px;
    margin-bottom: 5px;
}

/* 거래처 상세 - 거래처명 크게 표시 */
.client-name-large {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 20px 0;
    color: var(--tg-theme-text-color, #000);
}

/* 공지사항 */
.notice-section {
    margin-top: 24px;
    padding: 16px;
    background: var(--tg-theme-secondary-bg-color, #f8f9fa);
    border-radius: 8px;
}

.notice-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--tg-theme-text-color, #000);
}

.notice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notice-item {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #000);
    padding: 8px 0;
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

.notice-item:last-child {
    border-bottom: none;
}

/* 저장 완료 버튼 */
.btn-success {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

/* 결제 안내 문구 */
.payment-notice {
    text-align: center;
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
    margin-top: -10px;
    margin-bottom: 20px;
}

/* 비활성 버튼 */
.btn-primary:disabled,
.btn-large:disabled {
    background: var(--tg-theme-hint-color, #ccc) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 필드 힌트 */
.field-hint {
    display: block;
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
    margin-top: -10px;
    margin-bottom: 10px;
}

/* 모달 헤더 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--tg-theme-hint-color, #e0e0e0);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--tg-theme-text-color, #000);
}

/* 텍스트 영역 */
.form textarea {
    display: block;
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.5;
}

.form textarea:focus {
    outline: none;
    border-color: var(--tg-theme-button-color, #3390ec);
}

/* 글자수 카운터 */
.char-counter {
    text-align: right;
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
    margin-top: -10px;
    margin-bottom: 10px;
}

.char-counter.limit-exceeded {
    color: #e74c3c;
    font-weight: 600;
}

/* 거래처 소개 모달 - 큰 크기 */
#description-modal .modal-content {
    max-width: 90%;
    margin: 20px auto;
    padding: 20px;
}

#description-modal textarea {
    min-height: 300px;
    font-size: 15px;
}

/* 리스트 아이템 액션 버튼 */
.list-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-action {
    flex: 1;
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
}

.btn-action:active {
    opacity: 0.8;
}

.btn-action.btn-disabled {
    background: var(--tg-theme-hint-color, #ccc);
    color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 모바일 최적화 */
@media (max-width: 480px) {
    .content {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .tab {
        padding: 14px 8px;
        font-size: 13px;
    }

    .subtab {
        padding: 12px 8px;
        font-size: 12px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        min-height: 48px;
        padding: 14px 16px;
        font-size: 15px;
    }

    .back-btn {
        min-height: 44px;
        font-size: 16px;
    }

    .form input,
    .form select,
    .form textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .header input {
        min-height: 44px;
        font-size: 16px;
    }

    .search-input {
        min-height: 44px;
        font-size: 16px;
    }

    .list-item {
        padding: 14px;
    }

    .list-item-title {
        font-size: 15px;
    }

    .folders-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .folder-card {
        padding: 16px;
    }

    .folder-card .folder-icon {
        font-size: 36px;
    }

    .folder-card .folder-name {
        font-size: 13px;
    }

    .modal-content {
        margin: 20px auto;
        padding: 16px;
        max-width: calc(100% - 32px);
    }

    .photo-delete-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .client-name-large {
        font-size: 18px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }

    h4 {
        font-size: 15px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
}

/* 환불 요청 버튼 */
.refund-request-btn {
    width: 100%;
    padding: 10px 16px;
    background: white;
    border: 1px solid #dc3545;
    color: #dc3545;
    font-size: 14px;
    text-align: center;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.refund-request-btn:hover {
    background: #dc3545;
    color: white;
}

.refund-request-btn:active {
    transform: scale(0.98);
}

/* 환불 대기 상태 */
.list-item-refund-status {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 6px;
}

.refund-pending-text {
    color: var(--tg-theme-text-color, #333);
    font-size: 13px;
    margin-bottom: 8px;
}

.refund-cancel-btn {
    width: 100%;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--tg-theme-hint-color, #999);
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.refund-cancel-btn:hover {
    background: var(--tg-theme-hint-color, #999);
    color: #fff;
}

.refund-cancel-btn:active {
    transform: scale(0.98);
}

/* 확인 모달 */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}

.confirm-modal.active {
    opacity: 1;
}

.confirm-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 280px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.confirm-modal.active .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--tg-theme-text-color, #333);
}

.confirm-modal-message {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999);
    margin-bottom: 20px;
    line-height: 1.5;
}

.confirm-modal-buttons {
    display: flex;
    gap: 8px;
}

.confirm-modal-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.confirm-modal-btn-cancel {
    background: #fff;
    border: 1px solid var(--tg-theme-hint-color, #999);
    color: var(--tg-theme-hint-color, #999);
}

.confirm-modal-btn-cancel:hover {
    background: var(--tg-theme-hint-color, #999);
    color: #fff;
}

.confirm-modal-btn-confirm {
    background: #dc3545;
    color: #fff;
}

.confirm-modal-btn-confirm:hover {
    background: #c82333;
}

.confirm-modal-btn-confirm.success {
    background: #4CAF50;
}

.confirm-modal-btn-confirm.success:hover {
    background: #45a049;
}

.confirm-modal-btn:active {
    transform: scale(0.98);
}

/* 스켈레톤 UI */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    padding: 15px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 10px;
}

.skeleton-subtitle {
    height: 14px;
    width: 40%;
    margin-bottom: 8px;
}

.skeleton-text {
    height: 14px;
    width: 80%;
}

.skeleton-stat-card {
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.skeleton-stat-label {
    height: 14px;
    width: 70%;
    margin-bottom: 10px;
}

.skeleton-stat-value {
    height: 32px;
    width: 50%;
}

/* 로딩 메시지 개선 */
#loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    font-size: 14px;
    color: #999;
    margin-top: 10px;
}

.loading-progress {
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}
