:root {
  --primary-color: #353535;
  --secondary-color: #26506b;
  --border-color: #ddd;
  --success-color: #2ecc71;
  --danger-color: #e74c3c;
  --warning-color: #f1c40f;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  display: flex;
  min-height: 100vh;
  background: linear-gradient(120deg, #f5f6fa 0%, #eaf6fb 100%);
}

.sidebar {
  width: 200px;
  background-color: var(--primary-color);
  padding: 20px;
  color: white;
}

.sidebar button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar button.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: bold;
  border-color: rgba(255, 255, 255, 0.4);
}

.main {
  flex: 1;
  padding: 20px;
  background-color: #f5f6fa;
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px 16px;
  border-radius: 16px;
  box-shadow: 0 4px 24px #0001;
  background: #fff;
  overflow-y: auto; /* 允許頁面滾動 */
  max-height: 100vh; /* 限制最大高度 */
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

h2 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-color);
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

input:invalid {
  border-color: var(--danger-color);
}

button {
  padding: 10px 20px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #2980b9;
}

.filter {
  margin-bottom: 20px;
}

.filter-btn {
  margin-right: 10px;
  background-color: #f8f9fa;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.filter-btn.active {
  background-color: var(--secondary-color);
  color: white;
}



.price-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    border-left: 3px solid #2196f3;
}

.price-info b {
    color: #1565c0;
    font-size: 14px;
}

.amount {
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.amount.overdue {
    color: #dc3545;
    background: #f8d7da;
}

.amount.normal {
    color: #28a745;
    background: #d4edda;
}

.days-left {
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.days-left.urgent {
    color: #dc3545;
    background: #f8d7da;
    animation: pulse 2s infinite;
}

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

/* 繳款設定 */
.due-date-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.due-date-control label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.due-date-control input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

.override-tip {
    color: #6c757d;
    font-size: 12px;
    font-style: italic;
}

/* 客戶操作區域 */
.customer-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
}

.action-btn.primary {
    background: #007bff;
}

.action-btn.primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #f8f9fa;
    color: #374151;
    border: 1px solid #e1e8ed;
}

.action-btn.secondary:hover {
    background: #e9ecef;
}

.action-btn.warning {
    background: #ffc107;
    color: #212529;
}

.action-btn.warning:hover {
    background: #e0a800;
}

.action-btn.danger {
    background: #dc3545;
}

.action-btn.danger:hover {
    background: #c82333;
}

.action-btn.small {
    padding: 4px 8px;
    font-size: 11px;
}

.action-btn .icon {
    font-size: 14px;
}

/* 客戶詳細資料 */
.customer-detail {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    border: 1px solid #e9ecef;
}

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

.detail-section h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 5px;
}

/* 檔案上傳區域 */
.file-upload-group {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.file-upload-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

.file-info a {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
}

.file-info a:hover {
    text-decoration: underline;
}

.file-name {
    color: #6c757d;
    font-size: 12px;
    font-family: monospace;
}

.no-file {
    color: #6c757d;
    font-style: italic;
    font-size: 13px;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-controls input[type="file"] {
    flex: 1;
    padding: 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

.upload-controls .upload-btn {
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.upload-controls .upload-btn:hover {
    background: #218838;
}

/* 繳款紀錄樣式 */
.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.payment-header h5 {
    margin: 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
}

.add-payment-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.add-payment-btn:hover {
    background: #218838;
}

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

.payment-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.payment-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    flex: 1;
}

.payment-date,
.payment-amount,
.payment-note {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-date label,
.payment-amount label,
.payment-note label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
}

.payment-date input,
.payment-amount input,
.payment-note input {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

.payment-actions {
    display: flex;
    gap: 8px;
}

.payment-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.payment-summary p {
    margin: 0;
    font-size: 14px;
    color: #495057;
}

.payment-summary b {
    color: #28a745;
    font-size: 16px;
}

.no-payments {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* 通知樣式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 狀態標籤 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.renting {
    background: #d4edda;
    color: #155724;
}

.status-badge.buyback {
    background: #cce7ff;
    color: #004085;
}

.status-badge.locked {
    background: #f8d7da;
    color: #dc3545;
}

.status-badge.overdue {
    background: #fff3cd;
    color: #856404;
}

.status-badge.normal {
    background: #d1ecf1;
    color: #0c5460;
}

/* 響應式設計 */
@media (max-width: 768px) {
    /* 主要佈局調整 */
    body {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        z-index: 1000;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .sidebar button {
        flex: 1;
        min-width: 80px;
        margin: 2px;
        padding: 8px 4px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .main {
        margin-top: 60px;
        padding: 10px;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
        width: 100%;
    }
    
    /* 客戶資訊調整 */
    .customer-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .customer-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .payment-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .payment-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .payment-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* 表單調整 */
    .form-group {
        margin-bottom: 12px;
    }
    
    input[type="text"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px; /* 防止 iOS 縮放 */
        padding: 12px;
    }
    
    /* 按鈕調整 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        margin: 4px;
    }
    
    /* 表格調整 */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 6px 4px;
    }
}

.section {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.attachment-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.attachment-block img, .attachment-block iframe {
  border-radius: 8px;
  box-shadow: 0 2px 8px #0001;
  border: 1px solid #eee;
  background: #fafbfc;
}

.upload-btn, .btn {
  border-radius: 20px;
  padding: 6px 18px;
  font-weight: 500;
  margin-right: 8px;
  background: #3498db;
  color: #fff;
  border: none;
  transition: background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.upload-btn:hover, .btn:hover {
  background: #217dbb;
  box-shadow: 0 2px 8px #3498db33;
}

input[type="file"] {
  display: none;
}

.attachment-label {
  display: inline-block;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.95em;
  margin-bottom: 2px;
}

.attachment-preview {
  margin-top: 4px;
}



.status {
  font-size: 1em;
  padding: 4px 10px;
  border-radius: 8px;
  margin-right: 6px;
}







.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1000;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 10px;
  cursor: pointer;
  font-size: 24px;
  font-weight: bold;
  color: #000000;
  background: #fff;
  border: 2px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 1001;
}

.close-modal:hover {
  background-color: #f0f0f0;
  color: #333;
  transform: scale(1.1);
}

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

.dashboard-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(28, 70, 28, 0);
  text-align: center;
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.stat-card h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 1.1em;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-card p {
  font-size: 2.2em;
  font-weight: 700;
  color: var(--secondary-color);
  margin: 0;
  line-height: 1.2;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: #666;
  font-size: 0.9em;
  font-weight: 500;
}

/* 儀表板圖表容器 */
#dashboard-chart {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 24px;
}

#amount-chart-container {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 24px;
}

#ratio-chart-container {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 24px;
}

/* 儀表板日期選擇器 */
.dashboard-date-controls {
  background: linear-gradient(135deg, #232946 0%, #16161a 100%);
  border-color: #3a3a4a;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-date-controls label {
  color: #ffffff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dashboard-date-controls input[type="date"] {
  background: #181824;
  color: #f4f4f8;
  border: 1.5px solid #3a3a4a;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.dashboard-date-controls input[type="date"]:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 2px #6366f1;
  background: #232946;
  color: #fff;
  outline: none;
}

.dashboard-date-controls button,
.dashboard-date-controls .search-btn,
.dashboard-date-controls .reset-btn {
  background: linear-gradient(135deg, #6366f1 0%, #3730a3 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dashboard-date-controls button:hover,
.dashboard-date-controls .search-btn:hover,
.dashboard-date-controls .reset-btn:hover {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

#dashboard-date-search-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

#dashboard-date-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* 智能分析建議容器 */
.insights-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 32px;
}

.insights-container h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 1.4em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.5px;
}

.insights-container h3::before {
  content: '💡';
  font-size: 1.3em;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

#insights-content {
  line-height: 1.8;
  color: #333;
}

#insights-content p {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-left: 4px solid var(--secondary-color);
  background: rgba(52, 152, 219, 0.05);
  border-radius: 0 12px 12px 0;
  font-size: 1.05em;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

#insights-content p:hover {
  background: rgba(52, 152, 219, 0.08);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

#insights-content p::before {
  content: '•';
  position: absolute;
  left: -8px;
  top: 12px;
  color: var(--secondary-color);
  font-weight: bold;
  font-size: 1.2em;
}

/* 警告樣式 */
.insights-content .warning {
  border-left-color: #e74c3c;
  background: rgba(231, 76, 60, 0.05);
}

.insights-content .warning:hover {
  background: rgba(231, 76, 60, 0.08);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.15);
}

.insights-content .warning::before {
  content: '⚠️';
  color: #e74c3c;
}

/* 建議樣式 */
.insights-content .suggestion {
  border-left-color: #f39c12;
  background: rgba(243, 156, 18, 0.05);
}

.insights-content .suggestion:hover {
  background: rgba(243, 156, 18, 0.08);
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.15);
}

.insights-content .suggestion::before {
  content: '💡';
  color: #f39c12;
}

/* 成功樣式 */
.insights-content .success {
  border-left-color: #27ae60;
  background: rgba(39, 174, 96, 0.05);
}

.insights-content .success:hover {
  background: rgba(39, 174, 96, 0.08);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.15);
}

.insights-content .success::before {
  content: '✅';
  color: #27ae60;
}

/* 進階分析樣式 */
.advanced-analysis {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid rgba(52, 152, 219, 0.2);
}

.advanced-analysis h4 {
  color: #1976d2;
  font-weight: 700;
  margin-bottom: 16px;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.advanced-analysis h4::before {
  content: '🔍';
  font-size: 1.1em;
}

.ranking-item {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.ranking-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ranking-number {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  font-weight: bold;
  font-size: 0.9em;
  margin-right: 12px;
}

.ranking-content {
  display: inline-block;
  vertical-align: top;
  width: calc(100% - 40px);
}

.ranking-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.ranking-stats {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 4px;
}

.ranking-suggestion {
  font-size: 0.9em;
  color: var(--secondary-color);
  font-style: italic;
}

/* 分析章節樣式 */
.analysis-section {
  margin-bottom: 20px;
}

.analysis-section h5 {
  color: #34495e;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-section h5::before {
  content: '📊';
  font-size: 1em;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .insights-container {
    padding: 20px;
  }
  
  .insights-container h3 {
    font-size: 1.2em;
  }
  
  #insights-content p {
    font-size: 1em;
    padding: 10px 12px;
  }
  
  .ranking-item {
    padding: 10px 12px;
  }
  
  .ranking-content {
    width: calc(100% - 35px);
  }
}

/* 數據更新動畫 */
.stat-card.updated {
  animation: dataUpdate 0.6s ease;
}

@keyframes dataUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* 無數據狀態 */
.no-data {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 1.1em;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #ddd;
}

.no-data::before {
  content: '📊';
  font-size: 2em;
  display: block;
  margin-bottom: 12px;
}

/* 錯誤訊息樣式 */
.error-message {
  color: var(--danger-color);
  margin-top: 8px;
  font-size: 0.9em;
  padding: 8px 12px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 6px;
  border-left: 3px solid var(--danger-color);
}

/* 載入狀態 */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--secondary-color);
  font-size: 1.1em;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--secondary-color);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-left: 12px;
  vertical-align: middle;
}

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

