/* ==========================================================================
   0. Root Variables (Theme Colors)
   ========================================================================== */
:root {
    --akins-dark-green: #033028;
    --akins-lime-green: #08ac10;
    --akins-dark-grey: #343a40; /* Retained for potential future use */
    --akins-light-text: #f8f9fa;
    --akins-muted-text: #adb5bd;
    --bootstrap-red: #dc3545;
    --bootstrap-orange: #fd7e14;
    --bootstrap-yellow: #ffc107;
    --bootstrap-grey: #6c757d;
}

/* ==========================================================================
   1. General Body & Layout Styles
   ========================================================================== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f8f9fa; /* Light grey background */
}

.main-content {
    flex: 1;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* ==========================================================================
   2. Header, Utility Bar & Footer Styles
   ========================================================================== */

/* --- Utility Bar Styles --- */
.utility-bar { /* ... styles ... */
    background-color: #f8f9fa;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: #495057;
}

.utility-bar-contact { /* ... styles ... */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.utility-bar-contact-item { /* ... styles ... */
    color: #495057;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

    .utility-bar-contact-item i { /* ... styles ... */
        margin-right: 0.5rem;
        color: var(--akins-dark-green);
    }

.utility-bar-socials { /* ... styles ... */
    display: flex;
    justify-content: center;
    gap: 1.25rem;
}

    /* Set DEFAULT color using the Primary Brand Color variable */
    .utility-bar-socials a {
        color: var(--akins-dark-green); /* This variable IS overridden by ColorPrimary setting */
        text-decoration: none;
        font-size: 1.1rem;
        transition: color 0.2s ease-in-out;
    }

        /* Set HOVER color using the Accent Brand Color variable */
        .utility-bar-socials a:hover {
            color: var(--akins-lime-green); /* This variable IS overridden by ColorAccent setting */
        }

@media (min-width: 992px) { /* ... styles ... */
    .utility-bar-contact {
        justify-content: flex-start;
    }

    .utility-bar-socials {
        justify-content: flex-end;
    }
}

/* --- Main Header --- */
.app-header { /* ... styles ... */
    background-color: var(--akins-dark-green);
    color: var(--akins-light-text);
    padding: 10px 20px;
}

.navbar-brand img { /* ... styles ... */
    height: 50px;
}

.app-header .nav-link { /* ... styles ... */
    color: var(--akins-light-text);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

    .app-header .nav-link:hover { /* ... styles ... */
        background-color: var(--akins-lime-green);
        color: var(--akins-light-text) !important;
    }

.app-header .navbar-nav .nav-link { /* ... styles ... */
    color: var(--akins-light-text) !important;
}

/* --- Footer --- */
.app-footer { /* ... styles ... */
    background-color: var(--akins-dark-green);
    color: var(--akins-light-text);
    padding-top: 1rem;
    padding-bottom: 1rem;
    font-size: 0.9em;
}

    .app-footer a { /* ... styles ... */
        color: var(--akins-light-text);
        text-decoration: none;
    }

        .app-footer a:hover { /* ... styles ... */
            color: var(--akins-lime-green);
        }

.footer-logo { /* ... styles ... */
    height: 40px;
    opacity: 0.9;
}

.footer-copyright { /* ... styles ... */
    text-align: center;
    font-size: 0.8em;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid #444;
    color: #888;
}

/* ==========================================================================
   3. General Element Styles (Buttons, Tables, etc.)
   ========================================================================== */
.btn-primary {
    background-color: var(--akins-lime-green) !important;
    border-color: var(--akins-lime-green) !important;
}

/* Use Akins Green ONLY for theads with the .table-dark class */
/* --- Table Header Override - Use Akins Green via Bootstrap Variable --- */
body .table > thead.table-dark {
    --bs-table-bg: var(--akins-dark-green); /* Override Bootstrap's background variable */
    --bs-table-border-color: var(--akins-dark-green); /* Override Bootstrap's border variable */
    color: var(--akins-light-text); /* Ensure text remains light */
    /* background-color and border-color with !important can likely be removed now, but keep for safety if needed */
    background-color: var(--akins-dark-green) !important;
    border-color: var(--akins-dark-green) !important;
}

.actions-dropdown .dropdown-toggle::after {
    display: none;
}

/* ==========================================================================
   4. Component Styles (Reusable Widgets)
   ========================================================================== */

/* Dashboard Stat Cards */
.stat-card-container { /* ... styles ... */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.stat-card { /* ... styles ... */
    flex: 0 1 130px;
    aspect-ratio: 1 / 1;
    border-radius: .5rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.stat-number { /* ... styles ... */
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label { /* ... styles ... */
    font-size: 0.8rem;
    margin-top: 0.25rem;
    line-height: 1.2;
}

/* Dashboard Renewal Circles */
.renewal-circle-container { /* ... styles ... */
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-bottom: 2rem;
}

.renewal-circle { /* ... styles ... */
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    color: black;
}

    .renewal-circle:hover { /* ... styles ... */
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }

    .renewal-circle.active { /* ... styles ... */
        box-shadow: 0 0 20px rgba(0,0,0,0.6);
        transform: scale(1.08);
    }

.circle-30 { /* ... styles ... */
    background-color: var(--bootstrap-red);
    color: var(--akins-light-text);
}

.circle-60 { /* ... styles ... */
    background-color: var(--bootstrap-orange);
    color: var(--akins-light-text);
}

.circle-90 { /* ... styles ... */
    background-color: var(--bootstrap-yellow);
}

.circle-count { /* ... styles ... */
    font-size: 2.5rem;
    font-weight: bold;
}

.circle-label { /* ... styles ... */
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Status Badges */
.status-badge { /* ... styles ... */
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    color: #fff;
}

.status-badge-active { /* ... styles ... */
    background-color: var(--akins-lime-green);
}

.status-badge-archived { /* ... styles ... */
    background-color: var(--bootstrap-grey);
}

/* Contract Status Bubbles */
.contract-status-bubble { /* ... styles ... */
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 10rem;
    color: #fff;
}

.contract-status-active { /* ... styles ... */
    background-color: #198754;
}

.contract-status-expired { /* ... styles ... */
    background-color: var(--bootstrap-grey);
}

.contract-status-none { /* ... styles ... */
    background-color: #ced4da;
    color: #495057;
}

/* Contact Cards */
.contact-card { /* ... styles ... */
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    height: 100%;
}

.contact-card-img { /* ... styles ... */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 1rem;
    object-fit: cover;
}

.contact-card-body { /* ... styles ... */
    flex-grow: 1;
}

.contact-name { /* ... styles ... */
    font-weight: bold;
    font-size: 1.1rem;
}

.contact-title { /* ... styles ... */
    color: var(--bootstrap-grey);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.contact-info div { /* ... styles ... */
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.contact-info i { /* ... styles ... */
    color: var(--akins-lime-green);
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.contact-card-edit-btn { /* ... styles ... */
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--bootstrap-grey);
    text-decoration: none;
}

    .contact-card-edit-btn:hover { /* ... styles ... */
        color: var(--akins-lime-green);
    }

/* Overview Lists */
.overview-list .list-group-item { /* ... styles ... */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .overview-list .list-group-item a { /* ... styles ... */
        text-decoration: none;
        font-weight: 500;
    }

/* ==========================================================================
   5. Page-Specific Styles
   ========================================================================== */

/* Login Page */
main.login-main { /* ... styles ... */
    display: flex;
    flex-grow: 1;
}

.login-page-container { /* ... styles ... */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-grow: 1;
    background-color: #02261F;
    padding: 1rem;
    box-sizing: border-box;
}

.login-box { /* ... styles ... */
    background: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    max-width: 380px;
    width: 100%;
    color: #212529;
}

.login-title { /* ... styles ... */
    font-size: 1.5rem;
    color: #212529;
    margin-bottom: 1.5rem;
}

.login-box .form-group { /* ... styles ... */
    margin-bottom: 1rem;
}

.login-box .form-label { /* ... styles ... */
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.login-box .form-control { /* ... styles ... */
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.login-btn, .login-sso-btn { /* ... styles ... */
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}

.login-btn { /* ... styles ... */
    background-color: #28a745;
    border-color: #28a745;
}

    .login-btn:hover { /* ... styles ... */
        background-color: #218838;
        border-color: #1e7e34;
    }

.login-sso-btn { /* ... styles ... */
    background-color: var(--bootstrap-grey);
    border-color: var(--bootstrap-grey);
}

    .login-sso-btn:hover { /* ... styles ... */
        background-color: #5a6268;
        border-color: #545b62;
    }

.login-links { /* ... styles ... */
    margin-top: 1rem;
}

    .login-links p { /* ... styles ... */
        margin-bottom: 0.25rem;
    }

    .login-links a { /* ... styles ... */
        font-size: 0.85rem;
    }

/* SOP Reader Layout */
.sop-container { /* ... styles ... */
    display: flex;
    height: calc(100vh - 180px);
}

.sop-sidebar { /* ... styles ... */
    flex: 0 0 300px;
    padding-right: 20px;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    font-size: 0.9rem;
}

.sop-content { /* ... styles ... */
    flex-grow: 1;
    padding-left: 20px;
    overflow-y: auto;
}

/* SOP Sidebar TOC Styles */
.sop-sidebar p, .sop-sidebar hr {
    display: none;
}

.sop-sidebar h1, .sop-sidebar h2, .sop-sidebar h3 {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.sop-sidebar h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    color: #343a40;
}

    .sop-sidebar h1:first-child {
        margin-top: 0;
    }

.sop-sidebar h2 {
    font-size: 1rem;
    font-weight: 500;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

.sop-sidebar h3 {
    font-size: 0.9rem;
    font-weight: 400;
    padding-left: 2rem;
}

.sop-sidebar ul {
    padding-left: 2rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.sop-sidebar li {
    padding: 0.1rem 0;
}

.sop-sidebar a {
    font-weight: normal;
}

/* SOP Content (Rendered Markdown) Styles */
.sop-content h1, .sop-content h2, .sop-content h3, .sop-content h4, .sop-content h5, .sop-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.sop-content h1 {
    font-size: 1.8rem;
}

.sop-content h2 {
    font-size: 1.5rem;
}

.sop-content h3 {
    font-size: 1.25rem;
}

.sop-content a {
    text-decoration: none;
}

    .sop-content a:hover {
        text-decoration: underline;
    }

.sop-content hr {
    margin: 2rem 0;
}

/* Styles ONLY for content rendered from Markdown */
.markdown-content table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    vertical-align: top;
    border-color: #dee2e6;
    caption-side: bottom;
    border-collapse: collapse;
}

.markdown-content thead {
    background-color: var(--akins-dark-grey);
    color: var(--akins-light-text);
}

.markdown-content td, .markdown-content th {
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.5rem;
}

.markdown-content tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   6. Dashboard Truncation Styles
   ========================================================================== */
.table-truncate-customer { /* ... styles ... */
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-truncate-subject { /* ... styles ... */
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   7. Notification Bell Styles
   ========================================================================== */

.notification-bell {
    position: relative;
    cursor: pointer;
}

/* The little red dot */
.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    background-color: var(--bootstrap-red);
    border-radius: 50%;
    border: 2px solid var(--akins-dark-green); /* Match the header bg */
    display: none; /* Hidden by default */
}

/* When active/has notifications */
.notification-bell.has-notifications .notification-badge {
    display: block;
}

/* Styling for the dropdown menu */
.notification-dropdown {
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

.notification-dropdown .list-group-item {
    padding: 0.75rem 1rem;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
}

    .notification-dropdown .list-group-item:last-child {
        border-bottom: 0;
    }

.notification-dropdown .list-group-item-action:hover {
    background-color: #f8f9fa; /* Light grey hover */
}

.notification-dropdown .text-muted {
    font-size: 0.8rem;
}

/* ==========================================================================
   8. Brand Color Overrides (Fixing Bootstrap Blues)
   ========================================================================== */

/* 1. Default Links */
a {
    color: var(--akins-dark-green);
}

    a:hover {
        color: var(--akins-lime-green);
    }
/* --- Keep header/footer/utility links correct --- */
.app-header .nav-link, .app-footer a, .utility-bar-contact-item {
    color: var(--akins-light-text);
}

.app-header .navbar-brand {
    color: var(--akins-light-text);
}

    .app-header a:hover, .app-footer a:hover {
        color: var(--akins-lime-green);
    }

.utility-bar-contact-item {
    color: #495057;
}

.utility-bar-socials a {
    color: var(--akins-dark-green);
}

    .utility-bar-socials a:hover {
        color: var(--akins-lime-green);
    }


/* 2. Outline Buttons (e.g., "Details", "Next/Prev") */
.btn-outline-primary {
    color: var(--akins-dark-green);
    border-color: var(--akins-dark-green);
}

    .btn-outline-primary:hover {
        color: var(--akins-light-text);
        background-color: var(--akins-dark-green);
        border-color: var(--akins-dark-green);
    }

    .btn-outline-primary.disabled, .btn-outline-primary:disabled {
        color: var(--akins-dark-green);
        background-color: transparent;
    }


/* 3. Active Tabs */
.nav-tabs .nav-link.active {
    color: var(--akins-light-text);
    background-color: var(--akins-dark-green);
    border-color: var(--akins-dark-green);
}
/* --- Non-active tab links --- */
.nav-tabs .nav-link {
    color: var(--akins-dark-green);
}

    .nav-tabs .nav-link:hover {
        color: var(--akins-lime-green);
    }


/* 4. Primary Badges (bg-primary) */
.badge.bg-primary {
    background-color: var(--akins-dark-green) !important;
    color: var(--akins-light-text) !important;
}

/* 5. Info Badges (bg-info) */
.badge.bg-info {
    background-color: var(--akins-lime-green) !important;
    color: var(--akins-dark-green) !important; /* Dark text on lime green */
}

/* ==========================================================================
   9. Markdig / Wiki Content Styles (Final Master)
   ========================================================================== */

/* 1. Base Content Container */
.sop-content, .markdown-content {
    font-size: 0.925rem;
    line-height: 1.5;
    color: #212529;
    max-width: 1100px; /* Prevents reading fatigue on wide monitors */
}

    /* 2. Tame the Headers (Hierarchy) */
    .sop-content h1, .markdown-content h1 {
        font-size: 1.6rem;
        font-weight: 600;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.3rem;
        border-bottom: 1px solid #eaeaea;
        color: var(--akins-dark-green);
    }

    .sop-content h2, .markdown-content h2 {
        font-size: 1.3rem;
        font-weight: 600;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
        color: #343a40;
    }

    .sop-content h3, .markdown-content h3 {
        font-size: 1.1rem;
        font-weight: 600;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        color: #495057;
    }

    /* 3. List Control */
    .sop-content ul, .sop-content ol,
    .markdown-content ul, .markdown-content ol {
        padding-left: 1.5rem;
        margin-bottom: 1rem;
    }

    .sop-content li, .markdown-content li {
        margin-bottom: 0.25rem;
    }

    /* 4. Sleek Code Blocks (Akins Terminal Style) */
    .markdown-content pre {
        background-color: #033028; /* Akins Primary Dark Green */
        color: #08ac10; /* Akins Lime Green */

        font-size: 0.85em;
        padding: 0.75rem 1.5rem 0.75rem 0.75rem;
        border-radius: 6px;
        margin: 0.5rem 0 1.25rem 0;
        /* Shrink-wrap logic */
        width: fit-content;
        min-width: 200px;
        max-width: 100%;
        overflow-x: auto;
        border: 1px solid #054a3e;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

        /* Ensure text inside the block inherits the Lime Green */
        .markdown-content pre code {
            font-family: 'Cascadia Code', Consolas, 'Courier New', monospace;
            white-space: pre;
            background-color: transparent;
            padding: 0;
            color: inherit;
        }

    /* 5. Inline Code (Pink/Red High Contrast) */
    .markdown-content code:not(pre code) {
        color: #d63384; /* Bootstrap Pink/Red for contrast */
        background-color: #f8f9fa; /* Light grey background */
        padding: 0.1rem 0.3rem;
        border-radius: 3px;
        font-size: 0.9em;
        font-family: 'Cascadia Code', Consolas, monospace;
        border: 1px solid #e9ecef;
    }

    /* 6. Compact Tables */
    .markdown-content table {
        width: 100%;
        font-size: 0.9rem;
        margin-bottom: 1rem;
        border-collapse: collapse;
        border: 1px solid #dee2e6;
    }

    .markdown-content th {
        background-color: #f8f9fa;
        color: #212529;
        font-weight: 600;
        text-align: left;
        padding: 0.5rem 0.75rem;
        border-bottom: 2px solid #dee2e6;
    }

    .markdown-content td {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid #dee2e6;
        vertical-align: top;
    }

    .markdown-content tbody tr:hover {
        background-color: rgba(0,0,0,0.02);
    }