/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Tool Colors */
    --fep-blue: #007bff; --fep-bg: #eff6ff;
    --analytics-amber: #F59E0B; --analytics-bg: #FFFBEB;
    --simulator-green: #10B981; --simulator-bg: #ECFDF5;
    --diagnostics-purple: #8b5cf6; --diagnostics-bg: #f5f3ff;
    --amp-rose: #E11D48; --amp-bg: #FFF1F2;
    --locked-gray: #64748B;
    
    /* Brand & UI Colors */
    --bg: #F8FAFC;
    --panel: #ffffff;
    --edge: #E2E8F0;
    --edge-strong: #CBD5E1;
    --muted: #64748B;
    --text: #0F172A;
    --accent: #0F766E;        /* Teal 700 */
    --accent-light: #14B8A6;  /* Teal 500 */
    --accent-dark: #134E4A;   /* Teal 900 */
    
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05);
}

html, body { height: 100%; margin: 0; }
body {
    display: flex; flex-direction: column; min-height: 100vh;
    background-color: var(--bg); overflow-x: hidden;
    font-family: var(--font-body, sans-serif);
}
main { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; padding: 0; }
footer {
    flex-shrink: 0; margin-top: auto; padding: 4rem 0; 
    border-top: 1px solid var(--edge); text-align: center; 
    color: var(--muted); font-size: 1.4rem; background: var(--bg);
}

/* =========================================
   2. NAVIGATION MOBILE MENU
   ========================================= */
/* --- Mobile Toggle Button --- */
.nav-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    z-index: 1001;
}

.nav-toggle span {
    display: block; width: 24px; height: 2px;
    background-color: var(--text); border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- Mobile Overlay (The Container) --- */
.nav-overlay {
    position: fixed; /* Fixes to viewport, never pushes content */
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 9999; /* Highest priority */
    visibility: hidden; /* Hide completely when closed */
    transition: visibility 0.3s;
}

.nav-overlay.open { visibility: visible; }

/* The Dark Backdrop */
.nav-overlay__backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.nav-overlay.open .nav-overlay__backdrop { opacity: 1; }

/* The Drawer (White Box) */
.nav-overlay__card {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    max-height: 25vh;
    width: 280px; max-width: 80%;
    background: #fff;
    padding: 2rem;
    box-shadow: -5px 0 20px rgba(0,0,0,0.15);
    transform: translateX(100%); /* Start off-screen right */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}

.nav-overlay.open .nav-overlay__card { transform: translateX(0); }

/* Drawer Content Styling */
.nav-overlay__header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; border-bottom: 1px solid var(--edge); padding-bottom: 1rem;
}

.close-icon {
    position: absolute;
    top: 0;
    right: 0;
    background: none; border: none; font-size: 2rem; line-height: 1;
    color: var(--muted); cursor: pointer; padding: 0 5px;
}

.nav-menu { list-style: none; padding: 0; margin: 0; }
.nav-menu li { margin-bottom: 0.5rem; }

.nav-menu a {
    display: block; padding: 0.8rem 0;
    font-size: 1.2rem; color: var(--text);
    text-decoration: none; font-weight: 600;
}
.nav-menu a:hover { color: var(--accent); }

/* --- Mobile Breakpoint --- */
@media (max-width: 768px) {
    .nav-links { display: none; } /* Hide Desktop Links */
    .nav-toggle { display: flex; } /* Show Hamburger */
}


/* =========================================
   3. AUTH SCREEN
   ========================================= */
.auth-wrapper {
    flex: 1; width: 100%; display: flex; align-items: center;     
    justify-content: center; padding: 2rem;
    background: radial-gradient(circle at 50% 50%, #f8fafc 0%, #e2e8f0 100%);
}
.auth-card {
    background: #fff; width: 100%; max-width: 400px;
    padding: 4rem 3rem; border-radius: var(--radius-lg);
    border: 1px solid var(--edge); box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 2.4rem; }
.auth-header h2 { font-size: 2.2rem; color: var(--text); margin-bottom: 0.5rem; }
.auth-header p { font-size: 1.4rem; color: var(--muted); }
.lock-ring {
    background: #F1F5F9; color: var(--muted); width: 50px; height: 50px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
}
.auth-form { display: flex; flex-direction: column; gap: 1.6rem; }

/* Auth UI helpers */
.is-hidden { display: none !important; }

.input {
  width: 100%;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: #fff;
  color: var(--text);
  font-size: 1.5rem;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.input-row {
  display: flex;
  gap: 0.8rem;
  align-items: stretch;
}
.input-action {
  border-radius: var(--radius);
  padding: 0 1.2rem;
  white-space: nowrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 1.4rem;
}

.field-hint {
  margin-top: 0.6rem;
  font-size: 1.3rem;
  color: var(--muted);
}

.info-banner {
  border: 1px solid rgba(20,184,166,0.35);
  background: rgba(20,184,166,0.08);
  color: var(--text);
  padding: 1.2rem 1.2rem;
  border-radius: var(--radius);
}
.banner-row { font-weight: 700; font-size: 1.4rem; }
.banner-actions { display: flex; gap: 1rem; margin-top: 1rem; }

.error-banner {
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.08);
  color: var(--text);
  padding: 1.2rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1.4rem;
}

.auth-logo { margin-top: 0.6rem; opacity: 0.95; }

html.auth-pending body { visibility: hidden; }
.form-group label { display: block; font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 0.6rem; }
.form-group input {
    width: 100%; padding: 1.2rem; border: 1px solid var(--edge-strong); border-radius: 8px;
    font-family: inherit; font-size: 1.6rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1); }