/* === 響應式設計與現代化UI優化 === */
html {
  scroll-behavior: smooth;
}

button, .filter-btn {
  border-radius: 24px;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 4px #0001;
}

input, select, textarea {
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 10px;
  font-size: 1em;
  margin-bottom: 8px;
}

/* 客戶編輯表單分段顯示（手機） */
@media (max-width: 600px) {
  .main {
    padding: 8px 4px;
    border-radius: 0;
    box-shadow: none;
    margin-top: 80px;
  }
  
  .customer-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .customer-info p {
    font-size: 13px;
    margin: 3px 0;
  }
  
  .sidebar {
    position: fixed;
    left: 0; 
    top: 0; 
    right: 0;
    width: 100vw;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    z-index: 1000;
    background: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding: 8px 4px;
  }
  
  .sidebar button {
    flex: 1;
    min-width: 70px;
    font-size: 11px;
    padding: 6px 2px;
    margin: 1px;
    border: none;
    border-radius: 4px;
  }
  
  .form-group {
    margin-bottom: 8px;
  }
  
  /* 編輯表單分段顯示 */
  #edit-customer-form > .form-group {
    display: none;
  }
  
  #edit-customer-form > .form-group.active {
    display: block;
  }
  
  #edit-customer-form .form-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 4px;
  }
  
  #edit-customer-form .form-nav button {
    flex: 1;
    margin: 0;
    font-size: 12px;
    padding: 6px 2px;
  }
  
  /* 表格調整 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
    font-size: 11px;
  }
  
  th, td {
    padding: 4px 2px;
    white-space: nowrap;
  }
  
  /* 按鈕組調整 */
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .btn-group .btn {
    width: 100%;
    margin: 0;
  }
}

/* 超小螢幕手機優化 */
@media (max-width: 480px) {
  .main {
    margin-top: 100px;
    padding: 6px 2px;
  }
  
  .sidebar {
    padding: 6px 2px;
  }
  
  .sidebar button {
    font-size: 10px;
    padding: 4px 1px;
    min-width: 60px;
  }
  
  h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  .form-group {
    margin-bottom: 6px;
  }
  
  input[type="text"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px;
    padding: 10px;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 12px;
    margin: 2px;
  }
  
  /* 卡片樣式調整 */
  .customer-card {
    padding: 8px;
    margin-bottom: 8px;
  }
  
  .customer-info p {
    font-size: 12px;
    margin: 2px 0;
  }
  
  /* 表格進一步優化 */
  .table-container {
    margin: 0 -2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    font-size: 10px;
    min-width: 500px;
  }
  
  th, td {
    padding: 3px 1px;
    white-space: nowrap;
  }
  
  /* 確保表格可以水平滾動 */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
  }
  
  /* 模態框調整 */
  .modal {
    padding: 10px;
  }
  
  .modal-content {
    margin: 10px;
    padding: 15px;
  }
  
  /* Toast 調整 */
  .toast {
    top: 10px;
    right: 10px;
    left: 10px;
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* 手機端通用優化 */
@media (max-width: 768px) {
  /* 防止文字選擇 */
  * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* 允許輸入框文字選擇 */
  input, textarea, select {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }
  
  /* 改善觸控體驗 */
  button, .btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* 改善滾動體驗 */
  .main {
    -webkit-overflow-scrolling: touch;
  }
}

/* 美化滾動條 */
::-webkit-scrollbar {
  width: 8px;
  background: #f0f0f0;
}
::-webkit-scrollbar-thumb {
  background: #cfd8dc;
  border-radius: 8px;
}

/* Toast 美化 */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #222;
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  box-shadow: 0 2px 12px #0005;
  z-index: 9999;
  font-size: 1.1em;
  opacity: 0.95;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 0.95; transform: translateY(0); }
}

.payment-record {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
    padding: 5px;
    border-radius: 4px;
    background-color: #f5f5f5;
}

.payment-date {
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.payment-amount {
    font-weight: bold;
    color: #2e7d32;
}

.payment-note {
    color: #666;
    font-style: italic;
}

.edit-payment-btn {
    padding: 4px 8px;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-payment-btn:hover {
    background-color: #1976d2;
}

/* 帳務表格美化 */
.account-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
  background: #fff;
  font-size: 16px;
  box-shadow: 0 2px 8px #0001;
}
.account-table th, .account-table td {
  border: 1px solid #000000;
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}
.account-table th {
  background: #eaf3fb;
  color: #1565c0;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
}
.account-table tr:nth-child(even) {
  background: #f8fbfd;
}
.account-table tr:hover {
  background: #f1f8ff;
}
.account-table td {
  word-break: break-all;
  max-width: 240px;
  color: var(--text-color);
}

/* 表格外層橫向捲動 */
#table-container > div {
  overflow-x: auto;
}

#table-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 12px;
}

/* 風險評分樣式 */
.risk-score-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.risk-score {
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
}

.risk-level {
  font-size: 0.5em;
  margin-left: 10px;
  padding: 4px 8px;
  border-radius: 4px;
}

.high-risk {
  background-color: #ffebee;
  color: #c62828;
}

.medium-risk {
  background-color: #fff3e0;
  color: #ef6c00;
}

.low-risk {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.risk-details {
  margin-top: 15px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 4px;
}

.risk-details p {
  margin: 5px 0;
  color: #666;
}

.risk-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: bold;
}

/* 客戶列表中的風險評分樣式 */
.risk-score-cell {
  text-align: center;
  min-width: 80px;
} 

/* 帳表樣式 */
.account-summary {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.summary-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.summary-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.summary-card {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #6c757d;
    font-weight: 600;
}

.summary-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
}

.summary-value.normal {
    color: #28a745;
}

.summary-value.overdue {
    color: #dc3545;
}

.summary-value.locked {
    color: #dc3545;
}

.summary-value.buyback {
    color: #007bff;
}

.summary-value.completed {
    color: #6c757d;
}

.summary-value.profit {
    color: #28a745;
}

.summary-value.loss {
    color: #dc3545;
}

/* 帳表表格樣式 */
.account-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 12px;
}

.account-table th {
    background: #495057;
    color: white;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.account-table td {
    padding: 8px;
    border: 1px solid #000000;
    text-align: center;
    vertical-align: middle;
    color: var(--text-color);
}

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

/* 行狀態樣式 */
.overdue-row {
    background-color: #fff5f5;
}

.overdue-row:hover {
    background-color: #ffe6e6;
}

.normal-row {
    background-color: #f8fff8;
}

.normal-row:hover {
    background-color: #e6ffe6;
}

.buyback-row {
    background-color: #f0f8ff;
}

.buyback-row:hover {
    background-color: #e6f3ff;
}

.completed-row {
    background-color: #f8f9fa;
}

.completed-row:hover {
    background-color: #e9ecef;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .summary-cards {
        flex-direction: column;
    }
    
    .summary-card {
        min-width: auto;
    }
    
    .account-table {
        font-size: 10px;
    }
    
    .account-table th,
    .account-table td {
        padding: 6px 4px;
    }
}

/* 帳表導出按鈕 */
.export-buttons {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.export-btn:hover {
    background: #0056b3;
}

.export-btn.excel {
    background: #28a745;
}

.export-btn.excel:hover {
    background: #1e7e34;
}

/* 帳表篩選器 */
.account-filters {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.filter-group select,
.filter-group input {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group button {
    padding: 6px 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.filter-group button:hover {
    background: #5a6268;
}



 

/* 新的客户卡系统样式 */

/* 快速操作栏 */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(135deg, #242424 0%, #252525 100%);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 8px;
  color: #2c3e50;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.quick-action-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quick-action-btn.primary {
  background: rgba(255, 255, 255, 1);
  color: #333;
}

.quick-action-btn.primary:hover {
  background: rgba(250, 250, 250, 250);
}

.quick-action-btn .icon {
  font-size: 16px;
}

/* 智能筛选器 */
.smart-filter {
  margin-bottom: 24px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
}

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

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 18px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 20px;
  color: #6b7280;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.filter-tab:hover {
  background: #e9ecef;
  color: #374151;
}

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

.filter-tab .tab-icon {
  font-size: 14px;
}

.tab-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

/* 客户网格 */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

/* 本日應繳徽章樣式 */
.due-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  border: 2px solid #fff;
  animation: pulse 2s infinite;
  margin-left: 8px;
}

.due-today-icon {
  font-size: 14px;
}

.due-today-text {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.5);
  }
  100% {
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  }
}

/* 现代化客户卡片 */
.customer-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.customer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.customer-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.customer-card.overdue::before {
  background: #dc3545;
}

.customer-card.due-today::before {
  background: #ffc107;
}

.customer-card.locked::before {
  background: #6c757d;
}

.customer-card.buyback::before {
  background: #28a745;
}

/* 客户卡片头部 */
.customer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.customer-info-main {
  flex: 1;
}

