/* corporate_audit.css - 8 Departments Corporate Health Audit System Styles */

/* 1. Header Button Styles (Cockpit Main Header) */
.dept-audit-pill-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 14px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Prompt', 'Plus Jakarta Sans', sans-serif;
    outline: none;
    text-decoration: none;
    user-select: none;
}

.dept-audit-pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #94a3b8;
    background: #ffffff;
}

.dept-audit-pill-btn:active {
    transform: translateY(0);
}

.dept-audit-pill-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
}

.dept-audit-pill-icon .pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 2px solid #6366f1;
    animation: auditPulseRing 2s infinite;
    pointer-events: none;
}

@keyframes auditPulseRing {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}

.dept-audit-pill-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.dept-audit-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dept-audit-title .subtitle-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
}

.dept-audit-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.audit-counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.audit-counter-badge.badge-problem {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.audit-counter-badge.badge-problem.has-issues {
    animation: auditWarningGlow 2s infinite;
}

@keyframes auditWarningGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.audit-counter-badge.badge-normal {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.audit-counter-badge.badge-pending {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* Card Highlighting on Deep Link */
.audit-card-highlight {
    animation: auditCardPulse 3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative;
    z-index: 100;
}

@keyframes auditCardPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.8), 0 10px 30px rgba(0, 0, 0, 0.15);
        transform: scale(1.02);
    }
    30% {
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.4), 0 15px 40px rgba(99, 102, 241, 0.25);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        transform: scale(1);
    }
}

/* ========================================================= */
/* 2. Modal Backdrop & Dialog (Ultra-Modern Glassmorphic UX) */
/* ========================================================= */
.dept-audit-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.dept-audit-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.dept-audit-modal {
    background: #f8fafc;
    width: 100%;
    max-width: 1340px;
    height: calc(100vh - 36px);
    max-height: calc(100vh - 36px);
    margin: auto;
    border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(226, 232, 240, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    transform: translateY(16px) scale(0.98);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Prompt', 'Plus Jakarta Sans', sans-serif;
    box-sizing: border-box;
}

.dept-audit-backdrop.show .dept-audit-modal {
    transform: translateY(0) scale(1);
}

/* Modal Header - Sleek Executive Navy/Indigo Gradient */
.dept-audit-modal-header {
    background: linear-gradient(135deg, #090d16 0%, #0f172a 45%, #1e1b4b 100%);
    color: #ffffff;
    padding: 14px 26px;
    min-height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dept-audit-modal-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dept-audit-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.dept-audit-modal-title {
    font-size: 1.18rem;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

/* Live Pulse Pill & Meta Badges */
.live-status-pill {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.02em;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: livePulseDot 2s infinite;
}

@keyframes livePulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.dept-audit-modal-subtitle {
    font-size: 0.74rem;
    color: #94a3b8;
    margin: 3px 0 0 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.snapshot-id-tag {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 2px 7px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: #cbd5e1;
}

/* Button Check Latest */
.btn-check-latest {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    outline: none;
}

.btn-check-latest:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.38);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-check-latest.loading i {
    animation: auditSpin 1s linear infinite;
}

@keyframes auditSpin {
    100% { transform: rotate(360deg); }
}

.dept-audit-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    outline: none;
}

.dept-audit-close-btn:hover {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    border-color: transparent;
    transform: rotate(90deg);
}

/* ========================================================= */
/* 3. Toolbar (Filters, Search, Division Selector)          */
/* ========================================================= */
.dept-audit-toolbar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    padding: 10px 24px;
    min-height: 50px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.dept-audit-filter-pills {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.audit-filter-pill {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 5px 13px;
    font-size: 0.77rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    outline: none;
    user-select: none;
}

.audit-filter-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}

.audit-filter-pill.active {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
}

.audit-filter-pill.filter-issues.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #dc2626;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.35);
}

.audit-filter-pill.filter-normal.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
}

.audit-filter-pill.filter-pending.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #d97706;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}

.audit-filter-pill.filter-nodata.active {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    border-color: #475569;
    box-shadow: 0 3px 10px rgba(100, 116, 139, 0.35);
}

.audit-filter-pill.btn-toggle-all {
    background: #f8fafc;
    color: #4f46e5;
    border: 1px dashed #c7d2fe;
}

.audit-filter-pill.btn-toggle-all:hover {
    background: #eef2ff;
    color: #3730a3;
    border-color: #818cf8;
}

.dept-audit-search-box {
    position: relative;
    min-width: 240px;
}

.dept-audit-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

.dept-audit-search-input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    font-size: 0.78rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.dept-audit-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dept-audit-division-filter {
    min-width: 220px;
}

.dept-audit-select {
    width: 100%;
    padding: 7px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.dept-audit-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ========================================================= */
/* 4. Modal Body & Overview Stats Ribbon                     */
/* ========================================================= */
.dept-audit-modal-body {
    flex: 1 1 auto;
    overflow-y: scroll !important;
    overflow-x: hidden;
    padding: 20px 24px 30px 24px;
    min-height: 0;
    background: #f8fafc;
    box-sizing: border-box;
    outline: none;
}

/* Prominent Custom Scrollbar for Effortless Navigation */
.dept-audit-modal-body::-webkit-scrollbar {
    width: 9px;
}
.dept-audit-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.dept-audit-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}
.dept-audit-modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Stats Ribbon Grid */
.dept-audit-stats-ribbon {
    background: transparent;
    padding: 0;
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.audit-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    position: relative;
    user-select: none;
}

.audit-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.audit-stat-card.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 8px 20px rgba(0, 0, 0, 0.06);
}

.audit-stat-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.audit-stat-card:hover .audit-stat-icon-wrap {
    transform: scale(1.08);
}