.error-banner {
    background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B;
    padding: 1rem; border-radius: 8px; font-size: 1.3rem; text-align: center;
    margin-top: 1rem; font-weight: 600;
}

/* =========================================
   4. DASHBOARD LAYOUT (Sidebar + Main)
   ========================================= */
.full-width-container { width: 100%; max-width: 1600px; padding: 0 2rem; }
.dashboard-wrapper { flex: 1; width: 100%; padding: 2rem 0 8rem; background: var(--bg); }
.dashboard-layout { display: flex; gap: 3rem; align-items: flex-start; }

/* --- Sidebar --- */
#sidebar-container {
    width: 100%;
    padding: 0 1rem;
}
.dashboard-sidebar {
    flex-shrink: 0; 
    background: #fff;
    border: 1px solid var(--edge); 
    border-radius: var(--radius);
    padding: 5rem 1.5rem 2rem 1.5rem; /* Increased top padding for toggle button */
    position: sticky; 
    top: 2rem; 
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-sm);
    transition: width 0.3s ease, padding 0.3s ease;
    z-index: 90;
    scrollbar-width: thin; /* Firefox */
}

/* --- Desktop Collapsed State --- */
@media (min-width: 901px) {
    #sidebar-container {
        width: auto;
        padding: auto;
    }
    .dashboard-sidebar {
        width: 260px; 
    }
    /* Sidebar Toggle Button - Desktop Only */
    .sidebar-collapse-toggle {
        position: absolute;
        top: 1rem;
        right: 1.2rem;
        width: 32px;
        height: 32px;
        background: var(--bg); /* Light background for visibility */
        border: 1px solid var(--edge);
        color: var(--muted);
        cursor: pointer;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        z-index: 100;
    }
    .sidebar-collapse-toggle:hover {
        background: #fff;
        color: var(--text);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .dashboard-sidebar.collapsed {
        width: 80px;
        padding: 6rem 1rem 2rem 1rem;
    }

    .dashboard-sidebar.collapsed .sidebar-collapse-toggle {
        right: auto;
        left: 50%;
        transform: translateX(-50%) rotate(180deg);
    }

    .dashboard-sidebar.collapsed .welcome-text {
        display: none;
    }
    .dashboard-sidebar.collapsed .sidebar-welcome {
        justify-content: center;
        border-bottom: none;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
    .dashboard-sidebar.collapsed .avatar-circle {
        width: 32px; height: 32px;
        font-size: 1rem;
    }

    .dashboard-sidebar.collapsed .sidebar-menu .menu-item {
        font-size: 0 !important; /* Hide text */
        justify-content: center;
        padding: 1.2rem 0.5rem;
    }
    .dashboard-sidebar.collapsed .menu-item svg {
        margin: 0;
        opacity: 1;
        width: 24px; height: 24px;
    }

    /* Hide other elements in collapsed state */
    .dashboard-sidebar.collapsed .projects-nav-section .chevron-icon,
    .dashboard-sidebar.collapsed .projects-nav-section #projects-toggle-btn span {
        display: none !important;
    }
    .dashboard-sidebar.collapsed #projects-toggle-btn {
        justify-content: center;
    }
    .dashboard-sidebar.collapsed #projects-toggle-btn svg:first-child {
        display: block; /* The project icon */
        margin: 0;
    }
    .dashboard-sidebar.collapsed .projects-list {
        display: none; /* Hide dropdown in collapsed mode */
    }
    .dashboard-sidebar.collapsed #project-context-nav div[style*="height: 1px"] {
        margin: 0.8rem 0.5rem !important;
    }
}
.mobile-sidebar-chevron {
    display: none;
}
.sidebar-welcome {
    display: flex; align-items: center; gap: 1.2rem;
    padding-bottom: 2rem; margin-bottom: 2rem; border-bottom: 1px solid var(--edge);
}
.avatar-circle {
    width: 40px; height: 40px; background: var(--accent); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.4rem;
}
.sidebar-welcome .name { text-transform: capitalize; }
.welcome-text { display: flex; flex-direction: column; }
.welcome-text .sub { font-size: 1.1rem; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.welcome-text .name { font-size: 1.4rem; font-weight: 700; color: var(--text); }

/* Sidebar Menu Items */
.sidebar-menu { display: flex; flex-direction: column; gap: 0.8rem; }
.menu-item {
    background: transparent; border: none; width: 100%; text-align: left;
    padding: 1.2rem 1.6rem; font-family: var(--font-body, sans-serif);
    font-size: 1.5rem; font-weight: 600; color: var(--muted);
    border-radius: 8px; cursor: pointer; display: flex; align-items: center;
    gap: 1.2rem; transition: all 0.2s;
}
.menu-item svg { opacity: 0.7; }
.menu-item:hover:not([disabled]) { background: var(--bg); color: var(--text); }
.menu-item.active { background: #F0FDFA; color: var(--accent-dark); font-weight: 700; }
.menu-item.active svg { opacity: 1; color: var(--accent); }
.menu-item.action-item { color: var(--accent); }
.menu-item.action-item svg { color: var(--accent); opacity: 1; }
.menu-item.action-item:hover { background: #F0FDFA; }

/* Sidebar Project List Dropdown */
.justify-between { justify-content: space-between; }
.chevron-icon { transition: transform 0.2s ease; opacity: 0.5; }
.projects-nav-section.open .chevron-icon { transform: rotate(180deg); }
.projects-list { overflow: hidden; transition: max-height 0.3s ease-out; padding-left: 1.5rem; margin-bottom: 0.5rem; }
.projects-list.collapsed { max-height: 0; }
.projects-list.expanded { max-height: 300px; overflow-y: auto; }
.project-link-item {
    display: block; width: 100%; padding: 0.8rem 1rem; font-size: 1.4rem;
    color: var(--muted); background: transparent; border: none; text-align: left;
    cursor: pointer; border-radius: 6px; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-link-item:hover { color: var(--text); background: #F1F5F9; }
.project-link-item.active { color: var(--accent); background: #F0FDFA; font-weight: 700; }

/* --- Main Content Panel --- */
.dashboard-main-panel { flex: 1; min-width: 0; }
.dashboard-header {
    background: #fff; border: 1px solid var(--edge); border-radius: var(--radius);
    padding: 2rem 2.4rem; margin-bottom: 3rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 2rem; box-shadow: var(--shadow-sm);
}
.status-eyebrow {
    display: flex; align-items: center; gap: 8px; padding-top: 1rem;
    font-size: 0.9rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #16A34A; margin-bottom: 0.5rem;
}
.pulse-dot {
    width: 6px; height: 6px; background: #16A34A; border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}
.header-left h1 { font-size: 2.4rem; line-height: 1; margin: 0; color: var(--text); }
.system-toolbar {
    display: flex; align-items: center; background: #F8FAFC;
    border: 1px solid var(--edge); border-radius: 8px; padding: 0.4rem; gap: 0.5rem;
}
.toolbar-item {
    display: flex; align-items: center; gap: 8px; padding: 0 1rem;
    font-size: 0.9rem; font-weight: 600; color: var(--muted); user-select: none;
}
.db-indicator { width: 6px; height: 6px; background: #16A34A; border-radius: 50%; }
.db-label { font-size: 1rem !important; }
.toolbar-divider { width: 1px; height: 24px; background: var(--edge); }
.toolbar-btn {
    background: #fff; border: 1px solid var(--edge); color: var(--muted);
    width: 36px; height: 36px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
}
.toolbar-btn:hover {
    border-color: var(--accent); color: var(--accent); background: #F0FDFA;
    transform: translateY(-1px); box-shadow: var(--shadow-sm);
}

/* =========================================
   5. DASHBOARD WIDGETS
   ========================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.kpi-card {
    background: #fff; padding: 1.5rem; border: 1px solid var(--edge);
    border-radius: 12px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.kpi-label { font-size: 1.1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
.kpi-value { font-size: 2.4rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; font-family: "Sora", sans-serif; }
.kpi-sub { font-size: 1.1rem; color: var(--muted); margin-top: 0.2rem; }

.dashboard-split-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.dashboard-split-layout.split-1-3 { grid-template-columns: 1fr 2.5fr; }
.dashboard-split-layout.split-3-cols { grid-template-columns: 1fr 1fr 1fr; }

.content-card {
    background: #fff; border: 1px solid var(--edge); border-radius: 12px;
    padding: 2rem; box-shadow: var(--shadow-sm); height: 100%;
}
.card-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; border-bottom: 1px solid var(--edge); padding-bottom: 1rem;
}
.mb-4 { margin-bottom: 2rem; }
.mt-4 { margin-top: 2rem; }

.chart-container-wrapper { position: relative; height: 320px; width: 100%; }
canvas#dashboardWaterfallChart { width: 100% !important; height: 320px !important; }
canvas#dashboardPieChart { width: 100% !important; height: 200px !important; max-height: 200px; }
.chart-placeholder-area {
    background: #F8FAFC; border: 2px dashed var(--edge-strong); border-radius: 8px;
    height: 320px; display: flex; align-items: center; justify-content: center;
}

.simple-list li { padding: 0.8rem 0; border-bottom: 1px solid #f1f5f9; font-size: 1.6rem; color: var(--text); }
.empty-list-item { color: var(--muted); font-style: italic; text-align: center; padding: 1rem; }

.rich-list { list-style: none; padding: 0; margin: 0; }
.rich-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.2s;
}
.rich-item:hover { background: #f8fafc; padding-left: 0.5rem; padding-right: 0.5rem; }
.rich-list.full-width-list .rich-item {
    padding: 1.2rem; border: 1px solid var(--edge); border-radius: 8px;
    margin-bottom: 0.8rem; background: #F8FAFC;
}
.rich-list.full-width-list .rich-item:hover {
    background: #fff; border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px);
}

.item-main { display: flex; flex-direction: column; }
.item-title { font-weight: 700; font-size: 1.3rem; color: var(--text); display: block; }
.item-sub { font-size: 1.1rem; color: var(--muted); }
.item-status { font-size: 1rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 99px; text-transform: uppercase; }
.status-green { background: #DCFCE7; color: #166534; }
.status-blue { background: #E0F2FE; color: #0369A1; }
.status-gray { background: #F1F5F9; color: #64748B; }

.run-item {
    padding: 1rem; border-bottom: 1px solid #eee; cursor: pointer;
    transition: all 0.2s ease; border-radius: 6px; margin-bottom: 4px;
    border-left: 3px solid transparent; position: relative; overflow: hidden;
}
.run-item:hover { background-color: #F8FAFC; }
.run-item.active { background-color: #F0FDFA; border-left-color: var(--accent); }
.run-item.active div:first-child { color: var(--accent-dark) !important; font-weight: 700; }

.dashboard-table { width: 100%; border-collapse: collapse; font-size: 1.5rem; }
.dashboard-table th {
    text-align: left; color: var(--muted); font-weight: 700;
    padding: 0.8rem 0.5rem; border-bottom: 1px solid var(--edge);
    font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.dashboard-table td { padding: 1rem 0.5rem; border-bottom: 1px solid #f1f5f9; color: var(--text); vertical-align: middle; }
.dashboard-table .small { font-size: 1.3rem !important; }
.dashboard-table .text-right { text-align: right; }
.dashboard-table .text-center { text-align: center; }
.dashboard-table .text-muted { color: var(--muted); }
.dashboard-table .text-success { color: #16A34A; font-weight: 700; }
.dashboard-table .text-danger { color: #DC2626; font-weight: 700; }
.dashboard-table tr:last-child td { border-bottom: none; }

/* =========================================
   6. TOOL CARDS GRID
   ========================================= */
.category-title {
    font-size: 1.8rem; color: var(--muted); margin-bottom: 1.6rem;
    padding-bottom: 0.8rem; border-bottom: 1px solid var(--edge);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2.4rem; }
.tool-card {
    background: #fff; border: 1px solid var(--edge); border-radius: 12px;
    padding: 2.8rem; display: flex; flex-direction: column; height: 100%;
    position: relative; overflow: hidden; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-sm);
}
.tool-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.tool-icon {
    width: 52px; height: 52px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; background: #F1F5F9; color: var(--muted);
}
.tool-body { flex: 1; }
.tool-body h3 { font-size: 1.8rem; margin-bottom: 0.8rem; }
.tool-body p { font-size: 1.4rem; color: var(--muted); line-height: 1.5; margin-bottom: 2rem; }
.status-badge { font-size: 1.1rem; font-weight: 700; padding: 0.3rem 0.8rem; border-radius: 99px; text-transform: uppercase; }
.status-badge.active { background: #DCFCE7; color: #16A34A; }

.fep-card { --card-color: var(--fep-blue); --card-bg: var(--fep-bg); --btn-hover: #0069d9; --shadow-color: rgba(0, 123, 255, 0.15); --grad-end: #60a5fa; }
.analytics-card { --card-color: var(--analytics-amber); --card-bg: var(--analytics-bg); --btn-hover: #d97706; --shadow-color: rgba(245, 158, 11, 0.15); --grad-end: #fbbf24; }
.simulator-card { --card-color: var(--simulator-green); --card-bg: var(--simulator-bg); --btn-hover: #047857; --shadow-color: rgba(16, 185, 129, 0.15); --grad-end: #34D399; }
.diagnostics-card { --card-color: var(--diagnostics-purple); --card-bg: var(--diagnostics-bg); --btn-hover: #7c3aed; --shadow-color: rgba(139, 92, 246, 0.15); --grad-end: #a78bfa; }
.amp-card { --card-color: var(--amp-rose); --card-bg: var(--amp-bg); --btn-hover: #be123c; --shadow-color: rgba(225, 29, 72, 0.15); --grad-end: #FB7185; }
.finance-card { --card-color: #0d9488; --card-bg: #f0fdfa; --btn-hover: #0f766e; --shadow-color: rgba(13, 148, 136, 0.15); --grad-end: #2dd4bf; }

.fep-card, .analytics-card, .simulator-card, .diagnostics-card, .amp-card, .finance-card { border-left: 5px solid var(--card-color); }
.fep-card .tool-icon, .analytics-card .tool-icon, .simulator-card .tool-icon, .diagnostics-card .tool-icon, .amp-card .tool-icon, .finance-card .tool-icon { background: var(--card-bg); color: var(--card-color); }
.fep-card .btn.primary, .analytics-card .btn.primary, .simulator-card .btn.primary, .diagnostics-card .btn.primary, .amp-card .btn.primary, .finance-card .btn.primary { background: var(--card-color); color: #fff; }
.fep-card .btn.primary:hover, .analytics-card .btn.primary:hover, .simulator-card .btn.primary:hover, .diagnostics-card .btn.primary:hover, .amp-card .btn.primary:hover, .finance-card .btn.primary:hover { background: var(--btn-hover); }

.fep-card:hover, .analytics-card:hover, .simulator-card:hover, .diagnostics-card:hover, .amp-card:hover, .finance-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px var(--shadow-color); border-color: var(--card-color); }
.fep-bar, .analytics-bar, .simulator-bar, .diagnostics-bar, .amp-bar, .finance-bar {
    position: absolute; bottom: 0; left: 0; width: 0%; height: 4px;
    background: linear-gradient(90deg, var(--card-color), var(--grad-end));
    transition: width 0.4s ease;
}
.fep-card:hover .fep-bar, .analytics-card:hover .analytics-bar, .simulator-card:hover .simulator-bar, .diagnostics-card:hover .diagnostics-bar, .amp-card:hover .amp-bar, .finance-card:hover .finance-bar { width: 100%; }

.tool-card.inactive { border-left: 5px solid var(--locked-gray); opacity: 0.7; }
.tool-card.inactive:hover { transform: none; box-shadow: none; border-color: var(--edge); cursor: not-allowed; }

/* --- Reports View Styles --- */
.report-list-header {
    display: flex; padding: 0.8rem 1.2rem; border-bottom: 2px solid var(--edge);
    margin-bottom: 0.5rem; font-weight: 700; color: var(--muted);
    font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.report-item-content { display: flex; align-items: center; width: 100%; }
.report-col-name { flex: 2; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.report-col-type { flex: 1; font-size: 0.9rem; }
.report-col-date { flex: 1; font-size: 0.9rem; color: var(--muted); }
.report-col-author { flex: 1; font-size: 0.9rem; color: var(--muted); }
.report-col-actions { width: 100px; text-align: right; }

.type-badge { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.type-badge.diag { background: #F3E8FF; color: #7E22CE; border: 1px solid #D8B4FE; }
.type-badge.sim { background: #ECFDF5; color: #047857; border: 1px solid #6EE7B7; }
.type-badge.fin { background: #F0FDFA; color: #0F766E; border: 1px solid #99F6E4; }

.action-icon-btn {
    background: transparent; border: 1px solid var(--edge); color: var(--muted);
    width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s; margin-left: 4px;
}
.action-icon-btn:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.action-icon-btn.delete:hover { border-color: #EF4444; color: #EF4444; }

/* =========================================
   6. MODALS & FORMS
   ========================================= */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; /* Higher than nav */
    display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
    padding: 1rem; /* Prevents edge touching on small screens */
}

.modal-card {
    background: #fff; width: 100%; max-width: 600px; 
    max-height: 90vh; /* Cap height */
    display: flex; flex-direction: column; /* Organize header/body */
    border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: scaleIn 0.2s ease-out;
    position: relative;
}

/* Make the form/content scrollable, NOT the whole card (keeps header sticky if desired) */
.modal-card form, 
.settings-scroll-area {
    overflow-y: auto;
    padding: 0 2rem 2rem 2rem; /* moved padding here for scroll */
    flex: 1;
}

/* Header stays fixed at top of card */
.modal-header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 2rem 2rem 1.5rem 2rem;
    flex-shrink: 0;
}

@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.close-modal { background: none; border: none; font-size: 2.4rem; cursor: pointer; color: var(--muted); line-height: 1; }
.close-modal:hover { color: var(--text); }

.settings-section-title {
    font-size: 1.2rem; color: var(--muted); text-transform: uppercase;
    font-weight: 700; letter-spacing: 0.05em; margin-bottom: 1.2rem;
}

/* Tool Cards in Modal */
.tool-select-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem; margin-top: 0.5rem;
}

.tool-select-card {
    display: flex; align-items: flex-start; gap: 12px; padding: 1rem;
    border: 1px solid var(--edge); border-radius: 10px; background: #fff;
    cursor: pointer; transition: all 0.2s ease; position: relative;
}
.tool-select-card:hover { border-color: var(--accent); background-color: #F0FDFA; }
.tool-select-card input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.tool-select-card:has(input:checked) { border-color: var(--accent); background-color: #F0FDFA; box-shadow: 0 0 0 1px var(--accent); }

.tool-select-icon {
    width: 32px; height: 32px; background: #F1F5F9; color: var(--muted);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
}
.tool-select-card:has(input:checked) .tool-select-icon { background: var(--accent); color: #fff; }

.tool-content strong { display: block; font-size: 1rem; color: var(--text); margin-bottom: 2px; }
.tool-content p { font-size: 0.85rem; color: var(--muted); line-height: 1.3; margin: 0; }

/* ... (Keep your Role Badge, Buttons, Inputs CSS same as before) ... */
/* Team Roles */
.role-badge { display: inline-block; font-size: 1.0rem; font-weight: 700; padding: 0.3rem 0.8rem; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.6rem; border: 1px solid transparent; }
.role-badge.admin { background: #E0E7FF; color: #4338CA; border-color: #C7D2FE; }
.role-badge.partner { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.role-badge.operator { background: #F1F5F9; color: #475569; border-color: #E2E8F0; }
.role-badge.owner { background: #FEF3C7; color: #D97706; border-color: #FDE68A; }
.role-badge.viewer { background: #F1F5F9; color: #64748B; border-color: #E2E8F0; }
.role-badge.editor { background: #E0F2FE; color: #0284C7; border-color: #BAE6FD; }

.remove-icon-btn { background: transparent; border: none; cursor: pointer; padding: 8px; border-radius: 6px; color: #CBD5E1; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; }
.remove-icon-btn:hover { background-color: #FEF2F2; color: #DC2626; }
.remove-icon-btn svg { width: 18px; height: 18px; display: block; }

.add-member-box { background: #F8FAFC; padding: 1.5rem; border-radius: 12px; border: 1px solid var(--edge); margin-top: 1rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); }
.add-member-label { display: block; font-size: 1.1rem; font-weight: 700; color: var(--muted); margin-bottom: 1.2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.add-member-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }

.styled-input { width: 100%; padding: 1.2rem 1.4rem; border: 1px solid var(--edge-strong); border-radius: 8px; background: #fff; font-family: inherit; font-size: 1.4rem; color: var(--text); transition: all 0.2s ease; appearance: none; }
select.styled-input { appearance: auto; cursor: pointer; background-color: #fff; }
.styled-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1); }
.styled-input::placeholder { color: #94A3B8; }
.icon-btn { display: flex; align-items: center; justify-content: center; gap: 0.8rem; font-weight: 700; }

.pending-members-area { background: #F8FAFC; border: 1px solid var(--edge); border-radius: 8px; padding: 1rem; margin-top: 1rem; }
.pending-list { list-style: none; padding: 0; margin: 0; }
.pending-item { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem; background: #fff; border: 1px solid var(--edge); border-radius: 6px; margin-bottom: 0.5rem; }
.pending-info { display: flex; gap: 10px; align-items: center; }
.pending-email { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.pending-role { font-size: 0.8rem; text-transform: uppercase; font-weight: 700; color: var(--muted); background: #F1F5F9; padding: 2px 6px; border-radius: 4px; }

/* Override width for Create Modal specifically to be wider */
#project-modal .modal-card { max-width: 800px; }
/* =========================================
   8. HUB VIEW & GRID SYSTEM
   ========================================= */
.hub-wrapper { flex: 1; width: 100%; padding: 3rem 2rem; background-color: var(--bg); }
.hub-container { max-width: 1200px; margin: 0 auto; }
.hub-header-row {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 3rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--edge);
}
.hub-welcome h1 { font-family: "Sora", sans-serif; font-size: 2.8rem; margin-bottom: 0.5rem; color: var(--text); }
.hub-welcome p { font-size: 1.4rem; color: var(--muted); }

.project-grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.hub-project-card {
    background: #fff; border: 1px solid var(--edge); border-radius: 12px; padding: 2rem;
    display: flex; flex-direction: column; justify-content: space-between; min-height: 150px;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); position: relative; overflow: hidden;
}
.hub-project-card:hover { transform: translateY(-4px); box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1); border-color: var(--accent); }
.hub-project-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--edge); transition: background 0.2s;
}
.hub-project-card:hover::before { background: var(--accent); }
.hub-card-top h3 { font-size: 1.4rem; margin-bottom: 0.4rem; color: var(--text); }
.hub-card-top p { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.hub-card-bottom {
    margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--edge);
    display: flex; justify-content: space-between; align-items: center;
}
.hub-role-badge {
    font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
    background: #F1F5F9; color: var(--muted); padding: 4px 8px; border-radius: 4px;
}
.hub-enter-link {
    font-size: 1rem; color: var(--accent); font-weight: 600; 
    display: flex; align-items: center; gap: 6px; opacity: 0; transform: translateX(-10px);
    transition: all 0.2s ease;
}
.hub-project-card:hover .hub-enter-link { opacity: 1; transform: translateX(0); }

/* --- SIDEBAR MODIFICATIONS --- */
.sidebar-header-nav {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--edge);
}
.back-nav-btn {
    background: #fff; border: 1px solid var(--edge); border-radius: 8px;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    color: var(--muted); cursor: pointer; transition: all 0.2s;
}
.back-nav-btn:hover { border-color: var(--accent); color: var(--accent); background: #F0FDFA; }
.sidebar-welcome.condensed { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.sidebar-welcome.condensed .avatar-circle.small { width: 32px; height: 32px; font-size: 1.1rem; }
.sidebar-welcome.condensed .name { font-size: 1.2rem; }
.sidebar-welcome.condensed .sub { font-size: 0.85rem; }

/* =========================================
   9. MOBILE OPTIMIZATION
   ========================================= */
@media (max-width: 900px) {
    /* 1. LAYOUT FLOW */
    .dashboard-layout { flex-direction: column; }
    
    /* 2. STICKY NAV & SIDEBAR OFFSET */
    .site-nav { 
        position: static; 
        top: 0; 
        z-index: 1000; /* Highest priority */
    }
    .dashboard-wrapper {
        padding-top: 0;
    }

    /* Sticky Sidebar Accordion */
    .dashboard-sidebar {
        width: 100%;
        position: sticky;
        /* Stick just below the navbar (approx 70px) so they don't overlap */
        top: 0; 
        z-index: 900; /* Below Nav, Above Content */
        
        /* Accordion Logic */
        height: auto;
        min-height: auto;
        max-height: 80px; /* Collapsed Height matches header size */
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
        
        padding: 0 1.5rem; /* Trim vertical padding in collapsed state */
        margin: 0;
        cursor: pointer;
        background: rgba(255, 255, 255, 0.95); /* Slight transparency */
        backdrop-filter: blur(8px);
    }
    
    /* Hide Desktop Toggle on Mobile */
    .sidebar-collapse-toggle { display: none !important; }
    
    /* Expanded State */
    .dashboard-sidebar.mobile-expanded {
        max-height: 85vh; 
        padding: 1rem 1.5rem; /* Restore padding when open */
        overflow-y: auto;
        box-shadow: 0 20px 40px -5px rgba(0,0,0,0.2); /* Deep shadow when open */
        border-color: var(--accent);
        background: #fff; /* Solid background when reading menu */
    }
    
    /* Sidebar Header */
    .sidebar-welcome {
        margin-bottom: 0;
        border-bottom: 1px solid transparent; /* Hide separator when collapsed */
        padding: 1.2rem 0; /* Center vertically */
        transition: all 0.3s;
        display: flex; 
        align-items: center;
        justify-content: space-between;
    }
    
    .dashboard-sidebar.mobile-expanded .sidebar-welcome {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
        border-bottom-color: var(--edge);
    }
    
    /* Chevron Animation */
    .mobile-sidebar-chevron {
        display: block;
        color: var(--muted);
        transition: transform 0.3s ease;
    }
    .dashboard-sidebar.mobile-expanded .mobile-sidebar-chevron {
        transform: rotate(180deg);
        color: var(--accent);
    }
    
    /* Menu Fade In */
    .sidebar-menu {
        opacity: 0;
        transition: opacity 0.2s ease 0.1s;
        pointer-events: none;
    }
    .dashboard-sidebar.mobile-expanded .sidebar-menu {
        opacity: 1;
        pointer-events: auto;
    }

    /* Hub Banner Adjustment */
    .hub-welcome-banner { padding-left: 0.5rem; }
    
    .dashboard-header {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Hide Desktop Nav */
    .nav-links { display: none; }
    .nav-toggle { display: flex; }

    /* Container Padding */
    .full-width-container, .hub-wrapper { padding: 1.5rem 1rem; }
    .hub-container { padding: 0; }
    
    /* Content Widths */
    .dashboard-main-panel { width: 100%; }

    /* Headers */
    .hub-header-row { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .header-left h1, .hub-welcome h1 { font-size: 2rem; }
    
    /* Cards */
    .hub-project-card { min-height: auto; }
    .content-card, .tool-card, .hub-project-card { padding: 1.5rem; }
    
    /* Modals */
    .modal-card { width: 95%; padding: 1.5rem; max-height: 85vh; }
    
    /* Grid System - Single Column for Mobile */
    .dashboard-split-layout, 
    .dashboard-split-layout.split-1-3, 
    /* .dashboard-split-layout.split-3-cols, */
    .kpi-grid,
    .project-grid-layout,
    .tool-select-grid,
    .tools-grid {
        grid-template-columns: 1fr; /* Force 1 column stack on phones */
    }


    .kpi-grid {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
    /* --- NEW: REORDER BOTTOM GRID FOR MOBILE --- */
    /* Target the container holding Procedures, Pie, and Cashflow */
    .dashboard-split-layout.split-3-cols {
        display: flex; /* Switch to Flexbox for easier vertical stacking control */
        flex-direction: column;
    }

    /* 1. Pie Chart (Originally 2nd div) -> Move to Top */
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(2) {
        order: 1;
        margin-bottom: 1.5rem; /* Add spacing manually since gap might behave differently in flex */
    }

    /* 2. Partner Cashflow (Originally 3rd div) -> Move to Middle */
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(3) {
        order: 2;
        margin-bottom: 1.5rem;
    }

    /* 3. Active Procedures (Originally 1st div) -> Move to Bottom */
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(1) {
        order: 3;
    }
    
    /* Font Adjustments */
    .kpi-label {
        font-size: 1.1rem;
    }
    .kpi-value { font-size: 1.3rem; }
    .dashboard-table { font-size: 0.9rem; }
}

/* =========================================
   10. PRODUCT GATEWAY STYLES (NEW)
   ========================================= */
.product-gateway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.product-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--edge);
    background: white;
    /* Force height for consistency */
    min-height: 220px;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0,0,0,0.15);
    border-color: var(--accent);
}

.metric-pill {
    display: inline-block;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 1rem;
    font-weight: 600;
}

/* Adjust Icon size specifically for gateway */
.product-card .tool-icon svg {
    stroke-width: 1.5;
    width: 32px;
    height: 32px;
}

/* =========================================
   11. PRODUCT HOME STYLES (NEW - Correctly Placed)
   ========================================= */

/* --- Status Banner --- */
.status-banner {
    display: flex; justify-content: space-between; align-items: center;
    padding: 2rem 2.4rem; border-radius: 12px; border: 1px solid transparent;
    color: #fff; box-shadow: var(--shadow-sm);
    flex-wrap: wrap; gap: 1rem;
}
.amp-banner {
    background: linear-gradient(135deg, #FFF1F2 0%, #FFE4E6 100%);
    border-color: #FECDD3; color: #881337;
}
.veritainer-banner {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border-color: #A7F3D0; color: #064E3B;
}
.oor-banner {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-color: #BFDBFE; color: #1E3A8A;
}

.status-title { font-size: 1.8rem; margin: 0 0 0.5rem 0; display: flex; align-items: center; gap: 1rem; }
.status-indicator { 
    display: inline-block; padding: 0.2rem 0.8rem; border-radius: 99px; 
    font-size: 1rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em;
    background: rgba(255,255,255,0.6); backdrop-filter: blur(4px);
}
.status-indicator.online { color: inherit; } /* Inherit text color from banner */

.status-msg { font-size: 1.4rem; opacity: 0.9; margin: 0; }
.status-actions { margin-left: auto; }
.btn.inverted { background: rgba(255,255,255,0.5); color: inherit; border: 1px solid rgba(255,255,255,0.2); }
.btn.inverted:hover { background: #fff; }


/* --- Money Card --- */
.money-card {
    display: flex; flex-direction: column; justify-content: center;
    background: #fff; border: 1px solid var(--edge);
}
.money-label { 
    font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.05em; 
    color: var(--muted); margin-bottom: 0.5rem; font-weight: 700;
}
.money-value {
    font-size: 4rem; font-weight: 700; font-family: "Sora", sans-serif;
    color: var(--text); line-height: 1.1; margin-bottom: 0.5rem;
}
.money-trend { font-size: 1.2rem; font-weight: 600; }
.money-trend.positive { color: #16A34A; }
.money-trend.negative { color: #DC2626; }


/* --- Activity & Lists --- */
.time-badge {
    display: inline-block; width: 80px; font-size: 1.1rem; 
    color: var(--muted); font-variant-numeric: tabular-nums;
}
.activity-list li { font-size: 1.3rem; }

/* --- OOR COMMAND CENTER STYLES --- */

/* Mission Control Bar */
.mission-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #0f172a; /* Dark Navy for Enterprise Feel */
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    gap: 2rem;
    flex-wrap: wrap;
}

.mc-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    border-right: 1px solid rgba(255,255,255,0.1);
}
.mc-metric:last-child { border-right: none; }

.mc-metric .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}
.mc-metric .value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Sora', sans-serif;
}
.mc-metric .text-red { color: #F87171; }

.split-2-1 {
    grid-template-columns: 2fr 1fr;
}

/* Health Table */
.health-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.5rem;
}
.health-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid #f1f5f9;
    color: #64748b;
    font-weight: 600;
    font-size: 1.3rem;
    text-transform: uppercase;
}
.health-table td {
    padding: 1rem;
    border-bottom: 1px solid #f8fafc;
    color: #334155;
}
.health-table tr:last-child td { border-bottom: none; }
.health-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.health-green { background-color: #10B981; box-shadow: 0 0 0 4px #D1FAE5; }
.health-yellow { background-color: #F59E0B; box-shadow: 0 0 0 4px #FEF3C7; }
.health-red { background-color: #EF4444; box-shadow: 0 0 0 4px #FEE2E2; }

/* --- PROJECT CONTROL PANEL --- */
.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--edge);
}
.control-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.control-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.control-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.control-kpi {
    background: var(--bg-card);
    border: 1px solid var(--edge);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.control-kpi .label {
    font-size: 1.1rem;
    color: var(--muted);
    text-transform: uppercase;
}
.control-kpi .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    font-family: 'Sora', sans-serif;
}
.control-kpi .sub {
    font-size: 0.9rem;
    color: var(--muted);
}

.action-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.control-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.2rem 1.4rem;
    background: var(--bg-card);
    border: 1px solid var(--edge);
    border-radius: 6px;
    color: var(--text);
    font-weight: 600;
    font-size: 1.4rem;
    transition: all 0.2s;
    text-align: left;
}
.control-btn:hover {
    background: rgba(255,255,255,0.03);
    border-color: var(--accent);
    color: var(--accent);
}
.control-btn svg {
    opacity: 0.7;
}

.split-main-action {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .control-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .split-main-action { grid-template-columns: 1fr; }
}

/* =========================================
   10. FEP VIEW SPECIFIC STYLES
   ========================================= */
.feps-layout-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 4rem;
}

.fep-project-card {
    background: #fff;
    border: 1px solid var(--edge);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.fep-project-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--edge-strong);
}

.fep-project-header {
    background: #F8FAFC;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--edge);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fep-project-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fep-count-badge {
    background: #E2E8F0;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
}

.fep-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fep-item {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #F1F5F9;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fep-item:last-child {
    border-bottom: none;
}

.fep-item:hover {
    background: #F0FDFA; /* Teal-50 tint */
    padding-left: 2.2rem;
    padding-right: 1.8rem;
}

.fep-item:hover .fep-title {
    color: var(--accent);
}

.fep-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.fep-icon {
    width: 40px;
    height: 40px;
    background: #F1F5F9;
    color: var(--muted);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fep-item:hover .fep-icon {
    background: #E0F2FE; /* Light Blue */
    color: #0369A1; /* Blue 700 */
}

.fep-meta {
    display: flex;
    flex-direction: column;
}

.fep-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
    transition: color 0.2s;
}

.fep-date {
    font-size: 1rem;
    color: var(--muted);
}

.fep-status-badge {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    background: #F1F5F9;
    color: var(--muted);
}

/* Fix for FEP View overlap - User Request */
#view-product-feps {
    min-height: 100vh;
    padding-bottom: 4rem;
}
#view-product-feps .content-card {
    height: 100%;
    min-height: 60vh; 
}

.fep-status-badge.active {
    background: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.fep-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.4rem;
}

.fep-item:hover .fep-arrow {
    opacity: 1;
    transform: translateX(0);
}