.customer-name {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.customer-id {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.customer-status {
  display: flex;
  align-items: center;
  gap: 8px;
}



/* 客户信息网格 */
.customer-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.info-section {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid #6c757d;
}

.info-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.info-label {
  color: #6b7280;
  font-weight: 500;
}

.info-value {
  color: #2c3e50;
  font-weight: 600;
}

.info-value.amount {
  color: #e74c3c;
}

.info-value.amount.normal {
  color: #27ae60;
}

/* 财务信息突出显示 */
.financial-highlight {
  background: #6c757d;
  color: white;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.financial-highlight h4 {
  color: white;
  margin-bottom: 12px;
}

.financial-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.financial-label {
  color: rgba(255, 255, 255, 0.9);
}

.financial-value {
  font-weight: 600;
  font-size: 16px;
}

/* 操作按钮组 */
.customer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}



/* 分页控件 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.pagination-btn {
  padding: 8px 16px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  color: #374151;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #e9ecef;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-weight: 500;
  color: #6b7280;
}

/* 模态框样式更新 */
.modal-content.large {
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
}

.modal-content.large .close-modal {
  top: 20px;
  right: 25px;
}

/* 編輯表單特定樣式 - 已移至統一表單樣式系統 */

#edit-modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

#edit-modal .form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

#edit-modal .nav-btn {
  padding: 8px 16px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#edit-modal .nav-btn:hover {
  background: #5a6fd8;
}

#edit-modal .nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#edit-modal .section-indicators {
  display: flex;
  gap: 8px;
}

#edit-modal .indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e1e8ed;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#edit-modal .indicator.active {
  background: #667eea;
  color: white;
}

#edit-modal .form-actions {
  text-align: center;
}

#edit-modal .submit-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#edit-modal .submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.edit-customer-modal .file-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.edit-customer-modal .file-upload-item {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  border: 2px dashed #e1e8ed;
  transition: all 0.3s ease;
  cursor: pointer;
}

.edit-customer-modal .file-upload-item:hover {
  border-color: #667eea;
  background: #f0f2ff;
}

.edit-customer-modal .file-upload-item label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
}

.edit-customer-modal .file-upload-item input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #e1e8ed;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.edit-customer-modal .file-preview {
  margin-top: 8px;
  min-height: 20px;
}

.edit-customer-modal .file-preview.has-file {
  background: #e8f5e8;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #4caf50;
}

.edit-customer-modal .delete-file-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.edit-customer-modal .delete-file-btn:hover {
  background: #c82333;
}

.edit-customer-modal .delete-icon {
  font-size: 14px;
}

.edit-customer-modal .file-info.has-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 通用表單分節樣式 - 已移至統一位置 */

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

.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.nav-btn {
  padding: 8px 16px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: #5a6fd8;
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.section-indicators {
  display: flex;
  gap: 8px;
}

.indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e1e8ed;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator.active {
  background: #667eea;
  color: white;
}

.form-actions {
  text-align: center;
}

.submit-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-1px);
}

/* 文件上传网格 */
.file-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.file-upload-item {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  border: 2px dashed #e1e8ed;
  transition: all 0.3s ease;
}

.file-upload-item:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.file-upload-item label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #374151;
}

.file-upload-item input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #e1e8ed;
  border-radius: 4px;
}

.file-preview {
  margin-top: 8px;
  min-height: 60px;
  background: white;
  border-radius: 4px;
  padding: 8px;
  border: 1px solid #e1e8ed;
}

/* 批量缴款样式 */
.bulk-payment-content {
  display: grid;
  gap: 24px;
}

.bulk-payment-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
}

.bulk-payment-summary h4 {
  color: white;
  margin-bottom: 16px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 600;
}

.bulk-payment-form {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 12px;
}

.bulk-payment-customers {
  max-height: 300px;
  overflow-y: auto;
}

.customer-selection-list {
  display: grid;
  gap: 12px;
}

.customer-selection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
}

.bulk-payment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 50%;
}

.btn-secondary {
  background: #f8f9fa;
  color: #374151;
  border: 1px solid #e1e8ed;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #e9ecef;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .quick-actions {
    flex-direction: column;
  }
  
  .filter-tabs {
    justify-content: center;
  }
  
  .customer-grid {
    grid-template-columns: 1fr;
  }
  
  .customer-info-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .file-upload-grid {
    grid-template-columns: 1fr;
  }
  
  .summary-stats {
    grid-template-columns: 1fr;
  }
  
  .bulk-payment-actions {
    flex-direction: column;
  }
} 

/* 客户详情模态框样式 */
.customer-detail-full {
  max-height: 80vh;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e1e8ed;
}

.detail-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
}

.detail-sections {
  display: grid;
  gap: 24px;
}

.detail-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
}

.detail-section h4 {
  color: #2c3e50;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e1e8ed;
}

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

.detail-label {
  color: #6b7280;
  font-weight: 500;
  font-size: 14px;
}

.detail-value {
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
}

.payment-history {
  max-height: 200px;
  overflow-y: auto;
}

.payment-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: white;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e1e8ed;
}

.payment-date {
  color: #6b7280;
  font-size: 14px;
}

.payment-amount {
  color: #27ae60;
  font-weight: 600;
  font-size: 16px;
}

.payment-note {
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
}

.no-payments {
  text-align: center;
  color: #9ca3af;
  padding: 20px;
  font-style: italic;
}

.detail-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid #e1e8ed;
}

/* 客户卡片选择样式 */
.customer-card.selected {
  border: 2px solid #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
  transform: scale(1.02);
}

.customer-card.selected::before {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  height: 6px;
}

/* 通知样式 */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  max-width: 300px;
}

.notification.success {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.notification.error {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.notification.warning {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.notification.info {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 文件预览样式 */
.file-preview {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 6px;
  border: 1px solid #e1e8ed;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.file-preview.has-file {
  background: #f0f4ff;
  border-color: #667eea;
  color: #667eea;
}

/* 表单验证样式 */
.form-group.error input,
.form-group.error select {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group.error .error-message {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 4px;
}

/* 加载状态样式 */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: #6b7280;
}

.empty-state p {
  margin-bottom: 24px;
  font-size: 14px;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .detail-actions {
    flex-direction: column;
  }
  
  .customer-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
} 

/* 修复模态框层级问题 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  animation: modalSlideIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 确保客户详情模态框有更高的层级 */
#customer-detail-modal {
  z-index: 1001;
}

/* 确保编辑和缴款模态框在详情模态框之上 */
#edit-modal,
#payment-modal {
  z-index: 1002;
}

/* 确保通知显示在最顶层 */
.notification {
  z-index: 1003;
}

/* 添加自动刷新机制 */
.auto-refresh-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(52, 152, 219, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 999;
  display: none;
}

.auto-refresh-indicator.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* 优化模态框内容滚动 */
.modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 1003;
}

.modal-content.large {
  max-width: 800px;
  max-height: 90vh;
}

/* 确保按钮在模态框内正常工作 */
.modal-content .action-btn {
  position: relative;
  z-index: 1004;
}

/* 添加数据更新提示 */
.data-updated {
  animation: dataUpdate 0.5s ease;
}

@keyframes dataUpdate {
  0% { background-color: transparent; }
  50% { background-color: rgba(46, 204, 113, 0.2); }
  100% { background-color: transparent; }
}

/* 优化客户卡片更新效果 */
.customer-card.updated {
  animation: cardUpdate 0.6s ease;
}

@keyframes cardUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* 檔案連結樣式 */
.file-link {
  color: var(--secondary-color);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(52, 152, 219, 0.1);
  transition: all 0.3s ease;
  display: inline-block;
}

.file-link:hover {
  background-color: rgba(52, 152, 219, 0.2);
  color: var(--secondary-color);
  text-decoration: none;
  transform: translateY(-1px);
}

.no-file {
  color: #999;
  font-style: italic;
} 

/* 儀表板樣式 */
.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.date-filter-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-filter-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #495057;
}

.date-filter-section input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}


.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background: #545b62;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-section,
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.btn-toggle {
  background: #e9ecef;
  color: #495057;
  border: 1px solid #ced4da;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-toggle.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.btn-toggle:hover:not(.active) {
  background: #dee2e6;
}

/* 統計卡片網格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.stat-icon {
  font-size: 32px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f8f9fa;
}

.stat-content h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-content p {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #212529;
}

.stat-content small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6c757d;
}

/* 卡片主題 */
.stat-card.primary .stat-icon {
  background: #e3f2fd;
  color: #1976d2;
}

.stat-card.success .stat-icon {
  background: #e8f5e8;
  color: #2e7d32;
}

.stat-card.warning .stat-icon {
  background: #fff3e0;
  color: #f57c00;
}

.stat-card.danger .stat-icon {
  background: #ffebee;
  color: #d32f2f;
}

.stat-card.info .stat-icon {
  background: #e0f2f1;
  color: #00796b;
}

