/* Modern CSS Variables */
:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-secondary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Colors */
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-300: #6ee7b7;
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --primary-900: #064e3b;

    --accent-400: #fbbf24;
    --accent-500: #f59e0b;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 0px;
    --header-height: 64px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-secondary);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    overflow: hidden;
}

/* ===== APP CONTAINER ===== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Back to Dashboard Button */
.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--gray-300);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-secondary);
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.back-btn svg {
    flex-shrink: 0;
}

/* Sidebar Dashboard Content */
.sidebar-dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
}

.dashboard-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-welcome h3 {
    font-family: var(--font-primary);
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.sidebar-welcome p {
    font-size: 0.8125rem;
    color: var(--gray-400);
    line-height: 1.5;
}

.sidebar-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: var(--primary-600);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.quick-action-btn svg {
    flex-shrink: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section {
    padding: 0 12px;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 8px 12px;
    margin-bottom: 4px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 2px;
}

.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: var(--gray-300);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.category-list a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.category-list a.active {
    background: var(--primary-600);
    color: white;
}

.category-list .category-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.category-list .category-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 100px;
    flex-shrink: 0;
}

.category-list a.active .category-count {
    background: rgba(255,255,255,0.25);
}

/* Sidebar Filters */
.sidebar-filters {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-filters .filter-group {
    margin-bottom: 12px;
}

.sidebar-filters label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-bottom: 6px;
    font-weight: 500;
}

.sidebar-filters select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.8125rem;
    font-family: var(--font-secondary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.sidebar-filters select:focus {
    outline: none;
    border-color: var(--primary-500);
}

.sidebar-filters select option {
    background: var(--gray-800);
    color: white;
}

.clear-filters-btn {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    color: var(--gray-300);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.clear-filters-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

.filter-count {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
}

/* Sidebar Footer / User Menu */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    background: rgba(255,255,255,0.08);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar svg {
    color: white;
}

.user-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.user-menu-icon {
    color: var(--gray-500);
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 12px;
    right: 12px;
    background: var(--gray-800);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    margin-bottom: 8px;
    display: none;
    z-index: 10;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gray-300);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 0;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-wrapper {
    margin-left: 0;
}

.sidebar.collapsed + .main-wrapper .mobile-menu-btn {
    display: flex;
}

/* ===== MAIN HEADER ===== */
.main-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.mobile-menu-btn:hover {
    background: var(--gray-100);
}

.header-title {
    flex: 1;
    min-width: 0;
}

.header-title h1 {
    font-family: var(--font-primary);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-subtitle {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.header-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.stat-box {
    text-align: center;
    padding: 8px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    min-width: 100px;
}

.stat-box.highlight {
    background: var(--primary-50);
}

.stat-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.stat-value {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-box.highlight .stat-value {
    color: var(--primary-700);
}

.mini-progress {
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    border-radius: 100px;
    margin-top: 6px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-400) 0%, var(--primary-500) 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 100px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--gray-100);
}

/* Audit Info Card */
.audit-info-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
}

.audit-info-card h3 {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-info-card h3::before {
    content: "";
    width: 4px;
    height: 20px;
    background: var(--primary-500);
    border-radius: 2px;
}

.audit-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 180px;
}

.input-group label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.input-group input {
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: var(--font-secondary);
    background: white;
    color: var(--gray-800);
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.input-group input::placeholder {
    color: var(--gray-400);
}

/* Category Section */
.category-section {
    display: none;
}

.category-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Subcategory */
.subcategory {
    background: white;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.subcategory-header {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: filter 0.2s;
}

.subcategory-header:hover {
    filter: brightness(1.05);
}

.subcategory-header h3 {
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
}

.subcategory-score {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.subcategory.collapsed .subcategory-content {
    display: none;
}

/* Criterion */
.criterion {
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
    display: grid;
    grid-template-columns: 90px 1fr 130px 220px;
    gap: 20px;
    align-items: start;
    transition: background 0.2s;
}

.criterion:last-child {
    border-bottom: none;
}

.criterion:hover {
    background: var(--gray-50);
}

.criterion.filtered {
    display: none !important;
}

.criterion-number {
    text-align: center;
}

.criterion-number > div:first-child {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--primary-700);
    background: var(--primary-50);
    padding: 8px 10px;
    border-radius: var(--radius);
    border: 2px solid var(--primary-200);
}

.criterion-level {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
    font-weight: 500;
}

.criterion-details h4 {
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-800);
    line-height: 1.4;
}

.criterion-kpi {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 10px;
    line-height: 1.5;
}

.criterion-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.criterion-meta span {
    background: var(--gray-100);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.criterion-meta .priority-high {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}

.criterion-meta .priority-medium {
    background: #fffbeb;
    color: #d97706;
    font-weight: 600;
}

.criterion-meta .priority-low {
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 600;
}

/* Score Section */
.score-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-section > label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-buttons {
    display: flex;
    gap: 6px;
}

.score-btn {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8125rem;
    font-family: var(--font-secondary);
    transition: all 0.2s ease;
}

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

.score-btn.yes { color: var(--success); }
.score-btn.yes:hover { border-color: var(--success); background: #f0fdf4; }
.score-btn.no { color: var(--danger); }
.score-btn.no:hover { border-color: var(--danger); background: #fef2f2; }

.score-btn.selected.yes {
    background: var(--success);
    color: white;
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.score-btn.selected.no {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Verification Section */
.verification-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.verification-section > label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notes-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-family: var(--font-secondary);
    resize: vertical;
    min-height: 70px;
    transition: all 0.2s ease;
    color: var(--gray-700);
}

.notes-input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.file-btn:hover {
    background: var(--primary-50);
    border-color: var(--primary-400);
    color: var(--primary-700);
}

.file-btn::before {
    content: "+";
    font-size: 1rem;
    font-weight: 300;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-list {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-top: 4px;
}

.file-item span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .remove-file {
    color: var(--danger);
    cursor: pointer;
    font-weight: 600;
    opacity: 0.7;
}

.file-item .remove-file:hover {
    opacity: 1;
}

/* ===== MAIN FOOTER ===== */
.main-footer {
    background: white;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-secondary);
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: white;
    color: var(--danger);
    border: 2px solid var(--danger);
}

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

/* ===== SIDEBAR OVERLAY (Mobile) ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: var(--gray-800);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 500;
    font-size: 0.875rem;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .criterion {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .criterion-number {
        display: flex;
        align-items: center;
        gap: 10px;
        text-align: left;
    }

    .criterion-number > div:first-child {
        display: inline-block;
    }

    .criterion-level {
        margin: 0;
    }

    .score-buttons {
        max-width: 180px;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 260px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-toggle {
        display: none;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .main-header {
        padding: 0 16px;
    }

    .header-title h1 {
        font-size: 1rem;
    }

    .header-stats {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .audit-info {
        flex-direction: column;
        gap: 12px;
    }

    .input-group {
        min-width: 100%;
    }

    .main-footer {
        padding: 12px 16px;
        gap: 8px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 0.8125rem;
    }

    .btn span {
        display: none;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
}

/* ===== VIEW TABS ===== */
.view-tabs {
    display: flex;
    gap: 4px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.view-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--gray-400);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--gray-200);
}

.view-tab.active {
    background: var(--primary-600);
    color: white;
}

.view-tab svg {
    flex-shrink: 0;
}

/* ===== DASHBOARD VIEW ===== */
.dashboard-view {
    display: none;
}

.dashboard-view.active {
    display: block;
}

.audit-view {
    display: none;
}

.audit-view.active {
    display: block;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

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

.metric-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon.sites {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: var(--primary-600);
}

.metric-icon.compliance {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
}

.metric-icon.above-threshold {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.metric-icon.recent {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #9333ea;
}

.metric-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-value {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.metric-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ===== CHART CARD ===== */
.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.chart-card h3 {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card h3::before {
    content: "";
    width: 4px;
    height: 20px;
    background: var(--primary-500);
    border-radius: 2px;
}

.chart-container {
    min-height: 350px;
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--gray-400);
    text-align: center;
    gap: 12px;
}

.chart-empty svg {
    opacity: 0.5;
}

.chart-empty p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-500);
    margin: 0;
}

.chart-empty span {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* ===== RECENT AUDITS TABLE ===== */
.recent-audits-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.recent-audits-card h3 {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-audits-card h3::before {
    content: "";
    width: 4px;
    height: 20px;
    background: var(--primary-500);
    border-radius: 2px;
}

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

.audits-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.audits-table th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.audits-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.audits-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.audits-table tr:hover td {
    background: var(--gray-50);
}

.audits-table .site-name {
    font-weight: 600;
    color: var(--gray-800);
}

.compliance-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.compliance-bar {
    width: 80px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 100px;
    overflow: hidden;
}

.compliance-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.3s ease;
}

.compliance-fill.good {
    background: linear-gradient(90deg, var(--primary-400) 0%, var(--primary-500) 100%);
}

.compliance-fill.medium {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

.compliance-fill.low {
    background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
}

.compliance-value {
    font-weight: 600;
    font-size: 0.8125rem;
    min-width: 40px;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.action-btn.edit:hover {
    background: var(--primary-50);
    color: var(--primary-600);
}

.action-btn.delete:hover {
    background: #fef2f2;
    color: var(--danger);
}

.table-empty {
    padding: 40px;
    text-align: center;
    color: var(--gray-500);
}

.table-empty p {
    font-size: 0.9375rem;
}

/* History Button */
.history-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn:hover:not(.disabled) {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

.history-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-family: var(--font-primary);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* History Modal Specific */
.history-modal .history-chart {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.history-modal .history-list h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

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

.history-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.history-table td {
    padding: 12px;
    font-size: 0.8125rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.history-table tr.latest {
    background: var(--primary-50);
}

.history-table tr:hover {
    background: var(--gray-50);
}

.history-table tr.latest:hover {
    background: var(--primary-100);
}

.compliance-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.compliance-badge.good {
    background: var(--primary-100);
    color: var(--primary-700);
}

.compliance-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.compliance-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

.latest-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: var(--primary-500);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
}

/* ===== REPLACE OR NEW MODAL ===== */
.replace-modal {
    max-width: 420px;
    text-align: center;
}

.replace-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0;
}

.replace-modal .modal-header h3 {
    color: var(--gray-800);
}

.replace-modal-message {
    padding: 16px 0 24px;
}

.replace-modal-message .warning-icon {
    color: #f59e0b;
    margin-bottom: 16px;
}

.replace-modal-message p {
    font-size: 0.9375rem;
    color: var(--gray-700);
    margin: 0 0 8px;
    line-height: 1.5;
}

.replace-modal-message .existing-details {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.replace-modal-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}

.replace-modal-actions button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-replace {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-replace:hover {
    background: var(--gray-200);
}

.btn-save-new {
    background: var(--primary-500);
    color: white;
}

.btn-save-new:hover {
    background: var(--primary-600);
}

/* ===== HIDDEN UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE DASHBOARD ===== */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .dashboard-header h2 {
        font-size: 1.25rem;
    }

    .dashboard-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-card {
        padding: 16px;
    }

    .metric-icon {
        width: 40px;
        height: 40px;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .chart-card,
    .recent-audits-card {
        padding: 16px;
    }

    .audits-table th,
    .audits-table td {
        padding: 10px 12px;
    }

    .recent-audits-table {
        overflow-x: auto;
    }

    .audits-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .view-tabs {
        padding: 8px;
    }

    .view-tab {
        padding: 8px;
        font-size: 0.75rem;
    }
}
