* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.5;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    padding-bottom: 80px;
}

.header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.tab {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab.active {
    color: #2575fc;
    border-bottom-color: #2575fc;
    background-color: rgba(37, 117, 252, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.card h2 i {
    margin-right: 8px;
    color: #2575fc;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.3s;
}

input:focus, select:focus {
    border-color: #2575fc;
    outline: none;
}

.btn {
    display: inline-block;
    background: linear-gradient(to right, #2575fc, #6a11cb);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    width: 100%;
    margin-top: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #6c757d;
}

.btn-success {
    background: #28a745;
}

.btn-danger {
    background: #dc3545;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-info {
    background: #17a2b8;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-group .btn {
    flex: 1;
}

.product-list-container {
    margin-top: 15px;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    position: relative;
}

.table-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 800px;
}

th {
    background-color: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background-color: #f9f9f9;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.action-btn {
    padding: 5px 8px;
    border-radius: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.edit-btn {
    color: #2575fc;
}

.delete-btn {
    color: #dc3545;
}

.price-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.price-row {
    display: flex;
    gap: 10px;
}

.price-item {
    flex: 1;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
    overflow: hidden;
}

.price-value {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 3px;
    color: #2575fc;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-label {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.price-input {
    text-align: center;
    font-weight: bold;
    color: #2575fc;
    border: none;
    background: transparent;
    width: 100%;
    font-size: 1.3rem;
    padding: 0;
    margin-top: 3px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-input:focus {
    outline: none;
    border-bottom: 1px solid #2575fc;
}

.product-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.product-form-item {
    flex: 1;
    min-width: 0;
}

.product-form-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-form-item input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.3s;
}

.product-form-item input:focus {
    border-color: #2575fc;
    outline: none;
}

.input-error {
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.budget-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #2575fc;
}

.budget-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.budget-item-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.budget-item-price {
    font-weight: 700;
    color: #2575fc;
}

.budget-item-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #ddd;
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hidden {
    display: none;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 10px 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    z-index: 100;
}

.footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: #666;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.3s;
    width: 33%;
}

.footer-btn i {
    font-size: 1.2rem;
    margin-bottom: 3px;
}

.footer-btn.active {
    color: #2575fc;
    background-color: rgba(37, 117, 252, 0.1);
}

/* 报价单容器 - 适合手机端 */
#quote-image-container {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 600px;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    overflow: hidden;
}

/* 表格容器 - 整体框架 */
.quote-table-container {
    margin: 20px 0;
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    background-color: white;
    border: 1px solid #e0e0e0;
}

/* 表格样式 - 适合手机端 */
.quote-table {
    font-size: 12px;
    table-layout: auto;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: white;
    margin: 0;
}

.quote-table th {
    padding: 10px 12px;
    font-size: 11px;
    white-space: nowrap;
    background-color: #f8f9fa;
    color: #2c3e50;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #eee;
    border-left: none;
    border-right: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quote-table td {
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 1px solid #f2f2f2;
    border-left: none;
    border-right: none;
    vertical-align: middle;
}

/* 统一的列对齐方式 - 全部左对齐 */
.quote-table th,
.quote-table td {
    text-align: left !important;
}

.quote-table th:nth-child(1),
.quote-table td:nth-child(1) {
    min-width: 100px;
}

.quote-table th:nth-child(2),
.quote-table td:nth-child(2) {
    min-width: 120px;
}

.quote-table th:nth-child(3),
.quote-table td:nth-child(3) {
    min-width: 80px;
}

.quote-table th:nth-child(4),
.quote-table td:nth-child(4) {
    min-width: 60px;
}

.quote-table th:nth-child(5),
.quote-table td:nth-child(5) {
    min-width: 90px;
    font-weight: 600;
    color: #2c3e50;
}

/* 去除表格的额外样式，确保表头与内容对齐 */
.quote-table thead,
.quote-table tbody {
    display: table-header-group;
}

.quote-table tr {
    display: table-row;
}

.quote-table th,
.quote-table td {
    display: table-cell;
    box-sizing: border-box;
}

/* 确保表格在手机端能横向滚动 */
@media (max-width: 768px) {
    .quote-table-container {
        margin: 15px 0;
    }
    
    .quote-table th,
    .quote-table td {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .quote-table th {
        font-size: 10px;
    }
    
    /* 确保表格能横向滚动 */
    .quote-table-container {
        overflow-x: auto;
    }
    
    /* 防止表格内容换行 */
    .quote-table {
        white-space: nowrap;
        min-width: 100%;
    }
}



.quote-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.quote-header h2 {
    color: #1d1d1f;
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.quote-date {
    color: #86868b;
    font-size: 16px;
    font-weight: 400;
    margin-top: 8px;
}

.quote-company {
    font-size: 18px;
    font-weight: 500;
    color: #1d1d1f;
    margin-top: 15px;
    letter-spacing: 0.5px;
}

/* 表格样式 */
.quote-table-container {
    margin: 30px 0;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    background-color: white;
}

.quote-table thead {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
}

.quote-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    border: none;
    font-size: 16px;
}

.quote-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #f2f2f2;
    color: #1d1d1f;
}

.quote-table tbody tr {
    transition: all 0.3s ease;
}

.quote-table tbody tr:hover {
    background-color: rgba(37, 117, 252, 0.05);
}

.quote-table tbody tr:last-child td {
    border-bottom: none;
}

.quote-item-price {
    font-weight: 600;
    color: #2575fc;
    text-align: right;
}

.quote-table td:nth-child(3),
.quote-table td:nth-child(5) {
    text-align: right;
}

.quote-table td:nth-child(4) {
    text-align: center;
}

.quote-totals {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.quote-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    font-size: 18px;
    border-bottom: 1px solid #e0e0e0;
    color: #2c3e50;
    font-weight: 600;
}

.quote-total:last-child {
    border-bottom: none;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.quote-footer {
    margin-top: 40px;
    text-align: center;
    color: #86868b;
    font-size: 15px;
    border-top: 1px solid #f2f2f2;
    padding-top: 20px;
    line-height: 1.6;
}

.quote-note {
    margin-top: 30px;
    padding: 16px;
    background-color: #f5f5f7;
    border-radius: 8px;
    font-size: 14px;
    color: #515154;
    text-align: center;
}

.saved-budget-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.saved-budget-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.saved-budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.saved-budget-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.saved-budget-date {
    font-size: 0.85rem;
    color: #6c757d;
}

.saved-budget-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.saved-budget-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.filter-section {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #eaeaea;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-header h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0;
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.product-count {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
    text-align: right;
}

.product-count strong {
    color: #2575fc;
}

.product-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2575fc;
}

.stats-item {
    flex: 1;
    text-align: center;
    min-width: 0;
    padding: 5px;
}

.stats-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2575fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.budget-name-display {
    margin-top: 15px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-weight: 500;
    color: #495057;
}

.budget-name-display span {
    color: #2575fc;
    font-weight: 600;
}

.editing-mode {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.system-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.system-section {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #eaeaea;
}

.system-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.system-section h3 i {
    margin-right: 8px;
    color: #2575fc;
}

@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .table-scroll-container {
        max-height: 300px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .product-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stats-item {
        flex: 1;
        min-width: 45%;
    }
    
    .stats-label {
        font-size: 0.8rem;
    }
    
    .stats-value {
        font-size: 1.1rem;
    }
    
    .price-row {
        gap: 8px;
    }
    
    .price-item {
        padding: 10px 8px;
        min-height: 65px;
    }
    
    .product-form-row {
        gap: 8px;
    }
    
    .product-form-item {
        min-height: 70px;
    }
    
    .product-form-item label {
        font-size: 0.8rem;
    }
    
    .product-form-item input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .container {
        padding-bottom: 70px;
    }
}

@media (max-width: 480px) {
    .container {
        padding-bottom: 70px;
    }
    
    #quote-image-container {
        width: 600px;
        padding: 30px;
    }
    
    .quote-header h2 {
        font-size: 28px;
    }
    
    .quote-item-name {
        font-size: 16px;
    }
    
    .quote-total {
        font-size: 20px;
    }
    
    .table-scroll-container {
        max-height: 250px;
    }
    
    .product-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stats-item {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #eee;
    }
    
    .stats-item:last-child {
        border-bottom: none;
    }
    
    .stats-label {
        margin-bottom: 0;
        flex: 1;
        text-align: left;
        font-size: 0.8rem;
    }
    
    .stats-value {
        flex: 1;
        text-align: right;
        font-size: 1.1rem;
    }
    
    .price-summary {
        gap: 8px;
    }
    
    .price-row {
        gap: 6px;
    }
    
    .price-item {
        padding: 8px 5px;
        min-height: 55px;
    }
    
    .price-label {
        font-size: 0.75rem;
    }
    
    .price-value {
        font-size: 1.1rem;
    }
    
    .price-input {
        font-size: 1.1rem;
    }
    
    .product-form-row {
        gap: 6px;
    }
    
    .product-form-item {
        min-height: 60px;
    }
    
    .product-form-item label {
        font-size: 0.75rem;
    }
    
    .product-form-item input {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .price-label {
        font-size: 0.7rem;
    }
    
    .price-value {
        font-size: 1rem;
    }
    
    .price-input {
        font-size: 1rem;
    }
    
    .price-row {
        gap: 4px;
    }
    
    .price-item {
        padding: 6px 4px;
        min-height: 50px;
    }
    
    .product-form-row {
        gap: 4px;
    }
    
    .product-form-item {
        min-height: 55px;
    }
    
    .product-form-item label {
        font-size: 0.7rem;
    }
    
    .product-form-item input {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 200px;
}

.loading-content .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
    border-top-color: #2575fc;
}

.excel-template {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #6c757d;
}

.excel-template h4 {
    margin-bottom: 10px;
    color: #495057;
}

.excel-template ul {
    padding-left: 20px;
    color: #666;
    font-size: 0.9rem;
}

.excel-template li {
    margin-bottom: 5px;
}

.danger-zone {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

.danger-zone h3 {
    color: #721c24;
    margin-bottom: 15px;
}

.danger-zone p {
    color: #721c24;
    margin-bottom: 15px;
    font-size: 0.9rem;
}