:root {
    --primary: #4361ee;
    --primary-light: #8392ff;
    --secondary: #2dce89;
    --info: #11cdef;
    --warning: #fb6340;
    --danger: #f5365c;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4ecfb 100%);
    font-family: 'Segoe UI', 'Noto Sans SC', system-ui, sans-serif;
    min-height: 100vh;
    color: #344767;
    overflow-x: hidden;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.logo-text {
    font-weight: 700;
    font-size: 24px;
    color: var(--primary);
}

.app-nav {
    display: flex;
    gap: 15px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--light-gray);
    color: var(--gray);
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(94, 114, 228, 0.3);
}

.card {
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: none;
    margin-bottom: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--light-gray);
    padding: 20px 25px;
    font-weight: 600;
    font-size: 18px;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 25px;
}

.form-section {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-radius: 10px;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    transition: all 0.3s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.25);
}

.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 12px 25px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #4a5cd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(94, 114, 228, 0.4);
}

.btn-danger {
    background: var(--danger);
    border: none;
    border-radius: 10px;
    padding: 12px 25px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.batch-header {
    background: rgba(94, 114, 228, 0.05);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-gray);
    cursor: pointer;
    transition: background 0.2s;
}

.batch-header:hover {
    background: rgba(94, 114, 228, 0.1);
}

.batch-title {
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.batch-date {
    font-size: 14px;
    color: var(--gray);
    background: rgba(131, 146, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.batch-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--light-gray);
    color: var(--gray);
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tubes-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.tubes-container.expanded {
    max-height: 5000px;
    /* 足够大的值容纳大量管 */
}

.tube-row {
    padding: 15px 20px;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.tube-row:last-child {
    border-bottom: none;
}

.tube-row:hover {
    background: rgba(94, 114, 228, 0.03);
}

.tube-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tube-type {
    background: rgba(94, 114, 228, 0.1);
    color: var(--primary);
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.tube-genotype {
    font-weight: 500;
}

.tube-days {
    display: flex;
    align-items: center;
    gap: 15px;
}

.days-badge {
    background: rgba(45, 206, 137, 0.1);
    color: var(--secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.highlight-expansion {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

.highlight-hybrid {
    background-color: rgba(255, 152, 0, 0.15) !important;
}

.highlight-lifespan-2 {
    background-color: rgba(3, 169, 244, 0.15) !important;
}

.highlight-lifespan-7 {
    background-color: rgba(33, 150, 243, 0.15) !important;
}

.highlight-negative {
    background-color: rgba(156, 39, 176, 0.15) !important;
}

.highlight-stock {
    background-color: rgba(233, 30, 99, 0.15) !important;
}

.highlight-stock-overdue {
    background-color: rgba(244, 67, 54, 0.15) !important;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.history-table th {
    background: rgba(94, 114, 228, 0.05);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
}

.history-table td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover td {
    background: rgba(94, 114, 228, 0.03);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-icon {
    font-size: 60px;
    color: var(--light-gray);
    margin-bottom: 20px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(94, 114, 228, 0.2);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid var(--primary);
    margin-bottom: 15px;
    transform: translateX(120%);
    transition: transform 0.3s;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(94, 114, 228, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.toast-message {
    color: var(--gray);
    font-size: 14px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    padding-left: 40px;
    border-radius: 10px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.batch-actions-toolbar {
    display: flex;
    gap: 10px;
}

.batch-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1px solid var(--light-gray);
    cursor: pointer;
}

.batch-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.collapse-icon {
    transition: transform 0.3s;
}

.expanded .collapse-icon {
    transform: rotate(180deg);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 15px;
    }

    .app-nav {
        width: 100%;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
        gap: 15px;
    }

    .search-box {
        width: 100%;
    }
}