:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-bar {
    height: 70px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

tr:hover {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: #f1f5f9;
    color: var(--text-color);
}

.btn-edit:hover {
    color: var(--primary-color);
}

.btn-delete:hover {
    color: #ef4444;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
}

/* Search Select */
.search-select-container {
    position: relative;
}

.search-select-input-wrapper {
    position: relative;
}

.search-select-input {
    width: 100%;
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.search-select-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow);
}

.search-select-dropdown.hidden {
    display: none;
}

.search-select-option {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.search-select-option:hover {
    background-color: #f8fafc;
}

/* Multi Select */
.multi-select-container {
    position: relative;
}

.multi-select-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.375rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    min-height: 42px;
    cursor: text;
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.multi-select-tag .remove-tag {
    cursor: pointer;
    opacity: 0.6;
}

.multi-select-tag .remove-tag:hover {
    opacity: 1;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Dashboard */
.dashboard-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.overview-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
}

.overview-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.overview-card .value {
    font-size: 2rem;
    font-weight: 700;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.pagination button:hover {
    background-color: #f8fafc;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* Filters */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-item {
    min-width: 200px;
}

/* 对账表筛选栏优化 */
.filters-bar-mobile {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.filters-bar-mobile .filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters-bar-mobile .filter-row:not(:last-child) {
    margin-bottom: 0.75rem;
}

.filters-bar-mobile .filter-item {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    margin-bottom: 0;
}

.filters-bar-mobile .filter-item.filter-date {
    flex: 0 0 150px;
    min-width: 150px;
}

.filters-bar-mobile .filter-item.filter-status {
    flex: 0 0 120px;
    min-width: 120px;
}

.filters-bar-mobile .filter-item.filter-machine,
.filters-bar-mobile .filter-item.filter-category,
.filters-bar-mobile .filter-item.filter-payer,
.filters-bar-mobile .filter-item.filter-payee {
    flex: 1;
    min-width: 160px;
}

.filters-bar-mobile .form-group {
    margin-bottom: 0;
}

.filters-bar-mobile .form-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.filters-bar-mobile .form-group input,
.filters-bar-mobile .form-group select {
    padding: 0.5rem;
    font-size: 0.875rem;
    height: 38px;
}

.filters-bar-mobile .filter-reset {
    width: 38px;
    height: 38px;
    margin-bottom: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.filters-bar-mobile .filter-reset:hover {
    background: #f1f5f9;
    color: var(--text-color);
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-primary {
    background: #e0e7ff;
    color: var(--primary-color);
}

.tag-success {
    background: #d1fae5;
    color: #059669;
}

.tag-warning {
    background: #fef3c7;
    color: #d97706;
}

.tag-danger {
    background: #fee2e2;
    color: #dc2626;
}

/* Attachments */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.attachment-item {
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

.attachment-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-upload-area:hover {
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

/* Surcharges */
.surcharge-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.surcharge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.surcharge-tag i {
    cursor: pointer;
    opacity: 0.6;
}

.surcharge-tag i:hover {
    opacity: 1;
}

/* Utilities */
.hidden {
    display: none !important;
}

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

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

.text-muted {
    color: var(--text-muted);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

/* Form Grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Checkbox & Radio */
.checkbox-wrapper,
.radio-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-wrapper input,
.radio-wrapper input {
    width: auto;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f1f5f9;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-info {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: #1e293b;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==================== 对账表样式 ==================== */

/* 对账状态徽章 */
.reconcile-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-reconciled {
    background: #d1fae5;
    color: #059669;
}

/* 已对账行样式 */
.reconciled-row {
    background-color: #f0fdf4 !important;
}

.reconciled-row:hover {
    background-color: #dcfce7 !important;
}

/* 移动端已对账项样式 */
.expense-item.reconciled {
    background-color: #f0fdf4;
    border-left: 3px solid #10b981;
}

/* 对账备注 */
.reconcile-remark {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f9ff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #0369a1;
}

.reconcile-remark-text {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.remark-text {
    display: inline-block;
    margin-left: 0.25rem;
}

/* 批量操作栏 */
.batch-actions-bar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
}

.batch-actions-bar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 统计样式 */
.stat-value.stat-warning {
    color: #d97706;
}

/* 复选框样式优化 */
.expense-checkbox {
    cursor: pointer;
}

/* 导出CSV包含对账状态 */
.export-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
