/* NAVCDP Dashboard - Modern UI/UX Styles */

:root {
    /* NAVCDP Brand Colors */
    --navcdp-primary: #56ab2f; /* Green */
    --navcdp-primary-dark: #2d5016; /* Dark Green */
    --navcdp-primary-light: #a8e6cf; /* Light Green */
    --navcdp-secondary: #8b6914; /* Brown */
    --navcdp-accent: #ffc107; /* Yellow/Gold */
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    --gray-900: #0d1117;
    
    /* Sidebar (dark theme) */
    --sidebar-bg: #080c13;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
    --sidebar-text: #c8d0dc;
    --sidebar-text-muted: #8b95a5;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: rgba(86, 171, 47, 0.18);
    --sidebar-active-text: #a8e6cf;

    /* Spacing */
    --sidebar-width: 220px;
    --navbar-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    height: var(--navbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--navcdp-primary) !important;
    text-decoration: none;
    transition: var(--transition-fast);
}

.navbar-brand:hover {
    color: var(--navcdp-primary-dark) !important;
    transform: translateY(-1px);
}

.navbar-logo {
    height: 40px;
    width: auto;
    max-height: 44px;
    object-fit: contain;
}

a.fpo-name-link:hover {
    text-decoration: underline !important;
}

.navbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.navbar-brand-text .brand-acronym {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navcdp-primary);
}

.navbar-brand-text .brand-full {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--gray-600);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.navbar .dropdown-toggle {
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.navbar .dropdown-toggle:hover {
    background: var(--gray-50);
    color: var(--navcdp-primary);
}

.navbar-toggler {
    border: 1px solid var(--gray-300);
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.navbar-toggler:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(86, 171, 47, 0.25);
    outline: none;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 1.5em;
    height: 1.5em;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    transition: var(--transition);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

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

.sidebar .nav {
    padding: 1rem 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--transition-fast);
    margin: 0.25rem 0.75rem;
    border-radius: var(--border-radius-sm);
}

.sidebar .nav-link i:not(.nav-external-icon) {
    width: 22px;
    font-size: 1.1rem;
    margin-right: 12px;
    text-align: center;
    transition: var(--transition-fast);
    color: var(--sidebar-text-muted);
}

.sidebar .nav-link:hover {
    background: var(--sidebar-bg-hover);
    color: var(--white);
    transform: translateX(2px);
}

.sidebar .nav-link:hover i:not(.nav-external-icon) {
    color: var(--navcdp-primary-light);
    transform: scale(1.1);
}

.sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--navcdp-primary);
}

.sidebar .nav-link.active i:not(.nav-external-icon) {
    color: var(--navcdp-primary);
}

.sidebar .nav-link-external .nav-external-icon {
    width: auto;
    margin-left: auto;
    margin-right: 0;
    font-size: 0.7rem;
    opacity: 0.5;
    transition: var(--transition-fast);
}

.sidebar .nav-link-external:hover .nav-external-icon {
    opacity: 1;
    color: var(--navcdp-primary-light);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 2rem;
    min-height: calc(100vh - var(--navbar-height));
    transition: var(--transition);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1019;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Sidebar Header for Mobile */
.sidebar-header {
    display: none;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--white);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: var(--sidebar-bg-hover);
    color: var(--white);
}

