/* ========== 管理平台 v2.0.0 - Premium Design System ========== */
:root {
    --primary: #B84D6B;
    --primary-light: #FBF7F8;
    --primary-dark: #963B58;
    --primary-gradient: linear-gradient(135deg, #B84D6B 0%, #D9899F 100%);
    --success: #AF5E78;
    --success-light: #F3E1E7;
    --success-gradient: linear-gradient(135deg, #AF5E78 0%, #C98298 100%);
    --warning: #D9899F;
    --warning-light: #F3E1E7;
    --warning-gradient: linear-gradient(135deg, #D9899F 0%, #E5A6B8 100%);
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --danger-gradient: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
    --info: #C75D7B;
    --info-light: #F5E7EB;
    --info-gradient: linear-gradient(135deg, #C75D7B 0%, #E6A1B3 100%);
    --bg: #FBF7F8;
    --card-bg: #FFFFFF;
    --text: #3F2A32;
    --text-secondary: #7B626B;
    --text-muted: #A28A93;
    --border: #EAD8DE;
    --border-light: #FBF7F8;
    --shadow-sm: 0 1px 2px rgba(63,42,50,0.04);
    --shadow: 0 1px 3px rgba(63,42,50,0.06), 0 1px 2px rgba(63,42,50,0.04);
    --shadow-md: 0 4px 6px rgba(63,42,50,0.05), 0 2px 4px rgba(63,42,50,0.04);
    --shadow-lg: 0 10px 15px rgba(63,42,50,0.06), 0 4px 6px rgba(63,42,50,0.04);
    --shadow-xl: 0 20px 25px rgba(63,42,50,0.08), 0 8px 10px rgba(63,42,50,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-bg: linear-gradient(165deg, #35232A 0%, #4B2935 30%, #5A2F3E 65%, #6E3548 100%);
    --sidebar-text: rgba(238, 221, 227, 0.86);
    --sidebar-active: rgba(255,255,255,0.15);
    --sidebar-hover: rgba(255,255,255,0.07);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ========== Sidebar - Dark Premium ========== */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 8px 0 32px rgba(2, 8, 23, 0.32);
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 85% 45% at 15% 0%, rgba(96, 165, 250, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 40% at 85% 100%, rgba(37, 99, 235, 0.16), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.sidebar::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    pointer-events: none;
    z-index: 1;
}

.sidebar-brand {
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.sidebar-brand h1 {
    font-size: 19px;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.22);
}

.sidebar-brand .subtitle {
    font-size: 11px;
    color: rgba(221,184,196, 0.78);
    margin-top: 5px;
    letter-spacing: 0.35px;
    font-weight: 500;
}

/* 导航分组标签 */
.nav-section {
    padding: 6px 14px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(221,184,196, 0.42);
    text-transform: uppercase;
}

/* 品牌 logo 渐变 chip */
.sidebar-brand h1 { gap: 0; }
.sidebar-brand h1 .app-ico {
    width: 22px; height: 22px;
    padding: 9px;
    margin-right: 12px;
    box-sizing: content-box;
    border-radius: 12px;
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255,255,255,0.18);
    flex-shrink: 0;
}
.sidebar-brand h1 .app-ico svg.lucide { width: 22px; height: 22px; stroke: #fff; }

.sidebar-nav { padding: 0 12px; flex: 1; position: relative; z-index: 1; display: flex; flex-direction: column; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
    position: relative;
    letter-spacing: 0.2px;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(3px);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.32), inset 0 1px 0 rgba(255,255,255,0.14);
}

.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    border-radius: 0 4px 4px 0;
    background: #E6A1B3;
    box-shadow: 0 0 14px rgba(96, 165, 250, 0.75);
}

/* 导航项图标 chip */
.sidebar-nav .nav-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav a:hover .nav-icon { background: rgba(255,255,255,0.12); }
.sidebar-nav a.active .nav-icon { background: rgba(255,255,255,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12); }
.sidebar-nav .nav-icon svg.lucide { width: 18px; height: 18px; }
.sidebar-nav a.active .nav-icon svg.lucide { opacity: 1; }

/* 退出登录按钮：置于导航底部，颜色更克制 */
.sidebar-nav a.nav-logout {
    margin-top: auto;
    color: rgba(238, 221, 227, 0.72);
}
.sidebar-nav a.nav-logout:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
}
.sidebar-nav a.nav-logout .nav-icon {
    background: rgba(239, 68, 68, 0.1);
}
.sidebar-nav a.nav-logout:hover .nav-icon {
    background: rgba(239, 68, 68, 0.22);
}

/* ========== Main Content ========== */
.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px 36px;
    max-width: 1240px;
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ========== Cards ========== */
.card {
    --card-accent: var(--primary);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--card-accent);
    padding: 24px;
    margin-bottom: 30px;
    position: relative;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.card::after {
    /* 顶部细渐变强调线，强化模块边界 */
    content: '';
    position: absolute;
    top: 0; left: 4px; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, color-mix(in srgb, var(--card-accent) 55%, transparent), transparent 70%);
    opacity: 0.9;
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--card-accent) 35%, var(--border));
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 650;
    color: var(--text);
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
}

/* 卡片头图标 chip：用模块强调色渲染，让每个模块更可辨识 */
.card-header h3 .app-ico,
.card-header h3 svg.lucide {
    width: 18px; height: 18px;
    padding: 7px;
    margin-right: 12px;
    box-sizing: content-box;
    border-radius: 11px;
    background: color-mix(in srgb, var(--card-accent) 14%, #fff);
    color: var(--card-accent);
    flex-shrink: 0;
    vertical-align: middle;
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.25s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #EAD8DE;
}

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-icon.blue   { background: linear-gradient(135deg, #FBF7F8, #F5E7EB); color: var(--info); }
.stat-icon.green  { background: linear-gradient(135deg, #F7EEF1, #F3E1E7); color: var(--success); }
.stat-icon.orange { background: linear-gradient(135deg, #FDF9FA, #F3E1E7); color: var(--warning); }
.stat-icon.red    { background: linear-gradient(135deg, #FEF2F2, #FEE2E2); color: var(--danger); }
.stat-icon.purple { background: linear-gradient(135deg, #FCF4F6, #F4E7EC); color: #A84462; }
.stat-icon.indigo { background: linear-gradient(135deg, #FBF7F8, #F5E7EB); color: var(--primary); }
.stat-icon.teal   { background: linear-gradient(135deg, #F0FDFA, #F6E9ED); color: #A65E78; }
.stat-icon.cyan   { background: linear-gradient(135deg, #ECFEFF, #F4E5EA); color: #A65E78; }
.stat-icon.pink   { background: linear-gradient(135deg, #FDF2F8, #FCE7F3); color: #9F3F5F; }

.stat-body { flex: 1; min-width: 0; }
.stat-body .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.stat-body .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.stat-body .stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== KPI Grid ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.kpi-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.kpi-card .kpi-val {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.kpi-card .kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.kpi-card .kpi-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ========== Forms ========== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 12px;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--card-bg);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184,77,107,0.12);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    letter-spacing: 0.1px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(184,77,107,0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(184,77,107,0.4);
    transform: translateY(-1px);
}

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

.btn-success { background: var(--success); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
.btn-success:hover { background: #8F4961; box-shadow: 0 4px 12px rgba(16,185,129,0.35); transform: translateY(-1px); }
.btn-success:active { transform: translateY(0); }

.btn-warning { background: var(--warning-gradient); color: #fff; box-shadow: 0 2px 8px rgba(217,137,159,0.25); }
.btn-warning:hover { box-shadow: 0 4px 12px rgba(217,137,159,0.35); transform: translateY(-1px); }
.btn-warning:active { transform: translateY(0); }

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

.btn-outline {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

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

.preset-active {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 2px 10px rgba(184,77,107,0.35) !important;
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; margin-top: 4px; }

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

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: #FDF9FA;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FDF9FA; }

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success { background: var(--success-light); color: #7C3F53; }
.badge-warning { background: var(--warning-light); color: #744052; }
.badge-danger  { background: var(--danger-light); color: #991B1B; }
.badge-info    { background: var(--info-light); color: #8E4960; }
.badge-default { background: #FBF7F8; color: #674D57; }

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(63,42,50,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }

.modal-close {
    background: #FBF7F8;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px; height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    flex: 0 0 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover { background: #EAD8DE; color: var(--text); }
.modal-close svg,
.unused-modal__close svg { width: 18px; height: 18px; margin: 0; pointer-events: none; }

/* ========== Unused Tickets Modal ========== */
.unused-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 92%;
    max-width: 440px;
    max-height: 82vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.25s ease;
}

.unused-modal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.unused-modal__head .ico {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--warning-light);
    color: var(--warning);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.unused-modal__head h3 { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }

.unused-modal__close {
    background: #FBF7F8; border: none;
    font-size: 20px; line-height: 1;
    color: var(--text-secondary); cursor: pointer;
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}

.unused-modal__close:hover { background: #EAD8DE; color: var(--text); }
.unused-modal__body { padding: 18px 22px 22px; overflow-y: auto; }
.unused-modal__hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5; }
.unused-modal__hint b { color: var(--warning); font-weight: 700; }
.unused-modal__table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.unused-modal__table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    text-align: left; font-weight: 600;
    padding: 10px 12px;
    font-size: 11px; letter-spacing: 0.3px;
}
.unused-modal__table th:first-child { border-radius: 8px 0 0 0; }
.unused-modal__table th:last-child { border-radius: 0 8px 0 0; }
.unused-modal__table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); color: var(--text); }
.unused-modal__table tbody tr:nth-child(even) { background: #FDF9FA; }
.unused-modal__table tbody tr:hover { background: var(--primary-light); }
.unused-modal__qty { font-weight: 700; color: var(--warning); }
.unused-modal__empty { text-align: center; color: var(--text-secondary); padding: 32px 0; font-size: 14px; }
.unused-modal__foot { padding: 14px 22px; border-top: 1px solid var(--border); }

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 13px 22px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 550;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    max-width: 360px;
    letter-spacing: 0.1px;
}

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

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }

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

/* ========== Chart Container ========== */
.chart-container { width: 100%; height: 300px; margin-top: 16px; }

/* ========== Filter Bar ========== */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 18px;
}

.filter-bar .form-group { min-width: 140px; }

/* ========== Quick Actions ========== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.quick-action-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.quick-action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-card .action-icon { font-size: 32px; margin-bottom: 8px; }
.quick-action-card .action-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.quick-action-card .action-desc { font-size: 12px; color: var(--text-secondary); }

/* ========== Tags ========== */
.tag-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 2px;
}

.tag-agent  { background: var(--warning-light); color: #744052; }
.tag-self   { background: var(--info-light); color: #8E4960; }
.tag-yes    { background: var(--success-light); color: #7C3F53; }
.tag-no     { background: #FBF7F8; color: #7B626B; }
.tag-unused { background: var(--danger-light); color: #991B1B; }
.tag-recon  { background: #F3E1E7; color: #7C3F53; }

/* ========== Order Number ========== */
.order-number {
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 1px;
}

.order-row { cursor: pointer; transition: all 0.15s ease; }
.order-row:hover { background: var(--primary-light) !important; }

/* ========== Parse Area ========== */
.parse-area {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.parse-area:focus-within { border-color: var(--primary); border-style: solid; }

.parse-area textarea {
    width: 100%; border: none; outline: none; resize: vertical;
    font-size: 14px; font-family: inherit; min-height: 80px; color: var(--text);
    background: transparent;
}

.parse-hint { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

.parse-result {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 16px; margin-top: 10px;
    display: none;
}

.parse-result.show { display: block; animation: fadeIn 0.2s ease; }

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

.preview-table { width: 100%; font-size: 13px; margin: 8px 0; }
.preview-table td { padding: 4px 8px; }

/* ========== Inventory Bars ========== */
.inv-bar-wrap {
    background: var(--bg);
    border-radius: 10px;
    height: 28px; overflow: hidden; margin-top: 4px;
}

.inv-bar { height: 100%; border-radius: 10px; transition: width 0.5s ease; }
.inv-bar.used   { background: var(--danger-gradient); }
.inv-bar.remain { background: var(--success-gradient); }

/* ========== Today Bar ========== */
.today-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 18px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.today-bar .tb-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.today-bar .tb-val   { font-size: 16px; font-weight: 700; color: var(--text); }

/* ========== Reconciliation ========== */
.recon-box {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: all 0.2s ease;
}

.recon-box:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.ss-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========== Sidebar SVG Icon Colors ========== */
.sidebar svg.lucide { stroke: currentColor; }
.sidebar-nav a svg.lucide { opacity: 0.75; }
.sidebar-nav a.active svg.lucide { opacity: 1; }
.sidebar-brand h1 svg.lucide { stroke: #fff; }

/* ========== SVG Icon System ========== */
svg.lucide {
    flex-shrink: 0;
    vertical-align: middle;
    stroke-width: 2;
    display: inline-block;
}

.sidebar-brand h1 { display: flex; align-items: center; }
.sidebar-brand svg.lucide { width: 22px; height: 22px; margin-right: 10px; }

h1 svg.lucide { width: 30px; height: 30px; margin-right: 10px; vertical-align: -6px; }
h2 svg.lucide { width: 24px; height: 24px; margin-right: 9px; vertical-align: -5px; }
/* 非卡片头的 h3 图标（如页内小标题）保持默认尺寸；卡片头图标由 .card-header h3 svg.lucide 渲染为 chip */
:not(.card-header) h3 svg.lucide { width: 20px; height: 20px; margin-right: 8px; vertical-align: -4px; }

.nav-icon svg.lucide { width: 20px; height: 20px; }
.mn-icon svg.lucide  { width: 22px; height: 22px; }

.stat-icon svg.lucide { width: 22px; height: 22px; }

.btn svg.lucide { width: 16px; height: 16px; vertical-align: -3px; }

.logo svg.lucide, .brand-logo svg.lucide { width: 46px; height: 46px; }
.qr-hero svg.lucide { width: 40px; height: 40px; }

/* ========== Mobile Nav ========== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border-top: 1px solid rgba(148,163,184,0.24);
    z-index: 200;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -6px 24px rgba(71,85,105,0.12);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.mobile-nav.is-hidden {
    transform: translateY(calc(100% + 2px));
    pointer-events: none;
}

.mobile-nav-inner { display: flex; justify-content: space-around; padding: 4px 6px 3px; }

.mn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #7B626B;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.15;
    padding: 2px 3px;
    min-width: 0;
    flex: 1;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.mn-item:nth-child(1) { --mn-color:#B84D6B; --mn-soft:#F5E7EB; }
.mn-item:nth-child(2) { --mn-color:#A65E78; --mn-soft:#F3E1E7; }
.mn-item:nth-child(3) { --mn-color:#A84462; --mn-soft:#F4E7EC; }
.mn-item:nth-child(4) { --mn-color:#8F4961; --mn-soft:#F7E9ED; }
.mn-item:nth-child(5) { --mn-color:#A84462; --mn-soft:#FFE4E6; }
.mn-item:nth-child(6) { --mn-color:#7B626B; --mn-soft:#FBF7F8; }

.mn-item.active { color: var(--mn-color); font-weight: 700; }

.mn-icon {
    width: 34px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    color: var(--mn-color);
    background: var(--mn-soft);
    margin-bottom: 1px;
    transition: all 0.2s ease;
}
.mn-item.active .mn-icon {
    color: #fff;
    background: var(--mn-color);
    box-shadow: 0 3px 9px color-mix(in srgb, var(--mn-color) 30%, transparent);
    transform: translateY(-1px);
}
.mn-item .mn-icon svg.lucide { width: 18px; height: 18px; }
.mn-item.active .mn-icon svg.lucide { opacity: 1; }

.mn-version {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav { transition-duration: 0.01ms; }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .mobile-nav { display: block; }

    .main-content {
        margin-left: 0 !important;
        padding: 18px 14px;
        padding-bottom: 68px;
        max-width: 100%;
    }

    .page-header h2 { font-size: 20px; }
    .page-header p { font-size: 13px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .stat-card { padding: 14px 12px; gap: 10px; }
    .stat-body .stat-value { font-size: 18px; }
    .stat-body .stat-label { font-size: 11px; }
    .stat-icon { width: 36px; height: 36px; }

    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .kpi-card { padding: 14px 8px; }
    .kpi-card .kpi-val { font-size: 20px; }
    .kpi-card .kpi-label { font-size: 11px; }

    .form-row { grid-template-columns: 1fr; gap: 8px; }
    .form-group label { font-size: 12px; }
    .form-group input,
    .form-group select,
    .form-group textarea { font-size: 16px; padding: 10px 12px; }

    .btn { padding: 10px 16px; font-size: 13px; min-height: 40px; }
    .btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }
    .btn-xs { padding: 4px 10px; font-size: 11px; min-height: 26px; }

    .form-actions { flex-direction: column; gap: 8px; }
    .form-actions .btn { width: 100%; }

    .filter-bar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
    .quick-action-card { padding: 14px 10px; }
    .quick-action-card .action-icon { font-size: 26px; }
    .quick-action-card .action-title { font-size: 13px; }

    .table-wrap { margin: 0 -14px; padding: 0 14px; }
    table { font-size: 12px; }
    thead th { font-size: 10px; padding: 8px; }
    tbody td { padding: 8px; font-size: 12px; }

    /* 记录型宽表在手机端改为双列信息卡，长字段独占整行 */
    .mobile-record-wrap {
        overflow: visible;
        margin: 0;
        padding: 0;
    }

    .mobile-record-table,
    .mobile-record-table tbody {
        display: block;
        width: 100%;
    }

    .mobile-record-table thead { display: none; }

    .mobile-record-table tbody {
        display: grid;
        gap: 12px;
    }

    .mobile-record-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 12px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--card-bg);
        box-shadow: var(--shadow-sm);
    }

    .mobile-record-table tbody tr:hover { background: var(--card-bg); }

    .mobile-record-table tbody td {
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 3px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--border-light);
        background: transparent;
        line-height: 1.45;
        text-align: left !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .mobile-record-table tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: 0.2px;
    }

    .mobile-record-table tbody td:not([data-label])::before { display: none; }

    .mobile-record-table tbody td.mobile-span-2 {
        grid-column: 1 / -1;
    }

    .mobile-record-table .mobile-long-value,
    .mobile-record-table .order-number,
    .mobile-record-table .recon-orders {
        width: 100%;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .mobile-record-table .mobile-money {
        color: var(--text);
        font-size: 14px;
        font-weight: 700;
    }

    .mobile-record-table .mobile-price-note {
        display: block;
        margin-top: 3px;
        color: var(--text-secondary);
        font-size: 10px;
        font-weight: 400;
    }

    .mobile-record-table .mobile-action {
        padding-top: 10px;
        border-bottom: 0;
    }

    .mobile-record-table .mobile-action .btn {
        width: 100%;
        min-height: 36px;
    }

    .mobile-record-table .empty-state {
        grid-column: 1 / -1;
        width: 100%;
        padding: 26px 10px;
        border: 0;
        align-items: center;
        text-align: center !important;
    }

    .card { padding: 16px 14px; margin-bottom: 16px; border-radius: var(--radius); }
    .card-header { margin-bottom: 14px; padding-bottom: 12px; }
    .card-header h3 { font-size: 15px; }

    .modal { width: 95%; padding: 20px 16px; max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin-top: auto; max-height: 90vh; }

    .parse-area { padding: 14px; }
    .parse-area textarea { font-size: 16px; min-height: 100px; }
    .parse-hint { font-size: 11px; }

    .chart-container { height: 220px; }

    .toast-container { top: 14px; right: 14px; left: 14px; }
    .toast { max-width: none; font-size: 13px; padding: 10px 16px; }

    .badge { font-size: 10px; padding: 2px 8px; }
    .tag-sm { font-size: 10px; }

    .preview-table { font-size: 12px; }
    .preview-table td { padding: 3px 6px; }

    .inv-bar-wrap { height: 22px; }

    .order-number { font-size: 13px; letter-spacing: 0.5px; }

    .empty-state { padding: 36px 12px; }
}

/* 展开箭头：仅移动端显示（PC 端记录已全展示，无需折叠箭头） */
.mobile-record-table .row-chevron { display: none; }

/* ===== 列表紧凑化：操作按钮缩小 + 整行点击展开（仅移动端） ===== */
@media (max-width: 768px) {
  /* 卡片整体更紧凑 */
  .mobile-record-table tbody { gap: 8px; }
  .mobile-record-table tbody tr { padding: 10px; gap: 0 10px; }
  .mobile-record-table td { padding: 6px 0; }
  /* 操作区：删除按钮缩小 + 右侧展开箭头 */
  .mobile-record-table .mobile-action { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
  .mobile-record-table .mobile-action::before { display: none; }
  .mobile-record-table .mobile-action .btn { width: auto; min-height: 28px; padding: 4px 10px; font-size: 12px; }
  /* 展开箭头 */
  .mobile-record-table .row-chevron { display: inline-block; font-size: 13px; color: var(--text-muted); transition: transform .2s; }
  .mobile-record-table tr.row-open .row-chevron { transform: rotate(180deg); }
  /* 次要明细默认隐藏，点击记录展开 */
  .mobile-record-table td.mobile-detail { display: none; }
  .mobile-record-table tr.row-open td.mobile-detail { display: block; }

  /* ===== 对账历史：默认仅展示日期、伙伴和实收，点击整条后展开明细 ===== */
  .mobile-recon-table tbody tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  }
  .mobile-recon-table tbody tr:active { background: #FDF9FA; }
  .mobile-recon-table tbody tr.row-open {
    border-color: #DCBAC6;
    box-shadow: 0 6px 18px rgba(166,94,120,.10);
  }
  .mobile-recon-table .recon-mobile-date {
    position: relative;
    padding-right: 16px;
  }
  .mobile-recon-table .recon-history-time {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.2;
  }
  .mobile-recon-table .recon-history-time > span:last-child:not(:first-child) {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
  }
  .mobile-recon-table .recon-mobile-date .row-chevron {
    position: absolute;
    right: 0;
    bottom: 7px;
  }
  .mobile-recon-table .mobile-detail { grid-column: 1 / -1; }
  .mobile-recon-table tr.row-open td.mobile-detail { display: flex; }
  .mobile-recon-table .mobile-detail.mobile-money { font-size: 13px; }
  .mobile-recon-table tr.row-open .mobile-action { display: flex; }

  /* ===== 订单列表专用 3 列布局：日期|订单号|销售额 / 门店|佣金|操作 ===== */
  .mobile-orders-table tbody tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* 默认展示字段按精确位置排序 */
  .mobile-orders-table tbody td:nth-child(1)  { order: 1; }   /* 日期 */
  .mobile-orders-table tbody td:nth-child(2)  { order: 2; }   /* 订单号 */
  .mobile-orders-table tbody td:nth-child(5)  { order: 3; }   /* 销售额 */
  .mobile-orders-table tbody td:nth-child(3)  { order: 4; }   /* 门店 */
  .mobile-orders-table tbody td:nth-child(7)  { order: 5; }   /* 佣金 */
  .mobile-orders-table tbody td:nth-child(12) { order: 6; }   /* 操作 */
  /* 展开的次要字段排在后面，各自占整行 */
  .mobile-orders-table tbody td:nth-child(4)  { order: 10; }  /* 明细 */
  .mobile-orders-table tbody td:nth-child(6)  { order: 11; }  /* 成本 */
  .mobile-orders-table tbody td:nth-child(8)  { order: 12; }  /* 服务费 */
  .mobile-orders-table tbody td:nth-child(9)  { order: 13; }  /* 额外成本 */
  .mobile-orders-table tbody td:nth-child(10) { order: 14; }  /* 利润 */
  .mobile-orders-table tbody td:nth-child(11) { order: 15; }  /* 标识 */

  /* ===== 筛选栏：省份/订单号/搜索整行宽 + 控件缩小对齐 ===== */
  .filter-bar .filter-row { grid-column: 1 / -1; }
  .filter-bar .form-group { min-width: 0; }
  .filter-bar .form-group label { font-size: 11px; }
  .filter-bar .form-group select,
  .filter-bar .form-group input { font-size: 12px; padding: 5px 8px; height: 34px; }
  .filter-row .form-group { flex: 1 1 0; min-width: 0; }
  .filter-row .form-group + .form-group { margin-left: 0; }
}

@media (max-width: 440px) {
    .kpi-card .kpi-val { font-size: 18px !important; }
    .kpi-card .kpi-label { font-size: 10px; }
    .stat-card .stat-value { font-size: 16px !important; }
    .stat-card .stat-icon { width: 30px; height: 30px; }
    .stat-icon svg.lucide { width: 18px; height: 18px; }
    .page-header h2 { font-size: 18px; }
    .filter-bar { grid-template-columns: 1fr 1fr; gap: 6px; }
    .form-row { grid-template-columns: 1fr; }
    .chart-container { height: 180px; }
    .kpi-grid, .stats-grid { gap: 6px; }
    .kpi-card, .stat-card { padding: 10px 8px; }
    .card { padding: 12px 10px; }
    .card-header h3 { font-size: 14px; }
    .table-wrap table { font-size: 11px; }
    .btn { font-size: 12px; padding: 6px 12px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .main-content { padding: 24px 28px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
