:root {
    --primary-color: #2563eb;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    padding: 1.5rem;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.logo img {
    width: 40px;
    height: 40px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-links li:hover,
.nav-links li.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 1rem;
    margin-right: 300px; /* Make space for activity feed */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    width: 300px;
}

.search-bar input {
    border: none;
    outline: none;
    margin-left: 0.5rem;
    width: 100%;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Dashboard Grid Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.pods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 0;
}

.pod-card {
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
}

/* Activity Feed Styles */
.activity-feed {
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: calc(100vh - 5rem);
    position: fixed;
    right: 1rem;
    top: 1rem;
    width: 280px;
    overflow-y: auto;
}

.feed-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Inventory Status Styles */
.inventory-status {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Quick Stats Styles */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0;
}

.stat-card {
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.stat-card.warning {
    border-left: 3px solid var(--warning-color);
}

.stat-card.danger {
    border-left: 3px solid var(--danger-color);
}

.stat-icon {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.5rem;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.stat-action {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.stat-action:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.stat-action.urgent {
    color: var(--danger-color);
}

.stat-action.urgent:hover {
    background: #fee2e2;
}

.issue-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 1rem;
    font-weight: 500;
}

.issue-badge.critical {
    background: #fee2e2;
    color: var(--danger-color);
}

.issue-badge.warning {
    background: #fef3c7;
    color: var(--warning-color);
}

/* Main Content Grid */
.main-content-grid {
    display: grid;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.1rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn i {
    font-size: 0.875rem;
}

/* HACCP Grid Styles */
.haccp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 0;
}

.haccp-point {
    background: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

/* Corrective Actions Styles */
.capa-list {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 0;
}

.capa-item {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

/* Right Sidebar Styles */
.right-sidebar {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Activity Feed Container */
.activity-feed-container {
    flex: 1;
}

/* Inventory and Schedule Container */
.inventory-schedule-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.right-sidebar .dashboard-tile {
    margin-bottom: 0;
}

/* Adjust inventory and schedule cards for side-by-side layout */
.inventory-cards, .schedule-items {
    max-height: 300px;
    overflow-y: auto;
}

/* Make cards more compact for side-by-side view */
.inventory-card, .schedule-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 600px;
    position: relative;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.running { background: #dcfce7; color: var(--success-color); }
.status-badge.error { background: #fee2e2; color: var(--danger-color); }
.status-badge.idle { background: #f1f5f9; color: #64748b; }
.status-badge.complete { background: #dbeafe; color: var(--primary-color); }

/* Responsive Design */
@media (max-width: 1024px) {
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
}

.activity-item {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: white;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
}

.activity-item.new {
    animation: slideIn 0.3s ease-out;
    background: #f0f9ff;
    border-color: var(--primary-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-type {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.activity-type.test_complete { background: #dcfce7; color: var(--success-color); }
.activity-type.warning { background: #fef3c7; color: var(--warning-color); }
.activity-type.error { background: #fee2e2; color: var(--danger-color); }

.activity-time {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.schedule-items {
    margin-top: 1rem;
}

.schedule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: white;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
}

.schedule-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.schedule-item-actions {
    display: flex;
    gap: 0.5rem;
}

.schedule-item-actions button {
    padding: 0.25rem;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.schedule-item-actions button:hover {
    background-color: #f1f5f9;
}

.schedule-item-time {
    font-size: 0.75rem;
    color: #64748b;
}

section {
    margin-bottom: 1rem;
}

/* Activity Item Enhancements */
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.activity-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    padding: 0.25rem;
    border-radius: 0.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

/* CAPA Enhancements */
.capa-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.priority-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
}

.priority-badge.high { background: #fee2e2; color: var(--danger-color); }
.priority-badge.medium { background: #fef3c7; color: var(--warning-color); }
.priority-badge.low { background: #f1f5f9; color: #64748b; }

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #1f2937;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: #f1f5f9;
}

/* Inventory Card Styles */
.inventory-card {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stock-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.stock-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.stock-level {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.low-stock .stock-level {
    background: var(--danger-color);
}

.eta-warning {
    color: var(--warning-color);
    font-size: 0.75rem;
}

.order-status {
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Schedule Item Styles */
.schedule-item {
    background: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.schedule-date {
    font-size: 0.75rem;
    color: #64748b;
}

.schedule-test {
    font-weight: 500;
}

/* Sidebar AI and Support */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.ai-assistant {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-assistant:hover {
    background: #e0f2fe;
    transform: translateY(-1px);
}

.ai-assistant i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.support-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    color: #64748b;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.support-button:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

/* Chat Modal Styles */
.chat-modal {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 400px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.chat-modal.active {
    display: block;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
}

/* Activity Feed Enhancements */
.detail-grid {
    display: grid;
    gap: 0.75rem;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin: 0.75rem 0;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.label {
    color: #64748b;
    font-size: 0.75rem;
    min-width: 80px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    padding: 0.25rem;
    cursor: pointer;
    text-decoration: underline;
}

.trend-chart {
    grid-column: 1 / -1;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.75rem;
}

.sparkline {
    height: 30px;
    background: white;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
}

/* Pod Card Enhancements */
.pod-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Urgent Actions */
.btn-icon.urgent {
    color: var(--danger-color);
}

.btn-icon.urgent:hover {
    background: #fee2e2;
}

.btn-icon.warning {
    color: var(--warning-color);
}

.btn-icon.warning:hover {
    background: #fef3c7;
}

/* Order Modal Styles */
.order-details {
    display: grid;
    gap: 1.5rem;
}

.current-stats {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.warning {
    color: var(--warning-color);
    font-weight: 500;
}

.order-form {
    display: grid;
    gap: 1rem;
}

.quantity-input {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    width: 100%;
}

.delivery-estimate {
    color: #64748b;
    font-size: 0.875rem;
}

/* HACCP Documentation Styles */
.haccp-doc {
    display: grid;
    gap: 1.5rem;
}

.doc-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
}

.doc-meta {
    display: flex;
    gap: 1.5rem;
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.doc-content {
    display: grid;
    gap: 1.5rem;
}

.section h4 {
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.section ul, .section ol {
    padding-left: 1.5rem;
}

.section li {
    margin-bottom: 0.5rem;
    color: #475569;
}

.doc-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* Chain of Custody Timeline */
.custody-timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    padding: 1rem 0;
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideIn 0.3s ease forwards;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 95px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item:last-child::before {
    height: 50%;
}

.time {
    font-size: 0.875rem;
    color: #64748b;
    text-align: right;
    padding-right: 1rem;
    position: relative;
}

.time::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    z-index: 1;
}

.event {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-left: 1rem;
}

.badge.verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #dcfce7;
    color: var(--success-color);
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.badge.verified::before {
    content: '✓';
    font-weight: bold;
}

/* Compliance Report Styles */
.report-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.report-filters select {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.summary-card {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
}

.chart-placeholder {
    height: 200px;
    background: white;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* Enhanced Activity Feed */
.activity-item {
    transition: all 0.3s ease;
}

.activity-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.activity-item.expanded {
    background: #f8fafc;
}

.activity-details {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Trend Chart Styles */
.trend-chart {
    margin-top: 1rem;
}

.sparkline {
    position: relative;
    height: 40px;
    background: white;
    border-radius: 0.25rem;
    overflow: hidden;
}

.sparkline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

/* Dashboard Tile Styles */
.dashboard-tile {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tile-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.tile-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* View Controls */
.view-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Visualization Modal */
.visualization-modal .modal-content {
    max-width: 90vw;
    width: 90vw;
    height: 90vh;
    overflow: hidden; /* Prevent body scroll */
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-filter select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px); /* Account for header */
}

.chart-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #1e293b;
}

.chart {
    height: 250px; /* Make charts more compact */
    background: #f8fafc;
    border-radius: 0.5rem;
}

/* Chart Styles */
.chart-container {
    height: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.color-box.pass { background: var(--success-color); }
.color-box.fail { background: var(--danger-color); }

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding-bottom: 1.5rem;
    position: relative;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.bar {
    width: 100%;
    transition: height 0.3s ease;
}

.bar.pass {
    background: var(--success-color);
    border-radius: 2px 2px 0 0;
}

.bar.fail {
    background: var(--danger-color);
    border-radius: 0 0 2px 2px;
}

.bar-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    transform: rotate(-45deg);
}

/* Donut Chart Styles */
.donut-chart {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
}

.donut {
    position: absolute;
    width: 100%;
    height: 100%;
}

.donut-segment {
    fill: #f1f5f9;
    transition: all 0.3s;
}

.donut-segment:hover {
    transform: translateX(2px) translateY(2px);
}

.donut-segment.salmonella { fill: #3b82f6; }
.donut-segment.ecoli { fill: #10b981; }
.donut-segment.listeria { fill: #f59e0b; }
.donut-segment.other { fill: #6b7280; }

/* Facility Bar Chart Styles */
.facility-bars {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    padding: 1rem 0;
}

.facility-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
}

.bar-container {
    height: 180px;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

/* CAPA Funnel Chart */
.funnel-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0;
}

.funnel-stage {
    background: #f1f5f9;
    padding: 0.75rem;
    border-radius: 0.25rem;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
}

.funnel-stage.open { background: #fee2e2; }
.funnel-stage.in-progress { background: #fef3c7; }
.funnel-stage.resolved { background: #dcfce7; }

/* Box Plot Styles */
.boxplot {
    padding: 2rem 1rem;
    position: relative;
}

.boxplot-container {
    height: 20px;
    position: relative;
    background: #f1f5f9;
    border-radius: 10px;
}

.box {
    position: absolute;
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
}

.median {
    position: absolute;
    width: 2px;
    height: 120%;
    background: white;
    top: -10%;
}

/* Line Chart Styles */
.line-chart {
    position: relative;
    height: 200px;
    padding: 1rem;
}

.chart-grid {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.grid-line {
    border-top: 1px dashed #e5e7eb;
    position: relative;
}

.lines-container {
    position: relative;
    height: 100%;
}

.line {
    position: absolute;
    inset: 0;
    clip-path: polygon(var(--points));
}

.threshold-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ef4444;
    opacity: 0.5;
}

/* Location Selector Styles */
.location-selector {
    position: relative;
    margin: 0 2rem;
}

.selected-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.selected-location:hover {
    border-color: var(--primary-color);
}

.location-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 300px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    display: none;
    z-index: 100;
}

.location-dropdown.active {
    display: block;
}

.location-search {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.location-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.location-tree {
    max-height: 400px;
    overflow-y: auto;
}

.location-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.location-item:hover {
    background: #f8fafc;
}

.location-item.active {
    background: #eff6ff;
    color: var(--primary-color);
}

.facility-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: #f8fafc;
    font-weight: 500;
}

.facility-header i:last-child {
    margin-left: auto;
    transition: transform 0.2s;
}

.facility-header.expanded i:last-child {
    transform: rotate(90deg);
}

.site-list {
    display: none;
    padding-left: 1rem;
    background: #fafafa;
}

.site-list.expanded {
    display: block;
}

/* Tests Page Styles */
.tests-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Tests Header Styles */
.tests-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Filter Dropdowns */
.date-picker-dropdown,
.status-dropdown,
.test-type-dropdown,
.location-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    min-width: 200px;
    display: none;
    z-index: 50;
}

.date-picker-dropdown.active,
.status-dropdown.active,
.test-type-dropdown.active,
.location-dropdown.active {
    display: block;
}

/* Quick Stats Bar */
.quick-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quick-stats-bar .stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quick-stats-bar label {
    font-size: 0.875rem;
    color: #64748b;
}

.quick-stats-bar .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.value.success { color: var(--success-color); }
.value.danger { color: var(--danger-color); }

/* Tests Table Styles */
.tests-table-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.tests-table {
    width: 100%;
    border-collapse: collapse;
}

.tests-table th {
    background: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 500;
    color: #64748b;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
}

.tests-table th:hover {
    background: #f1f5f9;
}

.tests-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

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

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-badge.scheduled { background: #e0f2fe; color: #0284c7; }
.status-badge.running { background: #dcfce7; color: var(--success-color); }
.status-badge.completed { background: #f0fdf4; color: #16a34a; }
.status-badge.failed { background: #fee2e2; color: var(--danger-color); }

/* Table Actions */
.row-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.375rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-page {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Side Panel */
.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.side-panel.active {
    right: 0;
}

/* Side Panel Enhancements */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.panel-overlay.active {
    opacity: 1;
}

/* COA Preview Section */
.coa-preview {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.coa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.coa-content {
    position: relative;
    height: 200px;
    overflow: hidden;
    border-radius: 0.375rem;
    background: white;
}

.coa-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 70%, white);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1rem;
}

/* Enhanced Chain of Custody Timeline */
.custody-timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    padding: 1rem 0;
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideIn 0.3s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Interactive Results Section */
.results-section {
    position: relative;
}

.result-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.result-tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.result-tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.result-content {
    display: none;
}

.result-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Side Panel Enhancements */
.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title h2 {
    font-size: 1.25rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-id {
    font-size: 0.875rem;
    color: #64748b;
    padding: 0.25rem 0.75rem;
    background: #f1f5f9;
    border-radius: 1rem;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

/* Status Banner Enhancements */
.status-banner {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.status-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
}

.status-banner.completed::before { background: var(--success-color); }
.status-banner.failed::before { background: var(--danger-color); }
.status-banner.running::before { background: var(--warning-color); }

/* Quick Actions Enhancements */
.quick-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quick-actions .btn-action {
    flex: 1;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.quick-actions .btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Info Section Enhancements */
.info-section {
    margin-bottom: 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.info-section h3 {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section h3 i {
    color: #64748b;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.info-item:hover {
    background: #f1f5f9;
}

/* Chain of Custody Enhancements */
.custody-timeline {
    position: relative;
    padding: 1rem 0;
    margin-left: 1rem;
}

.custody-timeline::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    padding: 1rem 0;
    position: relative;
    margin-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 1.5rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary-color);
    z-index: 1;
}

.timeline-item.verified::before {
    background: var(--success-color);
    border-color: var(--success-color);
}

.badge.verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #f0fdf4;
    color: var(--success-color);
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Results Section Enhancements */
.result-content.summary {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-value i {
    font-size: 1.25rem;
}

.result-value.pass i { color: var(--success-color); }
.result-value.fail i { color: var(--danger-color); }

/* Login Page Styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo-section {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-section img {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.logo-section h1 {
    font-size: 1.5rem;
    color: #1e293b;
}

.login-form, .access-code-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.form-group label {
    font-size: 0.875rem;
    color: #64748b;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.input-with-icon input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.input-with-icon input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-login, .btn-verify {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-login:hover, .btn-verify:hover {
    background: #1d4ed8;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

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

.divider span {
    padding: 0 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

.btn-access-code {
    width: 100%;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-access-code:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.code-input {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.code-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-back {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

/* Single Test Page Styles */
.single-test-container {
    min-height: 100vh;
    background: #f8fafc;
}

.single-test-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.digital-seal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-color);
    font-size: 0.875rem;
}

.single-test-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.test-result-header {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.result-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-icon {
    width: 48px;
    height: 48px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success-color);
    font-size: 1.5rem;
}

.facility-info h2 {
    font-size: 1.25rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.facility-info p {
    color: #64748b;
    font-size: 0.875rem;
}

.test-details {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.detail-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-item label {
    color: #64748b;
    font-size: 0.875rem;
}

.chain-of-custody {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.test-results-pdf {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdf-header {
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.875rem;
}

.pdf-content {
    padding: 1.5rem;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-content img {
    max-width: 100%;
    height: auto;
}

/* Print Styles */
@media print {
    .single-test-container {
        background: white;
    }

    .action-buttons,
    .chain-of-custody {
        display: none;
    }

    .test-results-pdf {
        break-inside: avoid;
    }
}

/* Share Modal Styles */
.share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.btn-share {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-share:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-share i {
    font-size: 1.5rem;
}

.qr-code {
    text-align: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.qr-code img {
    width: 200px;
    height: 200px;
    margin-bottom: 0.5rem;
} 