@media (max-width: 768px) {
    body.sidebar-open {
        overflow: hidden;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1020;
        width: 280px;
        max-width: 85vw;
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-header {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
    overflow: hidden;
}

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

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   STATISTICS CARDS
   ============================================ */
.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(86, 171, 47, 0.1) 0%, transparent 100%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.success {
    border-left-color: var(--navcdp-primary);
}

.stat-card.info {
    border-left-color: #17a2b8;
}

.stat-card.warning {
    border-left-color: var(--navcdp-accent);
}

.stat-card.danger {
    border-left-color: #dc3545;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-card .stat-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    opacity: 0.1;
    color: var(--navcdp-primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: var(--transition-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--navcdp-primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--navcdp-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    border: 2px solid var(--navcdp-primary);
    color: var(--navcdp-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--navcdp-primary);
    color: var(--white);
}

/* ============================================
   SKELETON LOADERS
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

.skeleton-title {
    height: 1.75rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.skeleton-table-cell {
    flex: 1;
    height: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-badge {
    width: 80px;
    height: 24px;
    border-radius: 12px;
}

/* Table Skeleton */
.table-skeleton {
    display: table;
    width: 100%;
}

.table-skeleton .skeleton-row {
    display: table-row;
}

.table-skeleton .skeleton-cell {
    display: table-cell;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.skeleton-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    padding: 1rem;
    overflow: hidden;
}

.table-loading-host {
    position: relative;
    min-height: 220px;
}

/* ============================================
   FORMS
   ============================================ */
.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.form-control,
.form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    padding: 0.625rem 0.875rem;
    transition: var(--transition-fast);
    font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--navcdp-primary);
    box-shadow: 0 0 0 3px rgba(86, 171, 47, 0.1);
    outline: none;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: var(--navcdp-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--navcdp-primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--gray-600);
}

/* ============================================
   PAGE HEADERS
   ============================================ */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h2 i {
    color: var(--navcdp-primary);
}

.page-header p {
    color: var(--gray-600);
    margin: 0;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead {
    background: var(--gray-50);
}

.table thead th {
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

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

.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8125rem;
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--navcdp-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   UTILITIES
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.4s ease-out;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.75rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .navbar-brand-text .brand-acronym {
        font-size: 1rem;
    }
    
    .navbar-brand-text .brand-full {
        font-size: 0.6rem;
    }
    
    .navbar-logo {
        height: 35px;
    }
    
    .navbar {
        padding: 0 1rem;
    }
    
    .navbar .dropdown-toggle {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .sidebar .nav-link {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .sidebar .nav-link i:not(.nav-external-icon) {
        width: 20px;
        font-size: 1rem;
        margin-right: 10px;
    }
}

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

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

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

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

/* ============================================
   APP SHELL (unified dashboard layout)
   ============================================ */
:root {
    --sidebar-bg: #1a2b20;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.08);
    --sidebar-bg-active: rgba(255, 255, 255, 0.12);
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-text-active: #ffffff;
    --sidebar-width: 248px;
    --topbar-height: 64px;
}

body {
    background: #f4f5f7;
}

.navbar { display: none !important; }

.app-shell {
    display: flex;
    min-height: 100vh;
    background: #f4f5f7;
}

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}

.app-topbar-start { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }

.app-topbar-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--white);
    color: var(--gray-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-topbar-eyebrow {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-500);
}

.app-topbar-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar-end { display: flex; align-items: center; gap: 0.85rem; flex-shrink: 0; }

.scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(86, 171, 47, 0.1);
    color: var(--navcdp-primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.45rem 0.3rem 0.35rem;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    background: var(--white);
}

.app-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navcdp-primary), var(--navcdp-primary-dark));
    color: var(--white);
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-user-avatar--lg { width: 42px; height: 42px; font-size: 0.9rem; }
.app-user-meta { flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.app-user-name { font-size: 0.84rem; font-weight: 600; color: var(--gray-900); }
.app-user-role { font-size: 0.72rem; color: var(--gray-500); }
.app-user-chevron { font-size: 0.65rem; color: var(--gray-400); margin-right: 0.15rem; }
.app-user-dropdown { width: 260px; padding: 0.35rem; border-radius: 12px; box-shadow: var(--shadow-lg); }
.app-user-dropdown-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.75rem; }
.app-user-dropdown-name { font-size: 0.9rem; font-weight: 600; }
.app-user-dropdown-role { font-size: 0.75rem; color: var(--gray-500); }

.app-footer {
    margin-top: auto;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    padding: 0.9rem 1.5rem;
}

.app-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    font-size: 0.78rem;
    color: var(--gray-500);
}

.app-footer-copy strong { color: var(--gray-700); font-weight: 600; }
.app-footer-sep { margin: 0 0.35rem; opacity: 0.5; }
.app-footer-meta { display: flex; align-items: center; gap: 1rem; }
.app-footer-meta a { color: var(--navcdp-primary-dark); text-decoration: none; font-weight: 500; }

.sidebar {
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-right: none;
    box-shadow: none;
}