.stat-card.profit .stat-icon {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* 圖表區域 */
.charts-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

.chart-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.chart-container {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  height: 400px;
  overflow: hidden;
  flex: 1;
  min-width: 300px;
}

.chart-container.large {
  height: 450px;
  flex: 1 1 100%;
}

.chart-container.medium {
  height: 350px;
  flex: 1 1 calc(50% - 12px);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.chart-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chart-controls {
  display: flex;
  gap: 8px;
}

.chart-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.chart-btn:hover {
  background: #f3f4f6;
}

.chart-btn.active:hover {
  background: #2563eb;
}

.chart-summary {
  display: flex;
  gap: 16px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-label {
  font-size: 16px;
  color: #ffffff;
}

.summary-value {
  font-size: 16px;
  font-weight: 600;
  color: #FFF;
}

.chart-content {
  height: calc(100% - 60px);
  position: relative;
}

.chart-container canvas {
  max-height: 100% !important;
  height: 100% !important;
}

/* 實時監控區域 - 合併版本 */
.real-time-section {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 24px;
}

.real-time-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981, #059669);
}

.real-time-indicator {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-radius: 12px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #166534;
  border: 1px solid #bbf7d0;
  margin-bottom: 16px;
}

.pulse {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.real-time-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.rt-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rt-label {
  font-size: 14px;
  color: #000000;
  font-weight: 700;
}

.rt-value {
  font-size: 16px;
  font-weight: 800;
  color: #1a202c;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* 風險評估區域 - 合併版本 */
.risk-section {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 24px;
}

.risk-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.risk-level-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.risk-level-indicator h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.risk-level {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #fde68a;
}

.risk-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.risk-metric {
  padding: 16px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.risk-label {
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 8px;
  font-weight: 700;
}

.risk-value {
  font-size: 18px;
  font-weight: 800;
  color: #333;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.risk-bar {
  border-radius: 6px;
  overflow: hidden;
  background: #475569;
  height: 10px;
  margin: 8px 0;
}

.risk-fill {
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
}

/* 智能分析建議 - 合併版本 */
.insights-section {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 24px;
}

.insights-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

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

.insights-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.insights-controls {
  display: flex;
  gap: 8px;
}

.insight-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.insight-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.insight-card {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 20px;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
  border-radius: 16px 16px 0 0;
}

.insight-card.warning::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.insight-card.suggestion::before {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.insight-card.success::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.insight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.insight-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.insight-content h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.insight-content p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
  font-weight: 500;
}

.insight-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #f3f4f6;
}

/* 快速操作面板 */
.quick-actions-panel {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.quick-actions-panel h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action:hover {
  background: #f3f4f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-icon {
  font-size: 24px;
}

.action-text {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .chart-row {
    flex-direction: column;
  }
  
  .chart-container.medium {
    flex: 1 1 100%;
  }
  
  .real-time-stats {
    grid-template-columns: 1fr;
  }
  
  .risk-metrics {
    grid-template-columns: 1fr;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .chart-container {
    padding: 16px;
    height: 300px;
  }
  
  .chart-container.large {
    height: 350px;
  }
  
  .chart-container.medium {
    height: 250px;
  }
  
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* KPI 卡片區塊 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: 0 4px 16px rgba(59,130,246,0.10);
}

.kpi-title {
  font-size: 15px;
  color: #1f2937;
  margin-bottom: 4px;
  font-weight: 600;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.kpi-detail {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

/* KPI 卡片顏色樣式 */
.kpi-card.primary {
  border-left: 4px solid #3b82f6;
}

.kpi-card.success {
  border-left: 4px solid #10b981;
}

.kpi-card.warning {
  border-left: 4px solid #f59e0b;
}

.kpi-card.danger {
  border-left: 4px solid #ef4444;
}

.kpi-card.info {
  border-left: 4px solid #06b6d4;
}

.kpi-card.profit {
  border-left: 4px solid #8b5cf6;
}

.kpi-card.rental {
  border-left: 4px solid #f97316;
}

.kpi-card.weekly {
  border-left: 4px solid #10b981;
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kpi-card {
    padding: 16px 12px;
  }
}

/* 儀表板整體視覺優化 */
.dashboard-container {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 100vh;
  padding: 24px;
}

/* 頂部控制面板視覺優化 */
.dashboard-header {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.15);
  color: white;
  position: relative;
  overflow: hidden;
}

.dashboard-header::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.dashboard-title h2 {
  font-size: 36px;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(45deg, #ffffff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.dashboard-subtitle {
  opacity: 1;
  font-size: 16px;
  margin-top: 8px;
  font-weight: 500;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 控制面板視覺優化 */
.dashboard-controls {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.dashboard-controls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #06b6d4);
  border-radius: 2px;
}

/* 按鈕視覺優化 */
.search-btn, .reset-btn {
  border-radius: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-size: 14px;
  padding: 12px 24px;
}

.search-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  border: none;
  color: white;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.35);
}

.reset-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  color: #64748b;
}

.reset-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

/* 篩選標籤視覺優化 */
.filter-chip {
  border-radius: 24px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
  font-size: 14px;
  border: 2px solid #e2e8f0;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #64748b;
}

.filter-chip.active {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
  transform: scale(1.05);
  border-color: #4f46e5;
}

.filter-chip:hover:not(.active) {
  border-color: #4f46e5;
  color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}



/* 趨勢指示器視覺優化 */
.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.trend-indicator.positive {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-color: #bbf7d0;
}

.trend-indicator.negative {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  color: #dc2626;
  border-color: #fecaca;
}

.trend-indicator.neutral {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: #fde68a;
}

/* 圖表容器視覺優化 */
.chart-container {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  padding: 28px;
}

.chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #06b6d4);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.chart-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(79, 70, 229, 0.12);
}

.chart-container:hover::before {
  opacity: 1;
}

.chart-header {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.chart-header h3 {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.3px;
}


.insight-content h4 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 12px 0;
  letter-spacing: -0.2px;
}

.insight-content p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

/* 快速操作區塊視覺優化 */
.quick-actions-panel {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  padding: 28px;
}

.quick-actions-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #06b6d4, #0891b2);
}

.quick-action {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  padding: 24px;
  text-align: center;
}

.quick-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.03), rgba(139, 92, 246, 0.03));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.quick-action:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.12);
}

.quick-action:hover::before {
  opacity: 1;
}

.action-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.action-text {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
}



/* 載入動畫 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card,
.chart-container,
.insight-card,
.quick-action {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }
.kpi-card:nth-child(5) { animation-delay: 0.5s; }
.kpi-card:nth-child(6) { animation-delay: 0.6s; }
.kpi-card:nth-child(7) { animation-delay: 0.7s; }

/* 深色模式支持 */
/* 優化深色主題配色 - 提高對比度和可讀性 */
/* 強制深色主題 - 不依賴系統設置 */
@media (prefers-color-scheme: dark) {
  .dashboard-container {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }
  
  .dashboard-controls,
  .kpi-card,
  .chart-container,
  .real-time-section,
  .risk-section,
  .insights-section,
  .quick-actions-panel {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  
  .kpi-title,
  .chart-header h3,
  .insight-content h4,
  .action-text {
    color: #ffffff;
    font-weight: 600;
  }
  
  .kpi-detail,
  .insight-content p {
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
  
  .kpi-value {
    color: #ffffff !important;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
  
  .filter-chip {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
    color: #e2e8f0;
    font-weight: 500;
  }
  
  .filter-chip.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    font-weight: 600;
  }
  
  .chart-btn {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
    color: #e2e8f0;
    font-weight: 500;
  }
  
  .chart-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    font-weight: 600;
  }
  
  /* 提高文字對比度 */
  .dashboard-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: #ffffff;
  }
  .dashboard-subtitle {
    color: #ffffff !important;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* 按鈕優化 */
  .search-btn, .reset-btn {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }
  
  /* 日期篩選區塊統一深色主題 */
  .dashboard-date-controls {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    border: 2px solid #475569 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  }
  
  .dashboard-date-controls label {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  .dashboard-date-controls input[type="date"] {
    background: #2d3748 !important;
    color: #ffffff !important;
    border: 2px solid #6366f1 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  }
  
  .dashboard-date-controls input[type="date"]:focus {
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    background: #4a5568 !important;
    color: #ffffff !important;
  }
  
  .dashboard-date-controls input[type="date"]::placeholder {
    color: #a0aec0 !important;
    opacity: 1 !important;
  }
  
  .dashboard-date-controls button,
  .dashboard-date-controls .search-btn,
  .dashboard-date-controls .reset-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  .dashboard-date-controls button:hover,
  .dashboard-date-controls .search-btn:hover,
  .dashboard-date-controls .reset-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #4338ca 100%) !important;
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-1px) !important;
  }
  
  /* 視圖切換按鈕統一深色主題 */
  .view-toggle .btn-toggle {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    color: #e2e8f0 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }
  
  .view-toggle .btn-toggle.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
  }
  
  .view-toggle .btn-toggle:hover:not(.active) {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
  }
  
  .section-label {
    color: #a0aec0 !important;
    font-weight: 600 !important;
  }
  
  /* 時間範圍篩選統一深色主題 */
  .filter-chip {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    color: #e2e8f0 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }
  
  .filter-chip.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
  }
  
  .filter-chip:hover:not(.active) {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
  }
  
  /* 統計卡片統一深色主題 */
  .stat-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .stat-card h3 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  .stat-card p {
    color: #e2e8f0 !important;
    font-weight: 500 !important;
  }
  
  .stat-card small {
    color: #a0aec0 !important;
  }
  
  /* 圖表容器統一深色主題 */
  .chart-container {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .chart-header h3 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  /* 實時數據區塊統一深色主題 */
  .real-time-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .real-time-indicator {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    color: #ffffff !important;
  }
  
  .rt-label {
    color: #1a202c !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  .rt-value {
    color: #1a202c !important;
    font-weight: 700 !important;
  }
  
  /* 風險評估區塊統一深色主題 */
  .risk-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .risk-level-indicator h3 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  .risk-label {
    color: #333 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  .risk-value {
    color: #333 !important;
    font-weight: 700 !important;
  }
  
  /* 洞察分析區塊統一深色主題 */
  .insights-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .insights-header h3 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  .insight-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .insight-content h4 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  .insight-content p {
    color: #e2e8f0 !important;
    font-weight: 500 !important;
  }
  
  /* 快速操作區塊統一深色主題 */
  .quick-actions-panel {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .quick-actions-panel h3 {
    color: #ffffff !important;
    font-weight: 700 !important;
  }
  
  .quick-action {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    border: 2px solid #4a5568 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
  
  .action-text {
    color: #ffffff !important;
    font-weight: 600 !important;
  }
  
  /* 按鈕統一深色主題 */
  .action-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }
  
  .action-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #4338ca 100%) !important;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-2px) !important;
  }
  
  /* 日期選擇器圖標顏色 */
  .dashboard-date-controls input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5) !important;
  }

  
  /* 卡片內容優化 */
  .stat-card h3,
  .chart-header h3,
  .insight-content h4 {
    color: #ffffff !important;
    font-weight: 600;
  }
  
  .stat-card p,
  .stat-card small {
    color: #e2e8f0 !important;
    font-weight: 500;
  }
  
  /* 趨勢指標優化 */
  .trend-indicator {
    font-weight: 600;
  }
  
  .trend-indicator.positive {
    color: #10b981 !important;
  }
  
  .trend-indicator.negative {
    color: #ef4444 !important;
  }
  
  .trend-indicator.neutral {
    color: #6b7280 !important;
  }
}

/* 智能分析建議按鈕優化 */
.insight-actions {
  margin-top: 16px;
}

.action-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  position: relative;
  overflow: hidden;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* 智能分析建議控制按鈕 */
.insights-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.insight-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  color: #64748b;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.insight-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  border-color: #4f46e5;
}

.insight-btn:hover:not(.active) {
  border-color: #4f46e5;
  color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

/* 智能分析建議標題區域 */
.insights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.insights-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.3px;
}

