/*
   Premium Project Audit Scorecard - Custom CSS
   Theme: Audit Portal Modern
*/

:root {
    --primary-color: #FF6600;
    --primary-color-rgb: 255, 102, 0;
    --primary-hover: #e55a00;
    --primary-dark: #cc5200;
    --primary-tint-bg: #fff4eb;
    --primary-tint-bg-subtle: #fff8f0;
    --primary-tint-border: #ffd6b3;
    --accent-color: #FF6600;
    --sidebar-color: #0f172a;
    --sidebar-active: #1e293b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f3f3;
    --surface-color: #ffffff;
    --border-color: #e5e7eb;
    --text-color: #334155;
    --muted-color: #64748b;
    --sidebar-width: 260px;
    --lovable-card: #ffffff;
    --lovable-surface: #f9fafc;
    --lovable-outline: rgba(26, 26, 26, 0.08);
    --lovable-shadow: 0 25px 45px rgba(26, 26, 26, 0.12);
    --lovable-progress-bg: rgba(26, 26, 26, 0.1);
    --bs-primary: #FF6600;
    --bs-primary-rgb: 255, 102, 0;
    --bs-link-color: #FF6600;
    --bs-link-color-rgb: 255, 102, 0;
    --bs-link-hover-color: #e55a00;
    --bs-link-hover-color-rgb: 229, 90, 0;

    /* Primary derived (Bootstrap internally uses these) */
    --bs-primary-text-emphasis: var(--primary-dark);
    --bs-primary-bg-subtle: var(--primary-tint-bg);
    --bs-primary-border-subtle: var(--primary-tint-border);

    /* Body mapping */
    --bs-body-bg: var(--bg-color);
    --bs-body-bg-rgb: 243, 243, 243;

    --bs-body-color: var(--text-color);
    --bs-body-color-rgb: 51, 65, 85;

    /* Secondary / muted */
    --bs-secondary-color: var(--muted-color);
    --bs-secondary-color-rgb: 100, 116, 139;

    /* Border mapping */
    --bs-border-color: var(--border-color);
    --bs-border-color-translucent: rgba(0, 0, 0, 0.08);

    /* Semantic RGB (VERY IMPORTANT for opacity utilities) */
    --bs-success: var(--success-color);
    --bs-success-rgb: 34, 197, 94;

    --bs-warning: var(--warning-color);
    --bs-warning-rgb: 245, 158, 11;

    --bs-danger: var(--danger-color);
    --bs-danger-rgb: 239, 68, 68;
}

html,
body {
    height: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    font-size: 0.92rem;
    line-height: 1.45;
}

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

.guest-logo {
    max-height: 3.75rem;
    margin-bottom: 1.25rem;
}

/* Logo theme switching */
.logo-for-light {
    display: block;
}

.logo-for-dark {
    display: none;
}

html[data-theme="dark"] .logo-for-light {
    display: none;
}

html[data-theme="dark"] .logo-for-dark {
    display: block;
}

.page-content {
    padding: 1rem;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 1.7rem;
}

h2 {
    font-size: 1.3rem;
}

h3 {
    font-size: 1rem;
}

h4 {
    font-size: 0.8rem;
}

@media (max-width: 576px) {
    body {
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 1rem;
    }

    h3 {
        font-size: 0.90rem;
    }

    h4 {
        font-size: 0.85rem;
    }

    h5 {
        font-size: 0.75rem;
    }

    h6 {
        font-size: 0.86rem;
    }

    .btn {
        font-size: 0.8rem;
    }

    .card-header {
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.68rem;
    }

    .table thead th,
    .table tbody td {
        font-size: 0.8rem;
    }

    .page-content {
        padding: 0.85rem;
    }

    .table-responsive {
        border: 0;
    }

    .section-index {
        min-width: 65px;
    }
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    background-color: var(--surface-color);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

@media (min-width: 992px) {
    .governance-report-card {
        border-radius: 2.5rem;
    }
}

.governance-report-card {
    margin: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 249, 255, 1));
    border-radius: 1.75rem;
    box-shadow: var(--lovable-shadow);
    overflow: hidden;
}

.governance-report-card .card-body {
    padding: 1.25rem;
    background: var(--lovable-card);
}

.governance-card-header {
    gap: 1.5rem;
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    border-radius: 1.25rem;
    background: var(--lovable-surface);
    box-shadow: none;
}

.governance-card-title-block h3 {
    font-size: 2.1rem;
    font-weight: 700;
}

.governance-card-description {
    margin-top: 0.25rem;
    line-height: 1.4;
}

.governance-card-actions {
    justify-content: flex-end;
}

.governance-card-actions .governance-action-button {
    min-width: 150px;
}

.governance-hero-divider {
    height: 1px;
    background-color: var(--lovable-outline);
    width: 100%;
}

.governance-quick-heading .status-snapshot-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: rgba(34, 197, 94, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    box-shadow: 0 12px 30px rgba(34, 197, 94, 0.14);
}

.governance-quick-heading {
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    padding-bottom: 1rem;
}

.governance-quick-heading h5 {
    font-size: 1.1rem;
    color: #0f172a;
}

.governance-quick-heading p {
    font-size: 0.8rem;
    color: #58616f;
}

.governance-toolbar {
    gap: 0.75rem;
}

.governance-action-button {
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background-color: #ffffff;
    padding: 0.55rem 1.6rem;
    font-weight: 600;
    color: #0f172a;
    min-width: 170px;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.governance-action-button:hover,
.governance-action-button:focus {
    transform: translateY(-2px);
    border-color: rgba(var(--primary-color-rgb), 0.4);
    color: var(--primary-dark);
    box-shadow: 0 20px 45px rgba(var(--primary-color-rgb), 0.25);
}

.quick-report-heading .quick-report-chip {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 10px 24px rgba(34, 197, 94, 0.3);
}

.quick-report-chip i {
    font-size: 1.25rem;
}

.quick-report-cards {
    margin-top: 0.5rem;
}

.quick-report-cards .card {
    border: none;
}

.quick-report-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background-color: rgba(var(--primary-color-rgb), 0.14);
    color: var(--primary-dark);
}

.quick-report-icon--primary {
    background-color: rgba(var(--primary-color-rgb), 0.18);
    color: var(--primary-dark);
}

.quick-report-icon--danger {
    background-color: rgba(239, 68, 68, 0.14);
    color: #dc2626;
}

.quick-report-icon--warning {
    background-color: rgba(249, 115, 22, 0.15);
    color: #ea580c;
}

.quick-report-icon--info {
    background-color: rgba(14, 165, 233, 0.17);
    color: #0ea5e9;
}

.quick-report-card {
    border-radius: 20px;
    min-height: 200px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    border: 1px solid rgba(15, 23, 42, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Colored background tints per card variant */
.quick-report-card--primary {
    background: linear-gradient(135deg, var(--primary-tint-bg-subtle) 0%, var(--primary-tint-bg) 100%);
}

.quick-report-card--danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f1 100%);
}

.quick-report-card--warning {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f1 100%);
}

.quick-report-card--info {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf7 100%);
}

html[data-theme="dark"] .quick-report-card--primary {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.08) 0%, rgba(var(--primary-color-rgb), 0.03) 100%);
    border-color: rgba(var(--primary-color-rgb), 0.15);
}

html[data-theme="dark"] .quick-report-card--danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.03) 100%);
    border-color: rgba(239, 68, 68, 0.15);
}

html[data-theme="dark"] .quick-report-card--warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.03) 100%);
    border-color: rgba(245, 158, 11, 0.15);
}

html[data-theme="dark"] .quick-report-card--info {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
    border-color: rgba(16, 185, 129, 0.15);
}

.quick-report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .quick-report-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.quick-report-card .card-body {
    padding: 1.5rem 1.5rem 1.25rem;
}

.quick-report-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}

html[data-theme="dark"] .quick-report-value {
    color: #f8fafc;
}

.quick-report-badge {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

/* Trend badge — small pill in top-right of each card */
.quick-report-trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.quick-report-trend-badge--up {
    background-color: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}

.quick-report-trend-badge--down {
    background-color: rgba(239, 68, 68, 0.10);
    color: #dc2626;
}

.quick-report-trend-badge--neutral {
    background-color: rgba(100, 116, 139, 0.10);
    color: #64748b;
}

.quick-report-progress {
    height: 5px;
    border-radius: 999px;
    background-color: rgba(15, 23, 42, 0.08);
}

.quick-report-progress .progress-bar {
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

/* Colored progress bar variants */
.quick-report-progress-bar--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)) !important;
}

.quick-report-progress-bar--danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.quick-report-progress-bar--warning {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.quick-report-progress-bar--info {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)) !important;
}

.quick-report-window {
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.quick-report-label {
    font-size: 0.85rem;
    color: var(--muted-color);
    font-weight: 500;
}

/* Comparison text below progress bar */
.quick-report-comparison {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.35rem;
    line-height: 1;
}

.quick-report-comparison--up {
    color: #16a34a;
}

.quick-report-comparison--down {
    color: #dc2626;
}

.quick-report-comparison--neutral {
    color: #64748b;
}

.quick-report-dropdown .dropdown-toggle {
    border-radius: 999px;
    min-width: 150px;
    transition: all 0.25s ease;
}

.quick-report-dropdown .dropdown-menu {
    min-width: 180px;
}

.quick-report-dropdown .dropdown-item.active {
    background: var(--primary-color);
    color: #fff;
}

/* ── Audit Cycle Progress Stepper ── */
.audit-cycle-card {
    background-color: var(--surface-color);
}

.audit-cycle-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: 0.5rem 1rem;
}

.audit-cycle-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    min-width: 80px;
}

.audit-cycle-step__circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    border: 2.5px solid #cbd5e1;
    background: var(--surface-color);
    color: #94a3b8;
    transition: all 0.35s ease;
    position: relative;
    z-index: 1;
}

.audit-cycle-step--completed .audit-cycle-step__circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.audit-cycle-step--active .audit-cycle-step__circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    animation: cyclePulse 2s ease-in-out infinite;
}

.audit-cycle-step--count .audit-cycle-step__circle {
    background: var(--surface-color);
    border-color: #cbd5e1;
    color: var(--text-color);
}

.audit-cycle-step--count .audit-cycle-step__icon {
    display: none;
}

.audit-cycle-step--count .audit-cycle-step__count {
    display: flex !important;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.audit-cycle-step__icon {
    font-size: 1.15rem;
    line-height: 1;
}

.audit-cycle-step__count {
    font-size: 1.1rem;
    font-weight: 700;
}

.audit-cycle-step__label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
}

.audit-cycle-step--completed .audit-cycle-step__label,
.audit-cycle-step--active .audit-cycle-step__label {
    color: var(--primary-color);
    font-weight: 600;
}

.audit-cycle-step__connector {
    flex: 1;
    height: 2.5px;
    background: #cbd5e1;
    align-self: center;
    margin-top: -1rem;
    min-width: 40px;
    max-width: 100px;
    border-radius: 2px;
    transition: background 0.35s ease;
}

.audit-cycle-step__connector--completed {
    background: var(--primary-color);
}

@keyframes cyclePulse {

    0%,
    100% {
        box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
    }

    50% {
        box-shadow: 0 4px 22px rgba(79, 70, 229, 0.45);
    }
}

@media (max-width: 991.98px) {
    .audit-cycle-step__circle {
        width: 44px;
        height: 44px;
        font-size: 1rem;
        border-width: 2px;
    }

    .audit-cycle-step {
        min-width: 70px;
    }

    .audit-cycle-step__connector {
        min-width: 20px;
    }

    .audit-cycle-step__label {
        font-size: 0.75rem;
        white-space: normal;
        max-width: 80px;
    }
}

@media (max-width: 575.98px) {
    .audit-cycle-stepper {
        padding: 0.5rem 0;
        justify-content: space-between;
    }

    .audit-cycle-step {
        min-width: auto;
        flex: 0 0 auto;
    }

    .audit-cycle-step__circle {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        border-width: 2px;
    }

    .audit-cycle-step__label {
        font-size: 0.65rem;
    }

    .audit-cycle-step__connector {
        min-width: 15px;
        max-width: 50px;
        flex: 1;
        margin-top: -1.2rem;
    }
}

@media (max-width: 400px) {
    .audit-cycle-step__circle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .audit-cycle-step__label {
        font-size: 0.6rem;
        white-space: normal;
        max-width: 50px;
        line-height: 1.1;
    }

    .audit-cycle-step__connector {
        min-width: 10px;
    }
}

.status-snapshot-card {
    position: relative;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    padding: 1.25rem 1.15rem;
    /* min-height: 170px; */
    overflow: hidden;
    background-color: var(--surface-color);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.status-snapshot-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 6px;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    background: var(--snapshot-color, var(--primary-color));
}

.status-snapshot-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-snapshot-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background-color: #eef2ff;
    color: #4338ca;
}

.status-snapshot-card-icon--danger {
    background-color: rgba(239, 68, 68, 0.18);
    color: #dc2626;
}

.status-snapshot-card-icon--success {
    background-color: rgba(22, 163, 74, 0.18);
    color: #16a34a;
}

.status-snapshot-card-icon--warning {
    background-color: rgba(251, 191, 36, 0.18);
    color: #f59e0b;
}

.status-snapshot-card-icon--primary {
    background-color: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary-dark);
}

.status-snapshot-card-icon--info {
    background-color: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
}

.status-snapshot-value {
    font-size: 1.9rem;
    font-weight: 600;
}

.status-snapshot-heading {
    align-items: center;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-color);
    color: #e2e8f0;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding-top: 12px;
    transition: all 0.3s;
    z-index: 1050;
    overflow: hidden;
    overflow-x: visible;
    display: flex;
    flex-direction: column;
}

#content {
    min-width: 0;
}

.wrapper {
    width: 100%;
    overflow-x: hidden;
}

#sidebar .sidebar-brand {
    padding: 1rem 1rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--sidebar-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

#sidebar .sidebar-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

#sidebar .sidebar-brand-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
    border-radius: 10px;
}

#sidebar .brand-icon {
    width: 34px;
    height: 34px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#sidebar .brand-icon .brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#sidebar .brand-title {
    color: #ffffff;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

/* Scrollbar */
#sidebar .sidebar-body {
    scrollbar-width: none;
}

#sidebar .sidebar-body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#sidebar .sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 1rem;
}

#sidebar ul.components {
    padding: 0.75rem 0.75rem 1rem;
}

#sidebar ul p {
    color: #94a3b8;
    padding: 10px 12px 6px;
    font-size: 0.75rem;
}

#sidebar ul li a {
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 12px;
    min-height: 40px;
}

#sidebar ul li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

#sidebar ul li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

#sidebar ul li a:hover,
#sidebar ul li.active>a {
    color: #fff;
    background: var(--sidebar-active);
}

#sidebar ul li a:hover {
    background: #1a1a2e;
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.18);
}

#sidebar ul li.active>a {
    position: relative;
}

#sidebar ul li.active>a::before {
    content: none;
}

#sidebar ul li a:hover i,
#sidebar ul li a:hover span {
    color: var(--primary-color);
}

#sidebar ul li.active>a i {
    color: var(--primary-color);
}

.sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 999px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
}

.sidebar-footer .user-avatar--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-circle {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    min-width: 2.75rem;
    min-height: 2.75rem;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
}