.sidebar-brand {
    padding: 1.1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-brand-link { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.sidebar-brand-logo { width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand-mark {
    width: 42px; height: 42px; border-radius: 10px;
    background: rgba(86, 171, 47, 0.18); color: #a8e6cf;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.sidebar-brand-title { font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-brand-sub {
    font-size: 0.68rem; font-weight: 500; letter-spacing: 0.04em;
    text-transform: uppercase; color: rgba(255, 255, 255, 0.55);
}

.sidebar-nav { flex: 1; overflow-y: auto; }
.sidebar .nav { padding: 0.85rem 0.65rem; }
.sidebar .nav-link {
    border-radius: 8px;
    margin: 0.1rem 0;
    box-shadow: none;
}
.sidebar .nav-link.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
    box-shadow: none;
}

.main-content {
    margin-left: 0;
    margin-top: 0;
    padding: 1.35rem 1.5rem 1.5rem;
    min-height: 0;
    flex: 1;
}

.filter-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.15rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.85rem 1.25rem;
}

.filter-grid { display: flex; flex-wrap: wrap; gap: 0.85rem 1rem; flex: 1; }
.filter-field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.3rem;
}
.filter-field--wide { min-width: 200px; flex: 1; }

.filter-panel--compact {
    padding: 0.8rem 1rem;
    gap: 0.65rem 0.85rem;
    flex-wrap: nowrap;
    align-items: flex-end;
}

.filter-panel--compact .filter-grid {
    flex-wrap: nowrap;
    gap: 0.6rem 0.75rem;
    align-items: flex-end;
    min-width: 0;
    flex: 1;
}

.filter-panel--compact .filter-field label {
    font-size: 0.62rem;
    margin-bottom: 0.22rem;
    letter-spacing: 0.03em;
}

.filter-panel--compact .filter-field .form-control,
.filter-panel--compact .filter-field .form-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    min-height: 1.85rem;
    line-height: 1.4;
}

.filter-panel--compact .filter-field--search {
    flex: 0 1 160px;
    min-width: 110px;
    max-width: 180px;
}

.filter-panel--compact .filter-field--period {
    flex: 0 0 128px;
}

.filter-panel--compact .filter-field--select {
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 130px;
}

.filter-panel--compact .filter-field--county {
    flex: 0 0 115px;
}

.filter-panel--compact .btn-filter-clear {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
    flex-shrink: 0;
    min-height: 1.85rem;
}

.navcdp-dt-footer .dataTables_length label,
.navcdp-dt-footer .dataTables_info {
    margin-bottom: 0;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.navcdp-dt-footer .dataTables_length select {
    font-size: 0.8rem;
    padding: 0.2rem 1.5rem 0.2rem 0.45rem;
    min-height: 1.75rem;
    margin: 0 0.35rem;
}

.data-card > .navcdp-dt-footer {
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

@media (max-width: 991px) {
    .filter-panel--compact {
        flex-wrap: wrap;
    }
    .filter-panel--compact .filter-grid {
        flex-wrap: wrap;
    }
}

.btn-filter-clear {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
}

.data-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--gray-200);
}

.data-card-title { font-size: 0.95rem; font-weight: 700; margin: 0; }
.data-card-count { font-size: 0.78rem; color: var(--gray-500); font-weight: 500; }

.data-card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-export-csv {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--gray-700);
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
}

.btn-export-csv:hover {
    background: #f0f7eb;
    border-color: var(--navcdp-primary);
    color: var(--navcdp-primary-dark);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.data-card-hint {
    margin-top: 0.2rem;
    color: var(--gray-500);
    font-size: 0.75rem;
}

.county-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
}

.county-detail-heading__main {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.county-detail-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    color: var(--gray-700);
    background: var(--gray-50);
    text-decoration: none;
}

.county-detail-back:hover {
    color: var(--navcdp-primary-dark);
    border-color: var(--navcdp-primary);
    background: rgba(76, 175, 80, 0.08);
}

