body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: #333;
}

.navbar {
    background: linear-gradient(90deg, #1e3c72, #2a5298);
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    font-size: 18px;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
}

.nav-links a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.page-header h1 {
    font-size: 22px;
    margin-bottom: 15px;
}

.toolbar, .import-bar, .batch-actions, .form-inline {
    background: white;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-form {
    display: flex;
    gap: 8px;
    flex: 1;
}

.filter-form input,
.filter-form select,
.form-inline input,
.form-inline select,
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: #e0e0e0;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background: #2a5298;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scroll-hint {
    display: none;
    font-size: 12px;
    color: #e65100;
    margin: 4px 0;
}

@media (max-width: 768px) {
    .scroll-hint { display: block; }
}

.text-muted { color: #888; font-size: 13px; }

.invoice-group-header { background: #f0f2f5; }
.invoice-group-header td { font-weight: 600; border-top: 2px solid #ddd; padding: 10px 12px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f0f2f5;
    font-weight: 600;
}

.group-card {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.group-header .meta {
    color: #666;
    font-size: 13px;
}

.group-actions a {
    margin-left: 10px;
    font-size: 13px;
}

.form-card {
    background: white;
    padding: 20px;
    border-radius: 6px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
}

.form-actions {
    margin-top: 20px;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
}

.login-card {
    background: white;
    padding: 35px;
    border-radius: 10px;
    width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.login-card h2 {
    margin-top: 0;
    text-align: center;
}

.login-card p {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

.flash-messages {
    margin-bottom: 15px;
}

.flash {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.flash-success {
    background: #d4edda;
    color: #155724;
}

.flash-danger {
    background: #f8d7da;
    color: #721c24;
}

.active {
    background: #2a5298;
    color: white;
}

/* ===== 数据分析面板 ===== */
.stats-dashboard { margin-bottom: 20px; }
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.stats-header h2 { margin: 0; font-size: 18px; }
.time-tabs { display: flex; gap: 5px; }
.time-tab {
    padding: 6px 14px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    transition: all 0.2s;
}
.time-tab:hover { border-color: #007bff; color: #007bff; }
.time-tab.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}
.stat-card-new {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.stat-card-new::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}
.stat-card-new:nth-child(1)::before { background: #007bff; }
.stat-card-new:nth-child(2)::before { background: #dc3545; }
.stat-card-new:nth-child(3)::before { background: #28a745; }
.stat-card-new:nth-child(4)::before { background: #fd7e14; }
.stat-label { font-size: 13px; color: #666; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: bold; color: #333; }
.stat-value.sales { color: #dc3545; }
.stat-value.profit { color: #28a745; }
.stat-sub { font-size: 12px; color: #888; margin-top: 6px; }
.stat-sub span { color: #333; font-weight: bold; }

.monthly-summary {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}
.monthly-summary h3 { margin: 0 0 12px 0; font-size: 15px; }
.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.monthly-table th, .monthly-table td {
    padding: 7px 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
}
.monthly-table th { background: #f5f5f5; color: #555; font-weight: 600; }
.monthly-table td:first-child { text-align: left; font-weight: 500; cursor: pointer; }
.monthly-table td:first-child:hover { color: #007bff; text-decoration: underline; }
.monthly-table tr:hover { background: #f9f9f9; }
.sales-val { color: #dc3545; font-weight: 600; }
.profit-val { color: #28a745; font-weight: 600; }

.filter-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.filter-section h2 {
    margin: 0 0 14px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-main-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-group label {
    font-size: 13px;
    white-space: nowrap;
    color: #555;
    font-weight: 500;
}
.filter-group select,
.filter-group input {
    padding: 7px 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background: #fafafa;
}
.month-select {
    min-width: 140px;
    font-weight: 600;
    color: #007bff;
    font-size: 14px !important;
}
.quick-btns { display: flex; gap: 5px; }
.quick-btn {
    padding: 5px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 12px;
    transition: all 0.15s;
}
.quick-btn:hover { background: #e8f4ff; border-color: #007bff; color: #007bff; }
.secondary-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
}
.secondary-filters input,
.secondary-filters select {
    padding: 5px 9px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .filter-main-row { flex-direction: column; align-items: flex-start; }
}