.icon-circle--sm {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.icon-circle--lg {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    min-height: 3rem;
}

.icon-circle--xl {
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    min-height: 4rem;
    font-size: 1.5rem;
}

.stat-icon-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.super-admin-dashboard .health-summary-card {
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.super-admin-dashboard .health-summary-card .card-body {
    padding: 1.5rem;
}

.super-admin-dashboard .health-summary-title {
    font-size: 1rem;
    line-height: 1.3;
    word-break: keep-all;
    overflow-wrap: normal;
}

.super-admin-dashboard .health-summary-count {
    font-size: 2.2rem;
    line-height: 1;
}

.super-admin-dashboard .health-summary-note {
    font-size: 0.8rem;
}

.legend-swatch {
    width: 1.6rem;
    height: 0.5rem;
    opacity: 0.8;
    border-radius: 999px;
    display: inline-block;
}

#questionOffcanvas {
    width: 100%;
}

.scroll-panel {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
}

.progress-slim {
    height: 6px;
}

.signature-preview {
    max-height: 50px;
}

.signature-canvas {
    width: 100%;
    height: 200px;
    touch-action: none;
}

.column-width-sm {
    width: 110px;
}

.audit-actions-table .col-action-item {
    width: 40%;
}

.audit-actions-table .col-owner {
    width: 20%;
}

.audit-actions-table .col-due-date,
.audit-actions-table .col-priority {
    width: 15%;
}

.audit-actions-table .col-action {
    width: 10%;
}

/* Sidebar footer muted text */
#sidebar .sidebar-footer .text-muted {
    color: #94a3b8 !important;
}

/* Content */
#content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-top: 0;
    transition: all 0.3s;
}

/* App layout scrolling (sidebar stays fixed) */
body.page-transition:not(.guest-body) {
    overflow: hidden;
}

body.page-transition:not(.guest-body) #content {
    min-height: 100dvh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (max-width: 1024px) {
    body.page-transition:not(.guest-body) {
        overflow: auto;
    }

    body.page-transition:not(.guest-body) #content {
        min-height: 100%;
        height: auto;
        overflow: visible;
        overscroll-behavior: auto;
    }
}

/* Desktop Sidebar Toggle */
#sidebar.active {
    margin-left: calc(var(--sidebar-width) * -1);
}

#content.active {
    width: 100%;
    margin-left: 0;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 10px;
    box-shadow: 0 10px 18px rgba(var(--primary-color-rgb), 0.2);
}

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

.btn-outline-secondary {
    border-radius: 10px;
}

.btn-light {
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

/* Inputs */
.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb), 0.12);
}

/* Tables */
.table {
    color: var(--text-color);
}

.table thead th {
    color: var(--muted-color);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.roles-table thead th {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.roles-table tbody td {
    padding-top: 1rem;
    padding-bottom: 1rem;
    vertical-align: middle;
}

.roles-table .badge {
    line-height: 1.1;
}

/* Badges */
.badge {
    border-radius: 999px;
    font-weight: 600;
}

/* Alerts */
.alert {
    border-radius: 12px;
}

/* Settings */
.settings-tabs .nav-link {
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--muted-color);
    font-weight: 600;
    padding: 0.45rem 0.85rem;
}

.settings-tabs .nav-link.active {
    color: #0f172a;
    background: #f1f5ff;
    box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.2);
}

.settings-tabs {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.35rem;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.settings-avatar {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.4rem;
    overflow: hidden;
}

.settings-avatar--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.settings-toggle:last-child {
    border-bottom: 0;
}

.settings-toggle .form-check-label {
    cursor: pointer;
    user-select: none;
}

@media (max-width: 575px) {
    .settings-toggle {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1.25rem 0;
    }

    .settings-toggle>div:first-child {
        width: 100%;
    }

    .settings-toggle>div:last-child {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        gap: 1.5rem !important;
        /* Increase gap between Email and Push on mobile */
    }
}

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-item {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
}

.notification-item--unread {
    border-color: rgba(var(--primary-color-rgb), 0.35);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.08);
}

.notification-table table {
    border-collapse: separate;
    border-spacing: 0 0.6rem;
}

.notification-table thead th {
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notification-table tbody tr {
    background: var(--surface-color);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    border-radius: 12px;
}

.notification-table tbody tr td {
    padding: 0.85rem 0.75rem;
}

.notification-table tbody tr td:first-child {
    border-radius: 12px 0 0 12px;
}

.notification-table tbody tr td:last-child {
    border-radius: 0 12px 12px 0;
}

.notification-row--unread {
    border-left: 4px solid rgba(var(--primary-color-rgb), 0.5);
}

.sidebar-link {
    position: relative;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    line-height: 1;
    padding: 0.35rem 0.5rem;
}

body.sidebar-collapsed .sidebar-badge,
#sidebar.sidebar-mini .sidebar-badge {
    display: none;
}

html[data-theme="dark"] .notification-table tbody tr {
    background: #111827;
    box-shadow: 0 6px 14px rgba(2, 6, 23, 0.35);
}

html[data-theme="dark"] .notification-table thead th {
    color: #94a3b8;
}

html[data-theme="dark"] .notification-table tbody tr td {
    color: #e2e8f0;
}

html[data-theme="dark"] .notification-table tbody tr td.text-muted {
    color: #94a3b8 !important;
}

/* Notification page pagination */
.notification-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.notification-pagination .pagination {
    margin: 0;
    gap: 0.25rem;
}

.notification-pagination .page-link {
    border-radius: 8px !important;
    border: 1px solid var(--border-color);
    color: #1e293b;
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
    line-height: 1.5;
    min-width: 36px;
    text-align: center;
}

.notification-pagination .page-link:hover {
    background-color: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.notification-pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.3);
}

.notification-pagination .page-item.disabled .page-link {
    background-color: #f8fafc;
    border-color: var(--border-color);
    color: #94a3b8;
}

.notification-pagination-info {
    font-size: 0.82rem;
    color: var(--muted-color);
}

html[data-theme="dark"] .notification-pagination .page-link {
    background-color: #111827;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .notification-pagination .page-link:hover {
    background-color: #1f2937;
    color: var(--primary-color);
}

html[data-theme="dark"] .notification-pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

html[data-theme="dark"] .notification-pagination .page-item.disabled .page-link {
    background-color: #0f172a;
    color: #475569;
}

.theme-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    min-width: 120px;
    text-align: center;
    background: #fff;
}

.theme-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
}

.theme-swatch {
    width: 56px;
    height: 40px;
    border-radius: 8px;
    margin: 0 auto 0.4rem;
    border: 1px solid var(--border-color);
}

.theme-swatch.light {
    background: #fff;
}

.theme-swatch.dark {
    background: #9ca3af;
}

/* Guest auth pages */
.guest-wrapper {
    padding: 2rem 0;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    background: #fff;
}

.login-icon {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-icon .login-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-input {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: none;
}

.login-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb), 0.15);
}

.login-toggle {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-left: 0;
    border-radius: 0 10px 10px 0;
}

.login-submit {
    border-radius: 10px;
    padding: 0.8rem 1rem;
    box-shadow: 0 10px 18px rgba(var(--primary-color-rgb), 0.2);
}

/* Sidebar collapsed */
#sidebar.collapsed {
    width: 64px;
    overflow: visible;
}

#sidebar.collapsed .brand-text,
#sidebar.collapsed .sidebar-text,
#sidebar.collapsed ul p,
#sidebar.collapsed .sidebar-footer .text-muted,
#sidebar.collapsed .sidebar-footer .fw-semibold,
#sidebar.collapsed .sidebar-footer form {
    display: none;
}

#sidebar.collapsed .brand-icon {
    display: flex;
    width: 32px;
    height: 32px;
}

#sidebar.collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
    padding: 0.85rem 0;
    flex-direction: row;
    align-items: center;
}

#sidebar.collapsed .sidebar-mini-toggle {
    display: none;
}

#sidebar.collapsed .sidebar-brand-link {
    width: 100%;
    justify-content: center;
}

#sidebar.collapsed ul.components {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

#sidebar.collapsed ul li a {
    justify-content: center;
    padding: 0.45rem 0;
    min-height: 38px;
}

#sidebar .sidebar-link {
    position: relative;
}

/* Collapsed module tooltip */
#sidebar.collapsed .sidebar-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    color: #0f172a;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.2);
    border: 1px solid var(--border-color);
    z-index: 1200;
}

#sidebar.collapsed .sidebar-link:hover::after {
    opacity: 1;
}

#sidebar.collapsed .sidebar-link::before {
    content: '';
    position: absolute;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent #ffffff transparent transparent;
    opacity: 0;
}

#sidebar.collapsed .sidebar-link:hover::before {
    opacity: 1;
}

#sidebar.collapsed .sidebar-chevron {
    display: none;
}

#sidebar.collapsed .sidebar-link--group {
    justify-content: center;
}

#sidebar.collapsed .sidebar-link--group span {
    width: 100%;
    justify-content: center;
}

#sidebar .sidebar-link--group span {
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar.collapsed #mastersSubmenu {
    display: none !important;
}

/* Collapsed user tooltip */
#sidebar.collapsed .sidebar-footer .user-avatar {
    position: relative;
}

#sidebar.collapsed .sidebar-footer .sidebar-user {
    position: relative;
}

#sidebar.collapsed .sidebar-footer .sidebar-user::after {
    content: attr(data-name) "\A" attr(data-role);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    color: #0f172a;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    white-space: pre;
    word-break: keep-all;
    overflow-wrap: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.2);
    border: 1px solid var(--border-color);
    z-index: 1200;
}

.sidebar-footer .sidebar-user .user-details {
    min-width: 0;
}

.sidebar-footer .sidebar-user .user-name,
.sidebar-footer .sidebar-user .user-role {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    word-break: keep-all;
    overflow-wrap: normal;
}

.sidebar-footer .sidebar-user .user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

#sidebar.collapsed .sidebar-footer .sidebar-user:hover::after {
    opacity: 1;
}

#sidebar.collapsed .sidebar-footer .sidebar-user::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent #ffffff transparent transparent;
    opacity: 0;
}

#sidebar.collapsed .sidebar-footer .sidebar-user:hover::before {
    opacity: 1;
}

#sidebar.collapsed .sidebar-footer .user-avatar {
    border-radius: 999px;
}

#content.collapsed {
    width: calc(100% - 64px);
    margin-left: 64px;
}

/* Sidebar mini toggle */
.sidebar-mini-toggle {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #e2e8f0;
    background: transparent;
    box-shadow: none;
    margin-left: auto;
}

.sidebar-mini-toggle i {
    font-size: 0.95rem;
    line-height: 1;
}

.sidebar-mini-toggle:hover {
    background: transparent;
    color: #fff;
}

/* Mobile nav */
.mobile-nav,
.mobile-hamburger {
    display: none;
}

@media (max-width: 640px) {
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid var(--border-color);
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 2px;
        padding: 0.35rem 0.15rem;
        z-index: 1040;
    }

    .mobile-nav__item {
        text-decoration: none;
        color: var(--muted-color);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        font-size: 0.65rem;
        padding: 0.35rem 2px;
        min-width: 0;
        text-align: center;
    }

    .mobile-nav__item span {
        display: block;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav__item i {
        font-size: 1.1rem;
    }

    .mobile-nav__item.active {
        color: var(--primary-color);
    }

    .page-content {
        padding-bottom: 5rem !important;
    }

    .mobile-hamburger {
        position: sticky;
        top: 12px;
        margin: 12px 0 0 12px;
        z-index: 1031;
        display: inline-flex;
    }

    .sidebar-mini-toggle {
        display: none;
    }
}

body {
    overflow-x: hidden;
}

/* Responsive */
@media (max-width: 640px) {
    #sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
        width: 220px;
    }

    #sidebar.active {
        margin-left: 0;
    }

    #sidebar.collapsed {
        width: 220px;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    #content.active {
        margin-left: 0;
    }

    #content.collapsed {
        width: 100%;
        margin-left: 0;
    }
}

@media (min-width: 641px) {
    #sidebar {
        margin-left: 0 !important;
    }

    #content {
        width: calc(100% - var(--sidebar-width));
        margin-left: var(--sidebar-width);
    }

    #sidebar.collapsed {
        width: 64px;
    }

    #content.collapsed {
        width: calc(100% - 64px);
        margin-left: 64px;
    }

    #sidebar.active {
        margin-left: 0 !important;
    }

    #content.active {
        width: calc(100% - var(--sidebar-width));
        margin-left: var(--sidebar-width);
    }
}

/* Sidebar footer alignment */
.sidebar-footer {
    padding-bottom: 1rem;
}

#sidebar.collapsed .sidebar-footer {
    padding: 0.75rem 0;
    display: flex;
    justify-content: center;
}

#sidebar.collapsed .sidebar-footer .sidebar-user {
    justify-content: center;
    width: 100%;
}

/* Projects page */
.projects-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.projects-title {
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
}

.projects-subtitle {
    color: var(--muted-color);
    margin: 0;
    font-size: 0.95rem;
}

.projects-add {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.status-tabs {
    display: inline-flex;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 0.35rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    width: fit-content;
    max-width: 100%;
    flex-wrap: wrap;
}

.status-tab {
    border: 0;
    background: transparent;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted-color);
    border-radius: 999px;
    transition: all 0.2s ease;
}

.status-tab.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 6px 12px rgba(var(--primary-color-rgb), 0.25);
}

.status-tab.active[data-status="green"] {
    background: var(--success-color);
    box-shadow: 0 6px 12px rgba(34, 197, 94, 0.25);
}

.status-tab.active[data-status="yellow"] {
    background: var(--warning-color);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.25);
}

.status-tab.active[data-status="red"] {
    background: var(--danger-color);
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.25);
}

.status-tab:not(.active):hover {
    background: #f1f5ff;
    color: #1e293b;
}

.projects-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-field i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-color);
}

.search-field .form-control {
    padding-left: 2.25rem;
    height: 40px;
}

.toolbar-actions {
    display: inline-flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-icon.view-toggle.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 8px 16px rgba(var(--primary-color-rgb), 0.25);
}

.filter-panel {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.filter-panel.is-visible {
    display: flex;
}

.filter-select {
    min-width: 220px;
}

.btn-clear {
    color: var(--muted-color);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.projects-count {
    color: var(--muted-color);
    font-size: 0.9rem;
}

.project-card-shell {
    border-radius: 18px;
}

.projects-table thead th {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--muted-color);
    border-bottom: 2px solid var(--border-color);
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.projects-table tbody tr {
    border-top: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

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

.projects-table td {
    vertical-align: middle !important;
}

/* Project Info Cell */
.project-info-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.project-crm-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.project-name-header {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.project-link {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-link:hover {
    color: var(--primary-color);
}

.project-client-sub {
    font-size: 0.8rem;
    color: var(--muted-color);
}

/* Team Avatar Stack */
.avatar-stack {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.avatar-stack .avatar-item:first-child {
    margin-left: 0;
}

.avatar-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-left: -8px;
    flex-shrink: 0;
    user-select: none;
}

.avatar-item--sm {
    width: 28px;
    height: 28px;
    font-size: 0.62rem;
    border-width: 2px;
    margin-left: 0;
    flex-shrink: 0;
}

.avatar-item--count {
    background-color: var(--bs-secondary-bg, #e2e8f0);
    color: var(--bs-secondary-color, #475569);
    font-size: 0.62rem;
    font-weight: 600;
}

/* Team popover — container */
.team-popover.popover {
    max-width: 340px;
    width: 340px;
    border-radius: 0.85rem;
    overflow: hidden;
    border: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.08));
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.12);
}

.team-popover .popover-arrow::before,
.team-popover .popover-arrow::after {
    border-color: transparent;
}

.team-popover .popover-body {
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Team popover content */
.team-pop {
    width: 100%;
}

.team-pop__header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem 0.65rem;
    background: linear-gradient(135deg, #f8faff 0%, #f1f5fb 100%);
    border-bottom: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.06));
}

.team-pop__title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-color);
}

.team-pop__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.team-pop__role-group {
    border: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.08));
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    background: var(--surface-color, #fff);
}

.team-pop__role {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    margin-bottom: 0.45rem;
}

.team-pop__member {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
    min-width: 0;
}

.team-pop__member:first-of-type {
    padding-top: 0;
}

.team-pop__member:last-child {
    padding-bottom: 0;
}

.team-pop__member-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.team-pop__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.team-pop__name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-color, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-pop__email {
    font-size: 0.7rem;
    color: var(--muted-color);
    line-height: 1.3;
    text-decoration: none;
    word-break: break-all;
    transition: color 0.15s ease;
}

.table-col-team {
    min-width: 100px;
    text-align: center;
    vertical-align: middle;
}

.projects-table th.table-col-team,
.projects-table td.table-col-team {
    text-align: center;
    vertical-align: middle;
}