.county-detail-eyebrow {
    margin-bottom: 0.15rem;
    color: var(--gray-500);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.county-detail-heading h2 {
    margin: 0;
    color: var(--gray-900);
    font-size: 1.2rem;
    font-weight: 700;
}

.county-detail-heading p {
    margin: 0.2rem 0 0;
    color: var(--gray-500);
    font-size: 0.78rem;
}

.county-detail-period {
    flex: 0 0 auto;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 999px;
    background: rgba(76, 175, 80, 0.08);
    color: var(--navcdp-primary-dark);
    font-size: 0.76rem;
    font-weight: 700;
}

.dashboard-table-scroll {
    max-height: min(580px, calc(100vh - 220px));
    overflow: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.dashboard-table-scroll .table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
}

.dashboard-table-scroll table.dataTable thead > tr > th {
    position: sticky !important;
    top: 0;
    z-index: 3;
    background: var(--gray-50);
    box-shadow: 0 1px 0 var(--gray-200);
}

.dashboard-table-scroll thead th.col-county-sticky {
    z-index: 5;
    background: var(--gray-50);
}

#countiesTable th.col-county-sticky,
#countiesTable td.col-county-sticky,
#countyFposTable th.col-county-sticky,
#countyFposTable td.col-county-sticky,
#countyFposTable th.col-fpo-sticky,
#countyFposTable td.col-fpo-sticky,
#fposTable th.col-fpo-sticky,
#fposTable td.col-fpo-sticky,
#reportsTable th.col-fpo-sticky,
#reportsTable td.col-fpo-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--white);
    min-width: 140px;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
}

#countiesTable thead th.col-county-sticky,
#countyFposTable thead th.col-county-sticky,
#countyFposTable thead th.col-fpo-sticky,
#fposTable thead th.col-fpo-sticky,
#reportsTable thead th.col-fpo-sticky {
    z-index: 5;
    background: var(--gray-50);
    box-shadow: 1px 0 0 var(--gray-200), 0 1px 0 var(--gray-200);
}

#countiesTable tbody tr:hover td.col-county-sticky,
#countyFposTable tbody tr:hover td.col-county-sticky,
#countyFposTable tbody tr:hover td.col-fpo-sticky,
#fposTable tbody tr:hover td.col-fpo-sticky,
#reportsTable tbody tr:hover td.col-fpo-sticky {
    background: var(--gray-50);
}

#countiesTable, #countyFposTable { min-width: 1400px; }

