/* ===== CSS Variables ===== */
:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 56px;
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --primary-bg: rgba(79,70,229,0.08);
    --sidebar-bg: #1e293b;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(79,70,229,0.25);
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    /* Status palette */
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #06b6d4;
    --indigo: #6366f1;
    --rose: #f43f5e;
    --cyan: #06b6d4;
    --orange: #f97316;
    --teal: #0d9488;
    --lime: #84cc16;
    /* Radius system */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-pill: 20px;
    --transition: 0.2s ease;

    /* ─── 环境检测开关（手机端自适应）─── */
    --env-show-mobile-only: none;    /* 仅手机显示 */
    --env-hide-mobile-only: block;   /* 手机隐藏 */
}

/* ─── 手机环境 ─── */
html.env-mobile { --env-show-mobile-only: block; --env-hide-mobile-only: none; }

/* ─── 辅助类：按环境显示/隐藏 ─── */
.env-show-mobile   { display: var(--env-show-mobile-only) !important; }
.env-hide-mobile   { display: var(--env-hide-mobile-only) !important; }

/* ===== Mobile touch enhancement (global) ===== */
a, button, .btn, [role="button"], input[type="submit"], input[type="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Global button border-radius consistency ===== */
.btn { border-radius: 8px; }
.btn-sm { border-radius: 6px; }
.btn-lg { border-radius: 10px; }

/* ===== Mobile: scroll-margin so focused inputs don't hide under fixed topbar ===== */
@media (max-width: 768px) {
    input, textarea, select, .cs-input, .form-control, .form-select {
        scroll-margin-top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 14px);
    }
}

/* ===== Prevent blinking caret on non-editable text (mobile Safari) ===== */
body, div, span, p, h1, h2, h3, h4, h5, h6, a, button, label, td, th, li {
    caret-color: transparent;
}
input, textarea, [contenteditable="true"], .cs-input, .form-control, .form-select {
    caret-color: auto;
}

/* ===== Status Badge Color System (status 0-12) ===== */
/* 作废 */
.status-badge-0 {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}
/* 待审核 */
.status-badge-1 {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px solid #fde68a;
}
/* 待处理 */
.status-badge-5 {
    background: #dbeafe !important;
    color: #2563eb !important;
    border: 1px solid #93c5fd;
}
/* 处理中 */
.status-badge-6 {
    background: #e0e7ff !important;
    color: #4f46e5 !important;
    border: 1px solid #c7d2fe;
}
/* 待发货 */
.status-badge-8 {
    background: #ffedd5 !important;
    color: #ea580c !important;
    border: 1px solid #fed7aa;
}
/* 已返件 */
.status-badge-9 {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd;
}
/* 已结案 */
.status-badge-10 {
    background: #dcfce7 !important;
    color: #059669 !important;
    border: 1px solid #86efac;
}
/* 无法维修 */
.status-badge-12 {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5;
}

/* ===== Unified Card ===== */
.card-rma {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
    transition: box-shadow var(--transition);
    margin-bottom: 1rem;
}
.card-rma .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 14px 20px;
    color: var(--text-primary);
}

/* ===== Unified Table ===== */
.table-rma thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 10px 14px;
    white-space: nowrap;
}
.table-rma tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.table-rma tbody tr:hover {
    background: #f8fafc;
}

/* ===== Font Size Utility Classes ===== */
.text-xs { font-size: 0.72rem !important; }
.text-sm { font-size: 0.82rem !important; }
.text-base { font-size: 0.9rem !important; }
.text-mono { font-family: 'SF Mono', 'Consolas', 'Monaco', monospace !important; }

/* ===== Common Utility Classes ===== */
.bg-surface { background: #f8fafc !important; }
.divider-dashed {
    border-top: 1px dashed var(--border-color) !important;
}
.divider-dashed-light {
    border-top: 1px dashed #e8ecf1 !important;
}

/* ===== Global Button Override: unified border-radius ===== */
.btn {
    border-radius: var(--radius-sm);
}

/* ===== Noscript Banner (unified) ===== */
.noscript-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--danger);
    color: #fff;
    padding: 12px 20px;
    text-align: center;
    font-size: 0.88rem;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Status badge aliases (for print template compatibility) */
