/* ============================================================
   签证财务核对系统 — 暗黑主题样式 v1.0
   ============================================================ */

:root {
    --bg-primary: #0F1117;
    --bg-card: #1A1D27;
    --bg-input: #232733;
    --bg-hover: #262A36;
    --border: #2A2F3D;
    --text-primary: #E4E6EB;
    --text-secondary: #8B8FA3;
    --text-muted: #5A5E6E;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --success: #00D4AA;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
}

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

body.dark-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-divider {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    letter-spacing: 1px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-weight: 600;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}

.topbar {
    padding: 20px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    margin: 0 6px;
}

.page-content {
    padding: 24px;
}

/* ========== Cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.summary-card h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ========== Tables ========== */
.table-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table-mini th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.table-mini td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(42, 47, 61, 0.5);
}

.table-mini code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent);
}

/* ========== Alerts ========== */
.alert {
    margin: 0 24px;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
}

.alert-close:hover { opacity: 1; }

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-ctrip { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-fliggy { background: rgba(139,92,246,0.15); color: #8B5CF6; }
.badge-tonghang { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-offline { background: rgba(107,114,128,0.15); color: var(--text-secondary); }
.badge-store { background: rgba(0,212,170,0.15); color: var(--success); }

/* ========== Text Colors ========== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== Forms (global) ========== */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #000;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }
    .sidebar-title, .nav-item span, .user-meta, .nav-divider {
        display: none;
    }
    .sidebar-brand { padding: 16px 12px; }
    .nav-item { justify-content: center; padding: 10px; }
    .main-content { margin-left: 60px; }
    .charts-row { grid-template-columns: 1fr; }
}

/* ========== App Layout ========== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; min-width: 220px; background: #1A1D27; border-right: 1px solid #2A2F3D; display: flex; flex-direction: column; }
.sidebar-logo { padding: 20px; border-bottom: 1px solid #2A2F3D; }
.sidebar-logo h3 { font-size: 16px; color: #E4E6EB; }
.sidebar-nav { padding: 12px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #8B8FA3; text-decoration: none; border-radius: 8px; font-size: 14px; margin-bottom: 2px; transition: all .2s; }
.nav-item:hover { background: #232733; color: #E4E6EB; }
.nav-item.active { background: rgba(59,130,246,0.15); color: #3B82F6; }
.nav-icon { font-size: 16px; }
.nav-divider { height: 1px; background: #2A2F3D; margin: 12px 0; }
.nav-section-title { font-size: 11px; color: #5A5E6E; text-transform: uppercase; padding: 8px 12px; font-weight: 600; letter-spacing: .5px; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: #1A1D27; border-bottom: 1px solid #2A2F3D; }
.page-title { font-size: 18px; font-weight: 600; color: #E4E6EB; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-info { font-size: 13px; color: #8B8FA3; }
.badge-admin, .badge-finance { font-size: 11px; padding: 2px 8px; border-radius: 4px; margin-left: 8px; }
.badge-admin { background: rgba(59,130,246,0.15); color: #3B82F6; }
.badge-finance { background: rgba(0,212,170,0.15); color: #00D4AA; }
.btn-logout { font-size: 13px; color: #8B8FA3; text-decoration: none; padding: 6px 12px; border-radius: 6px; border: 1px solid #2A2F3D; }
.btn-logout:hover { color: #EF4444; border-color: #EF4444; }
.content-area { flex: 1; padding: 24px; overflow-y: auto; }
.footer { padding: 12px 24px; border-top: 1px solid #2A2F3D; font-size: 12px; color: #5A5E6E; text-align: center; }

/* ========== Filter Bar ========== */
.filter-bar { background: #1A1D27; border: 1px solid #2A2F3D; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; }
.filter-row { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 12px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item label { font-size: 12px; color: #5A5E6E; }
.filter-item input, .filter-item select { min-width: 140px; }
.filter-actions { flex-direction: row !important; align-items: flex-end; gap: 8px; }

/* ========== Page Toolbar ========== */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.total-badge { font-size: 13px; color: #8B8FA3; }

/* ========== Data Table ========== */
.data-table-container { background: #1A1D27; border: 1px solid #2A2F3D; border-radius: 12px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #0F1117; padding: 10px 14px; font-size: 12px; color: #5A5E6E; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.data-table td { padding: 12px 14px; font-size: 13px; border-top: 1px solid #2A2F3D; color: #E4E6EB; }
.data-table tr:hover td { background: rgba(59,130,246,0.03); }
.order-id { font-family: monospace; font-size: 12px; color: #8B8FA3; }
.text-right { text-align: right; }
.text-green { color: #10B981; }
.text-red { color: #EF4444; }
.channel-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: rgba(59,130,246,0.1); color: #3B82F6; }
.status-tag { font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 500; }
.status-pending { background: rgba(245,158,11,0.15); color: #F59E0B; }
.status-done { background: rgba(16,185,129,0.15); color: #10B981; }
.status-partial { background: rgba(59,130,246,0.15); color: #3B82F6; }
.empty-state td { padding: 60px; text-align: center; }
.empty-box { color: #5A5E6E; }
.empty-icon { font-size: 36px; margin-bottom: 8px; }
.empty-box p { margin: 8px 0; }

/* ========== Pagination ========== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 20px 0; }
.page-link { padding: 8px 16px; background: #232733; border: 1px solid #2A2F3D; border-radius: 6px; color: #8B8FA3; text-decoration: none; font-size: 13px; transition: all .2s; }
.page-link:hover { border-color: #3B82F6; color: #3B82F6; }
.page-info { font-size: 13px; color: #5A5E6E; }

/* ========== Button Sizes ========== */
.btn-lg { padding: 12px 32px; font-size: 15px; }
.btn-secondary { background: #232733; color: #E4E6EB; border: 1px solid #2A2F3D; }
.btn-secondary:hover { background: #262A36; }
.btn-ghost { background: transparent; color: #8B8FA3; border: none; }
.btn-ghost:hover { color: #E4E6EB; }

/* ========== Toast Notification ========== */
.toast { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 12px 20px; border-radius: 8px; font-size: 13px; color: #fff; animation: slideIn .3s ease; }
.toast-info { background: #3B82F6; }
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== File Upload ========== */
.file-upload { border: 2px dashed #2A2F3D; border-radius: 12px; padding: 40px 24px; text-align: center; cursor: pointer; transition: border-color .2s; background: #0F1117; }
.file-upload:hover { border-color: #3B82F6; }
.file-upload .icon { font-size: 48px; margin-bottom: 12px; }
.file-upload .text { color: #8B8FA3; font-size: 13px; }

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; color: #5A5E6E; font-size: 12px; margin-bottom: 6px; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; background: #232733; border: 1px solid #2A2F3D; border-radius: 8px; color: #E4E6EB; font-size: 13px; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: #3B82F6; }

/* ========== Modal ========== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: #1A1D27; border: 1px solid #2A2F3D; border-radius: 16px; padding: 28px; max-width: 460px; width: 90%; }
.modal-content h3 { font-size: 18px; margin-bottom: 20px; color: #E4E6EB; }
.modal-content input[readonly] { color: #8B8FA3; }