.entity-name-link {
    color: var(--navcdp-primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.entity-name-link:hover {
    color: var(--navcdp-primary);
    text-decoration: none;
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-500);
    font-size: 0.78rem;
}

a.county-link {
    color: var(--navcdp-primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.btn-table-action {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    background: var(--white);
    text-decoration: none;
}

.stat-card {
    border-left: none !important;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}

.stat-card .stat-value { font-size: 1.35rem; font-weight: 700; }
.stat-card .stat-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.5rem;
    opacity: 0.12;
    color: var(--navcdp-primary);
}

@media (max-width: 768px) {
    .app-main { margin-left: 0; }
    .main-content { padding: 1rem; }
    .app-topbar { padding: 0 1rem; }
    .app-topbar-title { font-size: 1rem; }
    .scope-badge { display: none; }
    .county-detail-heading { align-items: flex-start; }
    .county-detail-heading p { display: none; }
    .county-detail-period { font-size: 0.7rem; }
}

/* FPO Reports Insights */
.reports-insights-page { padding-bottom: 2rem; }
.reports-hub-page { padding-bottom: 2rem; }
.reports-report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    padding: 0 1rem 1rem;
}
.reports-report-type-field { min-width: min(100%, 320px); flex: 1 1 280px; }
.reports-report-desc { font-size: 0.78rem; color: #6c757d; margin-top: 0.15rem; }
.reports-status--top_performer { background: #dff3e8; color: #12603d; }
.reports-status--mid_performer { background: #eef6ff; color: #1a5a8a; }
.reports-status--low_performer { background: #fff1c8; color: #795a00; }
.analytics-page { padding-bottom: 2rem; }
.analytics-chart-card .data-card-header { padding-bottom: 0; }
.analytics-chart-wrap { position: relative; height: 280px; padding: 0 1rem 1rem; }
.analytics-chart-wrap--short { height: 240px; }
.reports-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: linear-gradient(125deg, var(--navcdp-primary-dark), var(--navcdp-primary));
    color: #fff;
    margin-bottom: 1rem;
}
.reports-hero h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.reports-hero p { margin: 0.2rem 0 0; font-size: 0.82rem; color: rgba(255,255,255,.78); }
.reports-tabs .nav-link { font-size: 0.82rem; font-weight: 650; color: #5d6b64; border: 0; border-bottom: 3px solid transparent; padding: 0.65rem 0.85rem; }
.reports-tabs .nav-link.active { color: var(--navcdp-primary-dark); border-bottom-color: var(--navcdp-primary); background: transparent; }
.reports-state { padding: 3rem 1rem; text-align: center; color: #66756d; background: #fff; border: 1px dashed #cfd9d3; border-radius: 12px; }
.reports-state--error { color: #a63434; background: #fff7f7; border-color: #efc4c4; }
.reports-kpi { position: relative; background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 1rem; min-height: 96px; }
.reports-kpi > i { position: absolute; top: 0.85rem; right: 0.85rem; color: rgba(86,171,47,.18); font-size: 1.4rem; }
.reports-kpi-label { color: #68766f; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.reports-kpi-value { margin-top: 0.45rem; color: var(--navcdp-primary-dark); font-size: 1.35rem; font-weight: 750; line-height: 1.15; }
.reports-kpi-hint { margin-top: 0.35rem; color: #819087; font-size: 0.7rem; }
.reports-panel { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 1rem; height: 100%; }
.reports-panel-title { color: var(--navcdp-primary-dark); font-size: 0.9rem; font-weight: 750; margin: 0; }
.reports-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.reports-chart { position: relative; height: 280px; }
.reports-table { margin: 0; font-size: 0.78rem; }
.reports-table thead th { padding: 0.65rem; background: #f6f9f7; color: #56655e; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.035em; white-space: nowrap; }
.reports-table tbody td { padding: 0.65rem; vertical-align: middle; }
.reports-alert { font-size: 0.78rem; padding: 0.55rem 0.75rem; border-radius: 8px; margin-bottom: 0.5rem; }
.reports-alert--warning { background: #fff8e6; border-left: 3px solid #d5a21b; }
.reports-alert--info { background: #eef6ff; border-left: 3px solid #4ba3d8; }
.reports-alert--muted { background: #f3f5f4; border-left: 3px solid #9aa8a0; color: #5f6b65; }
.reports-status { display: inline-block; padding: 0.18rem 0.48rem; border-radius: 999px; font-size: 0.62rem; font-weight: 750; background: #edf1ef; color: #58645e; }
.reports-status--verified { background: #dff3e8; color: #12603d; }
.reports-status--submitted { background: #fff1c8; color: #795a00; }
.reports-status--rejected { background: #fde3e3; color: #a12b2b; }
.reports-status--draft, .reports-status--not_submitted { background: #e7edf1; color: #4c5d67; }
.reports-status--aligned { background: #dff3e8; color: #12603d; }
.reports-status--variance { background: #fff1c8; color: #795a00; }
.reports-status--submission_only, .reports-status--mis_only, .reports-status--neither { background: #f0f1f1; color: #6b7570; }
.reports-drill { color: var(--navcdp-primary-dark); font-weight: 650; text-decoration: none; font-size: 0.75rem; }
.reports-drill:hover { color: var(--navcdp-primary); text-decoration: underline; }
.reports-progress { display: inline-block; width: 64px; height: 5px; margin-right: 0.35rem; background: #e5ebe8; border-radius: 999px; vertical-align: middle; overflow: hidden; }
.reports-progress span { display: block; height: 100%; background: var(--navcdp-primary); }
.reports-download-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.reports-download-card { border: 1px solid var(--gray-200); border-radius: 12px; padding: 1rem; background: #fff; display: flex; flex-direction: column; gap: 0.5rem; height: 100%; }
.reports-download-card h6 { margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--navcdp-primary-dark); }
.reports-download-card p { margin: 0; font-size: 0.75rem; color: #6c757d; flex: 1; }
@media (max-width: 767px) {
    .reports-tabs .nav-link { padding: 0.55rem 0.5rem; font-size: 0.72rem; }
    .reports-chart { height: 220px; }
}