/* Team popover — mobile/tablet responsive */
@media (max-width: 767.98px) {
    .team-popover.popover {
        max-width: calc(100vw - 2rem);
        width: calc(100vw - 2rem);
    }

    .team-popover .popover-body {
        max-height: 60vh;
    }

    .team-pop__name,
    .team-pop__email {
        white-space: normal;
        word-break: break-word;
    }
}

/* Score Alignment */
.projects-table .score-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
}

.projects-table .score-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}

.table-col-audit,
.table-col-score {
    white-space: nowrap !important;
    min-width: 100px;
}

.projects-table td:first-child {
    min-width: 200px;
}

@media (max-width: 768px) {
    .projects-table td:first-child {
        min-width: 160px;
    }
}

.dataTables_wrapper {
    width: 100%;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    justify-content: center;
    padding: 0.75rem 0.75rem 1rem;
    width: 100%;
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
}

/* Pagination active state — brand primary */
.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

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

.page-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb), 0.25);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-tint-bg-subtle) !important;
    border-color: var(--primary-tint-border) !important;
    color: var(--primary-dark) !important;
}

@media (max-width: 640px) {
    .projects-table .action-group {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
}

.projects-grid__sentinel {
    height: 1px;
}

/* Actions page */
.actions-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 100vh;
}

.actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.actions-title {
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
}

.actions-subtitle {
    color: var(--muted-color);
    margin: 0;
    font-size: 0.95rem;
}

.actions-add {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.actions-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.actions-summary-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.bg-soft-neutral {
    background: #f1f5f9;
    color: #475569;
}

.bg-soft-primary {
    background: rgba(var(--primary-color-rgb), 0.12);
    color: var(--primary-color);
}

.bg-soft-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-color);
}

.bg-soft-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
}

.summary-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-label {
    font-size: 0.85rem;
    color: var(--muted-color);
}

.actions-toolbar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    flex-direction: column;
}

.actions-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.actions-filters .form-select {
    width: 100%;
    height: 40px;
}

.actions-filter-dropdown {
    width: 100%;
}

.actions-filter-toggle {
    width: 100%;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.9rem;
    border-radius: 10px;
}

.actions-filter-dropdown .dropdown-menu {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.08);
}

.actions-filter-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.actions-filter-dropdown .dropdown-item i {
    opacity: 0;
}

.actions-filter-dropdown .dropdown-item.is-active i {
    opacity: 1;
}

.actions-count {
    color: var(--muted-color);
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .actions-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .page-content {
        padding: 0.5rem;
    }

    #questionOffcanvas {
        width: 520px;
    }

    .actions-toolbar {
        flex-direction: row;
        align-items: center;
    }

    .actions-filters {
        grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto;
    }
}

@media (min-width: 992px) {
    .page-content {
        padding: 1rem;
    }

    .actions-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }
}

.action-card-shell {
    overflow: hidden;
}

.actions-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
}

.actions-table tbody tr {
    border-top: 1px solid var(--border-color);
}

.action-name {
    font-weight: 600;
    color: #0f172a;
}

.action-name--link {
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    color: #0f172a;
    cursor: pointer;
}

.action-name--link:hover {
    color: var(--primary-color);
}

.action-description {
    color: var(--muted-color);
    font-size: 0.85rem;
    margin-top: 0.2rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.action-description.is-collapsed {
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.action-description.is-expanded {
    -webkit-line-clamp: initial;
    line-clamp: initial;
    overflow: visible;
}

.action-description-toggle {
    background: none;
    border: 0;
    padding: 0;
    margin-top: 0.35rem;
    color: var(--primary-color);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.action-description-toggle.is-hidden {
    display: none;
}

.action-owner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: #1f2937;
    font-weight: 500;
}

.owner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.action-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

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

.action-badge--high {
    background: #ffedd5;
    color: #ea580c;
}

.action-badge--medium {
    background: #fef3c7;
    color: #b45309;
}

.action-badge--low {
    background: #e0f2fe;
    color: #0284c7;
}

.action-badge--overdue {
    background: #fee2e2;
    color: var(--danger-color);
}

.actions-table .action-status-select {
    min-width: 90px;
    padding-right: 1.75rem;
}

.action-status-select--modal {
    min-width: 160px;
}

.action-due {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
}

.action-due.is-overdue {
    color: var(--danger-color);
    font-weight: 600;
}

.action-due i {
    font-size: 0.9rem;
}

.action-due.is-overdue i {
    color: var(--danger-color);
}

.actions-kanban-view {
    margin-top: 0.5rem;
    flex: 1;
}

.kanban-scroll {
    overflow: visible;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
    min-height: 100%;
}

.kanban-column {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.9rem;
    min-height: 260px;
    /* max-height: calc(100vh - 60px); */
    /* overflow: hidden; */
    display: flex;
    flex-direction: column;
}

.kanban-column__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: #0f172a;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    padding: 0.4rem 0;
}

.kanban-column--open {
    border-top: 3px solid #94a3b8;
}

.kanban-column--in-progress {
    border-top: 3px solid var(--primary-color);
}

.kanban-column--done {
    border-top: 3px solid var(--success-color);
}

.kanban-column--closed {
    border-top: 3px solid #64748b;
}

.kanban-column--open .kanban-column__title {
    color: #64748b;
}

.kanban-column--in-progress .kanban-column__title {
    color: var(--primary-color);
}

.kanban-column--done .kanban-column__title {
    color: var(--success-color);
}

.kanban-column--closed .kanban-column__title {
    color: #64748b;
}

.kanban-column__title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.95rem;
}

.kanban-status-icon {
    font-size: 1rem;
}

.kanban-status-icon--open {
    color: #64748b;
}

.kanban-status-icon--in-progress {
    color: var(--primary-color);
}

.kanban-status-icon--done {
    color: var(--success-color);
}

.kanban-status-icon--closed {
    color: #64748b;
}

.kanban-count {
    background: #e2e8f0;
    color: #1e293b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot--open {
    background: #94a3b8;
}

.status-dot--in-progress {
    background: var(--primary-color);
}

.status-dot--done {
    background: var(--success-color);
}

.status-dot--closed {
    background: #64748b;
}

.kanban-column__body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 120px;
    padding-bottom: 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.kanban-column__body.is-over {
    background: rgba(var(--primary-color-rgb), 0.08);
    border-radius: 12px;
    padding: 0.6rem;
}

.action-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    cursor: grab;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    touch-action: none;
}