/* 智能分析建議網格 */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* 深色模式支持 - 優化對比度 */
@media (prefers-color-scheme: dark) {
  .action-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }
  
  .insight-btn {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
    color: #e2e8f0;
    font-weight: 500;
  }
  
  .insight-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    font-weight: 600;
  }
  
  .insight-btn:hover:not(.active) {
    border-color: #4f46e5;
    color: #ffffff;
    background: linear-gradient(135deg, #3d4a5c 0%, #2a3441 100%);
  }
  
  .insights-header h3 {
    color: #ffffff;
    font-weight: 600;
  }
}

/* 智能分析建議模態框 */
.insight-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.insight-modal.show {
  opacity: 1;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid #e2e8f0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.insight-modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 24px;
  color: #1e293b;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
  font-size: 16px;
  color: #64748b;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .modal-content {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
  }
  
  .modal-body {
    color: #f8fafc;
  }
  
  .modal-body p {
    color: #cbd5e1;
  }
  
  .modal-footer {
    border-color: #475569;
  }
}

/* 智能分析建議詳細內容樣式 */
.detail-content {
  max-height: 60vh;
  overflow-y: auto;
}

.detail-content h4 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin: 20px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.detail-content h4:first-child {
  margin-top: 0;
}

/* 統計數據樣式 */
.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-item {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 14px;
  color: #64748b;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

/* 客戶列表樣式 */
.customer-list {
  margin-bottom: 20px;
}

.customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #fecaca;
}

.customer-name {
  font-weight: 600;
  color: #dc2626;
}

.customer-amount {
  font-weight: 600;
  color: #dc2626;
}

.customer-days {
  font-size: 12px;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

/* 建議列表樣式 */
.suggestion-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.suggestion-list li {
  padding: 8px 0;
  padding-left: 20px;
  position: relative;
  color: #64748b;
  line-height: 1.6;
}

.suggestion-list li:before {
  content: '💡';
  position: absolute;
  left: 0;
  top: 8px;
}

/* 策略列表樣式 */
.strategy-list {
  margin-bottom: 20px;
}

.strategy-item {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #bae6fd;
}

.strategy-item h5 {
  margin: 0 0 8px 0;
  color: #0369a1;
  font-size: 16px;
  font-weight: 600;
}

.strategy-item p {
  margin: 0;
  color: #0c4a6e;
  line-height: 1.5;
}

/* 預期效果樣式 */
.expected-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.result-item {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid #bbf7d0;
}

.result-label {
  display: block;
  font-size: 12px;
  color: #166534;
  margin-bottom: 4px;
}

.result-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #166534;
}

/* 趨勢分析樣式 */
.trend-analysis {
  margin-bottom: 20px;
}

.trend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
}

.trend-item.positive {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.trend-item.negative {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border-color: #fecaca;
}

.trend-label {
  font-weight: 600;
  color: #374151;
}

.trend-value {
  font-weight: 700;
  font-size: 16px;
}

.trend-item.positive .trend-value {
  color: #166534;
}

.trend-item.negative .trend-value {
  color: #dc2626;
}

.trend-desc {
  font-size: 12px;
  color: #6b7280;
}

/* 成就列表樣式 */
.achievements {
  margin-bottom: 20px;
}

.achievement-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #fde68a;
}

.achievement-icon {
  font-size: 20px;
  margin-right: 12px;
}

.achievement-text {
  font-weight: 600;
  color: #92400e;
}

/* 下月目標樣式 */
.next-month-goals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.goal-item {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid #e2e8f0;
}

.goal-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.goal-target {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .detail-content h4 {
    color: #f8fafc;
    border-bottom-color: #475569;
  }
  
  .stat-item {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
  }
  
  .stat-label {
    color: #cbd5e1;
  }
  
  .stat-value {
    color: #f8fafc;
  }
  
  .customer-item {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    border-color: #dc2626;
  }
  
  .customer-name,
  .customer-amount {
    color: #333;
  }
  
  .customer-days {
    color: #fecaca;
    background: rgba(220, 38, 38, 0.2);
  }
  
  .suggestion-list li {
    color: #cbd5e1;
  }
  
  .strategy-item {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3b82f6;
  }
  
  .strategy-item h5 {
    color: #93c5fd;
  }
  
  .strategy-item p {
    color: #dbeafe;
  }
  
  .result-item {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    border-color: #16a34a;
  }
  
  .result-label {
    color: #bbf7d0;
  }
  
  .result-value {
    color: #bbf7d0;
  }
  
  .trend-item {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
  }
  
  .trend-label {
    color: #f8fafc;
  }
  
  .trend-item.positive {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    border-color: #16a34a;
  }
  
  .trend-item.negative {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    border-color: #dc2626;
  }
  
  .achievement-item {
    background: linear-gradient(135deg, #92400e 0%, #a16207 100%);
    border-color: #f59e0b;
  }
  
  .achievement-text {
    color: #fde68a;
  }
  
  .goal-item {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
  }
  
  .goal-label {
    color: #cbd5e1;
  }
  
  .goal-target {
    color: #f8fafc;
  }
}
* 新增客戶頁面優化樣式 */

/* 新增客戶頁面容器 */
#add.page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

#add.page h2 {
  text-align: center;
  color: #2c3e50;
  font-size: 28px;
  margin-bottom: 30px;
  position: relative;
}

#add.page h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

/* 新增客戶表單優化 */
#add-customer-form {
  display: block;
  max-width: 100%;
}

/* ===== 統一表單樣式系統 ===== */

/* 基礎表單分節樣式 */
.form-sections {
  position: relative;
  margin-bottom: 24px;
}

.form-section {
  display: none;
  animation: fadeIn 0.3s ease;
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 20px;
  background: #f9f9f9;
}

.form-section.active {
  display: block;
}

/* 表單區塊標題樣式 */
.form-section h3,
.form-section h4 {
  color: #495057;
  font-size: 18px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #667eea;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h3::before,
.form-section h4::before {
  content: '📝';
  font-size: 20px;
}

/* 編輯模態框特定樣式 */
.edit-customer-modal .form-section,
#edit-modal .form-section {
  background: #ffffff;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.edit-customer-modal .form-section h3,
.edit-customer-modal .form-section h4,
#edit-modal .form-section h3,
#edit-modal .form-section h4 {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border-left: 4px solid #667eea;
  padding: 12px 16px;
  margin: -20px -20px 20px -20px;
}

/* 表單導航統一樣式 */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

/* 導航按鈕統一樣式 */
.nav-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  min-width: 100px;
}

.nav-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 步驟指示器統一樣式 */
.section-indicators {
  display: flex;
  gap: 8px;
}

.indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.indicator.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.indicator:hover {
  background: #dee2e6;
  transform: scale(1.05);
}

/* 表單操作統一樣式 */
.form-actions {
  text-align: center;
  margin-top: 20px;
}

.submit-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.submit-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* 檔案上傳統一樣式 */
.file-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.file-upload-item {
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.file-upload-item:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.file-upload-item label {
  display: block;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  cursor: pointer;
}

.file-upload-item input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: white;
}

/* 檔案預覽統一樣式 */
.file-preview {
  margin-top: 8px;
  padding: 8px;
  border-radius: 4px;
  background: #e9ecef;
  font-size: 12px;
  color: #6c757d;
  min-height: 20px;
}

.file-preview.has-file {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-navigation {
    flex-direction: column;
    gap: 10px;
  }
  
  .section-indicators {
    order: 2;
  }
  
  .file-upload-grid {
    grid-template-columns: 1fr;
  }
}

/* 已移至統一表單樣式系統 */

/* 已移至統一表單樣式系統 */

/* 表單操作區域 */
.form-actions {
  text-align: center;
  margin-top: 30px;
}

.submit-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 200px;
}

.submit-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* 檔案上傳樣式 */
.file-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.file-upload-item {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-upload-item:hover {
  border-color: #667eea;
  background: #f0f2ff;
  transform: translateY(-2px);
}

.file-upload-item label {
  display: block;
  font-weight: 600;
  color: #495057;
  margin-bottom: 10px;
  font-size: 14px;
}

.file-upload-item input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: white;
}

.file-preview {
  margin-top: 15px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.file-preview img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.file-preview .file-name {
  font-size: 12px;
  color: #6c757d;
  word-break: break-all;
}

.file-preview .file-icon {
  font-size: 24px;
  color: #6c757d;
  }

/* 表單行樣式 */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* 表單組樣式優化 */
#add-customer-form .form-group {
  margin-bottom: 0;
}

#add-customer-form .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#add-customer-form .form-group input,
#add-customer-form .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: white;
}

#add-customer-form .form-group input:focus,
#add-customer-form .form-group select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

/* 必填欄位標記 */
#add-customer-form .form-group label.required::after {
  content: ' *';
  color: #e74c3c;
  font-weight: bold;
}

/* 特殊欄位樣式 */
#add-customer-form .form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

#add-customer-form .form-group input[type="number"] {
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

/* 地址欄位組 */
.address-group {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 12px;
  align-items: end;
}

.address-group .form-group {
  margin-bottom: 0;
}

/* 提交按鈕優化 */
#add-customer-form button[type="submit"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#add-customer-form button[type="submit"]:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

#add-customer-form button[type="submit"]:active {
  transform: translateY(0);
}

/* 新增客戶模態框優化 */
#add-customer-modal .modal-content {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

#add-customer-modal h3 {
  text-align: center;
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 24px;
  position: relative;
}

#add-customer-modal h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

/* 表單分步驟樣式 - 已移至統一位置 */

/* 表單導航優化 */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.nav-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.nav-btn:hover:not(:disabled) {
  background: #5a6fd8;
  transform: translateY(-1px);
}

.nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* 步驟指示器優化 */
.section-indicators {
  display: flex;
  gap: 8px;
}

.indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.indicator.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: scale(1.1);
}

.indicator:hover {
  transform: scale(1.05);
}