.audit-stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.audit-stat-value-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.audit-stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.audit-stat-share {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
}

.audit-stat-label {
    font-size: 0.78rem;
    color: #1e293b;
    font-weight: 700;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-stat-sub {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 1px;
}

/* Stat color variants */
.stat-total .audit-stat-icon-wrap { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: #4338ca; }
.stat-issues .audit-stat-icon-wrap { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #e11d48; }
.stat-issues .audit-stat-value { color: #e11d48; }
.stat-normal .audit-stat-icon-wrap { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #059669; }
.stat-normal .audit-stat-value { color: #059669; }
.stat-pending .audit-stat-icon-wrap { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.stat-pending .audit-stat-value { color: #d97706; }
.stat-nodata .audit-stat-icon-wrap { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #475569; }
.stat-nodata .audit-stat-value { color: #475569; }

/* ========================================================= */
/* 5. Divisions & Departments Hierarchical Cards            */
/* ========================================================= */
.audit-division-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    margin-bottom: 22px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
    transition: all 0.25s ease;
}

.audit-division-section:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.audit-division-header {
    padding: 14px 22px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.audit-division-header:hover {
    background: #f8fafc;
}

.division-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.division-badge-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.division-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.division-desc {
    font-size: 0.72rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.division-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.division-summary-chip {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.division-summary-chip.chip-problem {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.division-summary-chip.chip-good {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.accordion-arrow {
    font-size: 0.85rem;
    color: #94a3b8;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.audit-division-section.collapsed .accordion-arrow {
    transform: rotate(-90deg);
}

.audit-division-section.collapsed .audit-departments-grid {
    display: none !important;
}

/* Division Color Themes */
.division-commercial .division-badge-icon {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}
.division-commercial .audit-division-header {
    border-left: 5px solid #6366f1;
}

.division-production .division-badge-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
}
.division-production .audit-division-header {
    border-left: 5px solid #0ea5e9;
}

.division-admin .division-badge-icon {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
}
.division-admin .audit-division-header {
    border-left: 5px solid #a855f7;
}

/* Department Grid inside Division */
.audit-departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 18px;
    padding: 20px;
    background: #f8fafc;
}

/* Department Card */
.audit-dept-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.22s ease;
}

.audit-dept-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.audit-dept-header {
    padding: 12px 18px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-dept-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.audit-dept-title i {
    font-size: 1.05rem;
    color: #4f46e5;
}

.audit-dept-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.audit-dept-badge.has-problem {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.audit-dept-badge.all-good {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* ========================================================= */
/* 6. Subtopics Items (24 KPI Topics)                       */
/* ========================================================= */
.audit-subtopics-list {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.audit-subtopic-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

.audit-subtopic-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.audit-subtopic-item.status-problem {
    border-left: 4px solid #ef4444;
    background: linear-gradient(to right, rgba(254, 242, 242, 0.6), #ffffff);
}

.audit-subtopic-item.status-normal {
    border-left: 4px solid #10b981;
    background: linear-gradient(to right, rgba(240, 253, 244, 0.6), #ffffff);
}

.audit-subtopic-item.status-pending {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(to right, rgba(254, 243, 199, 0.6), #ffffff);
}

.audit-subtopic-item.status-unevaluated {
    border-left: 4px solid #94a3b8;
    background: linear-gradient(to right, rgba(248, 250, 252, 0.8), #ffffff);
}

.audit-subtopic-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.audit-subtopic-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audit-subtopic-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.audit-subtopic-card-ref {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.audit-status-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.audit-status-tag.tag-problem {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #f87171;
}

.audit-status-tag.tag-normal {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #4ade80;
}

.audit-status-tag.tag-pending {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.audit-status-tag.tag-unevaluated {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* Data Readiness Badges */
.readiness-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.readiness-badge.readiness-ready {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.readiness-badge.readiness-not_available {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.readiness-badge.readiness-loading {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.readiness-badge.readiness-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.readiness-badge.readiness-stale {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Detail Box */
.audit-detail-box {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.audit-detail-box.box-problem {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.audit-detail-box.box-normal {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.audit-detail-box.box-in_progress {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.audit-detail-box.box-unevaluated {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.audit-navigate-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    outline: none;
    flex-shrink: 0;
}

.audit-navigate-btn:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* ========================================================= */
/* 7. Footer & Empty States                                  */
/* ========================================================= */
.dept-audit-modal-footer {
    padding: 12px 26px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.audit-footer-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.74rem;
    color: #64748b;
}

.audit-footer-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.audit-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

.audit-empty-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.audit-empty-state h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .dept-audit-modal {
        height: calc(100vh - 16px);
        max-height: calc(100vh - 16px);
        border-radius: 16px;
    }
    .dept-audit-stats-ribbon {
        grid-template-columns: repeat(2, 1fr);
    }
    .audit-departments-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dept-audit-backdrop {
        padding: 8px;
    }
    .dept-audit-modal {
        height: 100vh;
        max-height: 100vh;
        border-radius: 12px;
    }
    .dept-audit-modal-header {
        padding: 10px 14px;
    }
    .dept-audit-modal-body {
        padding: 14px 12px;
    }
    .dept-audit-stats-ribbon {
        grid-template-columns: 1fr;
    }
    .dept-audit-toolbar {
        padding: 8px 12px;
        flex-direction: column;
        align-items: stretch;
    }
    .dept-audit-search-box {
        width: 100%;
        min-width: 100%;
    }
    .dept-audit-modal-footer {
        padding: 8px 12px;
        flex-direction: column;
        align-items: stretch;
    }
    .audit-footer-actions {
        justify-content: flex-end;
    }
}