.action-card.is-touch-dragging {
    cursor: grabbing;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

.action-card-placeholder {
    border: 2px dashed rgba(var(--primary-color-rgb), 0.4);
    border-radius: 14px;
    background: rgba(var(--primary-color-rgb), 0.05);
}

.kanban-scroll.is-touch-dragging {
    scroll-snap-type: none;
}

.kanban-scroll {
    touch-action: pan-x;
}

.action-card.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.action-card.is-loading {
    opacity: 0.65;
    pointer-events: none;
}

.action-card.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    --c: no-repeat linear-gradient(var(--primary-color, #FF6600) 0 0);
    --b: no-repeat linear-gradient(var(--text-color, #334155) 0 0);
    background:
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--b);
    background-size: 10px 10px;
    animation: l32-1sm 1s infinite, l32-2 1s infinite;
    z-index: 2;
}

.action-card.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 14px;
    z-index: 1;
}

html[data-theme="dark"] .action-card.is-loading::after {
    background: rgba(11, 18, 32, 0.55);
}

.action-card:hover {
    border-color: rgba(var(--primary-color-rgb), 0.35);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}

.action-card__chevron {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 0;
    background: #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.action-card:hover .action-card__chevron {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(2px);
}

.action-card__chevron:hover {
    background: #e2e8f0;
    color: #1e293b;
}

@media (max-width: 992px) {
    .action-card__chevron {
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }
}

.action-modal .modal-dialog {
    max-width: 720px;
}

.action-modal__content {
    border-radius: 18px;
    border: 0;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.action-modal__header {
    border-bottom: 0;
    padding: 1.25rem 1.5rem 0.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.action-modal__body {
    padding: 0 1.5rem 1.5rem;
}

.action-modal__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.action-modal__title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.action-modal__section {
    margin-bottom: 1.5rem;
}

.action-modal__section--divider {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.action-modal__section-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.action-modal__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
    margin-bottom: 0.35rem;
}

.action-modal__text {
    color: #0f172a;
    font-size: 0.95rem;
}

.action-modal__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.action-modal__cell .action-modal__value {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.action-modal__value.is-overdue {
    color: var(--danger-color);
}

.action-modal__section-title {
    color: #0f172a;
}

.action-comments,
.action-attachments {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.action-comments {
    margin-bottom: 0;
}

.action-comment {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}

.action-comments .action-comment:last-child {
    margin-bottom: 0;
}

.action-comment__title {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.action-comment__body {
    color: #0f172a;
    font-size: 0.9rem;
}

.action-comment-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-top: 0.5rem;
}


.action-comment-form textarea {
    flex: 1;
    min-height: 80px;
    border-radius: 12px;
    background: #f8fafc;
}

.action-attachment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.action-attachment__details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.action-attachment__name {
    font-weight: 600;
    font-size: 0.9rem;
}

.action-attachment__meta {
    font-size: 0.8rem;
    color: #64748b;
}

.action-attachment__preview {
    margin-top: 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.action-attachment__preview img {
    width: 100%;
    display: block;
    max-height: 220px;
    object-fit: cover;
}

.action-attachment__thumb {
    width: 88px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex: 0 0 auto;
}

.action-attachment__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.action-attachment-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.75rem;
}

.action-attachment-form input[type="file"] {
    flex: 1;
    border-radius: 10px;
}

.action-modal__body .form-select {
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    border-color: #cbd5f5;
    box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.2);
}

.action-modal__body .btn-close {
    opacity: 0.6;
}

.action-modal__body .btn-close:hover {
    opacity: 1;
}

@media (max-width: 640px) {
    .action-modal .modal-dialog {
        margin: 0.75rem;
    }

    .action-modal__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .action-modal__body {
        padding: 0 1rem 1rem;
    }

    .action-modal__grid {
        grid-template-columns: 1fr;
    }

    .action-comment-form {
        flex-direction: column;
        align-items: stretch;
    }

    .action-comment-form textarea {
        width: 100%;
    }

    .action-attachment {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-attachment__thumb {
        width: 100%;
        height: auto;
    }

    .action-attachment__thumb img {
        height: auto;
        max-height: 160px;
    }

    .action-attachment-form {
        flex-direction: column;
        align-items: stretch;
    }

    .action-attachment-form input[type="file"] {
        width: 100%;
    }

    .action-attachment-form .action-upload-attachment {
        width: 100%;
        justify-content: center;
    }
}

.action-empty {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.action-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.action-pill.status-pill--open {
    background: #e2e8f0;
    color: #475569;
}

.action-pill.status-pill--in-progress {
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary-color);
}

.action-pill.status-pill--done {
    background: rgba(34, 197, 94, 0.16);
    color: var(--success-color);
}

.action-pill.status-pill--closed {
    background: #e2e8f0;
    color: #475569;
}

@media (max-width: 768px) {
    .action-modal__grid {
        grid-template-columns: 1fr;
    }
}

.action-card__badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.action-card__title {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.95rem;
}

.action-card__project {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.action-card__audit-date {
    color: var(--muted-color);
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

.action-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid #e2e8f0;
}

.kanban-empty {
    text-align: center;
    color: var(--muted-color);
    font-size: 0.85rem;
    padding: 1rem 0;
}

.action-row.is-hidden,
.action-card.is-hidden {
    display: none !important;
}

.actions-list-view.is-hidden,
.actions-kanban-view.is-hidden {
    display: none !important;
}

.kanban-empty.is-hidden {
    display: none !important;
}

@media (max-width: 1200px) {
    .actions-summary {
        display: flex;
        overflow-x: auto;
        gap: 0.85rem;
        padding-bottom: 0.5rem;
        scroll-snap-type: x proximity;
    }

    .actions-summary-card {
        flex: 0 0 220px;
        min-width: 200px;
        scroll-snap-align: start;
    }

    .summary-value {
        font-size: 1.1rem;
        font-weight: 600;
    }

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

    .kanban-scroll {
        overflow-x: auto;
        padding-bottom: 0.75rem;
        scroll-snap-type: x proximity;
    }

    .kanban-board {
        display: flex;
        align-items: stretch;
        gap: 0.85rem;
        width: max-content;
    }

    .kanban-column {
        flex: 0 0 280px;
        min-width: 260px;
        scroll-snap-align: start;
    }

    .actions-filters {
        grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr);
    }

    .actions-filters .toolbar-actions {
        justify-self: start;
    }
}

@media (max-width: 1024px) {
    .actions-header {
        align-items: flex-start;
    }

    .actions-toolbar {
        align-items: flex-start;
    }

    .actions-filters {
        grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
        width: 100%;
    }

    .actions-filters .toolbar-actions {
        justify-self: end;
    }

    .actions-summary-card {
        padding: 0.85rem 1rem;
    }

    .action-card {
        padding: 0.75rem 0.85rem;
    }
}

@media (max-width: 820px) {
    .actions-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-toolbar .search-field {
        min-width: 100%;
    }

    .actions-filters {
        grid-template-columns: 1fr 1fr auto;
    }

    .actions-filters .toolbar-actions {
        justify-self: end;
    }

}

@media (max-width: 768px) {
    .actions-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions-filters {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .actions-filters .form-select {
        min-width: 100%;
    }
}

@media (max-width: 640px) {
    .actions-summary {
        grid-template-columns: 1fr;
    }

    .actions-table {
        min-width: 720px;
    }

    .action-card-shell .table-responsive {
        overflow-x: auto;
    }

    .action-card__meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Audit Flow */
.audit-page {
    padding-bottom: 5rem;
}

.audit-page__header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audit-page__title {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.audit-page__subtitle {
    color: var(--muted-color);
}

.audit-back-btn {
    border-radius: 10px;
}

.audit-stepper-card {
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 1.5rem;
}

.audit-stepper-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.audit-stepper-center {
    text-align: center;
}

.audit-stepper-project-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.audit-stepper-project-subtitle {
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-top: 0.1rem;
}

.audit-stepper-score-box {
    text-align: right;
}

.audit-stepper-score-label {
    font-size: 0.72rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audit-stepper-score-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.audit-stepper-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.audit-stepper-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--primary-tint-bg);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.audit-stepper-title {
    font-weight: 600;
    color: #0f172a;
}

.audit-stepper-subtitle {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.audit-stepper-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-tint-bg-subtle);
    color: var(--primary-color);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.audit-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.audit-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, var(--primary-color));
    border-radius: 999px;
}

.audit-steps {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    padding-right: 0.75rem;
    scroll-padding-right: 0.75rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.audit-steps::-webkit-scrollbar {
    display: none;
}

.audit-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #f8fafc;
    color: var(--muted-color);
    font-size: 0.75rem;
    white-space: nowrap;
    border: 1px solid transparent;
    cursor: pointer;
}

.audit-step__index {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.audit-step.active {
    background: var(--primary-tint-bg);
    color: var(--primary-dark);
    border-color: var(--primary-tint-border);
}

.audit-step.active .audit-step__index {
    background: var(--primary-color);
    color: #fff;
}

.audit-step.done {
    color: #16a34a;
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.audit-step.done .audit-step__index {
    background: #22c55e;
    color: #fff;
}

.audit-wizard-step {
    display: none;
}

.audit-wizard-step.is-active {
    display: block;
}

.audit-step:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.audit-section-card {
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.audit-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.audit-section-score {
    display: flex;
    align-items: center;
    gap: 0rem;
    color: var(--muted-color);
    font-size: .9rem;
    flex-direction: column;
}

.audit-section-score strong {
    font-size: 1.1rem;
    color: #0f172a;
}

.audit-section-current {
    display: none;
}

.audit-section-current strong {
    display: none;
}

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

.audit-info-item {
    min-width: 0;
}

.audit-info-text {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

.audit-question-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.audit-question {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.25rem 1rem;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.audit-info-block {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
}

.audit-question__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.audit-question__header h6 {
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.audit-question__badges {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    white-space: nowrap;
    flex-wrap: wrap;
}

.audit-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.audit-toggle-row .audit-toggle-item {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.audit-question__body {
    display: grid;
    gap: 1rem;
    margin-top: 0.5rem;
}

.audit-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0f172a;
}

.audit-score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audit-score-row .score-input {
    max-width: 90px;
    border-radius: 12px;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
}

.audit-score-bar {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    position: relative;
    overflow: visible;
}

.audit-score-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #eef2f7;
    border-radius: 999px;
    z-index: 0;
}

.audit-score-bar__fill {
    position: absolute;
    inset: 0 auto 0 0;
    height: 10px;
    width: 0%;
    border-radius: 999px;
    transition: width 0.35s ease, background-color 0.25s ease;
    background: var(--danger-color);
    position: relative;
    z-index: 1;
}

.audit-score-row.is-dragging .audit-score-bar__fill {
    transition: none;
}

.audit-score-slider {
    position: absolute;
    inset: 50% 0 auto 0;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    background: transparent;
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
    z-index: 2;
}

.audit-score-slider:focus {
    outline: none;
}

.audit-score-slider::-webkit-slider-runnable-track {
    height: 10px;
    background: transparent;
}

.audit-score-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #16a34a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    margin-top: -5px;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.audit-score-slider::-moz-range-track {
    height: 10px;
    background: transparent;
}

.audit-score-slider::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #16a34a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.audit-score-bar__fill.is-low {
    background: var(--danger-color);
}

.audit-score-bar__fill.is-mid {
    background: var(--warning-color);
}

.audit-score-bar__fill.is-high {
    background: var(--success-color);
}


.audit-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #fff5f5;
    color: #b91c1c;
    border: 1px solid #fecaca;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1200;
    pointer-events: none;
}

.audit-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.audit-toast.is-success {
    background: #ecfdf3;
    color: #15803d;
    border-color: #bbf7d0;
}

.audit-toast i {
    font-size: 1.1rem;
}

.audit-option-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.audit-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.85rem;
}

.audit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.06);
}

.audit-footer__score {
    text-align: center;
}

.audit-footer__label {
    font-size: 0.75rem;
    color: var(--muted-color);
}

.audit-footer__value {
    font-weight: 700;
    color: #0f172a;
}

.audit-footer__section-score {
    font-size: 0.9rem;
    color: var(--muted-color);
    text-align: center;
}

.audit-footer__section-score strong {
    color: #0f172a;
    font-weight: 700;
}

.audit-score-card,
.audit-trigger-card,
.audit-actions-card {
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.audit-trigger-list {
    display: grid;
    gap: 0.75rem;
}

.audit-trigger-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid #fde8e8;
    background: #fff5f5;
    font-size: 0.9rem;
    color: #b91c1c;
}

.audit-trigger-item .form-check-input {
    margin-top: 0;
}

.audit-action-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    background: #fff7ed;
    color: #b45309;
    border: 1px solid #fed7aa;
}

.audit-action-list {
    display: grid;
    gap: 1rem;
}

.audit-collapsible-header {
    cursor: pointer;
    user-select: none;
}

.audit-collapsible-icon {
    transition: transform 0.3s ease;
    font-size: 1rem;
    color: var(--text-muted);
}

.audit-collapsible-header[aria-expanded="false"] .audit-collapsible-icon {
    transform: rotate(180deg);
}

.audit-unchecked-accordion .accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 10px !important;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.audit-unchecked-accordion .accordion-item:last-child {
    margin-bottom: 0;
}

.audit-unchecked-accordion .accordion-button {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    background: var(--audit-card-bg, #f8fafc);
    box-shadow: none;
}

.audit-unchecked-accordion .accordion-button:not(.collapsed) {
    background: var(--audit-card-bg, #f0f4ff);
    color: var(--text-color);
}

.audit-unchecked-accordion .accordion-button::after {
    width: 0.875rem;
    height: 0.875rem;
    background-size: 0.875rem;
}

.audit-unchecked-accordion .list-group-item {
    font-size: 0.8125rem;
    border-color: var(--border-color);
    background: transparent;
}

.audit-unchecked-badges {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.audit-action-card {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.audit-action-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.audit-action-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.audit-action-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.audit-action-pill--critical {
    background: #fee2e2;
    color: #b91c1c;
}

.audit-action-pill--high {
    background: #fde68a;
    color: #b45309;
}

.audit-action-pill--medium {
    background: #e0f2fe;
    color: #0369a1;
}

.audit-action-pill--low {
    background: #dcfce7;
    color: #15803d;
}

.audit-action-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.audit-action-desc {
    color: var(--muted-color);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.audit-action-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--muted-color);
}

.audit-action-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 1px dashed #cbd5f5;
    border-radius: 16px;
    background: #f8fafc;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.audit-stepper-pill--danger {
    background: #fee2e2;
    color: var(--danger-color);
}

.audit-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
}

.audit-review-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.audit-review-score__value {
    font-size: 2.4rem;
    font-weight: 700;
    color: #0f172a;
}

.audit-review-hero {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.audit-review-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1 1 360px;
}

.audit-review-info-cell {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #f8fafc;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.audit-review-info-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.15rem;
}

.audit-review-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
}

.audit-review-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.45;
}

.audit-review-checklist-item i {
    font-size: 0.95rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.audit-review-score {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.audit-review-score__ring {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    position: relative;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #0f172a;
    font-size: 1.2rem;
    background: conic-gradient(var(--score-color, #ef4444) var(--score-angle, 0deg), #eef2f7 0deg);
}

.audit-review-score__ring::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #eef2f7;
}

.audit-review-score__ring span {
    position: relative;
    z-index: 1;
}

.audit-review-section-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.audit-review-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.audit-review-row {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}

.audit-review-row strong {
    color: #0f172a;
}

/* Section Scores card grid (Review step) */
.audit-review-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.875rem;
}

.audit-review-section-card {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
}

.audit-review-section-score {
    font-weight: 700;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.audit-review-section-penalty {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 2px;
}

.audit-review-section-progress {
    height: 5px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.audit-review-section-bar {
    height: 100%;
    border-radius: 4px;
    background-color: #ef4444;
    transition: width 0.4s ease, background-color 0.4s ease;
    width: 0%;
}

.audit-review-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Scoring Overview Card (Review Tab) */
.scoring-overview-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

.scoring-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.scoring-overview-divider {
    border-top: 1px solid var(--border-color);
}

.scoring-overview-body {
    padding: 0.5rem 0;
}

.scoring-penalty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.15rem;
    font-size: 0.88rem;
    transition: background 0.15s;
}

.scoring-penalty-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.severity-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scoring-overview-footer {
    padding: 0.85rem 1.15rem;
    background: #f1f5f9;
}

/* Project Details + Audit History */
.audit-history-page .nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.audit-history-page .nav-tabs .nav-link {
    border: none;
    color: var(--muted-color);
    font-weight: 600;
}

.audit-history-page .nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: transparent;
}

.audit-history-header,
.audit-history-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.audit-history-summary-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.audit-history-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
}

.audit-history-subtitle {
    color: var(--muted-color);
    font-size: 0.9rem;
}

.audit-team-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    background: #f8fafc;
    overflow: hidden;
}

.audit-team-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.audit-team-member {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.audit-team-member>div {
    min-width: 0;
}

.audit-team-member .text-muted {
    word-break: break-word;
}

.audit-team-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ─── Compact Stakeholders ─────────────────────────────────── */
.stakeholder-group {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    margin-bottom: 0.5rem;
}

.stakeholder-role-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.stakeholder-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.stakeholder-member {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.2rem 0.6rem 0.2rem 0.2rem;
    font-size: 0.8rem;
    line-height: 1.3;
    cursor: default;
    transition: box-shadow 0.15s ease;
}

.stakeholder-member:hover {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.stakeholder-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.65rem;
}

.stakeholder-name {
    font-weight: 500;
    color: var(--text-color);
}

/* ─── Edit Project: Member Group Cards ─────────────────────── */
.ep-member-group {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.15s ease;
}

.ep-member-group:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.ep-member-group__header {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ep-member-group__role {
    flex: 1;
    min-width: 0;
}

.ep-member-group__remove {
    flex: 0 0 auto;
    margin-bottom: 1px;
}

.ep-member-group__body {
    width: 100%;
}

.audit-trend-header {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.audit-trend-chart {
    height: 120px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    position: relative;
    padding: 0.75rem 1rem;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.4);
}

.audit-trend-axis {
    position: absolute;
    bottom: 0.75rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.7rem;
}

.audit-history-list {
    display: grid;
    gap: 1rem;
}

.audit-history-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    background: #ffffff;
}

.schedule-offcanvas-wide {
    --bs-offcanvas-width: min(95vw, 980px);
}

#scheduledAuditsOffcanvas.schedule-offcanvas-wide {
    --bs-offcanvas-width: min(95vw, 980px);
}

.offcanvas.offcanvas-end {
    width: var(--bs-offcanvas-width);
}


@media (max-width: 1024px) {
    .schedule-offcanvas-wide {
        --bs-offcanvas-width: 100vw;
    }

    .offcanvas {
        z-index: 1100;
    }

    .offcanvas-backdrop {
        z-index: 1090;
    }
}

.schedule-table-wrap {
    height: calc(100vh - 140px);
    overflow: auto;
    margin: 0 -1.25rem;
    padding: 0 1.25rem 0.75rem;
}

.schedule-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--surface-color, #ffffff);
}

html[data-theme="dark"] .schedule-table thead th {
    background-color: var(--surface-color, #111827);
}

.schedule-table thead th,
.schedule-table tbody td {
    white-space: nowrap;
}

.schedule-table thead th {
    box-shadow: 0 1px 0 var(--border-color);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.schedule-table {
    border-collapse: separate;
    border-spacing: 0;
}

.schedule-table thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.schedule-table thead::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 12px;
    background: var(--surface-color, #ffffff);
    z-index: -1;
}

html[data-theme="dark"] .schedule-table thead::after {
    background: var(--surface-color, #111827);
}

.audit-history-score {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(var(--score-color, #22c55e) var(--score-angle, 0deg), #eef2f7 0deg);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #0f172a;
    position: relative;
}

.audit-history-score::after {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: #ffffff;
}

.audit-history-score span {
    position: relative;
    z-index: 1;
}

.audit-history-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.audit-history-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.audit-history-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.audit-history-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.audit-history-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    color: #64748b;
    background: #f1f5f9;
}

.audit-history-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 0.7rem;
    font-weight: 600;
}

.audit-history-details {
    display: flex;
    gap: 1rem;
    color: var(--muted-color);
    font-size: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.audit-history-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-end;
}

.audit-history-score-text {
    text-align: right;
    min-width: 70px;
}

.audit-history-score-value {
    font-weight: 700;
    font-size: 1.15rem;
    color: #0f172a;
}

.audit-history-score-label {
    font-size: 0.7rem;
    color: var(--muted-color);
}

.audit-history-card .btn-icon {
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.audit-history-card .btn-icon:hover {
    background: var(--primary-tint-bg-subtle);
}

.audit-history-next {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    text-decoration: none;
}

.audit-history-next:hover {
    background: var(--primary-tint-bg-subtle);
    color: var(--primary-dark);
}

.audit-history-score-text {
    text-align: right;
    min-width: 70px;
}

.audit-history-score-value {
    font-weight: 700;
    font-size: 1.2rem;
    color: #0f172a;
}

.audit-history-score-label {
    font-size: 0.7rem;
    color: var(--muted-color);
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.audit-review-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.audit-review-item {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.audit-footer--sticky {
    position: static;
    box-shadow: none;
    background: transparent;
}

@media (max-width: 640px) {
    .audit-page__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-section-header .btn {
        width: 100%;
    }

    .audit-question__header {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .audit-toggle-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-stepper-top {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .audit-stepper-center {
        grid-column: 1 / -1;
        order: -1;
        text-align: left;
    }

    .audit-stepper-score-box {
        text-align: right;
        justify-self: end;
    }

    .audit-stepper-score-value {
        font-size: 1rem;
    }

    .audit-info-grid {
        grid-template-columns: 1fr;
    }

    .audit-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .audit-review-grid {
        grid-template-columns: 1fr;
    }

    .audit-action-card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .audit-action-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: flex-start;
    }

    .audit-action-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-history-page .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .audit-history-page .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .audit-history-page .nav-tabs .nav-link {
        white-space: nowrap;
    }

    .audit-history-header,
    .audit-history-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-history-header .btn,
    .audit-history-summary .btn {
        width: 100%;
    }

    .audit-history-summary-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .audit-history-header .d-flex {
        width: 100%;
    }

    .audit-history-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .audit-history-score {
        width: 56px;
        height: 56px;
    }

    .audit-history-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .audit-history-score-text {
        text-align: left;
        min-width: 0;
    }
}

@media (max-width: 900px) {
    .audit-review-hero {
        flex-direction: column;
        gap: 1rem;
    }

    .audit-review-info-grid {
        grid-template-columns: 1fr;
    }

    .audit-review-score {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .audit-review-score__value {
        font-size: 2rem;
    }

    .audit-review-table {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-question__header {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .audit-toggle-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-report__section-header,
    .audit-report__question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}

@media (max-width: 520px) {
    .audit-review-table {
        grid-template-columns: 1fr;
    }
}

.project-name a {
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}

.project-client {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-pill--neutral {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

/* Project status pills */
.project-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.project-status-pill--running {
    background: rgba(22, 163, 74, 0.13);
    color: #16a34a;
}

.project-status-pill--hold {
    background: rgba(245, 158, 11, 0.13);
    color: #b45309;
}

.project-status-pill--closed {
    background: rgba(107, 114, 128, 0.13);
    color: #4b5563;
}

.project-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.score-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.score-ring {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #e2e8f0;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.score-ring::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: #fff;
    border-radius: 999px;
}

.score-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(var(--score-color) calc(var(--score) * 1%), #e2e8f0 0);
    z-index: 0;
}

.score-ring .score-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.65rem;
    z-index: 1;
}

.score-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f172a;
}

.score-ring--lg {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    flex: 0 0 auto;
}

.score-ring--lg::after {
    inset: 8px;
}

.score-ring--lg .score-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.7rem;
    z-index: 1;
}

.action-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.action-count {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.7rem;
    border-radius: 6px;
    padding: 0.15rem 0.4rem;
    min-width: 22px;
    text-align: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.projects-grid-view.is-hidden,
.projects-list-view.is-hidden {
    display: none;
}

.project-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 18px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    gap: 0.75rem;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border-color: var(--primary-color);
}

.project-card__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.project-card__meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--muted-color);
    font-size: 0.85rem;
}

.project-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.pending-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    background: #f8fafc;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--muted-color);
    white-space: nowrap;
}

.action-static {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: default;
}

.action-static:hover,
.action-static:focus {
    background: #f8fafc;
    border-color: var(--border-color);
}

@media (max-width: 992px) {
    main {
        padding: 1.25rem;
    }

    .container {
        max-width: 100% !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .status-tabs {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .status-tabs::-webkit-scrollbar {
        display: none;
    }

    .status-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .projects-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .status-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .filter-panel {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
}

/* Theme preference helpers (System/Light/Dark) */
.theme-option {
    position: relative;
}

.theme-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-option input:checked+.theme-card {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
}

.theme-option input:focus-visible+.theme-card {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
    border-color: var(--primary-color);
}

.theme-swatch.system {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.theme-swatch__half {
    display: block;
    width: 100%;
    height: 100%;
}

.theme-swatch__light {
    background: #ffffff;
}

.theme-swatch__dark {
    background: #9ca3af;
}

.guest-body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Dark mode overrides (scoped) */
html[data-theme="dark"] {
    --bg-color: #0b1220;
    --surface-color: #111827;
    --border-color: #1f2937;
    --text-color: #e2e8f0;
    --muted-color: #94a3b8;
    --sidebar-color: #0f172a;
    --sidebar-active: #1e293b;
    --primary-color: #FF8533;
    --primary-color-rgb: 255, 133, 51;
    --primary-hover: #e56a1a;
    --primary-dark: #cc5200;
    --primary-tint-bg: rgba(255, 133, 51, 0.12);
    --primary-tint-bg-subtle: rgba(255, 133, 51, 0.06);
    --primary-tint-border: rgba(255, 133, 51, 0.25);
    --accent-color: #FF8533;
    --bs-primary: #FF8533;
    --bs-primary-rgb: 255, 133, 51;
    --bs-link-color: #FF8533;
    --bs-link-color-rgb: 255, 133, 51;
    --bs-link-hover-color: #e56a1a;
    --bs-link-hover-color-rgb: 229, 106, 26;
}

html[data-theme="dark"] .bg-light {
    background-color: #111827 !important;
}

html[data-theme="dark"] .text-dark {
    color: var(--text-color) !important;
}

html[data-theme="dark"] .text-muted {
    color: var(--muted-color) !important;
}

html[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

html[data-theme="dark"] .card {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    box-shadow: 0 8px 20px rgba(3, 7, 18, 0.35);
}

html[data-theme="dark"] .card-header {
    background-color: #0f172a;
    border-color: var(--border-color);
}

html[data-theme="dark"] .btn-light {
    background: #1f2937;
    border-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text {
    background: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .form-control::placeholder {
    color: var(--muted-color);
}

html[data-theme="dark"] .table {
    color: var(--text-color);
}

html[data-theme="dark"] .table thead th {
    color: var(--muted-color);
}

html[data-theme="dark"] .table .bg-light {
    background-color: #0f172a !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .offcanvas-header,
html[data-theme="dark"] .offcanvas-body {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .settings-tabs {
    background: #0f172a;
    border-color: var(--border-color);
}

html[data-theme="dark"] .settings-tabs .nav-link {
    color: var(--muted-color);
}

html[data-theme="dark"] .settings-tabs .nav-link.active {
    color: var(--text-color);
    background: #111827;
    box-shadow: inset 0 0 0 1px var(--primary-tint-border);
}

html[data-theme="dark"] .theme-card {
    background: #111827;
}

html[data-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

html[data-theme="dark"] .bg-white {
    background-color: var(--surface-color) !important;
}

html[data-theme="dark"] .text-body,
html[data-theme="dark"] .text-secondary {
    color: var(--text-color) !important;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] label {
    color: var(--muted-color);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .card-body {
    color: var(--text-color);
}

html[data-theme="dark"] .nav-pills .nav-link {
    color: var(--muted-color);
    background: #0f172a;
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .nav-pills .nav-link.active {
    color: var(--text-color);
    background: #111827;
    box-shadow: inset 0 0 0 1px var(--primary-tint-border);
}

html[data-theme="dark"] .nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--muted-color);
    border-color: transparent;
}

html[data-theme="dark"] .nav-tabs .nav-link.active {
    color: var(--text-color);
    background: transparent;
    border-color: transparent transparent var(--primary-color) transparent;
}

html[data-theme="dark"] .table,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table tbody td {
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>* {
    background-color: #0f172a;
    color: var(--text-color);
}

html[data-theme="dark"] .table-hover>tbody>tr:hover>* {
    background-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .badge.bg-light {
    background-color: #0f172a !important;
    color: var(--muted-color);
}

html[data-theme="dark"] .btn-outline-light {
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .btn-outline-light:hover {
    background-color: #1f2937;
}

html[data-theme="dark"] .dropdown-item {
    color: var(--text-color);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

html[data-theme="dark"] .pagination .page-link {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .pagination .page-link:hover {
    background-color: #1f2937;
}

html[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

html[data-theme="dark"] .alert {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .table {
    background-color: var(--surface-color);
}

html[data-theme="dark"] .table> :not(caption)>*>* {
    background-color: transparent;
    color: var(--text-color);
}

html[data-theme="dark"] .table thead th {
    background-color: #0f172a;
    color: var(--muted-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .table tbody td {
    border-color: var(--border-color);
}

html[data-theme="dark"] .table-borderless> :not(caption)>*>* {
    border-bottom-width: 0;
}

html[data-theme="dark"] .table thead,
html[data-theme="dark"] .table tbody {
    background-color: var(--surface-color);
}

html[data-theme="dark"] .text-primary {
    color: var(--primary-color) !important;
}

html[data-theme="dark"] .text-info {
    color: #93c5fd !important;
}

html[data-theme="dark"] .text-success {
    color: #22c55e !important;
}

html[data-theme="dark"] .text-warning {
    color: #f59e0b !important;
}

html[data-theme="dark"] .text-danger {
    color: #f87171 !important;
}

html[data-theme="dark"] .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

html[data-theme="dark"] .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-hover);
}

html[data-theme="dark"] .btn-outline-primary:hover {
    background-color: var(--primary-dark);
    color: #ffffff;
}

html[data-theme="dark"] .form-check-input {
    background-color: #0f172a;
    border-color: var(--border-color);
}

html[data-theme="dark"] .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

html[data-theme="dark"] .form-switch .form-check-input {
    background-color: #1f2937;
}

html[data-theme="dark"] .input-group-text {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--muted-color);
}

html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-sm,
html[data-theme="dark"] .shadow-lg {
    box-shadow: 0 12px 28px rgba(3, 7, 18, 0.5) !important;
}

html[data-theme="dark"] .list-group-item-action:hover,
html[data-theme="dark"] .list-group-item-action:focus {
    background-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .badge.bg-light {
    border-color: var(--border-color);
}

html[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

html[data-theme="dark"] .page-link {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .page-link:hover {
    background-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--muted-color);
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-color) !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.select2-container {
    max-width: 100%;
}

.owner-option-select2-dropdown .select2-results__options {
    overflow-x: hidden;
}

.owner-option-select2-dropdown .select2-results__option {
    white-space: normal;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.owner-option-select2-dropdown .select2-search--dropdown {
    padding: 0.35rem;
}

.owner-option-select2-dropdown .select2-search__field {
    box-sizing: border-box;
    width: 100% !important;
}

.owner-option-select2-selection.select2-selection--single .select2-selection__rendered {
    line-height: 1.2;
    white-space: normal;
}

/* Fix Select2 selected item overflow */
.owner-option-select2-selection.select2-selection--single .select2-selection__rendered {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: calc(100% - 30px) !important;
    /* leave room for clear/arrow icons */
    display: block !important;
}

.project-form .project-members-header {
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

@media (max-width: 575.98px) {
    .project-form .project-members-header {
        gap: 0;
    }

    .project-form .project-members-add-btn {
        width: 100%;
    }
}

.project-form #members-container .member-group {
    margin-top: 0;
}

.project-form .select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: 2.25rem;
    padding: 0.2rem 0.45rem;
}

.project-form .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    padding: 0;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.35rem;
    white-space: normal;
}

.project-form .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice,
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    max-width: 100%;
}

.project-form .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    margin: 0;
    padding: 0.1rem 0.4rem;
    font-size: 0.8125rem;
}

.project-form .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__display,
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__display {
    white-space: normal;
    overflow-wrap: anywhere;
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection__rendered {
    color: var(--text-color);
}

html[data-theme="dark"] .select2-dropdown {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .progress {
    background-color: #1f2937;
}

html[data-theme="dark"] .progress-bar {
    background-color: var(--primary-color);
}

/* Dark theme: custom UI components */
html[data-theme="dark"] .status-tabs,
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .actions-summary-card,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .action-modal__content,
html[data-theme="dark"] .action-comment,
html[data-theme="dark"] .action-comment-form textarea,
html[data-theme="dark"] .action-attachment,
html[data-theme="dark"] .action-attachment__preview,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .pending-pill,
html[data-theme="dark"] .audit-question,
html[data-theme="dark"] .audit-info-block,
html[data-theme="dark"] .audit-stepper-card,
html[data-theme="dark"] .audit-section-card,
html[data-theme="dark"] .audit-footer,
html[data-theme="dark"] .audit-team-card,
html[data-theme="dark"] .stakeholder-group,
html[data-theme="dark"] .ep-member-group,
html[data-theme="dark"] .audit-trend-chart,
html[data-theme="dark"] .audit-history-card,
html[data-theme="dark"] .audit-review-row,
html[data-theme="dark"] .audit-review-item,
html[data-theme="dark"] .scoring-overview-card,
html[data-theme="dark"] .audit-action-card,
html[data-theme="dark"] .audit-action-empty,
html[data-theme="dark"] .audit-trigger-item,
html[data-theme="dark"] .audit-review-info-cell {
    background: var(--surface-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .audit-review-info-label {
    color: #94a3b8;
}

html[data-theme="dark"] .stakeholder-member {
    background: #1e293b;
    border-color: var(--border-color);
}

html[data-theme="dark"] .stakeholder-name {
    color: var(--text-color);
}

html[data-theme="dark"] .stakeholder-role-label {
    color: #94a3b8;
}

html[data-theme="dark"] .audit-review-checklist-item {
    color: var(--text-color);
}

html[data-theme="dark"] .audit-action-alert,
html[data-theme="dark"] .audit-alert,
html[data-theme="dark"] .audit-unchecked-accordion .accordion-item,
html[data-theme="dark"] .audit-unchecked-accordion .list-group-item,
html[data-theme="dark"] .audit-review-score__ring::after,
html[data-theme="dark"] .score-ring::after,
html[data-theme="dark"] .audit-history-score::after {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .status-tabs {
    box-shadow: 0 10px 20px rgba(3, 7, 18, 0.35);
}

html[data-theme="dark"] .status-tab:not(.active):hover {
    background: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .actions-summary-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .audit-history-card,
html[data-theme="dark"] .audit-stepper-card,
html[data-theme="dark"] .audit-section-card,
html[data-theme="dark"] .audit-action-card {
    box-shadow: 0 12px 24px rgba(3, 7, 18, 0.35);
}

html[data-theme="dark"] .summary-label,
html[data-theme="dark"] .projects-subtitle,
html[data-theme="dark"] .actions-subtitle,
html[data-theme="dark"] .projects-count,
html[data-theme="dark"] .actions-count,
html[data-theme="dark"] .project-client-sub,
html[data-theme="dark"] .team-pop__email,
html[data-theme="dark"] .action-description,
html[data-theme="dark"] .action-card__project,
html[data-theme="dark"] .action-card__audit-date,
html[data-theme="dark"] .action-due,
html[data-theme="dark"] .audit-page__subtitle,
html[data-theme="dark"] .audit-stepper-subtitle,
html[data-theme="dark"] .audit-stepper-project-subtitle,
html[data-theme="dark"] .audit-stepper-score-label,
html[data-theme="dark"] .audit-footer__section-score,
html[data-theme="dark"] .audit-section-score,
html[data-theme="dark"] .audit-action-desc,
html[data-theme="dark"] .audit-action-meta,
html[data-theme="dark"] .audit-history-details,
html[data-theme="dark"] .audit-history-score-label,
html[data-theme="dark"] .project-card__meta,
html[data-theme="dark"] .action-owner,
html[data-theme="dark"] .action-comment__title,
html[data-theme="dark"] .action-attachment__meta,
html[data-theme="dark"] .audit-trend-axis {
    color: var(--muted-color);
}

html[data-theme="dark"] .action-name,
html[data-theme="dark"] .action-name--link,
html[data-theme="dark"] .action-card__title,
html[data-theme="dark"] .action-modal__text,
html[data-theme="dark"] .action-modal__section-title,
html[data-theme="dark"] .audit-stepper-title,
html[data-theme="dark"] .audit-stepper-project-title,
html[data-theme="dark"] .audit-stepper-score-value,
html[data-theme="dark"] .audit-footer__section-score strong,
html[data-theme="dark"] .audit-section-score strong,
html[data-theme="dark"] .audit-action-title,
html[data-theme="dark"] .audit-history-title,
html[data-theme="dark"] .audit-team-title,
html[data-theme="dark"] .audit-review-score__value,
html[data-theme="dark"] .audit-review-section-title,
html[data-theme="dark"] .scoring-overview-header,
html[data-theme="dark"] .scoring-penalty-row,
html[data-theme="dark"] .audit-review-score__ring,
html[data-theme="dark"] .audit-review-row strong,
html[data-theme="dark"] .project-name a,
html[data-theme="dark"] .project-link,
html[data-theme="dark"] .team-pop__name,
html[data-theme="dark"] .score-value,
html[data-theme="dark"] .projects-table .score-value,
html[data-theme="dark"] .score-ring--lg .score-number,
html[data-theme="dark"] .audit-history-score,
html[data-theme="dark"] .audit-history-score span,
html[data-theme="dark"] .audit-history-score-value {
    color: var(--text-color);
}

html[data-theme="dark"] .scoring-overview-footer {
    background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .avatar-item {
    border-color: var(--surface-color);
}

html[data-theme="dark"] .avatar-item--count {
    background-color: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .team-pop__header {
    background: linear-gradient(135deg, #1e293b 0%, #162032 100%);
    border-bottom-color: rgba(248, 250, 252, 0.08);
}

html[data-theme="dark"] .team-pop__role {
    color: #f1f5f9;
}

html[data-theme="dark"] .team-pop__role-group {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(248, 250, 252, 0.08);
}

html[data-theme="dark"] .team-popover.popover {
    border-color: rgba(248, 250, 252, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .team-popover .popover-body {
    background: #1a2332;
}

html[data-theme="dark"] .scoring-penalty-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .project-crm-label {
    background: rgba(var(--primary-color-rgb), 0.18);
    color: var(--primary-color);
}

html[data-theme="dark"] .projects-table tbody tr:hover {
    background-color: #111827;
}

html[data-theme="dark"] .action-name--link:hover {
    color: var(--primary-color);
}

html[data-theme="dark"] .owner-avatar,
html[data-theme="dark"] .kanban-count,
html[data-theme="dark"] .action-count,
html[data-theme="dark"] .action-card__chevron,
html[data-theme="dark"] .audit-history-card .btn-icon,
html[data-theme="dark"] .audit-history-next,
html[data-theme="dark"] .audit-history-chip,
html[data-theme="dark"] .pending-pill,
html[data-theme="dark"] .action-pill.status-pill--open,
html[data-theme="dark"] .action-pill.status-pill--closed {
    background: #1f2937;
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .action-card__chevron:hover,
html[data-theme="dark"] .audit-history-next:hover,
html[data-theme="dark"] .audit-history-card .btn-icon:hover {
    background: #111827;
    color: var(--text-color);
}

html[data-theme="dark"] .action-badge--critical,
html[data-theme="dark"] .audit-action-pill--critical {
    background: rgba(248, 113, 113, 0.18);
    color: #f87171;
}

html[data-theme="dark"] .action-badge--high,
html[data-theme="dark"] .action-badge--medium,
html[data-theme="dark"] .audit-action-pill--high,
html[data-theme="dark"] .audit-action-pill--medium {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
}

html[data-theme="dark"] .action-badge--low,
html[data-theme="dark"] .audit-action-pill--low {
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
}

html[data-theme="dark"] .audit-trigger-item,
html[data-theme="dark"] .audit-alert {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.3);
    color: #f87171;
}

html[data-theme="dark"] .audit-action-alert {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

html[data-theme="dark"] .audit-step,
html[data-theme="dark"] .audit-step.done,
html[data-theme="dark"] .audit-step.active {
    background: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .audit-step__index {
    background: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .audit-step.active .audit-step__index,
html[data-theme="dark"] .audit-step.done .audit-step__index {
    background: var(--primary-color);
    color: #ffffff;
}

html[data-theme="dark"] .audit-stepper-icon,
html[data-theme="dark"] .audit-stepper-pill {
    background: #1f2937;
    color: var(--primary-color);
}

html[data-theme="dark"] .audit-progress {
    background: #1f2937;
}

html[data-theme="dark"] .audit-score-bar {
    background: #1f2937;
}

html[data-theme="dark"] .action-modal__label,
html[data-theme="dark"] .audit-field label {
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-history-score,
html[data-theme="dark"] .score-ring {
    background: conic-gradient(var(--score-color, #22c55e) var(--score-angle, 0deg), #1f2937 0deg);
}

html[data-theme="dark"] .audit-report__trigger {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .projects-table,
html[data-theme="dark"] .actions-table {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .badge.bg-warning {
    color: #111827;
}

html[data-theme="dark"] .badge.bg-light {
    background-color: #1f2937 !important;
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .card.bg-white,
html[data-theme="dark"] .card-header.bg-white,
html[data-theme="dark"] .card-body.bg-white,
html[data-theme="dark"] .card .bg-white {
    background-color: var(--surface-color) !important;
    color: var(--text-color);
}

html[data-theme="dark"] .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

html[data-theme="dark"] .btn-close:hover {
    opacity: 1;
}

html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .modal-footer {
    color: var(--text-color);
}

html[data-theme="dark"] .form-control.bg-white,
html[data-theme="dark"] .form-select.bg-white,
html[data-theme="dark"] .input-group-text.bg-white {
    background-color: #0f172a !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection__choice {
    background-color: #1f2937;
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection__choice__display {
    color: var(--text-color);
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection__choice__remove {
    color: var(--muted-color);
}

html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection__choice__remove:hover {
    color: var(--text-color);
}

html[data-theme="dark"] .table {
    background-color: var(--surface-color) !important;
}

html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table tbody td {
    background-color: transparent !important;
}

/* Auditor dashboard dark theme */
html[data-theme="dark"] .auditor-dashboard {
    --brand-accent: #FF8533;
    --brand-navy: #0f172a;
    --muted-text: #94a3b8;
    --surface: #111827;
    --page-bg: #0b1220;
    --danger: #f87171;
    --warning: #f59e0b;
    --success: #22c55e;
    color: var(--text-color);
}

html[data-theme="dark"] .auditor-title,
html[data-theme="dark"] .auditor-link,
html[data-theme="dark"] .auditor-action-body,
html[data-theme="dark"] .auditor-project-header,
html[data-theme="dark"] .auditor-table,
html[data-theme="dark"] .auditor-table table,
html[data-theme="dark"] .auditor-table th,
html[data-theme="dark"] .auditor-table td {
    color: var(--text-color);
}

html[data-theme="dark"] .auditor-subtitle,
html[data-theme="dark"] .auditor-stat-label,
html[data-theme="dark"] .auditor-project-meta,
html[data-theme="dark"] .auditor-action-sub,
html[data-theme="dark"] .auditor-action-footer {
    color: var(--muted-text);
}

html[data-theme="dark"] .auditor-stat-card,
html[data-theme="dark"] .auditor-card,
html[data-theme="dark"] .auditor-actions-card,
html[data-theme="dark"] .auditor-action-item,
html[data-theme="dark"] .auditor-table {
    background: var(--surface);
    border-color: var(--border-color);
    box-shadow: 0 12px 24px rgba(3, 7, 18, 0.4);
}

html[data-theme="dark"] .auditor-action-item,
html[data-theme="dark"] .auditor-btn-row,
html[data-theme="dark"] .auditor-action-footer {
    border-color: var(--border-color);
}

html[data-theme="dark"] .auditor-score-ring {
    background: conic-gradient(var(--danger) var(--percent, 60%), #1f2937 0);
}

html[data-theme="dark"] .auditor-score-ring::before {
    background: #0f172a;
}

html[data-theme="dark"] .auditor-stat-icon {
    background: var(--primary-tint-bg);
    color: var(--brand-accent);
}

html[data-theme="dark"] .auditor-outline-btn {
    background: #0f172a;
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .auditor-primary-btn,
html[data-theme="dark"] .auditor-filled-btn {
    background: var(--brand-accent);
    color: #ffffff;
}

html[data-theme="dark"] .auditor-pill {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

/* Projects: score alignment */
.projects-table .table-col-score {
    text-align: center;
    width: 110px;
}

.projects-table .score-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.projects-table th.table-col-score,
.projects-table td.table-col-score {
    text-align: center;
    vertical-align: middle;
}

.projects-table .score-wrap {
    min-width: 72px;
}

.projects-table .score-value {
    display: inline-block;
    min-width: 20px;
    text-align: left;
}

/* Dashboard project health tables */
.dashboard-health-table {
    min-width: 700px;
}

.preview-scroll {
    max-height: 360px;
    overflow-y: auto;
}

/* Schedule mini calendar */
.schedule-mini-calendar {
    /* max-height: 250px;
    overflow-y: auto; */
}

.schedule-preview-panel {
    width: 400px;
    flex-shrink: 0;
}

.schedule-preview-panel .schedule-mini-calendar {
    max-height: none;
    overflow-y: visible;
}

.schedule-preview-panel .schedule-mini-cal-month {
    flex: 1 1 140px;
    max-width: 170px;
}

.schedule-mini-cal-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.schedule-mini-cal-month {
    flex: 1 1 200px;
    max-width: 240px;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.schedule-mini-cal-title {
    font-weight: 600;
    font-size: 0.8125rem;
    text-align: center;
    margin-bottom: 0.25rem;
}

.schedule-mini-cal-header,
.schedule-mini-cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.schedule-mini-cal-dh {
    font-size: 0.6875rem;
    color: var(--bs-secondary-color, #6c757d);
    padding: 0.125rem 0;
}

.schedule-mini-cal-day {
    font-size: 0.75rem;
    padding: 0.125rem 0;
    line-height: 1.6;
}

.schedule-mini-cal-active {
    background: var(--bs-primary, #FF6600);
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
}

.schedule-mini-cal-empty {
    visibility: hidden;
}

html[data-theme="dark"] .score-ring {
    background: conic-gradient(var(--score-color) calc(var(--score) * 1%), #1f2937 0) !important;
}

html[data-theme="dark"] .score-ring::after {
    background: #0f172a !important;
}

html[data-theme="dark"] .score-ring .score-number {
    color: #e2e8f0;
}

html[data-theme="dark"] .kanban-column {
    background: #111827;
}

html[data-theme="dark"] .kanban-column__header {
    background: #111827;
    color: var(--text-color);
}

/* ==========================================================================
   Audit Report (audits/show)
   ========================================================================== */
.audit-report {
    color: #334155;
}

.audit-report__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audit-report__title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0f172a;
}

.audit-report__subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

.audit-report__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.audit-report__btn {
    border-radius: 10px;
    padding: 0.45rem 0.85rem;
}

.audit-report__scorecard {
    border: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.audit-score {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.audit-score__ring {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: conic-gradient(var(--score-color) calc(var(--score)*1%), #e5e7eb 0);
    display: grid;
    place-items: center;
}

.audit-score__inner {
    width: 70px;
    height: 70px;
    background: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}

.audit-score__value {
    font-weight: 700;
    font-size: 1.15rem;
    color: #0f172a;
}

.audit-score__meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audit-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
}

.audit-status--excellent {
    background: #dcfce7;
    color: #15803d;
}

.audit-status--healthy {
    background: #dcfce7;
    color: #15803d;
}

.audit-status--needs-attention {
    background: #fef3c7;
    color: #b45309;
}

.audit-status--risky {
    background: #fee2e2;
    color: #b91c1c;
}

.audit-status--critical {
    background: #fee2e2;
    color: #b91c1c;
}

.audit-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.audit-score__title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
}

.audit-score__denom {
    font-size: 0.95rem;
    color: #94a3b8;
}

.audit-score__sub {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.audit-score__timeline {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.audit-report__tabs {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.audit-report__tabs .nav-link {
    border-radius: 999px;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid transparent;
}

.audit-report__tabs .nav-link.active {
    background: #fff;
    border-color: #e5e7eb;
    color: #0f172a;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
}

.audit-report__panel {
    border: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.audit-report__panel-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1rem;
}

.audit-report__section-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.audit-report__section-title {
    font-weight: 600;
    color: #0f172a;
}

.audit-report__section-sub {
    color: #94a3b8;
    font-size: 0.8rem;
}

.audit-report__section-score {
    font-weight: 600;
}

.audit-report__progress {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.audit-report__progress--strong {
    height: 8px;
}

.audit-report__progress-bar {
    height: 100%;
    border-radius: 999px;
}

.audit-report__section-card {
    border: 1px solid #e5e7eb;
}

.audit-report__trigger-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.audit-report__trigger {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.audit-report__empty {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #22c55e;
    font-weight: 500;
}

.audit-report__action-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem;
    background: #fff;
}

.audit-report__action-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.audit-report__action-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.audit-report__action-footer {
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Context card */
.audit-report__context-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 1.5rem;
}

.audit-report__context-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.audit-report__context-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.audit-report__context-value {
    font-size: 0.925rem;
    font-weight: 500;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.audit-report__context-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-tint-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-tint-border);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
}

/* Stakeholders */
.audit-report__stakeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.audit-report__stakeholder-group {}

.audit-report__stakeholder-role {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.35rem;
}

.audit-report__stakeholder-members {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.audit-report__stakeholder-member {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audit-report__stakeholder-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.audit-report__stakeholder-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-report__stakeholder-email {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section mini cards (summary tab) */
.audit-report__section-mini {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    height: 100%;
}

.audit-report__section-mini-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #0f172a;
}

.audit-report__section-mini-score {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.audit-report__section-mini-percent {
    font-size: 0.75rem;
    color: #64748b;
}

/* Section penalty earned/penalty indicators */
.audit-report__section-penalty {
    display: flex;
    gap: 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Severity breakdown grid */
.audit-report__severity-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.audit-report__severity-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
}

.audit-report__severity-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.audit-report__severity-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
}

/* Formula breakdown card */
.audit-report__formula-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

/* Process gaps */
.audit-report__gaps-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audit-report__gap-section {}

.audit-report__gap-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.35rem;
    margin-top: 0.5rem;
}

.audit-report__gap-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    font-size: 0.85rem;
    color: #991b1b;
}

/* Sign-off rows */
.audit-report__signoff-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Section Details — Toggle grid */
.audit-report__toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.audit-report__toggle-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    font-size: 0.85rem;
    transition: all .15s ease;
}

.audit-report__toggle-item.is-pass {
    background: #f0fdf4;
    border-color: #dcfce7;
}

.audit-report__toggle-item.is-pass .audit-report__toggle-icon {
    color: #16a34a;
}

.audit-report__toggle-item.is-fail {
    background: #fef2f2;
    border-color: #fecaca;
}

.audit-report__toggle-item.is-fail .audit-report__toggle-icon {
    color: #dc2626;
}

.audit-report__toggle-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.audit-report__toggle-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.audit-report__toggle-text {
    font-weight: 500;
    color: #0f172a;
    line-height: 1.3;
}

.audit-report__toggle-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Section Details — Question cards */
.audit-report__questions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audit-report__q-card {
    padding: 0.65rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.audit-report__q-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.audit-report__q-text {
    font-weight: 500;
    font-size: 0.88rem;
    color: #0f172a;
}

.audit-report__q-badges {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.audit-report__q-score-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.audit-report__q-bar {
    height: 5px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.audit-report__q-bar-fill {
    height: 100%;
    border-radius: 999px;
}

.audit-report__q-score-value {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.audit-report__q-notes {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: #f8fafc;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    font-size: 0.82rem;
    color: #475569;
}

.audit-report__q-response {
    padding: 0.3rem 0.5rem;
    background: #f8fafc;
    border-left: 3px solid #94a3b8;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: #475569;
    font-style: italic;
}

/* Checkbox pills */
.audit-report__checkbox-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.audit-report__checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    font-size: 0.78rem;
    color: #64748b;
}

.audit-report__checkbox-pill.is-selected {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
    font-weight: 500;
}

/* Section notes callout */
.audit-report__section-note {
    margin-top: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--primary-tint-bg);
    border: 1px solid var(--primary-tint-border);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 10px 10px 0;
}

.audit-report__section-note-header {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-dark);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.audit-report__section-note-body {
    font-size: 0.85rem;
    color: #1e3a5f;
    line-height: 1.45;
}

/* Responsive */
@media (max-width: 640px) {
    .audit-report__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .audit-score {
        flex-direction: column;
        align-items: flex-start;
    }

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

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

    .audit-report__toggle-grid {
        grid-template-columns: 1fr;
    }

    .audit-report__section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .audit-report__q-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .audit-report__stakeholder-grid {
        grid-template-columns: 1fr;
    }
}

/* Audit report (audits/show) dark theme */
html[data-theme="dark"] .audit-report,
html[data-theme="dark"] .audit-report__panel,
html[data-theme="dark"] .audit-report__scorecard,
html[data-theme="dark"] .audit-report__section,
html[data-theme="dark"] .audit-report__question,
html[data-theme="dark"] .audit-report__action-card,
html[data-theme="dark"] .audit-report__accordion .accordion-item,
html[data-theme="dark"] .audit-report__accordion .accordion-body {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__title,
html[data-theme="dark"] .audit-report__section-title,
html[data-theme="dark"] .audit-report__panel-title,
html[data-theme="dark"] .audit-report__action-title,
html[data-theme="dark"] .audit-score__value,
html[data-theme="dark"] .audit-score__number {
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__subtitle,
html[data-theme="dark"] .audit-report__section-sub,
html[data-theme="dark"] .audit-report__answer,
html[data-theme="dark"] .audit-score__sub,
html[data-theme="dark"] .audit-score__timeline {
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__tabs .nav-link {
    color: var(--muted-color);
    background: #0f172a;
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .audit-report__tabs .nav-link.active {
    color: var(--text-color);
    background: #111827;
    border-color: var(--border-color);
    box-shadow: inset 0 0 0 1px var(--primary-tint-border);
}

html[data-theme="dark"] .audit-report__progress {
    background: #1f2937;
}

html[data-theme="dark"] .audit-score__ring {
    background: conic-gradient(var(--score-color) calc(var(--score) * 1%), #1f2937 0);
}

html[data-theme="dark"] .audit-score__inner,
html[data-theme="dark"] .audit-history-score::after,
html[data-theme="dark"] .audit-review-score__ring::after {
    background: #0f172a;
}

html[data-theme="dark"] .audit-report__question-bar {
    background: #1f2937;
}

/* Audit report new components — dark */
html[data-theme="dark"] .audit-report__section-mini,
html[data-theme="dark"] .audit-report__severity-card,
html[data-theme="dark"] .audit-report__formula-card,
html[data-theme="dark"] .audit-report__signoff-row,
html[data-theme="dark"] .audit-report__q-card,
html[data-theme="dark"] .audit-report__trigger {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__section-mini-title,
html[data-theme="dark"] .audit-report__severity-label,
html[data-theme="dark"] .audit-report__q-text,
html[data-theme="dark"] .audit-report__toggle-text,
html[data-theme="dark"] .audit-report__stakeholder-name {
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__context-value {
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__toggle-item {
    background: #111827;
    border-color: var(--border-color);
}

html[data-theme="dark"] .audit-report__toggle-item.is-pass {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.25);
}

html[data-theme="dark"] .audit-report__toggle-item.is-fail {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="dark"] .audit-report__q-notes,
html[data-theme="dark"] .audit-report__q-response {
    background: #0f172a;
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__q-bar {
    background: #1f2937;
}

html[data-theme="dark"] .audit-report__checkbox-pill {
    background: #111827;
    border-color: var(--border-color);
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__checkbox-pill.is-selected {
    background: rgba(22, 163, 74, 0.15);
    border-color: rgba(22, 163, 74, 0.3);
    color: #86efac;
}

html[data-theme="dark"] .audit-report__section-note {
    background: var(--primary-tint-bg);
    border-color: var(--primary-tint-border);
}

html[data-theme="dark"] .audit-report__section-note-header {
    color: var(--primary-color);
}

html[data-theme="dark"] .audit-report__section-note-body {
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__gap-item {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.25);
    color: #fca5a5;
}

html[data-theme="dark"] .audit-report__stakeholder-role {
    border-color: var(--border-color);
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__stakeholder-email {
    color: var(--muted-color);
}

html[data-theme="dark"] .audit-report__accordion .accordion-button {
    background: #0f172a;
    color: var(--text-color);
}

html[data-theme="dark"] .audit-report__accordion .accordion-button:not(.collapsed) {
    background: #111827;
    color: var(--text-color);
}

html[data-theme="dark"] .audit-unchecked-accordion .accordion-button {
    background: var(--surface-color);
    color: var(--text-color);
}

html[data-theme="dark"] .audit-unchecked-accordion .accordion-button:not(.collapsed) {
    background: #111827;
    color: var(--text-color);
}

html[data-theme="dark"] .actions-title {
    color: var(--text-color);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
    color: var(--text-color);
}

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-gray-700,
html[data-theme="dark"] .text-black {
    color: var(--text-color) !important;
}

html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-gray-500 {
    color: var(--muted-color) !important;
}

html[data-theme="dark"] .form-text {
    color: var(--muted-color) !important;
}

html[data-theme="dark"] .audit-footer__label,
html[data-theme="dark"] .audit-footer__value {
    color: var(--text-color);
}

html[data-theme="dark"] .mobile-nav {
    background-color: #0f172a;
    border-top-color: var(--border-color);
}

html[data-theme="dark"] .mobile-nav__item {
    color: var(--muted-color);
}

html[data-theme="dark"] .mobile-nav__item.active {
    color: var(--primary-color);
}

/* Dark theme: bootstrap utility safety net */
html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-body {
    color: var(--text-color) !important;
}

html[data-theme="dark"] .text-secondary {
    color: var(--muted-color) !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .alert-light {
    background-color: var(--surface-color) !important;
    color: var(--text-color) !important;
}

html[data-theme="dark"] .border-light {
    border-color: var(--border-color) !important;
}

html[data-theme="dark"] .btn-dark {
    background-color: #1f2937;
    border-color: #1f2937;
    color: var(--text-color);
}

html[data-theme="dark"] .btn-outline-dark {
    color: var(--text-color);
    border-color: var(--border-color);
}

html[data-theme="dark"] .btn-outline-dark:hover {
    background-color: #1f2937;
}

html[data-theme="dark"] .bg-primary.bg-opacity-10 {
    background-color: rgba(var(--primary-color-rgb), 0.18) !important;
}

html[data-theme="dark"] .bg-success.bg-opacity-10 {
    background-color: rgba(34, 197, 94, 0.18) !important;
}

html[data-theme="dark"] .bg-warning.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.18) !important;
}

html[data-theme="dark"] .bg-danger.bg-opacity-10 {
    background-color: rgba(248, 113, 113, 0.18) !important;
}

html[data-theme="dark"] .bg-info.bg-opacity-10 {
    background-color: rgba(56, 189, 248, 0.18) !important;
}

html[data-theme="dark"] .bg-secondary.bg-opacity-10 {
    background-color: rgba(148, 163, 184, 0.18) !important;
}

html[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

/* Audit Calendar */
.audit-calendar-card {
    margin-top: 1.5rem;
}

.audit-calendar-filters {
    margin-bottom: 1.5rem;
}

.audit-calendar {
    width: 100%;
}

.audit-calendar .fc-toolbar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.audit-calendar .fc-button {
    border-radius: 999px;
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
}

.audit-calendar {
    --fc-event-bg-color: var(--primary-color);
    --fc-event-border-color: var(--primary-color);
    --fc-event-text-color: #fff;
    --fc-button-bg-color: var(--primary-color);
    --fc-button-border-color: var(--primary-color);
    --fc-button-text-color: #fff;
    --fc-button-hover-bg-color: var(--primary-hover);
    --fc-button-hover-border-color: var(--primary-hover);
    --fc-button-active-bg-color: var(--primary-dark);
    --fc-button-active-border-color: var(--primary-dark);
    --fc-today-bg-color: rgba(var(--primary-color-rgb), 0.08);
}

.audit-calendar .fc-event {
    border-radius: 10px;
    border: 0;
}

.audit-severity--none {
    --audit-event-bg: rgba(148, 163, 184, 0.2);
    --audit-event-text: #475569;
}

.audit-severity--excellent {
    --audit-event-bg: rgba(22, 163, 74, 0.13);
    --audit-event-text: #16a34a;
}

.audit-severity--healthy {
    --audit-event-bg: rgba(34, 197, 94, 0.13);
    --audit-event-text: #15803d;
}

.audit-severity--needs-attention {
    --audit-event-bg: rgba(245, 158, 11, 0.13);
    --audit-event-text: #b45309;
}

.audit-severity--risky {
    --audit-event-bg: rgba(249, 115, 22, 0.13);
    --audit-event-text: #c2410c;
}

.audit-severity--critical {
    --audit-event-bg: rgba(239, 68, 68, 0.13);
    --audit-event-text: #dc2626;
}

.audit-calendar .fc-event .fc-event-main {
    background: var(--audit-event-bg, rgba(var(--primary-color-rgb), 0.18));
    color: var(--audit-event-text, var(--primary-dark));
    padding: 6px 8px;
    border-radius: 10px;
}

@media (min-width: 768px) {
    .audit-calendar .fc-daygrid-event .fc-event-main {
        background: var(--primary-hover);
        color: #fefefe;
        padding: 0.25rem 0.45rem;
        border-radius: 0.75rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
        font-size: 0.85rem;
    }

    .audit-calendar-desktop-event {
        color: inherit;
        font-weight: 600;
        line-height: 1.2;
        text-transform: none;
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: x-small;
    }

    .audit-calendar .fc-daygrid-event .fc-event-title {
        display: none;
    }

    .audit-calendar .fc-daygrid-event .fc-event-title {
        color: inherit;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
        max-width: 100%;
    }

    .audit-calendar .fc-daygrid-more-link {
        border-radius: 0.75rem;
        padding: 0.15rem 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        background: #0f172a;
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.4);
    }

    .audit-calendar .fc-daygrid-more-link:hover,
    .audit-calendar .fc-daygrid-more-link:focus {
        background: #1f2937;
    }
}

.audit-calendar-dot-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
    padding-top: 0.35rem;
    padding-left: 0.35rem;
}

.audit-calendar-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background-color: var(--audit-event-text, var(--primary-color));
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 0 0 2px rgba(var(--primary-color-rgb), 0.4);
}

.audit-calendar-dot--with-count {
    padding: 0;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.audit-calendar-event-feed {
    display: none;
    font-size: 0.9rem;
    background-color: var(--bs-white, #fff);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

.audit-calendar-event-feed__list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 420px;
    overflow-y: auto;
}

.audit-calendar-event-feed__date-group {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.audit-calendar-event-feed__date-group:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.audit-calendar-event-feed__date-header {
    margin-bottom: 0.75rem;
}

.audit-calendar-event-feed__date-marker {
    min-width: 48px;
    min-height: 48px;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.04);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    gap: 0.05rem;
}

.audit-calendar-event-feed__date-marker-day {
    font-size: 1.35rem;
    line-height: 1;
}

.audit-calendar-event-feed__date-heading {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.audit-calendar-event-feed__date {
    margin: 0;
}

.audit-calendar-event-feed__date-count {
    letter-spacing: 0.08em;
}

.audit-calendar-event-feed__item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    text-decoration: none;
}

.audit-calendar-event-feed__item-body {
    flex: 1;
}

.audit-calendar-event-feed__item-header {
    gap: 0.75rem;
}

.audit-calendar-event-feed__item-title {
    font-weight: 600;
}

.audit-calendar-event-feed__item-status-pill {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.65);
    color: var(--audit-event-text, var(--primary-dark));
    border-color: currentColor;
}

.audit-calendar-event-feed__item-status-pill:empty {
    display: none;
}

.audit-calendar-event-feed__item-meta {
    letter-spacing: 0.04em;
}

.audit-calendar-event-feed__item-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-top: 0.35rem;
    flex-shrink: 0;
}

.audit-calendar-event-feed__date-marker-weekday {
    font-size: 0.7rem;
}

.audit-calendar-event-feed__item-severity-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    background: var(--audit-event-bg, rgba(var(--primary-color-rgb), 0.25));
    color: var(--audit-event-text, var(--primary-dark));
    align-self: flex-start;
}

.audit-calendar-event-feed__item-severity-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background-color: currentColor;
    display: inline-block;
}

@media (max-width: 767.98px) {
    .audit-calendar {
        padding-bottom: 0.5rem;
    }

    .audit-calendar .fc-daygrid-event-harness,
    .audit-calendar .fc-event,
    .audit-calendar .fc-event-main {
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 999px;
        padding: 0 !important;
        min-height: 0;
    }

    .audit-calendar .fc-event {
        height: auto;
    }

    .audit-calendar-dot-wrapper {
        background: transparent;
    }

    .audit-calendar-event-feed {
        display: block;
        margin-top: 0.75rem;
        padding-bottom: 1.5rem;
    }

    .audit-calendar-event-feed__list {
        overflow-y: auto;
        gap: 1rem;
    }

    [data-theme="dark"] .audit-calendar-event-feed {
        background-color: #0b1220;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    }

    [data-theme="dark"] .audit-calendar-event-feed__list {
        max-height: 360px;
    }

    [data-theme="dark"] .audit-calendar-event-feed__item {
        background: rgba(15, 23, 42, 0.75);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    }

    [data-theme="dark"] .audit-calendar-event-feed__item,
    [data-theme="dark"] .audit-calendar-event-feed__item-title,
    [data-theme="dark"] .audit-calendar-event-feed__item-header,
    [data-theme="dark"] .audit-calendar-event-feed__date-header,
    [data-theme="dark"] .audit-calendar-event-feed__date,
    [data-theme="dark"] .audit-calendar-event-feed__item-meta,
    [data-theme="dark"] .audit-calendar-event-feed__date-count,
    [data-theme="dark"] .audit-calendar-event-feed__item-status-pill {
        color: #f8fafc;
    }

    [data-theme="dark"] .audit-calendar-event-feed__item-status-pill {
        background: rgba(255, 255, 255, 0.1);
    }

    [data-theme="dark"] .audit-calendar-event-feed__item-severity-tag {
        border-color: rgba(248, 250, 252, 0.3);
        background: rgba(255, 255, 255, 0.08);
        color: #fefce8;
    }
}

.audit-status--overdue .fc-event-main {
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.audit-status--due-today .fc-event-main {
    border: 1px solid rgba(var(--primary-color-rgb), 0.45);
}

.audit-status--completed .fc-event-main {
    opacity: 0.7;
}

.audit-calendar .fc-list-event-title,
.audit-calendar .fc-list-day-text {
    font-weight: 600;
}

/* Calendar event text truncation */
.audit-calendar .fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Calendar more-link popover */
.audit-calendar .fc-popover {
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1040;
    max-width: 280px;
}

.audit-calendar .fc-popover-header {
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
}

.audit-calendar .fc-popover-body {
    padding: 0.5rem;
    max-height: 260px;
    overflow-y: auto;
}

.audit-calendar .fc-popover-body .fc-event {
    margin-bottom: 4px;
}

/* Calendar more-link styling */
.audit-calendar .fc-more-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-color, var(--primary-color));
    padding: 1px 4px;
    border-radius: 4px;
}

.audit-calendar .fc-more-link:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    text-decoration: none;
}

/* Tablet: tighten event font and toolbar */
@media (max-width: 768px) {
    .audit-calendar-card {
        margin-top: 1rem;
    }

    .audit-calendar .fc-toolbar.fc-header-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }


    .audit-calendar .fc {
        width: 100%;
        overflow-x: auto;
    }

    .audit-calendar-event-feed {
        padding: 1rem;
    }

    .audit-calendar-event-feed__item {
        padding: 0.85rem;
    }
}

[data-theme="dark"] .audit-calendar {
    --fc-border-color: #1f2937;
    --fc-page-bg-color: #0b1220;
    --fc-neutral-bg-color: #111827;
    --fc-neutral-text-color: #94a3b8;
    --fc-button-bg-color: #1f2937;
    --fc-button-border-color: #1f2937;
    --fc-button-text-color: #e2e8f0;
    --fc-button-hover-bg-color: #273449;
    --fc-button-active-bg-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .audit-calendar .fc-event .fc-event-main {
    color: #e2e8f0;
}

[data-theme="dark"] .audit-severity--none {
    --audit-event-bg: rgba(148, 163, 184, 0.2);
    --audit-event-text: #e2e8f0;
}

[data-theme="dark"] .audit-severity--excellent {
    --audit-event-bg: rgba(22, 163, 74, 0.18);
    --audit-event-text: #4ade80;
}

[data-theme="dark"] .audit-severity--healthy {
    --audit-event-bg: rgba(34, 197, 94, 0.18);
    --audit-event-text: #86efac;
}

[data-theme="dark"] .audit-severity--needs-attention {
    --audit-event-bg: rgba(245, 158, 11, 0.18);
    --audit-event-text: #fbbf24;
}

[data-theme="dark"] .audit-severity--risky {
    --audit-event-bg: rgba(249, 115, 22, 0.18);
    --audit-event-text: #fb923c;
}

[data-theme="dark"] .audit-severity--critical {
    --audit-event-bg: rgba(239, 68, 68, 0.18);
    --audit-event-text: #f87171;
}

[data-theme="dark"] .audit-calendar .fc-popover {
    background: var(--surface-color, #111827);
    border-color: var(--border-color, #1f2937);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .audit-calendar .fc-popover-header {
    background: #0f172a;
    color: var(--text-color, #e2e8f0);
}

[data-theme="dark"] .audit-calendar .fc-popover-close {
    color: var(--muted-color, #94a3b8);
}

[data-theme="dark"] .audit-calendar .fc-list-empty {
    background: var(--surface-color, #111827);
    color: var(--muted-color, #94a3b8);
}

[data-theme="dark"] .audit-calendar .fc-list-day-cushion {
    background: #0f172a;
}

[data-theme="dark"] .audit-calendar .fc-list-event:hover td {
    background: #1f2937;
}

/* Audit Calendar Event Popover */
.audit-event-popover.popover {
    --audit-popover-gutter: 0.75rem;
    width: min(340px, calc(100vw - (var(--audit-popover-gutter) * 2)));
    max-width: min(340px, calc(100vw - (var(--audit-popover-gutter) * 2)));
    font-size: 0.82rem;
    border: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.08));
    border-radius: 0.85rem;
    box-shadow: var(--lovable-shadow, 0 25px 45px rgba(15, 23, 42, 0.12));
    overflow: hidden;
}

.audit-event-popover .popover-arrow::before,
.audit-event-popover .popover-arrow::after {
    border-color: transparent;
}

.audit-event-popover.bs-popover-top>.popover-arrow::after,
.audit-event-popover.bs-popover-auto[data-popper-placement^="top"]>.popover-arrow::after {
    border-top-color: var(--surface-color, #fff);
}

.audit-event-popover.bs-popover-bottom>.popover-arrow::after,
.audit-event-popover.bs-popover-auto[data-popper-placement^="bottom"]>.popover-arrow::after {
    border-bottom-color: var(--surface-color, #fff);
}

.audit-event-popover .popover-body {
    padding: 0;
    background: var(--surface-color, #fff);
    border-radius: 0.85rem;
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Popover content root */
.audit-event-pop {
    display: flex;
    flex-direction: column;
}

/* Header: project name + CRM badge */
.audit-event-pop__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.85rem 1rem 0.7rem;
    background: linear-gradient(135deg, #f8faff 0%, #f1f5fb 100%);
    border-bottom: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.06));
}

.audit-event-pop__project-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-color, #1e293b);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.audit-event-pop__crm-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color, var(--primary-color));
    border: 1px solid rgba(var(--primary-color-rgb), 0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Info rows section */
.audit-event-pop__meta {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.6rem 1rem;
}

.audit-event-pop__row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.28rem 0;
    border-bottom: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.05));
}

.audit-event-pop__row:last-child {
    border-bottom: none;
}

.audit-event-pop__row-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted-color, #94a3b8);
}

.audit-event-pop__row-body {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.audit-event-pop__label {
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-color, #94a3b8);
    min-width: 72px;
    flex-shrink: 0;
}

.audit-event-pop__value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color, #1e293b);
    word-break: break-word;
}

/* Team section */
.audit-event-pop__team {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.06));
    background: rgba(248, 250, 252, 0.6);
}

.audit-event-pop__role-group {
    border: 1px solid var(--lovable-outline, rgba(15, 23, 42, 0.08));
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    background: var(--surface-color, #fff);
}

.audit-event-pop__role-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    margin-bottom: 0.45rem;
}

.audit-event-pop__person {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
}

.audit-event-pop__person:first-of-type {
    padding-top: 0;
}

.audit-event-pop__person:last-child {
    padding-bottom: 0;
}

.audit-event-pop__person-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--bs-secondary-bg, #e2e8f0);
    background-image: none;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.audit-event-pop__person-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}


.audit-event-pop__person-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-event-pop__person-email {
    font-size: 0.7rem;
    color: var(--muted-color, #94a3b8);
    text-decoration: none;
    word-break: break-all;
    line-height: 1.3;
    transition: color 0.15s ease;
}

.audit-event-pop__person-email:hover {
    text-decoration: underline;
    color: var(--primary-color, var(--primary-color));
}

/* Mobile event feed info button */
.audit-calendar-event-feed__info-btn {
    color: var(--muted-color, #94a3b8);
    line-height: 1;
    flex-shrink: 0;
    font-size: 0.9rem;
    text-decoration: none !important;
    border: none;
    background: none;
    cursor: pointer;
    box-shadow: none !important;
    padding: 0.1rem 0.2rem;
    border-radius: 0.3rem;
    transition: color 0.15s ease, background 0.15s ease;
}

.audit-calendar-event-feed__info-btn:hover,
.audit-calendar-event-feed__info-btn:focus {
    color: var(--primary-color, var(--primary-color));
    background: rgba(var(--primary-color-rgb), 0.08);
    outline: none;
}

@media (max-width: 575.98px) {
    .audit-event-popover.popover {
        --audit-popover-gutter: 0.5rem;
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
    }

    .audit-event-popover .popover-body {
        max-height: 68vh;
    }
}

/* Dark mode */
[data-theme="dark"] .audit-event-pop__header {
    background: linear-gradient(135deg, #1e293b 0%, #162032 100%);
    border-color: rgba(248, 250, 252, 0.08);
}

[data-theme="dark"] .audit-event-pop__project-name,
[data-theme="dark"] .audit-event-pop__value,
[data-theme="dark"] .audit-event-pop__person-name,
[data-theme="dark"] .audit-event-pop__role-title {
    color: #f1f5f9;
}

[data-theme="dark"] .audit-event-pop__row {
    border-color: rgba(248, 250, 252, 0.07);
}

[data-theme="dark"] .audit-event-pop__role-group {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(248, 250, 252, 0.08);
}

[data-theme="dark"] .audit-event-pop__team {
    background: rgba(15, 23, 42, 0.3);
    border-color: rgba(248, 250, 252, 0.08);
}

[data-theme="dark"] .audit-event-popover .popover-body {
    background: #1a2332;
}

[data-theme="dark"] .audit-event-popover.popover {
    border-color: rgba(248, 250, 252, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .audit-event-popover.bs-popover-top>.popover-arrow::after,
[data-theme="dark"] .audit-event-popover.bs-popover-auto[data-popper-placement^="top"]>.popover-arrow::after {
    border-top-color: #1a2332;
}

[data-theme="dark"] .audit-event-popover.bs-popover-bottom>.popover-arrow::after,
[data-theme="dark"] .audit-event-popover.bs-popover-auto[data-popper-placement^="bottom"]>.popover-arrow::after {
    border-bottom-color: #1a2332;
}

[data-theme="dark"] .audit-event-pop__crm-badge {
    background: rgba(var(--primary-color-rgb), 0.2);
    border-color: rgba(var(--primary-color-rgb), 0.3);
}

/* Audit Impact Section */
.audit-impact-card {
    background: var(--surface-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.impact-metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.impact-metric-icon--success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.key-insight-box {
    background: rgba(79, 70, 229, 0.04);
    border: 1px solid rgba(79, 70, 229, 0.08);
}

[data-theme='dark'] .key-insight-box {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.1);
}

.key-insight-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Root Cause Distribution */
.root-cause-chart-card,
.root-cause-breakdown-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.root-cause-chart-wrapper {
    width: 100%;
    max-width: 280px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.root-cause-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.root-cause-list {
    display: flex;
    flex-direction: column;
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.root-cause-item {
    display: block;
}

.root-cause-item__label {
    max-width: 70%;
}

.root-cause-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.root-cause-progress .progress-bar {
    border-radius: 999px;
    transition: width 0.3s ease;
}

[data-theme='dark'] .root-cause-chart-card,
[data-theme='dark'] .root-cause-breakdown-card {
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme='dark'] .root-cause-progress {
    background: rgba(255, 255, 255, 0.08);
}

.root-cause-legend {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.root-cause-legend__item {
    padding: 0.325rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.04);
    align-items: center;
}

.root-cause-legend__item .root-cause-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

[data-theme='dark'] .root-cause-legend__item {
    background: rgba(255, 255, 255, 0.04);
}

.governance-metric-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    transition: border 0.2s ease;
}

.governance-metric-card:hover {
    border-color: var(--primary-color);
}

.governance-alerts-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.governance-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.governance-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background: rgba(var(--primary-color-rgb), 0.06);
    border-left: 4px solid transparent;
}

.governance-alert__content {
    flex: 1;
}

.governance-alert__severity {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    text-transform: capitalize;
    font-weight: 600;
}

.governance-alert-severity {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
}

.governance-alert-severity--critical {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.governance-alert-severity--high {
    color: #b45309;
    background: rgba(180, 83, 9, 0.1);
}

.governance-alert-severity--medium {
    color: #c2410c;
    background: rgba(194, 65, 12, 0.1);
}

.governance-alert-severity--info {
    color: var(--primary-dark);
    background: rgba(var(--primary-color-rgb), 0.1);
}

.governance-alert--critical {
    border-left-color: #dc2626;
}

.governance-alert--high {
    border-left-color: #f97316;
}

.governance-alert--medium {
    border-left-color: #d97706;
}

.governance-alert--info {
    border-left-color: var(--primary-hover);
}

/* Drag and Drop Reordering */
.draggable-row {
    user-select: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.draggable-row.dragging {
    opacity: 0.2;
    background-color: var(--lovable-surface) !important;
}

.section-index {
    white-space: nowrap !important;
    min-width: 80px;
}

.section-index-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.drag-handle {
    cursor: grab;
    color: var(--muted-color);
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    touch-action: none;
    /* Required for touch reordering */
}

.drag-handle:hover {
    background-color: rgba(15, 23, 42, 0.05);
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-over-top {
    border-top: 3px solid var(--primary-color) !important;
    background-color: rgba(var(--primary-color-rgb), 0.02) !important;
}

.drag-over-bottom {
    border-bottom: 3px solid var(--primary-color) !important;
    background-color: rgba(var(--primary-color-rgb), 0.02) !important;
}

/* Custom drag ghost styling hint */
.row-drag-ghost {
    position: absolute;
    top: -1000px;
    left: -1000px;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: var(--lovable-shadow);
    border: 1px solid var(--primary-color);
    z-index: -1;
    display: flex;
    align-items: center;
    gap: 15px;
    width: auto;
    font-weight: 600;
}


.dragging-touch {}


.audit-question--toggle:has(.audit-toggle-main:checked) {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

html[data-theme="dark"] .audit-question--toggle:has(.audit-toggle-main:checked) {
    background: rgba(21, 128, 61, 0.15);
    border-color: rgba(21, 128, 61, 0.35);
}

/* light */
/* This targets the slider background when the checkbox is checked */
.audit-question--toggle:has(input[type="checkbox"]:checked)::after {
    content: "";
    position: relative;
    left: 59px;
    top: 0%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
}

/* Ensure your existing background color logic stays intact */
.audit-question.audit-question--toggle:has(input[type="checkbox"]:checked) {
    background-color: #dcffdc61;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /* background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2399d39961' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); */
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
    border: 1px solid #99d39961;
}

/* dark */
html[data-theme="dark"] .audit-question.audit-question--toggle:has(input[type="checkbox"]:checked) {
    background-color: rgba(21, 128, 61, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(21, 128, 61, 0.35);
}

/* ───── Management Dashboard ───── */
.mgmt-loader-overlay {
    background: rgba(255, 255, 255, 0.7);
    z-index: 1050;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

html[data-theme="dark"] .mgmt-loader-overlay {
    background: rgba(11, 18, 32, 0.7);
}

.mgmt-kpi-card {
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mgmt-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .mgmt-kpi-card {
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .mgmt-kpi-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.mgmt-kpi-card--primary {
    background: linear-gradient(135deg, var(--primary-tint-bg-subtle) 0%, var(--primary-tint-bg) 100%);
}

.mgmt-kpi-card--success {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf7 100%);
}

.mgmt-kpi-card--info {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
}

.mgmt-kpi-card--danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f1 100%);
}

html[data-theme="dark"] .mgmt-kpi-card--primary {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.08) 0%, rgba(var(--primary-color-rgb), 0.03) 100%);
    border-color: rgba(var(--primary-color-rgb), 0.15);
}

html[data-theme="dark"] .mgmt-kpi-card--success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
    border-color: rgba(16, 185, 129, 0.15);
}

html[data-theme="dark"] .mgmt-kpi-card--info {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0.03) 100%);
    border-color: rgba(14, 165, 233, 0.15);
}

html[data-theme="dark"] .mgmt-kpi-card--danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.03) 100%);
    border-color: rgba(239, 68, 68, 0.15);
}

.mgmt-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.mgmt-kpi-icon--primary {
    background-color: rgba(var(--primary-color-rgb), 0.18);
    color: var(--primary-dark);
}

.mgmt-kpi-icon--success {
    background-color: rgba(16, 185, 129, 0.18);
    color: #059669;
}

.mgmt-kpi-icon--info {
    background-color: rgba(14, 165, 233, 0.17);
    color: #0ea5e9;
}

.mgmt-kpi-icon--danger {
    background-color: rgba(239, 68, 68, 0.14);
    color: #dc2626;
}

.mgmt-kpi-value {
    font-size: 1.9rem;
    line-height: 1.2;
}

.mgmt-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.mgmt-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mgmt-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
    cursor: default;
}

.mgmt-legend-item:hover {
    background: var(--lovable-surface, #f9fafc);
}

html[data-theme="dark"] .mgmt-legend-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.mgmt-legend-swatch {
    width: 10px;
    height: 34px;
    border-radius: 3px;
    flex-shrink: 0;
}

.mgmt-legend-body {
    flex: 1;
    min-width: 0;
}

.mgmt-legend-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color, #334155);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-theme="dark"] .mgmt-legend-label {
    color: #e2e8f0;
}

.mgmt-legend-bar-wrap {
    height: 4px;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

html[data-theme="dark"] .mgmt-legend-bar-wrap {
    background: rgba(255, 255, 255, 0.08);
}

.mgmt-legend-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.mgmt-legend-count {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 26px;
    text-align: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid;
    flex-shrink: 0;
}

.mgmt-issue-row {
    transition: background-color 0.15s ease;
    overflow: hidden;
}

.mgmt-issue-question-wrap {
    min-width: 0;
    flex: 1 1 0%;
    overflow: hidden;
    margin-right: 0.75rem;
}

.mgmt-issue-question {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}

.mgmt-issue-row:hover {
    background-color: rgba(var(--primary-color-rgb), 0.04);
}

html[data-theme="dark"] .mgmt-issue-row:hover {
    background-color: rgba(var(--primary-color-rgb), 0.08);
}

.mgmt-issue-count {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-weight: 700;
    min-width: 56px;
    text-align: center;
}

.mgmt-issue-meta {
    font-size: 0.78rem;
    color: #94a3b8;
}

html[data-theme="dark"] .mgmt-issue-count {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.35);
}

html[data-theme="dark"] .mgmt-issue-meta {
    color: #cbd5e1;
}

.mgmt-action-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mgmt-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.mgmt-action-count {
    font-size: 1.8rem;
    line-height: 1.2;
}

.mgmt-action-card--critical {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.mgmt-action-card--critical .mgmt-action-count {
    color: #ef4444;
}

.mgmt-action-card--high {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.15);
}

.mgmt-action-card--high .mgmt-action-count {
    color: #f97316;
}

.mgmt-action-card--medium {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.15);
}

.mgmt-action-card--medium .mgmt-action-count {
    color: #f59e0b;
}

.mgmt-action-card--low {
    background: rgba(var(--primary-color-rgb), 0.08);
    border-color: rgba(var(--primary-color-rgb), 0.15);
}

.mgmt-action-card--low .mgmt-action-count {
    color: var(--primary-color);
}

html[data-theme="dark"] .mgmt-action-card {
    border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .mgmt-action-card--critical {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
}

html[data-theme="dark"] .mgmt-action-card--high {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.2);
}

html[data-theme="dark"] .mgmt-action-card--medium {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.2);
}

html[data-theme="dark"] .mgmt-action-card--low {
    background: rgba(var(--primary-color-rgb), 0.12);
    border-color: rgba(var(--primary-color-rgb), 0.2);
}

/* ── Management Dashboard — Responsive ────────────────────────── */
.mgmt-health-chart-wrap {
    position: relative;
    width: 100%;
    height: 220px;
    flex-shrink: 0;
}

@media (min-width: 576px) {
    .mgmt-health-chart-wrap {
        width: 45%;
        min-width: 155px;
        max-width: 260px;
        height: 250px;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .mgmt-health-chart-wrap {
        width: 100%;
        max-width: 100%;
        height: 200px;
    }
}

@media (min-width: 1200px) {
    .mgmt-health-chart-wrap {
        width: 45%;
        min-width: 155px;
        max-width: 260px;
        height: 250px;
    }
}

.mgmt-polar-chart-wrap {
    position: relative;
    width: 100%;
    height: 250px;
}

@media (min-width: 576px) {
    .mgmt-polar-chart-wrap {
        height: 280px;
    }
}

.mgmt-issue-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

.mgmt-issue-question-wrap {
    flex: 1 1 100%;
    overflow: visible;
    margin-right: 0;
}

.mgmt-issue-question {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.mgmt-issue-meta-wrap {
    flex-basis: 100%;
    padding-left: 1.75rem;
    margin-top: 0.2rem;
}

@media (max-width: 575.98px) {
    .mgmt-issue-count {
        min-width: 36px;
        padding: 0.25rem 0.45rem;
        font-size: 0.7rem;
    }

    .mgmt-issue-meta {
        font-size: 0.72rem;
    }

    .mgmt-action-count {
        font-size: 1.4rem;
    }

    .mgmt-kpi-value {
        font-size: 1.5rem;
    }
}

/* Hide default DataTable 4-dot processing spinner (replaced by .loader-sm) */
div.dt-processing>div:last-child {
    display: none;
}

/* ── Custom Grid Loader ───────────────────────────────────────────── */
.loader {
    --c: no-repeat linear-gradient(var(--primary-color, #FF6600) 0 0);
    --b: no-repeat linear-gradient(var(--text-color, #334155) 0 0);
    background:
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--b);
    background-size: 16px 16px;
    animation: l32-1 1s infinite, l32-2 1s infinite;
}

.loader-sm {
    --c: no-repeat linear-gradient(var(--primary-color, #FF6600) 0 0);
    --b: no-repeat linear-gradient(var(--text-color, #334155) 0 0);
    background:
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--c),
        var(--c), var(--c), var(--b);
    background-size: 10px 10px;
    animation: l32-1sm 1s infinite, l32-2 1s infinite;
}

@keyframes l32-1 {

    0%,
    100% {
        width: 45px;
        height: 45px;
    }

    35%,
    65% {
        width: 65px;
        height: 65px;
    }
}

@keyframes l32-1sm {

    0%,
    100% {
        width: 28px;
        height: 28px;
    }

    35%,
    65% {
        width: 40px;
        height: 40px;
    }
}

@keyframes l32-2 {

    0%,
    40% {
        background-position: 0 0, 0 50%, 0 100%, 50% 100%, 100% 100%, 100% 50%, 100% 0, 50% 0, 50% 50%;
    }

    60%,
    100% {
        background-position: 0 50%, 0 100%, 50% 100%, 100% 100%, 100% 50%, 100% 0, 50% 0, 0 0, 50% 50%;
    }
}