/* 提交按鈕區域 */
.form-actions {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.submit-btn {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.submit-btn:hover {
  background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

/* 檔案上傳區域優化 */
.file-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.file-upload-item {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-upload-item:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.file-upload-item label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #495057;
  cursor: pointer;
}

.file-upload-item input[type="file"] {
  display: none;
}

.file-preview {
  margin-top: 12px;
  min-height: 60px;
  border-radius: 8px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e9ecef;
}

.file-preview.has-file {
  background: #e8f5e8;
  border-color: #27ae60;
}

/* 響應式設計 */
@media (max-width: 768px) {
  #add.page {
    margin: 10px;
    padding: 16px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .address-group {
    grid-template-columns: 1fr;
  }
  
  .form-navigation {
    flex-direction: column;
    gap: 16px;
  }
  
  .section-indicators {
    order: -1;
  }
  
  .file-upload-grid {
    grid-template-columns: 1fr;
  }
}

/* 動畫效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 表單驗證樣式 */
.form-group.error input,
.form-group.error select {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group.error .error-message {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* 載入狀態 */
.submit-btn.loading {
  background: #95a5a6;
  cursor: not-allowed;
  position: relative;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 設備管理頁面 - 全新設計 */

/* 載入和錯誤狀態樣式 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.loading::before {
    content: "⏳";
    display: block;
    font-size: 32px;
    margin-bottom: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: #c53030;
}

.error h3 {
    margin: 0 0 10px 0;
    color: #c53030;
}

.error ul {
    margin: 10px 0;
    padding-left: 20px;
}

.error button {
    margin-top: 15px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-data h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.no-data p {
    margin: 0;
    color: #666;
}

/* 頁面容器 */
#sales.page {
  padding: 0;
  background: #f8f9fa;
  min-height: 100vh;
}

/* 頁面標題 */
.sales-header {
  background: white;
  padding: 30px;
  border-bottom: 1px solid #e9ecef;
  text-align: center;
}

.sales-header h2 {
  color: #2c3e50;
  font-size: 32px;
  margin: 0 0 10px 0;
  font-weight: 700;
}

.sales-subtitle {
  color: #6c757d;
  font-size: 16px;
  margin: 0;
}



.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.stat-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.2);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

/* 主要內容區域 */
.sales-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 0;
  min-height: calc(100vh - 300px);
}

/* 設備列表區域 */
.sales-list-section {
  background: white;
  padding: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h3 {
  color: #2c3e50;
  font-size: 24px;
  margin: 0;
  font-weight: 600;
}

.icon {
  font-size: 16px;
}

/* 設備網格 */
.sales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

/* 設備卡片 */
.sales-card {
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.sales-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.sales-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.sales-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.sales-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sales-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
}

.sales-info h4 {
  margin: 0 0 4px 0;
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
}

.sales-info p {
  margin: 0;
  color: #6c757d;
  font-size: 14px;
}

.sales-card-actions {
  display: flex;
  gap: 8px;
}

.sales-card-actions button {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.edit-sales-btn {
  background: #007bff;
  color: white;
}

.edit-sales-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.delete-sales-btn {
  background: #dc3545;
  color: white;
}

.delete-sales-btn:hover {
  background: #c82333;
  transform: translateY(-1px);
}

/* 設備詳細資訊 */
.sales-card-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.sales-detail-item {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.sales-detail-item label {
  display: block;
  font-size: 11px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.sales-detail-item span {
  display: block;
  font-size: 13px;
  color: #495057;
  font-weight: 500;
}

/* 客戶統計 */
.sales-customers-stats {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  margin-top: 16px;
}

.sales-customers-stats h5 {
  margin: 0 0 12px 0;
  color: #495057;
  font-size: 14px;
  font-weight: 600;
}

.sales-customers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sales-customer-tag {
  background: #667eea;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* 側邊欄表單 */
.sales-form-sidebar {
  background: #f8f9fa;
  border-left: 1px solid #e9ecef;
  padding: 30px;
  position: sticky;
  top: 0;
  height: fit-content;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.form-header h3 {
  color: #2c3e50;
  font-size: 20px;
  margin: 0;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #e9ecef;
  color: #495057;
}

/* 表單樣式 */
#sales-form {
  background: white;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e9ecef;
}

#sales-form .form-group {
  margin-bottom: 20px;
}

#sales-form .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

#sales-form .form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: white;
  box-sizing: border-box;
}

#sales-form .form-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

/* 表單按鈕 */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

/* 無資料狀態 */
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
  font-size: 16px;
  background: white;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
  margin: 20px 0;
}

.no-data::before {
  content: '👥';
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
}

/* 錯誤狀態 */
.error {
  text-align: center;
  padding: 20px;
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  margin: 20px 0;
}

/* 載入動畫 */
.sales-loading {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.sales-loading::before {
  content: '';
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

/* 響應式設計 */
@media (max-width: 1024px) {
  .sales-content {
    grid-template-columns: 1fr;
  }
  
  .sales-form-sidebar {
    border-left: none;
    border-top: 1px solid #e9ecef;
  }
}

@media (max-width: 768px) {
  
  .sales-list-section {
    padding: 20px;
  }
  
  .sales-form-sidebar {
    padding: 20px;
  }
  
  .sales-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* 動畫效果 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sales-card {
  animation: slideIn 0.3s ease;
}

/* 收款記錄彈窗樣式 */
.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  border: 1px solid #e2e8f0;
}

.summary-card h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
}

.summary-card .amount {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.summary-card .amount.overdue {
  color: #dc2626;
}

.payment-list {
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.payment-list h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #1e293b;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

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

.payment-item .customer {
  font-weight: 600;
  color: #1e293b;
}

.payment-item .amount {
  font-weight: 600;
  color: #059669;
}

.payment-item .date {
  color: #64748b;
  font-size: 14px;
}

.no-payments {
  text-align: center;
  padding: 20px;
  color: #64748b;
  font-style: italic;
  background: #f8fafc;
  border-radius: 8px;
  margin: 16px 0;
}

/* 系統設置彈窗樣式 */
.settings-section {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #1e293b;
  font-weight: 600;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 0;
}

.setting-item label {
  font-weight: 500;
  color: #374151;
}

.setting-item input[type="text"],
.setting-item select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
}

.setting-item input[type="checkbox"] {
  margin-right: 8px;
}


.btn-secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-1px);
}

/* 深色主題下的彈窗樣式 */
@media (prefers-color-scheme: dark) {
  .summary-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
  }
  
  .summary-card h4 {
    color: #a0aec0;
  }
  
  .summary-card .amount {
    color: #ffffff;
  }
  
  .payment-list h4 {
    color: #ffffff;
  }
  
  .payment-item .customer {
    color: #e2e8f0;
  }
  
  .payment-item .date {
    color: #a0aec0;
  }
  
  .settings-section {
    border-color: #4a5568;
  }
  
  .settings-section h4 {
    color: #ffffff;
  }
  
  .setting-item label {
    color: #e2e8f0;
  }
  
  .setting-item input[type="text"],
  .setting-item select {
    background: #2d3748;
    border-color: #4a5568;
    color: #ffffff;
  }
  
  .no-payments {
    background: #2d3748;
    color: #a0aec0;
  }
}

/* 編輯客戶模態框專用樣式 */
.edit-customer-modal {
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  border: 1px solid #e9ecef;
}

.edit-customer-modal h3 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e9ecef;
  position: relative;
}

.edit-customer-modal h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 編輯客戶模態框樣式 - 已移至統一表單樣式系統 */

.edit-customer-modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.edit-customer-modal .form-group {
  margin-bottom: 0;
}

.edit-customer-modal .form-group label {
  display: block;
  margin-bottom: 8px;
  color: #495057;
  font-weight: 500;
  font-size: 14px;
}

.edit-customer-modal .form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #ffffff;
}

.edit-customer-modal .form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.edit-customer-modal .form-group input:invalid {
  border-color: #e74c3c;
}

/* 編輯客戶模態框導航樣式 - 已移至統一表單樣式系統 */
.edit-customer-modal .section-indicators {
  display: flex;
  gap: 8px;
}

.edit-customer-modal .indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.edit-customer-modal .indicator.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.edit-customer-modal .indicator:hover {
  transform: scale(1.1);
}

.edit-customer-modal .form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.edit-customer-modal .submit-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.edit-customer-modal .submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.edit-customer-modal .btn-secondary {
  padding: 12px 24px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.edit-customer-modal .btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .edit-customer-modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .edit-customer-modal .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .edit-customer-modal .form-navigation {
    flex-direction: column;
    gap: 16px;
  }
  
  .edit-customer-modal .form-actions {
    flex-direction: column;
  }
  
  .edit-customer-modal .nav-btn {
    width: 100%;
  }
}

/* 動畫效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 編輯成功動畫 */
.customer-card.updated {
  animation: cardUpdate 0.6s ease;
}

@keyframes cardUpdate {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  }
}



/* 表單驗證樣式 */
.edit-customer-modal .form-group.error input {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.edit-customer-modal .form-group.error .error-message {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* 載入狀態 */
.edit-customer-modal .submit-btn.loading {
  position: relative;
  color: transparent;
}

.edit-customer-modal .submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 繳款紀錄編輯樣式 */
.payment-history {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
}

.payment-record {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 10px;
  background: white;
  transition: all 0.3s ease;
}

.payment-record:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-color: #007bff;
}

.payment-date-input,
.payment-amount-input,
.payment-note-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.payment-date-input:focus,
.payment-amount-input:focus,
.payment-note-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
  outline: none;
}

.payment-actions {
  display: flex;
  gap: 5px;
}

.action-btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

.action-btn.small.danger {
  background: #dc3545;
  color: white;
}

.action-btn.small.danger:hover {
  background: #c82333;
}

.action-btn.small:not(.danger) {
  background: #28a745;
  color: white;
}

.action-btn.small:not(.danger):hover {
  background: #218838;
}

.no-payments {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
  background: white;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

/* 編輯表單樣式 - 已移至統一表單樣式系統 */

.edit-customer-modal .section-indicators {
  display: flex;
  gap: 10px;
}

.edit-customer-modal .indicator {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.edit-customer-modal .indicator.active {
  background: #007bff;
  color: white;
  transform: scale(1.1);
}

.edit-customer-modal .indicator:hover {
  background: #0056b3;
  color: white;
}

.edit-customer-modal .nav-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #007bff;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.edit-customer-modal .nav-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.edit-customer-modal .nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .payment-record {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .payment-actions {
    justify-content: center;
  }
  
  .edit-customer-modal .form-navigation {
    flex-direction: column;
    gap: 10px;
  }
  
  .edit-customer-modal .section-indicators {
    order: 2;
  }
}

/* Google Sheets 頁面樣式 */
#google-sheets .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

#google-sheets .header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

#google-sheets .header h1 {
  font-size: 32px;
  margin-bottom: 12px;
  font-weight: 700;
  color: white;
}