.status-0 { background: #f1f5f9 !important; color: #64748b !important; border:1px solid #e2e8f0; }
.status-1 { background: #fef3c7 !important; color: #d97706 !important; border:1px solid #fde68a; }
.status-5 { background: #dbeafe !important; color: #2563eb !important; border:1px solid #93c5fd; }
.status-6 { background: #e0e7ff !important; color: #4f46e5 !important; border:1px solid #c7d2fe; }
.status-8 { background: #ffedd5 !important; color: #ea580c !important; border:1px solid #fed7aa; }
.status-9 { background: #e0f2fe !important; color: #0284c7 !important; border:1px solid #bae6fd; }
.status-10 { background: #dcfce7 !important; color: #059669 !important; border:1px solid #86efac; }
.status-12 { background: #fee2e2 !important; color: #dc2626 !important; border:1px solid #fca5a5; }

/* ===== Font Weight Utility ===== */
.fw-500 { font-weight: 500 !important; }

/* ===== Query Page (Standalone) ===== */
.query-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
}
.query-header {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    padding: 28px 24px;
    text-align: center;
    color: #fff;
}
.query-header h4 { margin: 0; font-weight: 600; }
.query-header p { margin: 6px 0 0; opacity: 0.85; font-size: 0.9rem; }
.query-body { padding: 24px; }
.result-area { padding: 0 24px 24px; }

/* Query result card */
.query-result-card {
    background: var(--body-bg);
    border-radius: var(--radius);
}

/* Status badge base (query.html) */
.status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Timeline (query.html) */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #c7d2fe; }
.timeline-dot.done { background: #22c55e; border-color: #bbf7d0; }
.timeline-time { font-size: 0.75rem; color: var(--text-muted); }
.timeline-text { font-size: 0.85rem; color: #334155; margin-top: 2px; }

/* ===== Global Reset ===== */
body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    overflow-x: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.sidebar-brand-text {
    margin-left: 10px;
    font-size: 0.95rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: contain;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

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

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.6);
    padding: 10px 20px;
    margin: 2px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    margin-left: 12px;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-dropdown-toggle {
    cursor: pointer;
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar-dropdown-toggle[aria-expanded="true"] .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-subnav .nav-link {
    padding: 7px 20px 7px 56px;
    font-size: 0.85rem;
    margin: 1px 12px;
}

.sidebar-subnav .nav-link i {
    font-size: 0.9rem;
    width: 20px;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sidebar-user-avatar i {
    font-size: 1.6rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-user-info {
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
}

.sidebar-logout {
    color: rgba(255,255,255,0.4);
    font-size: 1.2rem;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.15);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    transition: all var(--transition);
    font-size: 1.1rem;
}

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

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

/* ===== Top Bar ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-right: 12px;
    display: none;
}

.topbar-toggle:hover {
    background: var(--body-bg);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-role-badge {
    background: var(--primary);
    color: #fff;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
}

.topbar-user-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Content Wrapper ===== */
.content-wrapper {
    padding: 24px;
}

/* ===== Flat Card ===== */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
    transition: box-shadow var(--transition);
    margin-bottom: 1rem;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 14px 20px;
    color: var(--text-primary);
}

.card-header i {
    margin-right: 6px;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* ===== Flat Table ===== */
.table {
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    padding: 10px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.table code {
    font-size: 0.8rem;
    background: var(--body-bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-weight: 500;
}

/* ===== Flat Form Controls ===== */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--card-bg);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.input-group-text {
    background: var(--body-bg);
    border-color: var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

/* ===== Flat Buttons ===== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 8px 16px;
    transition: all var(--transition);
}

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

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

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.btn .bi {
    vertical-align: 0;
}

/* ===== Capsule Badges ===== */
.badge {
    border-radius: var(--radius-pill);
    font-weight: 500;
    font-size: 0.78rem;
    padding: 4px 10px;
}

.badge.fs-5 {
    font-size: 1rem !important;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
}

/* ===== Status Badges ===== */
.badge.bg-primary {
    background: var(--primary) !important;
}

.badge.bg-info {
    background: #06b6d4 !important;
    color: #fff !important;
}

.badge.bg-success {
    background: #10b981 !important;
}

.badge.bg-warning {
    background: #f59e0b !important;
    color: #1e293b !important;
}

.badge.bg-danger {
    background: #ef4444 !important;
}

.badge.bg-secondary {
    background: #64748b !important;
}

/* 自定义状态标签颜色 */
.badge.bg-orange {
    background: #f97316 !important;
    color: #fff !important;
}
.badge.bg-teal {
    background: #0d9488 !important;
    color: #fff !important;
}
.badge.bg-indigo {
    background: #6366f1 !important;
    color: #fff !important;
}
.badge.bg-pink {
    background: #ec4899 !important;
    color: #fff !important;
}
.badge.bg-lime {
    background: #84cc16 !important;
    color: #1e293b !important;
}

/* Mixed batch status badges */
.badge-mixed-closed {
    background: linear-gradient(135deg, #84cc16 0%, #4f46e5 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.badge-mixed-shipped {
    background: linear-gradient(135deg, #14b8a6 0%, #4f46e5 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.badge-mixed-unrepair {
    background: linear-gradient(135deg, #ef4444 0%, #4f46e5 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.badge-mixed-active {
    background: linear-gradient(135deg, #f59e0b 0%, #4f46e5 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.badge.bg-rose {
    background: #f43f5e !important;
    color: #fff !important;
}
.badge.bg-violet {
    background: #8b5cf6 !important;
    color: #fff !important;
}
.badge.bg-cyan {
    background: #06b6d4 !important;
    color: #fff !important;
}

/* ===== Urgent Badge ===== */
.urgent-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    animation: urgentPulse 1.5s infinite;
}

@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.urgent-row {
    border-left: 3px solid #ef4444;
}

/* ===== Overdue Row ===== */
.overdue-row {
    border-left: 3px solid #ef4444;
    background-color: rgba(239, 68, 68, 0.04);
}

/* ===== Flat Alert ===== */
.flat-alert {
    border: none;
    border-left: 4px solid transparent;
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 0.88rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    animation: alertSlideDown 0.35s ease-out;
    position: relative;
}
/* Per-category accent bar */
.flat-alert.alert-success { border-left-color: #10b981; background: rgba(16,185,129,0.06); color: #065f46; }
.flat-alert.alert-danger  { border-left-color: #ef4444; background: rgba(239,68,68,0.06); color: #991b1b; }
.flat-alert.alert-warning { border-left-color: #f59e0b; background: rgba(245,158,11,0.06); color: #92400e; }
.flat-alert.alert-info    { border-left-color: #6366f1; background: rgba(99,102,241,0.06); color: #3730a3; }

.flat-alert i {
    margin-right: 8px;
}

/* ===== Toast (右下角通知) ===== */
.toast-container {
    z-index: 1080;
}
.flash-toast {
    border: none;
    border-left: 4px solid transparent;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    min-width: 260px;
    max-width: 380px;
    font-size: 0.88rem;
    animation: toastSlideUp 0.4s ease-out;
}
.flash-toast .toast-body {
    padding: 12px 16px;
}
.flash-toast .toast-body i {
    margin-right: 8px;
}
/* Per-category toast accent */
.flash-toast.toast-success { border-left-color: #10b981; }
.flash-toast.toast-success .toast-body i { color: #10b981; }
.flash-toast.toast-danger  { border-left-color: #ef4444; }
.flash-toast.toast-danger  .toast-body i { color: #ef4444; }
.flash-toast.toast-warning { border-left-color: #f59e0b; }
.flash-toast.toast-warning .toast-body i { color: #f59e0b; }
.flash-toast.toast-info    { border-left-color: #6366f1; }
.flash-toast.toast-info    .toast-body i { color: #6366f1; }

/* Keyframes */
@keyframes alertSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item:first-child .timeline-marker {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981;
}

.timeline-content {
    padding: 10px 14px;
    background: var(--body-bg);
    border-radius: var(--radius-sm);
}

/* ────── Timeline Card Tabs (操作日志按显卡分组) ────── */
/* 标签页内容面板 */
.log-tab-pane {
    transition: opacity 0.2s ease;
}

/* 全部Tab中每条日志的"第N张"彩色标签 */
.timeline-card-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tag-color, #6366f1) 15%, transparent);
    color: var(--tag-color, #6366f1);
    border: 1px solid color-mix(in srgb, var(--tag-color, #6366f1) 30%, transparent);
    margin-right: 4px;
    vertical-align: middle;
}

/* 带颜色强调的卡片日志项 */
.log-card-accent .timeline-content {
    border-left: 3px solid var(--log-accent, var(--primary));
    padding-left: 12px;
}

/* 标签页按钮组优化 */
#logTabBtns .btn {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 16px;
    transition: all 0.2s ease;
}
#logTabBtns .btn.active {
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(79,70,229,.25);
}

/* ────── 工单详情页美化 ────── */
/* 批次多卡间的虚线分隔优化 */
#opLogCard .card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* 显卡信息区域内卡卡片美化 */
.detail-row .card .card-body > .p-3.border-bottom {
    position: relative;
    transition: background 0.2s ease;
}
.detail-row .card .card-body > .p-3.border-bottom:hover {
    background: #f8fafc;
}
.detail-row .card .card-body > .p-3:not(.border-bottom) {
    background: #fdfdfd;
}

/* 审核结果区域微调 */
.inspection-box {
    background: linear-gradient(135deg, #fef9e7 0%, #fefce8 100%);
    border-radius: 8px;
    padding: 8px 12px;
}

/* ===== Stat Cards (Dashboard) ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    min-height: 88px;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

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

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card-body {
    display: flex;
    flex-direction: column;
}

.stat-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

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

/* Stat card color themes */
.stat-card-warning::before { background: #f59e0b; }
.stat-card-warning .stat-card-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.stat-card-warning .stat-card-value { color: #d97706; }

.stat-card-info::before { background: #06b6d4; }
.stat-card-info .stat-card-icon { background: rgba(6,182,212,0.12); color: #06b6d4; }
.stat-card-info .stat-card-value { color: #0891b2; }

.stat-card-primary::before { background: var(--primary); }
.stat-card-primary .stat-card-icon { background: rgba(79,70,229,0.12); color: var(--primary); }
.stat-card-primary .stat-card-value { color: var(--primary); }

.stat-card-teal::before { background: #14b8a6; }
.stat-card-teal .stat-card-icon { background: rgba(20,184,166,0.12); color: #14b8a6; }
.stat-card-teal .stat-card-value { color: #0d9488; }

.stat-card-success::before { background: #10b981; }
.stat-card-success .stat-card-icon { background: rgba(16,185,129,0.12); color: #10b981; }
.stat-card-success .stat-card-value { color: #059669; }

.stat-card-orange::before { background: #f97316; }
.stat-card-orange .stat-card-icon { background: rgba(249,115,22,0.12); color: #f97316; }
.stat-card-orange .stat-card-value { color: #ea580c; }

.stat-card-danger::before { background: #ef4444; }
.stat-card-danger .stat-card-icon { background: rgba(239,68,68,0.12); color: #ef4444; }
.stat-card-danger .stat-card-value { color: #dc2626; }

.stat-card-danger-pulse {
    animation: dangerPulse 2s ease-in-out infinite;
}
.stat-card-danger-pulse::before { background: #ef4444; }
.stat-card-danger-pulse .stat-card-icon { background: rgba(239,68,68,0.12); color: #ef4444; }
.stat-card-danger-pulse .stat-card-value { color: #dc2626; }

@keyframes dangerPulse {
    0%, 100% { box-shadow: var(--card-shadow); }
    50% { box-shadow: 0 0 0 4px rgba(239,68,68,0.12), var(--card-shadow); }
}

.stat-card-urgent::before { background: #f59e0b; }
.stat-card-urgent .stat-card-icon { background: rgba(245,158,11,0.15); color: #f59e0b; }
.stat-card-urgent .stat-card-value { color: #d97706; }

.stat-card-indigo::before { background: #6366f1; }
.stat-card-indigo .stat-card-icon { background: rgba(99,102,241,0.12); color: #6366f1; }
.stat-card-indigo .stat-card-value { color: #4f46e5; }

/* ===== Cost Stat Card Variants ===== */
.stat-card-cost-blue::before { background: #3b82f6; }
.stat-card-cost-blue .stat-card-icon { background: rgba(59,130,246,0.12); color: #3b82f6; }
.stat-card-cost-blue .stat-card-value { color: #2563eb; }

.stat-card-cost-green::before { background: #10b981; }
.stat-card-cost-green .stat-card-icon { background: rgba(16,185,129,0.12); color: #10b981; }
.stat-card-cost-green .stat-card-value { color: #059669; }

.stat-card-cost-amber::before { background: #f59e0b; }
.stat-card-cost-amber .stat-card-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.stat-card-cost-amber .stat-card-value { color: #d97706; }

.stat-card-cost-purple::before { background: #a855f7; }
.stat-card-cost-purple .stat-card-icon { background: rgba(168,85,247,0.12); color: #a855f7; }
.stat-card-cost-purple .stat-card-value { color: #9333ea; }

.stat-card-cost-rose::before { background: #f43f5e; }
.stat-card-cost-rose .stat-card-icon { background: rgba(244,63,94,0.12); color: #f43f5e; }
.stat-card-cost-rose .stat-card-value { color: #e11d48; }

/* ===== Summary Cards ===== */
.summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    transition: all 0.25s ease;
}

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

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.summary-body {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Chart Card ===== */
.chart-card .card-header {
    font-size: 0.92rem;
    font-weight: 600;
    padding: 14px 20px;
}

.chart-card .card-body {
    padding: 16px 20px;
}

/* ===== Dashboard Mobile Responsive ===== */
@media (max-width: 768px) {
    .stat-card {
        padding: 12px 14px;
        gap: 12px;
        min-height: 72px;
        flex-direction: row;
        align-items: center;
        border-radius: 12px;
    }

    .stat-card::before {
        width: 3px;
        border-radius: 3px 0 0 3px;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 1.15rem;
    }

    .stat-card-body {
        align-items: flex-start;
        justify-content: center;
        min-width: 0;
    }

    .stat-card-value {
        font-size: 1.35rem;
        font-weight: 700;
        line-height: 1.15;
    }

    .stat-card-label {
        font-size: 0.72rem;
        margin-top: 2px;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .stat-card:hover {
        transform: none;
        box-shadow: var(--card-shadow);
    }

    .summary-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .summary-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .summary-value {
        font-size: 1.05rem;
    }

    .summary-label {
        font-size: 0.68rem;
    }

    .chart-card .card-body {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 10px 12px;
        gap: 10px;
        min-height: 64px;
        border-radius: 10px;
    }

    .stat-card-icon {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .stat-card-value {
        font-size: 1.2rem;
    }

    .stat-card-label {
        font-size: 0.68rem;
    }
}

/* ===== Legacy stat card overrides (keep for compatibility) ===== */
.card[class*="bg-opacity-10"],
.card.border-warning,
.card.border-info,
.card.border-primary,
.card.border-success,
.card.border-secondary,
.card.border-danger {
    border: none !important;
    border-radius: var(--radius);
}

.card .card-body.text-center i {
    font-size: 1.6rem;
}

/* ===== Attachment Preview ===== */
.img-thumbnail {
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
/* Create form attachment preview */
#createAttachPreview .img-thumnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
#createAttachPreview .position-relative:hover .btn-danger {
    opacity: 1;
}
#createAttachPreview .btn-danger {
    opacity: 0.8;
    transition: opacity 0.15s;
}

/* ===== Pagination ===== */
.pagination .page-link {
    border-radius: var(--radius-sm);
    margin: 0 2px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ===== Form Group Vertical Buttons ===== */
.btn-group-vertical .btn {
    text-align: left;
    border-radius: var(--radius-sm) !important;
}

/* ===== Status Tabs ===== */
.btn-group .btn-sm {
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: var(--radius-pill) !important;
}

.btn-group .btn-sm + .btn-sm {
    margin-left: 4px;
}

.btn-group .badge {
    background: rgba(255,255,255,0.2);
    margin-left: 4px;
}

/* ===== Page Headings ===== */
h4 {
    font-weight: 700;
    color: var(--text-primary);
}

h4 i {
    color: var(--primary);
    margin-right: 6px;
}

/* ===== Modal ===== */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.modal-title i {
    color: var(--primary);
    margin-right: 8px;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 24px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar-overlay {
        z-index: 1070;
    }
    .sidebar {
        z-index: 1075;
        transform: translateX(-100%);
        width: 280px;
        /* 默认无过渡，防止页面刷新时侧边栏闪烁（FOUC）。
           JS toggleSidebar() 会临时添加 transition 实现平滑动画。 */
        transition: none;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* ─── 所有弹窗不超出导航栏 ─── */
    .modal-backdrop {
        z-index: 1066;
    }
    .modal {
        --bs-modal-margin: 0.5rem;
        z-index: 1067;
    }
    .modal-dialog {
        max-height: calc(100vh - var(--topbar-height) - env(safe-area-inset-top, 0px));
    }
    /* 通知下拉/搜索下拉也限制在导航下方 */
    .notification-dropdown,
    .model-dropdown {
        top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 4px) !important;
        max-height: calc(100vh - var(--topbar-height) - env(safe-area-inset-top, 0px) - 8px);
    }

    .main-wrapper {
        margin-left: 0;
        max-width: 100vw;
        overflow-x: hidden;
        padding-top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px)) !important;
    }

    .topbar-toggle {
        display: block;
        flex-shrink: 0;
        font-size: 1.5rem;
        padding: 6px 10px;
        margin-right: 0;
    }

    /* 固定顶部导航栏（移动端始终可见） */
    .topbar {
        position: fixed;
        top: env(safe-area-inset-top, 0px);
        left: 0;
        right: 0;
        z-index: 1065;
        padding: 0 12px 0 8px;
        border-bottom: 1px solid var(--border-color);
        gap: 0;
    }

    /* 填充灵动岛/状态栏上方空白区域 */
    .topbar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: env(safe-area-inset-top, 0px);
        background: var(--card-bg);
        z-index: 99;
    }

    /* 标题绝对居中（不受左右元素宽度影响） */
    .topbar-title {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1rem;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        max-width: calc(100vw - 120px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 移动端顶部空间有限，隐藏角色标签和用户名 */
    .topbar-role-badge,
    .topbar-user-name {
        display: none;
    }

    /* 通知铃铛保持可见 */
    .topbar-notification-bell {
        margin-right: 2px !important;
        font-size: 1.2rem;
    }

    /* Search filter area */
    .filter-card .row > [class*="col-md"] {
        margin-bottom: 8px;
    }

    /* Hide desktop date inputs on mobile (use toggle ones) */
    .filter-card .d-md-block {
        display: none !important;
    }

    /* Status tabs — horizontal scroll */
    .status-tabs-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }
    .status-tabs-scroll::-webkit-scrollbar {
        display: none;
    }
    .status-tabs-scroll .btn-group {
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    /* Table — card layout on mobile (legacy) */
    .mobile-card-table thead {
        display: none;
    }
    .mobile-card-table tbody tr {
        display: block;
        background: var(--card-bg);
        border-radius: var(--radius-sm);
        box-shadow: var(--card-shadow);
        margin-bottom: 12px;
        padding: 12px 16px;
        border-left: 3px solid transparent;
    }
    .mobile-card-table tbody tr.urgent-row {
        border-left: 3px solid #ef4444;
    }
    .mobile-card-table tbody tr.overdue-row {
        border-left: 3px solid #ef4444;
        background-color: rgba(239, 68, 68, 0.04);
    }
    .mobile-card-table tbody tr:hover {
        background: var(--card-bg);
    }
    .mobile-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f8fafc;
        font-size: 0.88rem;
    }
    .mobile-card-table tbody td:last-child {
        border-bottom: none;
    }
    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.78rem;
        flex-shrink: 0;
        margin-right: 12px;
    }
    .mobile-card-table tbody td.empty-cell::before {
        display: none;
    }
    .mobile-card-table tbody tr.text-muted td::before {
        color: var(--text-muted);
    }

    /* Action buttons full width */
    .detail-actions {
        flex-direction: row;
        gap: 8px !important;
    }

    /* Legacy mobile action bar styles */
    .mobile-action-bar {
        display: flex;
    }
}

/* ===== Mobile Action Bar (hidden on desktop) ===== */
.mobile-action-bar {
    display: none;
}

/* ===== Bottom Safe Area for Mobile ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-action-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* ===== Login Page ===== */
body.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--body-bg);
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    animation: loginBgPulse 8s ease-in-out infinite;
}

@keyframes loginBgPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-left-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.login-left h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.login-left p {
    font-size: 1rem;
    opacity: 0.7;
    position: relative;
    z-index: 1;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-form-wrapper h2 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-form-wrapper .text-muted-sub {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form-wrapper .form-label {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.login-form-wrapper .btn-primary {
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

/* ===== Login OAuth Buttons ===== */
.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0 20px;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #e5e7eb);
}
.login-divider span {
    padding: 0 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.login-oauth-btns {
    display: flex;
    gap: 12px;
}

.btn-oauth {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color, #e5e7eb);
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-oauth:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
    color: var(--primary);
}
.btn-mp:hover {
    border-color: #07C160;
    background: rgba(7, 193, 96, 0.04);
    color: #07C160;
}

/* ===== Mini Program Login Modal ===== */
.mp-login-modal .modal-content {
    border-radius: var(--radius-lg);
    border: none;
}
.mp-login-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
}
.mp-login-qr-wrap img {
    width: 200px;
    height: 200px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
}
.mp-login-status {
    margin-top: 16px;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mp-login-status.waiting {
    background: #fef3c7;
    color: #92400e;
}
.mp-login-status.success {
    background: #d1fae5;
    color: #065f46;
}
.mp-login-status.expired {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-left {
        padding: 40px 24px;
        min-height: auto;
    }

    .login-left-icon {
        font-size: 3rem;
    }

    .login-left h1 {
        font-size: 1.3rem;
    }

    .login-right {
        padding: 24px;
    }
}

/* ===== Scrollbar ===== */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* ===== List Group ===== */
.list-group-item {
    border-color: var(--border-color);
    padding: 12px 20px;
}

.list-group-item-action:hover {
    background: var(--body-bg);
}

/* ===== Form Switch ===== */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ===== Delete Button (red accent) ===== */
.btn-delete-workorder {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: #ef4444;
    border-radius: 10px;
    font-size: 0.8rem;
    padding: 7px 16px;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-delete-workorder:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}

/* ===== Back Button (gray) ===== */
.btn-back-page {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 10px;
    font-size: 0.8rem;
    padding: 7px 16px;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    text-decoration: none;
}

.btn-back-page:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ===== 操作按钮文字标签（手机端紧凑 / 桌面端正常） ===== */
.btn-text-label {
    display: inline;
    font-size: 0.75rem;
}

/* 桌面端恢复正常字号 */
@media (min-width: 768px) {
    .btn-text-label {
        font-size: inherit;
    }
}

/* 手机端：操作按钮更紧凑 */
@media (max-width: 767px) {
    .detail-actions .btn,
    .detail-actions .btn-back-page,
    .detail-actions .btn-delete-workorder {
        font-size: 0.75rem;
        padding: 6px 10px;
        white-space: nowrap;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    .detail-actions .btn i,
    .detail-actions .btn-back-page i,
    .detail-actions .btn-delete-workorder i {
        font-size: 0.85rem;
    }
}

/* ===== Model Search Dropdown (fixed定位: 脱离父容器层级) ===== */
.model-dropdown {
    display: none;
    position: fixed;
    z-index: 1060;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 260px;
    overflow-y: auto;
    width: 0; /* JS 动态设置 */
}

.model-dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    min-width: 0;
}
.model-dropdown-item .md-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.model-dropdown-item:last-child {
    border-bottom: none;
}

.model-dropdown-item:hover {
    background: #f0f0ff;
    color: var(--primary);
}

.model-dropdown-sold {
    font-size: 0.75rem;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ===== Custom Select Dropdown (通用自定义下拉, 替代原生 <select>) ===== */
.cs-wrapper {
    position: relative;
}

.cs-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px 12px;
    padding-right: 2.25rem;
}

.cs-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.15);
}

.cs-dropdown {
    /* width/left/top 由 JS _position() 动态设置，不设固定 min-width 防止 fixed 定位时占满视口 */
}

.cs-option mark {
    background: #e0e7ff;
    color: var(--primary);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.cs-option.active {
    background: #f0f0ff;
    color: var(--primary);
    font-weight: 600;
}

.cs-option.highlight {
    background: #eef2ff;
    outline: 1px solid var(--primary);
    outline-offset: -1px;
}

/* ===== Batch GPU Card Styles ===== */
.gpu-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    transition: border-color 0.2s;
}
.gpu-card:hover {
    border-color: #cbd5e1;
}
.gpu-card-divider {
    border-top: 1px dashed #cbd5e1;
    margin: 12px -16px 0 -16px;
}

.divider-text {
    display: flex;
    align-items: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider-text::before { margin-right: 12px; }
.divider-text::after { margin-left: 12px; }

/* ===== Mobile Work Order List Cards ===== */
.mobile-workorder-list .card.urgent-row {
    border-left: 3px solid #ef4444;
}

.mobile-workorder-list .card.overdue-row {
    border-left: 3px solid #ef4444;
}

.mobile-workorder-list .card.card-voided {
    opacity: 0.55;
}

/* ===== Mobile Status Banner (Detail Page) ===== */
.mobile-status-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}

.mobile-status-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.mobile-status-text {
    display: flex;
    flex-direction: column;
}

.mobile-status-label {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.mobile-status-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-banner-pending {
    background: rgba(245,158,11,0.06);
    border-left: 3px solid #f59e0b;
}
.status-banner-pending .mobile-status-icon { background: rgba(245,158,11,0.15); color: #f59e0b; }
.status-banner-pending .mobile-status-label { color: #d97706; }

.status-banner-processing {
    background: rgba(79,70,229,0.06);
    border-left: 3px solid var(--primary);
}
.status-banner-processing .mobile-status-icon { background: rgba(79,70,229,0.15); color: var(--primary); }
.status-banner-processing .mobile-status-label { color: var(--primary); }

.status-banner-done {
    background: rgba(20,184,166,0.06);
    border-left: 3px solid #14b8a6;
}
.status-banner-done .mobile-status-icon { background: rgba(20,184,166,0.15); color: #14b8a6; }
.status-banner-done .mobile-status-label { color: #0d9488; }

.status-banner-shipped {
    background: rgba(249,115,22,0.06);
    border-left: 3px solid #f97316;
}
.status-banner-shipped .mobile-status-icon { background: rgba(249,115,22,0.15); color: #f97316; }
.status-banner-shipped .mobile-status-label { color: #ea580c; }

.status-banner-closed {
    background: rgba(16,185,129,0.06);
    border-left: 3px solid #10b981;
}
.status-banner-closed .mobile-status-icon { background: rgba(16,185,129,0.15); color: #10b981; }
.status-banner-closed .mobile-status-label { color: #059669; }

.status-banner-void {
    background: rgba(100,116,139,0.06);
    border-left: 3px solid #64748b;
}
.status-banner-void .mobile-status-icon { background: rgba(100,116,139,0.15); color: #64748b; }
.status-banner-void .mobile-status-label { color: #64748b; }

.status-banner-unreparable {
    background: rgba(239,68,68,0.06);
    border-left: 3px solid #ef4444;
}
.status-banner-unreparable .mobile-status-icon { background: rgba(239,68,68,0.15); color: #ef4444; }
.status-banner-unreparable .mobile-status-label { color: #dc2626; }

.status-banner-default {
    background: rgba(79,70,229,0.06);
    border-left: 3px solid var(--primary);
}
.status-banner-default .mobile-status-icon { background: rgba(79,70,229,0.15); color: var(--primary); }
.status-banner-default .mobile-status-label { color: var(--primary); }

/* ===== Mobile Record Card (Detail Page) ===== */
.mobile-record-card {
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary);
}

.mobile-record-card:last-child {
    margin-bottom: 0;
}

.mobile-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.mobile-record-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mobile-record-body {
    margin-bottom: 6px;
}

.mobile-record-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 3px 0;
    font-size: 0.82rem;
    gap: 8px;
}

.mobile-record-row .text-muted {
    flex-shrink: 0;
    font-size: 0.78rem;
}

.mobile-record-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
}

/* ===== Filter Date Toggle (Mobile) ===== */
.filter-date-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.filter-date-toggle:active,
.filter-date-toggle.active {
    background: rgba(79,70,229,0.08);
    color: var(--primary);
}

/* ===== Mobile Form Submit Area ===== */
.form-submit-area {
    padding-bottom: 20px;
}

@media (max-width: 768px) {
    .form-submit-area {
        position: sticky;
        bottom: 0;
        background: linear-gradient(to top, var(--body-bg) 80%, transparent);
        padding: 16px 0 8px;
        margin-bottom: 0 !important;
        z-index: 10;
    }

    .form-submit-area .btn-lg {
        width: 100%;
    }
}

/* ===== Mobile Detail Page Info Grid Enhancement ===== */
@media (max-width: 768px) {
    .info-grid .col-md-3,
    .info-grid .col-md-4,
    .info-grid .col-md-6 {
        width: 50%;
        margin-bottom: 8px;
    }

    .info-grid p {
        font-size: 0.85rem;
        margin-bottom: 0 !important;
    }

    .info-grid p:first-child {
        margin-bottom: 2px !important;
    }

    .info-grid small {
        font-size: 0.72rem;
    }

    .info-grid code {
        font-size: 0.78rem;
    }

    /* Make detail page single column */
    .detail-row > [class*="col-lg"] {
        width: 100%;
    }

    /* Timeline compact on mobile */
    .timeline {
        padding-left: 24px;
    }

    .timeline::before {
        left: 8px;
    }

    .timeline-marker {
        left: -20px;
        width: 10px;
        height: 10px;
    }

    .timeline-content {
        padding: 8px 10px;
    }

    .timeline-content strong {
        font-size: 0.82rem;
    }

    .timeline-content .small,
    .timeline-content small {
        font-size: 0.72rem;
    }

    /* Log tabs inline on mobile */
    #logTabBtns {
        width: 100%;
        margin-top: 4px;
    }
    #logTabBtns .btn {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    /* Action bar improved */
    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border-color);
        padding: 8px 10px;
        z-index: 1030;
        display: flex;
        gap: 6px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    }

    .mobile-action-bar .btn {
        flex: 1;
        font-size: 0.78rem;
        padding: 10px 6px;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }

    .mobile-action-bar .btn i {
        font-size: 0.9rem;
    }

    /* Card improvements on mobile */
    .card {
        border-radius: var(--radius-sm);
        margin-bottom: 0.6rem;
    }

    .card-header {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 12px 14px;
    }

    /* Better search bar */
    .filter-card .input-group {
        border-radius: var(--radius-sm);
        overflow: hidden;
    }

    .filter-card .form-control {
        border-radius: 0;
    }

    .filter-card .input-group-text {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    .filter-card .input-group .bi {
        color: #fff;
    }

    /* Status tabs improvement */
    .status-tabs-scroll .btn-group .btn-sm {
        padding: 6px 10px;
        font-size: 0.76rem;
    }

    /* Page header on mobile */
    .page-header-mobile {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px !important;
    }

    .page-header-mobile .btn {
        white-space: nowrap;
    }

    /* Hide desktop "当前状态" card on mobile since we have the banner */
    .detail-row .col-lg-4 .card:first-child {
        display: none;
    }

    /* Modal improvements */
    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .modal-dialog:not(.modal-dialog-centered) {
        min-height: auto;
    }

    .modal-dialog-centered {
        display: flex;
        align-items: flex-end;
    }

    .modal-dialog-centered .modal-content {
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-content {
        border-radius: var(--radius-sm);
    }

    .modal-body {
        padding: 16px;
    }

    /* Form improvements */
    .form-control,
    .form-select {
        font-size: 16px;
        padding: 10px 12px;
    }

    .form-label {
        font-size: 0.82rem;
        font-weight: 500;
        margin-bottom: 4px;
    }

    .btn {
        padding: 9px 14px;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    /* Attachment grid: 2 cols on mobile */
    .attachment-grid .col-6 {
        width: 50%;
        padding: 0 4px;
    }
}

/* ===== Attachment Preview Cards ===== */
.att-preview-card {
    border: 1px solid #e2e8f0 !important;
    overflow: hidden;
}
.att-preview-card .card-body {
    padding: 8px !important;
}
/* Mobile: ensure tappable area */
.js-att-card {
    -webkit-tap-highlight-color: rgba(79, 70, 229, 0.15);
    -webkit-touch-callout: none;
    user-select: none;
    min-height: 44px;
}
.js-att-card:active {
    background: rgba(79, 70, 229, 0.06);
}
.att-media-box {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    margin-bottom: 6px;
    pointer-events: none;  /* 让点击穿透到 .js-att-card */
}
.att-video-box {
    background: #000;
}
.att-play-icon {
    position: absolute;
    z-index: 1;
    font-size: 2.5rem;
}
.att-img-box {
    padding: 0;
}
.att-label {
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.att-view-badge {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-bg);
    border-radius: 20px;
    padding: 3px 12px;
    display: inline-block;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(79, 70, 229, 0.2);
    transition: background 0.15s, color 0.15s;
}
.att-view-badge:active {
    background: var(--primary);
    color: #fff;
}
/* Mobile: attachment card tap feedback */
@media (max-width: 767px) {
    .js-att-card:active {
        background: var(--primary-bg) !important;
    }
    .att-media-box {
        height: 80px;
    }
}

/* Mobile attachment list card (详情页底部文字列表 → 卡片) */
.mobile-att-card {
    -webkit-tap-highlight-color: rgba(79, 70, 229, 0.15);
    transition: background 0.12s ease;
}
.mobile-att-card:active {
    background: rgba(79, 70, 229, 0.06) !important;
}
.mobile-att-view-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--primary);
    background: var(--primary-bg);
    border-radius: 20px;
    padding: 3px 10px;
    font-weight: 600;
}

/* Attachment card hover (desktop only) */
@media (hover: hover) {
    .att-preview-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        transition: transform 0.15s, box-shadow 0.15s;
    }
}

    /* Create form stacked */
    .form-create .row > [class*="col-md"] {
        margin-bottom: 4px;
    }

    /* Create form: full width for some fields on mobile */
    .form-create .col-md-4 {
        width: 50%;
    }

    .form-create .col-md-8 {
        width: 100%;
    }

    /* Model dropdown for mobile — JS 动态定位,无需覆盖 */

    /* Pagination compact */
    .pagination .page-link {
        font-size: 0.8rem;
        padding: 8px 12px;
        min-width: 40px;
        text-align: center;
    }

    /* Content wrapper */
    .content-wrapper {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 8px;
    }

    .mobile-status-banner {
        padding: 10px 12px;
    }

    .mobile-status-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .mobile-status-label {
        font-size: 0.9rem;
    }

    .info-grid .col-md-3,
    .info-grid .col-md-4,
    .info-grid .col-md-6 {
        width: 100%;
    }

    .badge.fs-5 {
        font-size: 0.85rem !important;
        padding: 6px 14px;
    }

    /* Filter card more compact */
    .filter-card .card-body {
        padding: 10px;
    }

    .filter-card .form-control,
    .filter-card .form-select {
        padding: 8px 10px;
    }

    /* Status tabs even smaller */
    .status-tabs-scroll .btn-group .btn-sm {
        padding: 5px 8px;
        font-size: 0.72rem;
    }
}

/* ===== Barcode Scan Button ===== */
.scan-trigger {
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
    transition: all 0.15s;
}
.scan-trigger:hover {
    background: #4f46e5 !important;
    color: #fff !important;
}
.scan-trigger .bi {
    font-size: 1.1rem;
}

/* ===== Form Validation Feedback ===== */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: #22c55e;
    background-image: none;
    padding-right: inherit;
}
.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: #ef4444;
    background-image: none;
    padding-right: inherit;
}
.form-control.is-valid:focus {
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}
.invalid-feedback {
    font-size: 0.8rem;
}
.valid-feedback {
    font-size: 0.8rem;
    color: #22c55e;
}

/* ===== Notification Bell ===== */
.topbar-notification-bell {
    color: var(--text-secondary);
    font-size: 1.25rem;
    text-decoration: none;
    transition: color var(--transition);
    line-height: 1;
    cursor: pointer;
}
.topbar-notification-bell:hover {
    color: var(--primary);
}
.notification-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 10px;
    padding: 0 5px;
    pointer-events: none;
}

/* Notification Dropdown (fixed定位: 脱离父容器层级) */
.notification-dropdown {
    display: none;
    position: fixed;
    margin-top: 8px;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 1070;
    overflow: hidden;
}
.notification-dropdown.show {
    display: block;
    animation: notifSlideIn 0.15s ease;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.notification-dropdown-header .btn-close {
    font-size: 0.7rem;
}
.notification-dropdown-body {
    max-height: 360px;
    overflow-y: auto;
}
.notification-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.notification-view-all {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color var(--transition);
}
.notification-view-all:hover {
    color: var(--primary-dark);
}
.notif-drop-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
}
.notif-drop-item:last-child {
    border-bottom: none;
}
.notif-drop-item:hover {
    background: #f8fafc;
}
.notif-drop-item.unread {
    background: #eff6ff;
}
.notif-drop-item.unread:hover {
    background: #dbeafe;
}
.notif-drop-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}
.notif-drop-content {
    flex: 1;
    min-width: 0;
}
.notif-drop-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-drop-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.notif-drop-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
/* Notification center */
.notification-item {
    transition: background 0.15s;
}
.notification-item:hover {
    background: #f8fafc;
}
.notification-item.unread {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}
.notification-item.unread:hover {
    background: #dbeafe;
}
/* ===== Chart Responsive Container ===== */
.chart-responsive {
    position: relative;
    width: 100%;
    height: 280px;
}

@media (max-width: 768px) {
    .chart-responsive {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .chart-responsive {
        height: 180px;
    }
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 6px;
}

/* ===== Dashboard Chart Mobile Optimization ===== */
@media (max-width: 768px) {
    .chart-card .card-body {
        padding: 12px 8px;
    }
    .chart-card canvas {
        max-height: 240px !important;
    }
    /* Table scroll hint on mobile */
    .table-responsive::after {
        content: '← 左右滑动查看完整表格 →';
        display: block;
        text-align: center;
        padding: 6px 8px 2px;
        color: var(--text-muted);
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .stat-card .row.g-2 {
        gap: 6px !important;
    }
    .stat-card .col-6 {
        padding-left: 3px;
        padding-right: 3px;
    }
    /* Chart cards full width */
    .chart-card {
        margin-left: -8px;
        margin-right: -8px;
        border-radius: 0;
    }
    /* Notification dropdown — 手机端居中显示，覆盖 JS 的 right 定位 */
    .notification-dropdown {
        left: 4px !important;
        right: 4px !important;
        width: auto !important;
        max-width: none !important;
    }
    /* Dashboard chart canvas smaller */
    .chart-card canvas {
        max-height: 200px !important;
    }
}

/* ===== Table Responsive Enhancement ===== */
.table-responsive {
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 500px;
}

/* ===== Better Touch Targets (Mobile) ===== */
@media (max-width: 768px) {
    /* Sidebar nav links larger touch target */
    .sidebar-nav .nav-link {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    .sidebar-nav .nav-link i {
        font-size: 1.1rem;
        width: 22px;
    }
    /* Table action buttons larger */
    .table-responsive .btn-sm {
        padding: 6px 10px;
        font-size: 0.82rem;
        min-height: 32px;
    }
    /* Form check input larger */
    .form-check-input {
        width: 18px;
        height: 18px;
    }
    /* Pagination larger touch targets */
    .pagination .page-link {
        min-width: 40px;
        min-height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    /* Alert dismiss button larger */
    .alert .btn-close {
        padding: 12px;
    }
}

/* ===== Modal Bottom Sheet on Mobile ===== */
@media (max-width: 768px) {
    .modal-dialog-centered {
        align-items: flex-end !important;
        min-height: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .modal-dialog-centered .modal-content {
        border-radius: 16px 16px 0 0 !important;
        max-height: 92vh;
        overflow-y: auto;
    }
    .modal-header {
        padding: 14px 16px;
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 1;
    }
    .modal-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        z-index: 1;
    }
}

/* ===== Dashboard Weekly Report Table Mobile ===== */
@media (max-width: 768px) {
    .table-responsive .badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}

/* ===== GPU Model Management Search Mobile ===== */
@media (max-width: 768px) {
    .model-search-box {
        margin-bottom: 12px;
    }
    .model-search-box .input-group {
        flex-wrap: nowrap;
    }
}

/* ===== Repair Cost Table Mobile ===== */
@media (max-width: 768px) {
    #costTable th,
    #costTable td {
        padding: 8px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }
}

/* ===== Print Optimization ===== */
@media print {
    .sidebar, .topbar, .mobile-action-bar, .btn, .pagination,
    .filter-card, .status-tabs-scroll, .page-header-mobile .btn {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .content-wrapper {
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}

/* ===== Mobile Sticky Bottom Bar ===== */
@media (max-width: 768px) {
    .mobile-submit-bar,
    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #e2e8f0;
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 1030;
        display: flex;
        gap: 8px;
        box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
    }
    .mobile-submit-bar .btn,
    .mobile-action-bar .btn {
        flex: 1;
        padding-top: 10px;
        padding-bottom: 10px;
        font-size: 0.92rem;
        font-weight: 600;
        border-radius: 10px;
        min-height: 44px;
    }
    /* Padding bottom on detail page to avoid content hidden behind sticky bar */
    .detail-row {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }
    /* Padding bottom on form to avoid content hidden behind sticky bar */
    .form-with-mobile-bar {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ===== Mobile Form Card Spacing ===== */
@media (max-width: 768px) {
    .form-create .card {
        border-radius: 12px;
        margin-left: -4px;
        margin-right: -4px;
    }
    .form-create .card-header {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    .form-create .card-body {
        padding: 16px 14px;
    }
    .form-create .form-label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }
    .form-create .form-control,
    .form-create .form-select {
        font-size: 0.95rem;
        padding: 8px 12px;
    }
    /* Stack columns fully on mobile */
    .form-create .col-12 {
        padding-left: 4px;
        padding-right: 4px;
    }
}

/* ===== Mobile Page Header ===== */
@media (max-width: 768px) {
    .page-header-mobile {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    .page-header-mobile .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Mobile Status Tabs ===== */
@media (max-width: 768px) {
    .status-tabs-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        padding-bottom: 4px;
    }
    .status-tabs-scroll .btn-sm {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ===== Mobile Table Improvements ===== */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.82rem;
    }
    .table-responsive .btn-sm {
        padding: 4px 8px;
        font-size: 0.78rem;
    }
    /* mobile-card-table 在 table-responsive 内取消 min-width */
    .table-responsive .mobile-card-table {
        min-width: 0 !important;
    }
}

/* ===== Stat Grid: CSS Grid for dashboard stat cards ===== */
.stat-grid,
.stat-grid-cost {
    display: grid !important;
    gap: 8px;
}
@media (min-width: 768px) {
    .stat-grid,
    .stat-grid-cost { gap: 16px; }
}
@media (max-width: 991px) {
    .stat-grid,
    .stat-grid-cost {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (min-width: 768px) and (max-width: 991px) {
    .stat-grid-9cards {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (min-width: 992px) {
    .stat-grid-5 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .stat-grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    .stat-grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .stat-grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .stat-grid-9cards {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .stat-grid-cost {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ===== Dashboard Mobile Optimization ===== */
@media (max-width: 768px) {
    /* 9宫格统计卡片：手机端3列，9张卡刚好3×3对齐 */
    .stat-grid-9cards {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
    /* Reduce gap between stat card rows */
    .row.g-2.g-md-3.mb-2,
    .row.g-2.g-md-3.mb-3 {
        gap: 6px !important;
    }
    /* Chart cards: full width on mobile */
    .chart-card .card-header {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    /* Export buttons: stack on mobile */
    .card:last-child .d-flex.gap-2 {
        flex-direction: column;
    }
    .card:last-child .d-flex.gap-2 .btn {
        width: 100%;
        justify-content: center;
    }
    /* Pending reminder card */
    .card[style*="background:#fff7ed"] .card-body {
        padding: 8px 12px !important;
    }
}

@media (max-width: 480px) {
    /* Hide chart legends on very small screens to save space */
    .chart-legend-custom {
        display: none;
    }
}

/* 工单列表表格单元格垂直居中 */
#workorder-table td {
    vertical-align: middle !important;
}

/* ===== 工单列表移动端优化 ===== */
@media (max-width: 768px) {
    /* 筛选折叠区动画 */
    #filterCollapse,
    #costFilterCollapse,
    #gpuFilterCollapse {
        transition: height 0.2s ease;
    }
    #filterCollapse.collapse:not(.show),
    #costFilterCollapse.collapse:not(.show),
    #gpuFilterCollapse.collapse:not(.show) {
        display: none;
    }

    /* 状态选项卡横向滚动优化 */
    div[style*="overflow-x: auto"] {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    div[style*="overflow-x: auto"]::-webkit-scrollbar {
        display: none;
    }

    /* 工单表格→卡片模式优化 */
    .mobile-card-table tr {
        border-radius: var(--radius-sm);
        box-shadow: var(--card-shadow);
        margin-bottom: 10px;
        padding: 10px 14px;
    }
    .mobile-card-table td {
        padding: 6px 0;
        font-size: 0.85rem;
    }
    .mobile-card-table td::before {
        font-size: 0.72rem;
        min-width: 64px;
        flex-shrink: 0;
    }

    /* 操作按钮全宽 */
    .mobile-card-table .btn-sm {
        padding: 6px 10px;
        font-size: 0.78rem;
        min-width: 44px;
        min-height: 34px;
    }

    /* 分页 */
    .pagination .page-link {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    /* 筛选区域在折叠面板内垂直排列，全宽（cost/gpu filter） */
    #costFilterCollapse .input-group,
    #costFilterCollapse .form-select,
    #costFilterCollapse .form-control,
    #costFilterCollapse > div > form > div,
    #costFilterCollapse .d-flex.gap-2,
    #gpuFilterCollapse .input-group,
    #gpuFilterCollapse .form-select,
    #gpuFilterCollapse .form-control,
    #gpuFilterCollapse > div > form > div,
    #gpuFilterCollapse .d-flex.gap-2 {
        width: 100% !important;
    }
}
@media (max-width: 480px) {
    .mobile-card-table tr {
        padding: 8px 10px;
    }
    .mobile-card-table td {
        font-size: 0.82rem;
    }
    .mobile-card-table td::before {
        font-size: 0.7rem;
        min-width: 56px;
    }
}

/* ===== 显卡档案手机端卡片 ===== */
.gpu-mobile-card {
    border-radius: 12px;
    overflow: hidden;
    border-left: 3px solid #4f46e5 !important;
}
.gpu-mobile-card .btn-outline-primary {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ===== 数据看板平台工单排行条形图 ===== */
.platform-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.platform-bar-row:last-child {
    border-bottom: none;
}
.platform-bar-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 56px;
    flex-shrink: 0;
}
.platform-bar-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}
.platform-bar-track {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    min-width: 40px;
}
.platform-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.platform-bar-pct {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* ===== 维修费用明细手机端卡片 ===== */
.cost-detail-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e8ecf1;
}

/* ===== 平台费用分布手机端卡片 ===== */
.platform-cost-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8ecf1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* ===== 型号费用排行手机端卡片 ===== */
.model-cost-card {
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e8ecf1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* ===== 工单列表手机端卡片 ===== */
.wom-card {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e8ecf1;
    transition: all 0.15s ease;
    position: relative;
}
/* Status accent stripe on left edge */
.wom-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #cbd5e1;
    border-radius: 12px 0 0 12px;
    z-index: 1;
}
.wom-card.status-1::before { background: #4f46e5; }  /* 待审核 - indigo */
.wom-card.status-5::before { background: #f59e0b; }  /* 待处理 - orange */
.wom-card.status-6::before { background: #06b6d4; }  /* 处理中 - cyan */
.wom-card.status-7::before { background: #8b5cf6; }  /* 处理完成 - violet */
.wom-card.status-8::before { background: #6366f1; }  /* 待发货 - indigo */
.wom-card.status-9::before { background: #14b8a6; }  /* 已返件 - teal */
.wom-card.status-10::before { background: #84cc16; } /* 结案 - lime */
.wom-card.status-12::before { background: #ef4444; } /* 无法维修 - red */
.wom-card.status-0::before { background: #94a3b8; }   /* 作废 - gray */
.wom-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08) !important;
    border-color: #cbd5e1;
}
.wom-card:active {
    transform: scale(0.985);
    transition: transform 0.1s ease;
}
.wom-card.opacity-60 {
    opacity: 0.55;
}
.wom-card .status-badge-sm {
    padding: 2px 8px;
    font-weight: 500;
}
.wom-card .form-check-input {
    border: 2px solid #cbd5e1;
    border-radius: 4px !important;
    width: 18px;
    height: 18px;
    cursor: pointer;
    touch-action: manipulation;
}
.wom-card .form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}
/* Mobile card header area */
.wom-card .wom-header {
    padding: 12px 16px 8px 16px;
}
.wom-card .wom-header .order-no {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}
/* GPU info labels in mobile cards */
.wom-card .wom-gpu-label {
    font-size: 0.6rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.wom-card .wom-gpu-value {
    font-size: 0.78rem;
    color: #334155;
}
.wom-card .wom-gpu-model {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
}
/* Card footer */
.wom-card .wom-footer {
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    padding: 8px 14px;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}
.wom-card.status-0 .wom-footer { background: #f1f5f9; }
/* Footer action buttons */
.wom-card .wom-footer .btn {
    min-height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    border-radius: 8px;
    font-size: 0.78rem;
    padding: 4px 10px;
    transition: all 0.15s ease;
}
.wom-card .wom-footer .btn:active {
    transform: scale(0.94);
}
/* Batch expand section in mobile */
.wom-card .batch-divider {
    border-top: 1px dashed #e8ecf1;
    margin: 4px 14px;
}

/* ===== 工单列表筛选卡片美化 ===== */
.filter-card .input-group-text {
    background: #f8fafc;
    border-color: #e8ecf1;
}
.filter-card .form-control,
.filter-card .form-select {
    border-color: #e8ecf1;
}
.filter-card .form-control:focus,
.filter-card .form-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.15);
}

/* ===== Page Summary Stats Bar ===== */
.summary-stats-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.summary-stat-item {
    flex: 1;
    min-width: 100px;
    background: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    cursor: default;
    border: 1px solid #f1f5f9;
}
.summary-stat-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.summary-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.summary-stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.summary-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1e293b;
}
.summary-stat-label {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
}
/* Stat color themes */
.summary-stat-total .summary-stat-icon { background: rgba(79,70,229,0.1); color: #4f46e5; }
.summary-stat-total .summary-stat-value { color: #4f46e5; }
.summary-stat-pending .summary-stat-icon { background: rgba(245,158,11,0.1); color: #f59e0b; }
.summary-stat-pending .summary-stat-value { color: #d97706; }
.summary-stat-repair .summary-stat-icon { background: rgba(6,182,212,0.1); color: #06b6d4; }
.summary-stat-repair .summary-stat-value { color: #0891b2; }
.summary-stat-done .summary-stat-icon { background: rgba(16,185,129,0.1); color: #10b981; }
.summary-stat-done .summary-stat-value { color: #059669; }
.summary-stat-closed .summary-stat-icon { background: rgba(132,204,22,0.1); color: #84cc16; }
.summary-stat-closed .summary-stat-value { color: #65a30d; }
.summary-stat-overdue .summary-stat-icon { background: rgba(239,68,68,0.1); color: #ef4444; }
.summary-stat-overdue .summary-stat-value { color: #dc2626; }

@media (max-width: 768px) {
    .summary-stats-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .summary-stat-item {
        padding: 10px 12px;
        border-radius: 10px;
        gap: 8px;
        min-width: 0;
        border: 1px solid #e8ecf1;
    }
    .summary-stat-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 0.95rem;
    }
    .summary-stat-value {
        font-size: 1.1rem;
    }
    .summary-stat-label {
        font-size: 0.68rem;
    }
    /* Filter toggle button */
    #filterToggleBtn {
        border-radius: 10px !important;
        font-size: 0.85rem;
        font-weight: 500;
        color: #475569;
        border-color: #e2e8f0;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,0.03);
        padding: 10px 16px;
        touch-action: manipulation;
    }
    #filterToggleBtn:active {
        transform: scale(0.97);
        background: #f8fafc;
    }
    /* Pagination mobile */
    .rma-pagination {
        gap: 4px;
    }
    .rma-pagination .page-link {
        min-width: 36px;
        height: 36px;
        font-size: 0.82rem;
        border-radius: 8px;
        border-color: #e2e8f0;
    }
    .rma-pagination .page-item.active .page-link {
        background: #4f46e5;
        border-color: #4f46e5;
        color: #fff;
        font-weight: 600;
    }
    .rma-pagination-info {
        font-size: 0.72rem;
        margin-top: 6px;
    }
    /* Bottom safe area for mobile list */
    #workorder-list-container .d-md-none {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    }
}
    .summary-stat-value {
        font-size: 1rem;
    }
    .summary-stat-label {
        font-size: 0.65rem;
    }
}

/* ===== Batch Expand Row (Desktop Table) ===== */
.batch-expand-row {
    background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
    border-left: 3px solid #818cf8 !important;
}
.batch-expand-row td {
    padding: 0 !important;
    border-bottom: 2px solid #e0e7ff !important;
}
.batch-expand-inner {
    padding: 8px 16px 10px;
}
.batch-expand-cards {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.batch-mini-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    min-width: 0;
}
.batch-mini-card:hover {
    border-color: #818cf8;
    box-shadow: 0 2px 6px rgba(79,70,229,0.08);
}
.batch-mini-card-current {
    border-color: #4f46e5;
    background: #f5f3ff;
}
.batch-mini-card .batch-card-index {
    font-weight: 700;
    color: #4f46e5;
    font-size: 0.7rem;
    background: rgba(79,70,229,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.batch-mini-card .batch-card-model {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.batch-mini-card .batch-card-sn {
    color: #64748b;
    font-size: 0.72rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}
.batch-expand-btn {
    cursor: pointer;
    transition: transform 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(79,70,229,0.08);
    color: #4f46e5;
    font-size: 0.7rem;
}
.batch-expand-btn.expanded {
    transform: rotate(180deg);
    background: rgba(79,70,229,0.15);
}
.batch-expand-btn:hover {
    background: rgba(79,70,229,0.15);
}

/* ===== Inline Batch Model/SN in Table Column ===== */
.batch-inline-list {
    display: flex;
    align-items: stretch;
    gap: 6px;
    flex-wrap: wrap;
}
.batch-inline-item {
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 0;
    transition: all 0.15s;
    cursor: default;
}
.batch-inline-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 1px 4px rgba(79,70,229,0.06);
}
.batch-inline-item .bii-model {
    font-weight: 600;
    color: #334155;
    font-size: 0.78rem;
    word-break: break-word;
}
.batch-inline-item .bii-sn {
    font-size: 0.68rem;
    color: #64748b;
    font-family: 'SF Mono', 'Consolas', monospace;
    word-break: break-word;
}
.batch-more-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: #4f46e5;
    text-decoration: none;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(79,70,229,0.06);
    transition: all 0.15s;
}
.batch-more-link:hover {
    background: rgba(79,70,229,0.12);
    color: #4338ca;
    text-decoration: none;
}

/* ===== Uniform action buttons (详情/复制/删除) ===== */
.wo-action-btn {
    width: 42px;
    height: 27px;
    padding: 0 !important;
    font-size: 0.7rem !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important;
    flex-shrink: 0;
}

/* ===== Mobile Batch Section ===== */
.batch-mobile-section {
    margin: 0 16px 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
    border-radius: 8px;
    border: 1px solid #e0e7ff;
}
.batch-mobile-section .batch-mobile-title {
    font-size: 0.68rem;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.batch-mobile-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.72rem;
}
.batch-mobile-mini + .batch-mobile-mini {
    border-top: 1px dashed #e0e7ff;
    margin-top: 2px;
    padding-top: 6px;
}
.batch-mobile-mini-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.batch-mobile-mini .batch-card-index {
    font-weight: 700;
    color: #4f46e5;
    font-size: 0.65rem;
    background: rgba(79,70,229,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}
.batch-mobile-mini .batch-card-model {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.batch-mobile-mini .batch-card-sn {
    color: #64748b;
    font-size: 0.68rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* ===== Batch Detail Section (for GPU Archive Modal) ===== */
.batch-detail-section {
    background: #f8fafc;
    border-top: 1px dashed #e2e8f0;
    border-bottom: 1px dashed #e2e8f0;
    padding: 10px 16px;
}
.batch-detail-section .batch-detail-title {
    font-size: 0.78rem;
    color: #475569;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.batch-detail-section .batch-detail-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
}
.batch-detail-section .batch-detail-item:last-child {
    margin-bottom: 0;
}
.batch-detail-section .batch-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.batch-detail-section .batch-detail-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4f46e5;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.batch-detail-section .batch-detail-model {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.batch-detail-section .batch-detail-sn {
    color: #64748b;
    font-size: 0.72rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    flex-shrink: 0;
}
.batch-detail-section .batch-detail-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-left: 28px;
}

/* ===== Modern Table Enhancements ===== */
.wo-table-modern thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 10px 14px;
}
.wo-table-modern tbody tr {
    transition: background 0.15s;
}
.wo-table-modern tbody tr:hover {
    background: #f8faff;
}
.wo-table-modern tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.wo-order-no {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
}
.wo-model-name {
    font-weight: 600;
    color: #334155;
    font-size: 0.82rem;
}

/* ===== GPU Archive Styles ===== */
.gpu-risk-level {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
}
.gpu-risk-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.gpu-risk-safe .gpu-risk-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }
.gpu-risk-safe { color: #059669; }
.gpu-risk-low .gpu-risk-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }
.gpu-risk-low { color: #d97706; }
.gpu-risk-medium .gpu-risk-dot { background: #f97316; box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.gpu-risk-medium { color: #ea580c; }
.gpu-risk-high .gpu-risk-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.15); animation: riskPulse 2s infinite; }
.gpu-risk-high { color: #dc2626; font-weight: 600; }

@keyframes riskPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0.06); }
}

.gpu-table-modern thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 10px 14px;
}
.gpu-table-modern tbody tr {
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.gpu-table-modern tbody tr:hover {
    background: #f8faff;
}
.gpu-table-modern tbody tr.risk-safe { border-left-color: #10b981; }
.gpu-table-modern tbody tr.risk-low { border-left-color: #f59e0b; }
.gpu-table-modern tbody tr.risk-medium { border-left-color: #f97316; }
.gpu-table-modern tbody tr.risk-high { border-left-color: #ef4444; background: rgba(254,242,242,0.3); }

.gpu-sn-code {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.82rem;
    color: #4f46e5;
    font-weight: 500;
    background: rgba(79,70,229,0.04);
    padding: 3px 8px;
    border-radius: 4px;
}

/* GPU Mobile Card Enhancement */
.gpu-mobile-card-v2 {
    transition: all 0.2s;
    overflow: hidden;
}
.gpu-mobile-card-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.gpu-mobile-card-v2.risk-safe { border-left: 3px solid #10b981; }
.gpu-mobile-card-v2.risk-low { border-left: 3px solid #f59e0b; }
.gpu-mobile-card-v2.risk-medium { border-left: 3px solid #f97316; }
.gpu-mobile-card-v2.risk-high { border-left: 3px solid #ef4444; }

/* History Modal enhancements */
.gpu-history-modal .modal-header {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-bottom: none;
}
.gpu-history-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}
.gpu-history-modal .modal-title {
    color: #fff;
}
.gpu-history-modal .modal-title i {
    color: rgba(255,255,255,0.8);
}
.history-order-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
}
.history-order-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.history-order-card .order-link {
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.9rem;
}
.history-order-card .order-link:hover {
    text-decoration: underline;
}

/* ===== WorkOrder Detail Page: Compact Fields ===== */
.detail-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 0;
}
.detail-label {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
    font-weight: 600;
}
.detail-value {
    font-size: 0.92rem;
    color: #1e293b;
    line-height: 1.35;
    font-weight: 500;
}
.detail-value code {
    font-size: 0.82rem;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
}

/* GPU Info Compact Row */
.gpu-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-start;
}
.gpu-info-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0;
}
.gpu-info-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
    font-weight: 600;
}
.gpu-info-value {
    font-size: 0.87rem;
    color: #1e293b;
    line-height: 1.3;
    font-weight: 600;
}

/* GPU Card accent (detail page) */
.gpu-card-accent {
    border-left: 3px solid var(--primary);
    background: #fafbff;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}

/* ── Mobile GPU info grid ── */
@media (max-width: 768px) {
    .gpu-info-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 12px;
    }
    .gpu-info-row .ms-auto {
        grid-column: 1 / -1;
        margin-left: 0 !important;
        display: flex;
        justify-content: flex-start;
        padding-top: 4px;
    }
    .gpu-info-cell {
        padding: 2px 0;
    }
    .gpu-info-label {
        font-size: 0.65rem;
    }
    .gpu-info-value {
        font-size: 0.82rem;
    }
}

/* Batch card header — consistent alignment */
.gpu-card-batch-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.gpu-card-batch-header .batch-order-no {
    font-size: 0.78rem;
    margin-left: auto;
    white-space: nowrap;
}

/* ===== Empty State Enhancement ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
    color: #94a3b8;
}
.empty-state h5 {
    color: #64748b;
    font-weight: 600;
}
.empty-state p {
    color: #94a3b8;
    font-size: 0.88rem;
}

/* ===== Logistics Timeline ===== */
.logistics-section {
    padding: 0;
}
.logistics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.logistics-header:hover {
    background: #f8fafc;
}
.logistics-toggle {
    transition: transform 0.2s;
    color: #94a3b8;
    font-size: 0.85rem;
}
.logistics-toggle.rotated {
    transform: rotate(180deg);
}
.logistics-timeline {
    padding: 8px 16px 16px 16px;
    border-top: 1px solid #f1f5f9;
}
.logistics-items {
    position: relative;
    padding-left: 18px;
}
.logistics-item {
    position: relative;
    padding: 0 0 14px 14px;
    border-left: 2px solid #e2e8f0;
    min-height: 44px;
}
.logistics-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}
.logistics-dot {
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #fff;
}
.logistics-dot-active {
    background: var(--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.18);
}
.logistics-item-active .logistics-item-content {
    font-weight: 500;
    color: #1e293b;
}
.logistics-time {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 2px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.logistics-context {
    font-size: 0.84rem;
    color: #475569;
    line-height: 1.5;
}
.logistics-status-tag {
    display: inline-block;
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(79,70,229,0.08);
    color: #4f46e5;
    margin-top: 3px;
}
.spin-me {
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ===== Unified Pagination ===== */
.rma-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
    align-items: center;
    justify-content: center;
}
.rma-pagination .page-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition);
    min-width: 36px;
    justify-content: center;
}
.rma-pagination .page-link:hover {
    background: rgba(79,70,229,0.06);
    color: var(--primary);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(79,70,229,0.12);
}
.rma-pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
    font-weight: 600;
    transform: none;
}
.rma-pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background: transparent;
    border-color: transparent;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}
.rma-pagination .page-item.ellipsis .page-link {
    border-color: transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: default;
    pointer-events: none;
    box-shadow: none;
    transform: none;
    min-width: 28px;
    padding: 6px 4px;
}
/* Page info text */
.rma-pagination-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
}
/* Responsive: icon only for prev/next on small screens */
@media (max-width: 576px) {
    .rma-pagination .page-link {
        padding: 5px 9px;
        font-size: 0.8rem;
        min-width: 30px;
        border-radius: 6px;
    }
    .rma-pagination .page-link .page-text { display: none; }
    .rma-pagination .page-link .page-num { display: none; }
    .rma-pagination .page-item.active .page-link .page-num { display: inline; }
    .rma-pagination .page-item.prev-next .page-link { min-width: 30px; }
    .rma-pagination-info { font-size: 0.75rem; }
}
@media (min-width: 577px) {
    .rma-pagination .page-link .page-icon-only { display: none; }
}

/* ===== UI Consistency: Component Classes ===== */
/* Extra small button */
.btn-xs {
    font-size: 0.7rem !important;
    padding: 2px 8px !important;
    line-height: 1.4;
}

/* Attachment thumbnail (grid card) */
.attachment-thumb {
    max-height: 100px;
    cursor: pointer;
    width: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* Video thumbnail */
.video-thumb {
    max-height: 100px;
    width: 100%;
    border-radius: var(--radius-sm);
    background: #000;
}

/* File icon placeholder */
.file-icon {
    height: 100px;
    border-radius: var(--radius-sm);
    background: #1e293b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Note avatar circle */
.note-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Note content box */
.note-content {
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #334155;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Log tab pane (hide/show) */
.log-tab-pane { display: none; }
.log-tab-pane.active { display: block; }

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem 0;
    font-size: 0.85rem;
}
.empty-state .empty-icon {
    font-size: 1.5rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 0.25rem;
}

/* Card footer compact */
.card-footer-compact {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid var(--border-color);
}

/* Textarea autoresize */
.textarea-auto {
    border-radius: var(--radius-sm);
    resize: none;
    font-size: 0.85rem;
}

/* Button pill small */
.btn-pill-sm {
    font-size: 0.75rem;
    border-radius: 14px;
    padding: 3px 11px;
    background: var(--body-bg);
    border-color: var(--border-color);
    color: #475569;
}

/* Mobile bottom spacer */
.mobile-bottom-spacer { height: 70px; }

/* Lightbox modal override */
.lightbox-modal .modal-content {
    background: rgba(0,0,0,0.92);
}
.lightbox-modal .modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    border: 0;
}
.lightbox-modal .modal-body {
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ===== UI Consistency: More Utility Classes ===== */
/* Small nav button (28x28) */
.btn-nav-sm {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 12px;
    z-index: 2;
}
/* Divider top border */
.divider-top { border-top: 1px solid #f1f5f9 !important; }
/* Notes scroll area */
.notes-scroll {
    max-height: 400px;
    overflow-y: auto;
}
/* Lightbox nav button circle */
.lightbox-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    z-index: 5;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background 0.2s;
}
.lightbox-nav-btn:hover { background: rgba(0,0,0,0.7); }
.lightbox-nav-btn.prev-btn { left: 12px; }
.lightbox-nav-btn.next-btn { right: 12px; }
/* Lightbox image wrap */
.lightbox-image-wrap {
    transition: transform 0.2s;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== GPU Archive Page Specific Styles ===== */
/* Filter card */
.filter-card {
    border-radius: var(--radius) !important;
    overflow: visible;
}

/* Search input (43px height) */
.search-input-flat {
    height: 43px;
    background: var(--body-bg);
    border-color: #e2e8f0;
}
.search-input-flat:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* Table archive (compact) */
.table-archive {
    font-size: 0.85rem;
}
.table-archive thead th {
    background: var(--body-bg) !important;
    font-weight: 600;
    color: #475569;
    font-size: 0.78rem;
    border-bottom: 2px solid var(--border-color);
    padding: 10px 14px;
    white-space: nowrap;
}

/* Card grid (GPU archive mobile) */
.gpu-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* Risk dot (dynamic color via style="--risk-color:{{ risk_color }}") */
.risk-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: var(--risk-color, #64748b);
}

/* Risk text (dynamic color) */
.risk-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--risk-color, #64748b);
}

/* SN code text */
.sn-code {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

/* Model text */
.model-text {
    color: #334155;
    font-size: 0.82rem;
}

/* Condition badge */
.condition-badge {
    font-size: 0.72rem;
    font-weight: 400;
}

/* Batch detail section */
.batch-detail-section {
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 8px;
    font-size: 0.85rem;
}

/* History order card */
.history-order-card {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition);
}
.history-order-card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* ===== Opacity Utilities ===== */
.opacity-7 { opacity: 0.7 !important; }

/* ==============================================
   Bottom Sheet Dropdown (移动端下拉面板)
   参考智能表格 / 飞书多维表格
   ============================================== */
.cs-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 9998;
    transition: background 0.28s ease;
    pointer-events: none;
}
.cs-backdrop--show {
    background: rgba(0,0,0,0.4);
    pointer-events: auto;
}

.cs-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 9999;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
}
.cs-sheet--show {
    pointer-events: auto;
    transform: translateY(0);
}

.cs-sheet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.cs-sheet-search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 8px 12px;
}
.cs-sheet-search-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #94a3b8;
}
.cs-sheet-search-icon svg {
    width: 100%;
    height: 100%;
}
.cs-sheet-search {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.92rem;
    color: #1e293b;
    outline: none;
    min-width: 0;
}
.cs-sheet-search::placeholder {
    color: #94a3b8;
}
.cs-sheet-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #4f46e5;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.cs-sheet-close:active {
    background: rgba(79,70,229,0.08);
}

.cs-sheet-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}
.cs-sheet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    font-size: 0.95rem;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: rgba(79,70,229,0.08);
    min-height: 48px;
}
.cs-sheet-item:active {
    background: #f1f5ff;
}
.cs-sheet-item.cs-sel {
    color: #4f46e5;
    font-weight: 600;
    background: #f5f3ff;
}
.cs-sheet-check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #4f46e5;
}
.cs-sheet-label {
    flex: 1;
    min-width: 0;
}
.cs-sheet-label mark {
    background: #fef08a;
    color: #1e293b;
    padding: 0 2px;
    border-radius: 2px;
}

/* 阻止背景滚动 */
body.cs-sheet-open {
    overflow: hidden;
}
