:root {
    --primary: #2563eb;
    /* Trust Blue */
    --primary-dark: #1d4ed8;
    --secondary: #0f172a;
    /* Slate Dark */
    --text: #334155;
    /* Slate 700 */
    --text-light: #64748b;
    /* Slate 500 */
    --bg: #f8fafc;
    /* Slate 50 */
    --surface: #ffffff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --border: #e2e8f0;
    --nav-height: 70px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #f8fafc;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-top: var(--nav-height);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--secondary);
    line-height: 1.25;
}

/* --- Navigation --- */
nav.audit-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    z-index: 1000;
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand span {
    color: var(--secondary);
    font-weight: 400;
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* Mobile Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.mobile-menu-toggle i {
    position: relative;
    z-index: 2;
}

/* --- Layout --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.audit-header {
    padding: 3rem 0 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    background: linear-gradient(to bottom, var(--bg), #eff6ff);
}

.audit-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.audit-header p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto;
}

.audit-content {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    padding-bottom: 5rem;
    margin-top: 2rem;
}

/* --- Sidebar --- */
.audit-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 2rem);
    height: fit-content;
}

.sidebar-menu {
    list-style: none;
    padding-bottom: 2rem;
    /* Buffer for scrolling */
}

.sidebar-menu-header {
    font-weight: 700;
    color: var(--secondary);
    margin: 20px 0 10px;
    padding-left: 15px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.sidebar-menu-header:first-child {
    margin-top: 0;
}

.sidebar-menu a {
    display: block;
    padding: 8px 15px;
    color: var(--text-light);
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.sidebar-menu a:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.sidebar-menu a.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    font-weight: 600;
}

/* --- Mobile Menu Drawer --- */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--surface);
    z-index: 1002;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.mobile-menu-drawer.active {
    right: 0;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* --- Main Content --- */
.audit-body {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.audit-section {
    margin-bottom: 3rem;
}

.audit-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Components --- */
.info-box {
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.info-box.danger {
    background: rgba(220, 38, 38, 0.04);
    border-color: rgba(220, 38, 38, 0.2);
}

.info-box.danger h4 {
    color: var(--danger);
}

.info-box.success {
    background: rgba(22, 163, 74, 0.04);
    border-color: rgba(22, 163, 74, 0.2);
}

.info-box.success h4 {
    color: var(--success);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
    transition: transform 0.3s, opacity 0.3s;
}

.status-badge.verified {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.status-badge.disclosure {
    background: rgba(202, 138, 4, 0.1);
    color: var(--warning);
    border: 1px solid rgba(202, 138, 4, 0.2);
}

/* --- Tables --- */
.permission-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.permission-table th {
    background: var(--bg);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--secondary);
    border-bottom: 2px solid var(--border);
}

.permission-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    min-width: 160px;
    /* Prevent text crushing */
    vertical-align: top;
}

.permission-table tr:last-child td {
    border-bottom: none;
}

.permission-table tr:hover {
    background: rgba(37, 99, 235, 0.02);
}

/* --- Footer --- */
.audit-footer {
    margin-top: 5rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    background: var(--bg);
    text-align: center;
}

.audit-footer p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.audit-footer a {
    color: var(--primary);
    margin-left: 0.5rem;
}

.audit-footer a:hover {
    text-decoration: underline;
}

/* --- Page Navigation --- */
.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 3rem 0 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: nowrap;
}

.page-navigation .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.page-navigation .nav-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
    transform: translateX(0);
}

.page-navigation .prev-btn:hover {
    transform: translateX(-4px);
}

.page-navigation .next-btn {
    margin-left: auto;
}

.page-navigation .next-btn:hover {
    transform: translateX(4px);
}

.page-navigation .nav-btn i {
    transition: transform 0.2s;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .page-navigation .nav-btn {
        font-size: 0.85rem;
        padding: 10px 16px;
        gap: 6px;
    }
}

/* --- Responsive Media Queries --- */
@media (max-width: 900px) {
    .container {
        padding: 0 16px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .audit-content {
        grid-template-columns: 1fr;
        /* Full width content */
        gap: 2rem;
    }

    .audit-sidebar {
        display: none;
        /* Hide standard sidebar on mobile */
    }

    .nav-links {
        display: none;
        /* Hide header links */
    }

    .mobile-menu-toggle {
        display: block !important;
        /* Show hamburger */
        font-size: 1.8rem;
        padding: 5px;
        z-index: 1010;
    }

    .audit-body {
        padding: 1.5rem;
        overflow-x: hidden;
    }

    .audit-header {
        padding: 2rem 16px 1.5rem;
    }

    .audit-header h1 {
        font-size: 1.8rem;
        word-wrap: break-word;
    }

    .audit-header p {
        font-size: 1rem;
    }

    .audit-section h2 {
        font-size: 1.3rem;
        word-wrap: break-word;
    }

    .info-box {
        overflow-x: auto;
    }
}

@media (max-width: 600px) {
    body {
        overflow-x: hidden;
    }

    .container {
        padding: 0 12px;
    }

    .audit-header {
        padding: 1.5rem 12px 1rem;
    }

    .audit-header h1 {
        font-size: 1.6rem;
    }

    .audit-header p {
        font-size: 0.95rem;
    }

    .audit-body {
        padding: 1.2rem;
    }

    .audit-section h2 {
        font-size: 1.2rem;
    }

    .permission-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-brand span {
        font-size: 0.95rem;
    }
}