#google-sheets .header p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.sheets-controls {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.sheets-controls .control-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  align-items: end;
}

.sheets-controls .form-group {
  margin-bottom: 0;
}

.sheets-controls label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.sheets-controls input,
.sheets-controls select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.sheets-controls input:focus,
.sheets-controls select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.action-buttons {
  display: flex;
  gap: 12px;
  align-items: end;
}

.action-buttons button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.action-buttons .btn-secondary {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #e9ecef;
}

.action-buttons .btn-secondary:hover {
  background: #e9ecef;
  color: #495057;
}

.sheets-result {
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  background-color: #f8f9fa;
  border-left: 4px solid #28a745;
  min-height: 100px;
}

.sheets-result.error {
  border-left-color: #dc3545;
  background-color: #f8d7da;
}

.sheets-result.loading {
  text-align: center;
  color: #6c757d;
}

.sheets-result .data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sheets-result .data-table th,
.sheets-result .data-table td {
  border: 1px solid #e9ecef;
  padding: 12px;
  text-align: left;
}

.sheets-result .data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

.sheets-result .data-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

.sheets-result .json-view {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  font-size: 13px;
  line-height: 1.5;
}

.sheets-examples {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sheets-examples h3 {
  margin-bottom: 20px;
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.example-card {
  padding: 20px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.example-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.example-card h4 {
  margin-bottom: 10px;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.example-card p {
  margin-bottom: 15px;
  color: #6c757d;
  line-height: 1.5;
}

.example-card code {
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  color: #e83e8c;
  border: 1px solid #e9ecef;
}

/* 更新結果樣式 */
.sheets-result .summary-stats {
  background: #e8f5e8;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #28a745;
}

.sheets-result .summary-stats p {
  margin: 5px 0;
  font-weight: 500;
}

.sheets-result .data-table tr.success {
  background-color: #d4edda;
}

.sheets-result .data-table tr.error {
  background-color: #f8d7da;
}

.sheets-result .data-table tr.success td {
  color: #155724;
}

.sheets-result .data-table tr.error td {
  color: #721c24;
}

/* 表單提示文字樣式 */
.form-text {
  font-size: 12px;
  color: #6c757d;
  margin-top: 4px;
  display: block;
}

.text-muted {
  color: #6c757d !important;
}

/* 警告訊息樣式 */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeaa7;
}

.alert h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #856404;
}

.alert ul {
  margin-bottom: 10px;
  padding-left: 20px;
}

.alert li {
  margin-bottom: 5px;
}

.alert p {
  margin-bottom: 10px;
}

.alert strong {
  color: #856404;
}

/* 表格容器樣式 */
.table-container {
  overflow-x: auto;
  margin: 15px 0;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.data-table.full-width {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

.data-table.full-width th,
.data-table.full-width td {
  padding: 8px 12px;
  border: 1px solid #e9ecef;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  max-width: 200px;
}

.header-cell {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #495057;
}

.data-cell {
  background-color: #ffffff;
}

.alert-error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-error h4 {
  color: #721c24;
}

/* 催收管理頁面樣式 */
.collection-controls {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.collection-result {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-height: 100px;
}

.collection-result.success {
  border-left: 4px solid #28a745;
  background: #f8fff9;
}

.collection-result.error {
  border-left: 4px solid #dc3545;
  background: #fff5f5;
}

.collection-result.loading {
  border-left: 4px solid #007bff;
  background: #f8f9ff;
}

.collection-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 14px;
}

.collection-table th {
  background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
  color: white;
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.collection-table td {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.collection-table tr:nth-child(even) {
  background: #f8f9fa;
}

.collection-table tr:hover {
  background: #e3f2fd;
  transition: background-color 0.3s ease;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.status-collected {
  background: #d4edda;
  color: #155724;
}

.status-badge.status-pending {
  background: #fff3cd;
  color: #856404;
}

.action-btn-success {
  background: #28a745;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
}

.action-btn-success:hover {
  background: #218838;
  transform: translateY(-1px);
}

.action-btn-warning {
  background: #ffc107;
  color: #212529;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
}

.action-btn-warning:hover {
  background: #e0a800;
  transform: translateY(-1px);
}

.collection-info {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.collection-info h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.info-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.info-card h4 {
  margin: 0 0 10px 0;
  color: #495057;
  font-size: 16px;
}

.info-card p {
  margin: 0;
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
}

.btn-info {
  background: #17a2b8;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(23,162,184,0.3);
}

.btn-info:hover {
  background: #138496;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23,162,184,0.4);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .collection-controls {
    padding: 20px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .btn-primary,
  .btn-secondary,
  .btn-info {
    width: 100%;
    justify-content: center;
  }
  
  .collection-table {
    font-size: 12px;
  }
  
  .collection-table th,
  .collection-table td {
    padding: 8px;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* 日誌管理頁面樣式 */
.logs-controls {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.logs-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.filter-group input,
.filter-group select {
  padding: 10px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #fff;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.logs-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

.btn-query {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.btn-query:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,123,255,0.4);
}

.btn-reset {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(108,117,125,0.3);
}

.btn-reset:hover {
  background: #545b62;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108,117,125,0.4);
}

#logs-container {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-height: 400px;
}

.log-entry {
  display: grid;
  grid-template-columns: 150px 80px 1fr 200px;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
  align-items: center;
  transition: background-color 0.3s ease;
}

.log-entry:hover {
  background: #f8f9fa;
}

.log-entry.error {
  border-left: 4px solid #dc3545;
  background: #fff5f5;
}

.log-entry.warning {
  border-left: 4px solid #ffc107;
  background: #fffbf0;
}

.log-entry.info {
  border-left: 4px solid #17a2b8;
  background: #f8f9ff;
}

.log-timestamp {
  font-size: 12px;
  color: #6c757d;
  font-family: 'Courier New', monospace;
}

.log-level {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  text-transform: uppercase;
}

.log-entry.error .log-level {
  background: #dc3545;
  color: white;
}

.log-entry.warning .log-level {
  background: #ffc107;
  color: #212529;
}

.log-entry.info .log-level {
  background: #17a2b8;
  color: white;
}

.log-message {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.log-details {
  font-size: 12px;
  color: #6c757d;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-logs {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}

.no-logs::before {
  content: '📋';
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.error-logs {
  text-align: center;
  padding: 40px 20px;
  color: #dc3545;
  font-size: 16px;
  background: #fff5f5;
  border-radius: 8px;
  border: 2px solid #dc3545;
}

.error-logs::before {
  content: '❌';
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .logs-controls {
    padding: 20px;
  }
  
  .logs-filters {
    grid-template-columns: 1fr;
  }
  
  .logs-actions {
    flex-direction: column;
  }
  
  .btn-query,
  .btn-reset {
    width: 100%;
    justify-content: center;
  }
  
  .log-entry {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }
  
  .log-timestamp {
    font-size: 11px;
  }
  
  .log-level {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .log-message {
    font-size: 13px;
  }
  
  .log-details {
    font-size: 11px;
    max-width: none;
    white-space: normal;
  }
}

/* ============================================================================
   設備管理系統樣式
   ============================================================================ */

.sales-management {
  padding: 20px;
}

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

.sales-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

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

.stat-number {
  font-size: 2em;
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

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

.sales-list {
  display: grid;
  gap: 20px;
}

.sales-item {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

.sales-card-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sales-card-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sales-avatar {
  width: 50px;
  height: 50px;
  background: #6f42c1;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  font-weight: bold;
}

.sales-info h4 {
  margin: 0 0 5px 0;
  color: #333;
}

.sales-info p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

.sales-card-actions {
  display: flex;
  gap: 10px;
}

.sales-details {
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}

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

.detail-label {
  font-weight: bold;
  color: #333;
}

.detail-value {
  color: #666;
}

.password-logs {
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.password-logs h5 {
  margin: 0 0 15px 0;
  color: #333;
}

.password-logs ul {
  margin: 0;
  padding-left: 20px;
  color: #666;
}

.password-logs li {
  margin: 5px 0;
}

.customers-section {
  padding: 20px;
}

.customers-section h5 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.1em;
}

.customer-list {
  display: grid;
  gap: 15px;
}

.customer-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e9ecef;
}

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

.customer-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
  border-bottom: 1px solid #e9ecef;
}

.customer-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.customer-detail-item .detail-label {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
}

.customer-detail-item .detail-value {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.customer-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.customer-model {
  color: #666;
  font-size: 0.9em;
}

.customer-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
}

.status-normal {
  background: #e8f5e8;
  color: #2d5a2d;
}

.status-overdue {
  background: #ffe8e8;
  color: #d32f2f;
}

.status-completed {
  background: #e3f2fd;
  color: #1976d2;
}

.status-locked {
  background: #fff3e0;
  color: #f57c00;
}

.finance-toggle {
  background: #ffc107;
  color: #333;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8em;
}

.finance-summary {
  display: none;
  background: white;
  border-radius: 5px;
  padding: 15px;
  margin-top: 10px;
  border: 1px solid #dee2e6;
}

.finance-summary.show {
  display: block;
}

.finance-summary h6 {
  margin: 0 0 10px 0;
  color: #333;
}

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

.finance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
}

.finance-label {
  font-weight: bold;
  color: #333;
  font-size: 0.9em;
}

.finance-value {
  color: #666;
  font-weight: bold;
}

.screen-password-value {
  color: #007bff !important;
  background: rgba(0, 123, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

.profit-positive {
  color: #28a745;
}

.profit-negative {
  color: #dc3545;
}

/* 付款記錄樣式 */
.payment-history {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.payment-history h4 {
  margin: 0 0 15px 0;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
}

.payment-list {
  max-height: 200px;
  overflow-y: auto;
}

.payment-item {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.payment-date {
  flex: 1;
  font-weight: 500;
  color: #495057;
  font-size: 14px;
}

.payment-amount {
  flex: 1;
  text-align: right;
  font-weight: 600;
  color: #28a745;
  font-size: 14px;
}

.payment-note {
  flex: 2;
  margin-left: 10px;
  color: #6c757d;
  font-size: 12px;
  font-style: italic;
}

.no-payments {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.sales-status {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.8em;
  font-weight: bold;
}

.sales-status.active {
  background: #e8f5e8;
  color: #2d5a2d;
}

.sales-body {
  padding: 20px;
}

.sales-body p {
  margin: 10px 0;
  color: #666;
}

.sales-actions {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
}

.btn-edit, .btn-delete, .btn-payment, .btn-detail {
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
}

.btn-payment {
  background: #28a745;
  color: white;
}

.btn-payment:hover {
  background: #218838;
}

.btn-edit {
  background: #007bff;
  color: white;
}

.btn-edit:hover {
  background: #0056b3;
}

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

.btn-delete:hover {
  background: #c82333;
}

.btn-detail {
  background: #6c757d;
  color: white;
}

.btn-detail:hover {
  background: #5a6268;
}

.btn-add {
  background: #6f42c1;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #666;
}

.error-message {
  text-align: center;
  padding: 40px;
  color: #dc3546;
}

/* 設備管理系統響應式設計 */
@media (max-width: 768px) {
  .sales-management {
    padding: 15px;
  }
  
  .sales-stats {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .sales-card-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .sales-card-title {
    width: 100%;
  }
  
  .sales-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .customer-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .customer-info {
    flex-wrap: wrap;
  }
  
  .finance-grid {
    grid-template-columns: 1fr;
  }
  
  .detail-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* ============================================================================
   業務員管理系統樣式
   ============================================================================ */

.salesperson-management {
  padding: 20px;
}

/* 損益分析詳細樣式 */
.profit-details {
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profit-details h4 {
  margin: 0 0 15px 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

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

.customer-profit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.customer-profit-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.customer-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.customer-name {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}

.customer-model,
.customer-equipment {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.customer-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.customer-status.buyback,
.customer-status.已買回 {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.customer-status.locked,
.customer-status.呆帳 {
  background: rgba(244, 67, 54, 0.2);
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.profit-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.sale-price,
.total-paid {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.profit-amount {
  font-weight: 600;
  font-size: 14px;
}

.profit-amount.profit-positive {
  color: #4CAF50;
}

.profit-amount.profit-negative {
  color: #F44336;
}

/* 設備選擇模態框樣式 */
.equipment-selection {
  margin-bottom: 20px;
}

.equipment-selection h4 {
  margin-bottom: 15px;
  color: #333;
  font-size: 1.1em;
}

.equipment-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
}

.equipment-item {
  margin-bottom: 10px;
}

.equipment-item:last-child {
  margin-bottom: 0;
}

.equipment-item input[type="checkbox"] {
  display: none;
}

.equipment-item label {
  display: block;
  cursor: pointer;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.equipment-item input[type="checkbox"]:checked + label {
  border-color: #007bff;
  background-color: #f8f9ff;
}

.equipment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.equipment-main {
  display: flex;
  align-items: center;
  gap: 15px;
}

.equipment-icon {
  font-size: 2em;
  color: #007bff;
}

.equipment-content {
  flex: 1;
}

.equipment-name {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

.equipment-meta {
  display: flex;
  gap: 15px;
  font-size: 0.9em;
  color: #666;
}

.equipment-account,
.equipment-phone {
  display: flex;
  align-items: center;
  gap: 5px;
}

.equipment-stats {
  text-align: center;
}

.customer-count {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.count-number {
  font-size: 1.5em;
  font-weight: bold;
  color: #007bff;
}

.count-label {
  font-size: 0.8em;
  color: #666;
}

.no-equipment {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

/* 分配進度條樣式 */
.assigning-progress {
  text-align: center;
}

.progress-text {
  margin-bottom: 10px;
  color: #333;
  font-weight: bold;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #007bff;
  transition: width 0.3s ease;
}

/* 設備詳情模態框樣式 */
.equipment-details-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: 1000;
}

.equipment-details-modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.equipment-details-modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px 10px 0 0;
  color: white;
}

.equipment-details-modal-header h3 {
  margin: 0;
  color: white;
  font-weight: 600;
}

.equipment-details-modal-body {
  padding: 20px;
}

.equipment-info-section,
.equipment-stats-section,
.equipment-customers-section {
  margin-bottom: 30px;
}

.equipment-info-section h4,
.equipment-stats-section h4,
.equipment-customers-section h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.2em;
}

.equipment-info-grid {
  display: grid;
  gap: 10px;
}

.equipment-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.equipment-info-item:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.info-label {
  font-weight: bold;
  color: #495057;
}

.info-value {
  color: #6c757d;
  font-weight: 500;
}

.equipment-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
}

.equipment-stat-item {
  text-align: center;
  padding: 20px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.equipment-stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.equipment-stat-item .stat-number {
  font-size: 2em;
  font-weight: bold;
  color: white;
  display: block;
  margin-bottom: 5px;
}

.equipment-stat-item .stat-label {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 5px;
  font-weight: 500;
}

.equipment-customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.equipment-customer-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 18px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.equipment-customer-card:hover {
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
  transform: translateY(-2px);
}

.customer-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.customer-avatar {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1em;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.customer-info h5 {
  margin: 0 0 5px 0;
  color: #333;
}

.customer-info p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

.customer-info .screen-password {
  color: #007bff;
  font-weight: 500;
  font-size: 0.8em;
  background: rgba(0, 123, 255, 0.1);
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid rgba(0, 123, 255, 0.2);
  margin-top: 3px;
}

.customer-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.customer-profit {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
  font-size: 1.1em;
}

.profit-positive {
  color: #28a745;
}

.profit-negative {
  color: #dc3545;
}

.customer-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-renting {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.status-buyback {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.status-locked {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.customer-card-footer {
  text-align: center;
}

.finance-btn {
  background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(111, 66, 193, 0.3);
}

.finance-btn:hover {
  background: linear-gradient(135deg, #5a32a3 0%, #4a2a8a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(111, 66, 193, 0.4);
}

.no-customers {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

/* 財務詳情模態框樣式 */
.finance-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: 1000;
}

.finance-modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.finance-modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.finance-modal-header h3 {
  margin: 0;
  color: white;
  font-weight: 600;
}

.finance-modal-body {
  padding: 20px;
}

.finance-summary {
  text-align: center;
  margin-bottom: 30px;
}

.finance-main-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 25px;
  border-radius: 15px;
  min-width: 180px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.finance-main-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.finance-main-stat.profit-positive {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
}

.finance-main-stat.profit-negative {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3);
}

.finance-icon {
  font-size: 2em;
  margin-bottom: 10px;
}

.finance-amount {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 5px;
}

.finance-label {
  font-size: 1.1em;
  font-weight: bold;
}

.finance-details {
  display: grid;
  gap: 15px;
}

.finance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.finance-item:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.finance-label {
  font-weight: bold;
  color: #495057;
}

.finance-value {
  color: #6c757d;
  font-weight: 500;
}

.status-renting {
  color: #28a745;
}

.status-buyback {
  color: #007bff;
}

.status-locked {
  color: #ffc107;
}

/* 當月設備損益功能樣式 */
.monthly-equipment-profit {
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.profit-summary {
  margin-bottom: 30px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
}

.profit-summary h4 {
  margin: 0 0 20px 0;
  font-size: 1.4em;
  font-weight: 600;
  text-align: center;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.summary-stat {
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.summary-stat:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.summary-stat .stat-number {
  font-size: 1.8em;
  font-weight: bold;
  margin-bottom: 5px;
}

.summary-stat .stat-number.positive {
  color: #4CAF50;
}

.summary-stat .stat-number.negative {
  color: #F44336;
}

.summary-stat .stat-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.profit-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.breakdown-label {
  font-weight: 500;
}

.breakdown-value {
  font-weight: bold;
}

.breakdown-profit {
  font-weight: bold;
  font-size: 1.1em;
}

.breakdown-profit.positive {
  color: #4CAF50;
}

.breakdown-profit.negative {
  color: #F44336;
}

.equipment-details {
  margin-top: 30px;
}

.equipment-details h4 {
  margin: 0 0 20px 0;
  font-size: 1.3em;
  color: #333;
  font-weight: 600;
}

.equipment-profit-card {
  margin-bottom: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.equipment-profit-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.equipment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e9ecef;
}

.equipment-header h5 {
  margin: 0;
  font-size: 1.2em;
  color: #333;
  font-weight: 600;
}

.equipment-type {
  font-size: 0.9em;
  color: #6c757d;
  background: #e9ecef;
  padding: 4px 8px;
  border-radius: 12px;
}

.equipment-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.equipment-stat {
  text-align: center;
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.equipment-stat .stat-number {
  font-size: 1.4em;
  font-weight: bold;
  margin-bottom: 5px;
}

.equipment-stat .stat-number.positive {
  color: #28a745;
}

.equipment-stat .stat-number.negative {
  color: #dc3545;
}

.equipment-stat .stat-label {
  font-size: 0.85em;
  color: #6c757d;
}

.customer-list {
  margin-top: 20px;
}

.customer-list h6 {
  margin: 0 0 15px 0;
  font-size: 1.1em;
  color: #495057;
  font-weight: 600;
}

.customer-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.customer-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.customer-item.buyback {
  border-left: 4px solid #28a745;
}

.customer-item.locked {
  border-left: 4px solid #dc3545;
}

.customer-info {
  flex: 1;
}

.customer-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.customer-model {
  font-size: 0.9em;
  color: #6c757d;
  margin-bottom: 4px;
}

.customer-status {
  font-size: 0.8em;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  display: inline-block;
}

.customer-item.buyback .customer-status {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.customer-item.locked .customer-status {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.customer-finance {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.finance-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.9em;
}

.finance-item .label {
  color: #6c757d;
  font-weight: 500;
}

.finance-item .value {
  font-weight: 600;
  color: #333;
}

.finance-item .value.positive {
  color: #28a745;
}

.finance-item .value.negative {
  color: #dc3545;
}

.no-data {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  font-style: italic;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .profit-breakdown {
    grid-template-columns: 1fr;
  }
  
  .equipment-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .customer-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .customer-finance {
    text-align: left;
    width: 100%;
  }
  
  .finance-item {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .summary-stats {
    grid-template-columns: 1fr;
  }
  
  .equipment-stats {
    grid-template-columns: 1fr;
  }
}

