/* ========================================
   SITE CSS - HGOV ADO REPORTING
   Base styles and icon imports
   ======================================== */

/* Import Icon Font */
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* Import Modern App Styles */
@import url('app.css');

/* Import Mobile Responsive Styles (must be after app.css) */
@import url('mobile.css');

/* ========================================
   SITE-SPECIFIC OVERRIDES & ADDITIONS
   Add any site-specific styles here
   ======================================== */

/* Navbar toggler icon for mobile */
.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

/* Open Iconic Font Sizing */
.oi {
    font-size: inherit;
    line-height: inherit;
    vertical-align: middle;
}

/* ========================================
   NAV RAIL STYLING - GLOBAL
   ======================================== */

/* Layout/nav-specific variables - extend global theme variables */
:root,
[data-theme="light"] {
    --nav-rail-width-expanded: 16rem;
    --nav-rail-width-collapsed: 3.75rem;
    --nav-rail-bg: #ffffff;
    --nav-rail-border: #e5e5e5;
    --nav-rail-item-hover: #f5f5f5;
    --color-primary: #0078d4;
    --color-primary-text: #ffffff;
    --color-text: #323130;
    --color-border: #e5e5e5;
    --color-surface-hover: #f5f5f5;
    --radius-md: 0.25rem;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
}

/* Dark theme overrides for site-specific styles */
[data-theme="dark"] {
    --nav-rail-bg: #22262e;
    --nav-rail-border: #374151;
    --nav-rail-item-hover: rgba(77, 163, 255, 0.1);
    --color-primary: #4da3ff;
    --color-text: #e8eaed;
    --color-border: #374151;
    --color-surface-hover: rgba(77, 163, 255, 0.1);
}

.nav-rail {
    width: var(--nav-rail-width-expanded);
    background-color: var(--nav-rail-bg);
    border-right: 1px solid var(--nav-rail-border);
    transition: width var(--transition-base);
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-rail.collapsed {
    width: var(--nav-rail-width-collapsed);
}

.nav-rail-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0.625rem 0.75rem;
    color: var(--color-text) !important;
    text-decoration: none !important;
    border-radius: var(--radius-md);
    white-space: nowrap;
    gap: 0.75rem;
    margin: 0.125rem 0.5rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-rail-item .icon {
    font-size: 1.25rem;
    min-width: 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

.nav-rail-item .icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.nav-rail-item .text {
    opacity: 1;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.nav-rail.collapsed .nav-rail-item {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    margin: 0.125rem 0.25rem;
    gap: 0;
}

.nav-rail.collapsed .nav-rail-item .icon {
    margin: 0 auto;
}

.nav-rail.collapsed .nav-rail-item .text {
    opacity: 0;
    width: 0;
    min-width: 0;
    overflow: hidden;
    display: none;
}

.nav-rail-item:hover {
    transform: translateX(3px);
    background: linear-gradient(90deg, var(--nav-item-hover-gradient-start, rgba(0, 120, 212, 0.06)) 0%, transparent 100%);
    color: var(--primary-color) !important;
}

.nav-rail-item:hover::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, transparent 0%, var(--primary-color) 20%, var(--primary-color) 50%, var(--primary-color) 80%, transparent 100%);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px var(--primary-color-glow, rgba(0, 120, 212, 0.5));
    animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
    from {
        height: 0%;
        opacity: 0;
    }
    to {
        height: 60%;
        opacity: 1;
    }
}

.nav-rail-item:hover .icon i {
    color: var(--primary-color);
    filter: drop-shadow(0 0 4px var(--primary-color-glow, rgba(0, 120, 212, 0.3)));
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.nav-rail.collapsed .nav-rail-item:hover {
    transform: scale(1.05);
    background: radial-gradient(circle at left, var(--nav-item-active-bg, rgba(0, 120, 212, 0.15)) 0%, transparent 70%);
}

.nav-rail.collapsed .nav-rail-item:hover::after {
    width: 3px;
    height: 80%;
    box-shadow: 0 0 12px var(--primary-color-glow, rgba(0, 120, 212, 0.7));
}

.nav-rail-item.active {
    background: linear-gradient(90deg, var(--nav-item-active-bg, rgba(0, 120, 212, 0.1)) 0%, var(--nav-item-active-bg-end, rgba(0, 120, 212, 0.03)) 100%) !important;
    border-left: 4px solid var(--primary-color);
    color: var(--primary-color) !important;
    font-weight: 600;
    position: relative;
}

.nav-rail-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-color) 100%);
    box-shadow: 0 0 12px var(--primary-color-glow, rgba(0, 120, 212, 0.5)),
                0 0 24px var(--primary-color-glow-light, rgba(0, 120, 212, 0.3));
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(0, 120, 212, 0.5),
                    0 0 24px rgba(0, 120, 212, 0.3);
    }
    50% {
        box-shadow: 0 0 16px rgba(0, 120, 212, 0.7),
                    0 0 32px rgba(0, 120, 212, 0.4);
    }
}

.nav-rail-item.active .icon i {
    color: var(--primary-color);
    filter: drop-shadow(0 0 4px var(--primary-color-glow, rgba(0, 120, 212, 0.4)));
}

.nav-rail.collapsed .nav-rail-item.active {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, var(--nav-item-active-bg, rgba(0, 120, 212, 0.1)) 0%, var(--nav-item-active-bg-end, rgba(0, 120, 212, 0.03)) 100%);
}

.nav-rail.collapsed .nav-rail-item.active::before {
    width: 4px;
    box-shadow: 0 0 8px var(--primary-color-glow, rgba(0, 120, 212, 0.6));
}

button.nav-rail-item {
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
}

button.nav-rail-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-rail.collapsed button.nav-rail-item {
    justify-content: center;
}

/* Dashboard specific styles */
.dashboard-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* KPI Card Styles */
.kpi-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-left: 4px solid var(--primary-color);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* KPI Info Tooltip */
.kpi-header,
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.kpi-header h3,
.chart-header h3 {
    margin: 0;
    flex: 1;
}

.kpi-info {
    position: relative;
    display: inline-flex;
    cursor: help;
}

.kpi-info-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: var(--bg-primary);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.kpi-info:hover .kpi-info-icon {
    opacity: 1;
}

.kpi-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    max-width: 300px;
    padding: 0.75rem;
    background: var(--tooltip-bg);
    border: 1px solid var(--tooltip-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--tooltip-text);
    text-transform: none;
    letter-spacing: normal;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.kpi-info:hover .kpi-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kpi-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 12px;
    border: 6px solid transparent;
    border-top-color: var(--tooltip-bg);
}

.kpi-tooltip strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.kpi-tooltip code {
    background: var(--bg-secondary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Work Item Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: var(--info-bg);
    color: var(--info-text);
}

.status-badge.resolved {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-badge.closed {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 767.98px) {
    .chart-container {
        height: 300px;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
}

/* Data Table Enhancements */
.data-table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table-container .table {
    margin-bottom: 0;
}

/* Search and Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 300px;
}

@media (max-width: 767.98px) {
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 100%;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Connection Test Status */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.connection-status.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-color);
}

.connection-status.error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-color);
}

.connection-status.pending {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-color);
}

/* Spinner for loading states */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Pulse animation for loading indicators */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   AREA PATH TREE VIEW - Clean Modern Design
   ======================================== */

.area-path-tree {
    background: var(--bg-secondary) !important;
    border-radius: 4px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    padding: 8px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
}

.area-path-tree .empty-tree {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.area-path-tree .empty-tree i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    color: var(--primary-color);
    opacity: 0.5;
}

.area-path-tree .empty-tree p {
    font-size: 1rem;
    margin: 0;
}

/* Tree Node Structure */
.area-path-tree .tree-node {
    margin: 0;
    user-select: none;
}

.area-path-tree .node-content {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: background-color 0.15s ease !important;
    position: relative !important;
    min-height: 28px !important;
    background: transparent !important;
    margin-bottom: 1px !important;
    border: none !important;
}

.area-path-tree .node-content:hover {
    background: var(--nav-rail-item-hover) !important;
}

.area-path-tree .node-content:active {
    background: var(--bg-tertiary) !important;
}

.area-path-tree .node-content.has-children .node-name {
    font-weight: 500 !important;
    color: var(--text-primary) !important;
}

/* Expand/Collapse Caret - Tree View Style */
.area-path-tree .expand-toggle {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    padding: 0 !important;
    margin: 0 8px 0 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s ease !important;
    border-radius: 0 !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    flex-shrink: 0 !important;
}

.area-path-tree .expand-toggle:hover {
    background: transparent !important;
    color: var(--primary-color) !important;
    transform: scale(1.2) !important;
    box-shadow: none !important;
}

.area-path-tree .expand-toggle:active {
    transform: scale(1) !important;
}

.area-path-tree .expand-toggle i {
    font-size: 0.7rem !important;
    font-weight: normal !important;
    transition: transform 0.15s ease !important;
}

.area-path-tree .expand-placeholder {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 0 8px 0 0 !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
}

/* Checkbox and Label */
.area-path-tree .node-label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: default !important;
    flex: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.area-path-tree .node-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    cursor: pointer !important;
    margin: 0 !important;
    accent-color: var(--primary-color) !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.area-path-tree .node-label input[type="checkbox"]:hover {
    transform: scale(1.1) !important;
}

.area-path-tree .node-label input[type="checkbox"]:indeterminate {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M3 8h10'/%3E%3C/svg%3E") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Node Name and Count */
.area-path-tree .node-name {
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    transition: color 0.2s ease !important;
    flex: 1 !important;
}

.area-path-tree .node-content:not(.has-children) .node-name {
    color: var(--text-secondary) !important;
    font-weight: 400 !important;
}

.area-path-tree .node-content:hover .node-name {
    color: var(--primary-color) !important;
}

.area-path-tree .child-count {
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    margin-left: 6px !important;
    opacity: 0.9 !important;
    transition: all 0.2s ease !important;
}

.area-path-tree .node-content:hover .child-count {
    color: var(--primary-color) !important;
    opacity: 1 !important;
    font-weight: 500 !important;
}

/* Children Container */
.area-path-tree .node-children {
    margin-left: 0 !important;
    padding-left: 20px !important;
    animation: expandDown 0.25s ease-out !important;
}

@keyframes expandDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
.area-path-tree::-webkit-scrollbar {
    width: 12px !important;
}

.area-path-tree::-webkit-scrollbar-track {
    background: var(--bg-tertiary) !important;
    border-radius: 10px !important;
    margin: 8px 0 !important;
}

.area-path-tree::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: 10px !important;
    border: 3px solid var(--bg-tertiary) !important;
}

.area-path-tree::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .area-path-tree {
        max-height: 400px !important;
        padding: 8px !important;
    }
    
    .area-path-tree .node-content {
        padding: 8px 10px !important;
        min-height: 38px !important;
    }
    
    .area-path-tree .node-name {
        font-size: 0.9rem !important;
    }

    .area-path-tree .expand-toggle {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }
}

/* ========================================
   SIMPLE POPOVER - PORTAL STYLES
   Styles for popovers appended to body
   ======================================== */
.simple-popover-portal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: normal;
}

.simple-popover-portal.popover-size-small {
    min-width: 150px;
    max-width: 200px;
}

.simple-popover-portal.popover-size-medium {
    min-width: 200px;
    max-width: 280px;
}

.simple-popover-portal.popover-size-large {
    min-width: 280px;
    max-width: 360px;
}

.simple-popover-portal.popover-size-auto {
    width: fit-content;
    max-width: none;
}

/* Popover content helpers */
.simple-popover-portal .popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.simple-popover-portal .popover-header .allocation-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 500;
}

.simple-popover-portal .popover-section {
    margin-top: 8px;
    padding: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.simple-popover-portal .popover-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.simple-popover-portal .popover-row {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
}

.simple-popover-portal .popover-label {
    color: var(--text-secondary);
}

.simple-popover-portal .popover-value {
    font-weight: 500;
    color: var(--text-primary);
}

.simple-popover-portal .popover-value.positive {
    color: var(--popover-positive-text);
}

.simple-popover-portal .popover-value.negative {
    color: var(--popover-negative-text);
}

.simple-popover-portal .popover-section.timeoff {
    background: var(--warning-bg);
    border-left: 3px solid var(--warning-color);
}

.simple-popover-portal .popover-section.calculation {
    background: var(--info-bg);
    border-left: 3px solid var(--primary-color);
}

/* State Counts Popover */
.simple-popover-portal .state-counts-popover,
.simple-popover-portal .resource-counts-popover {
    min-width: 160px;
}

.simple-popover-portal .state-count-row,
.simple-popover-portal .resource-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    gap: 16px;
}

.simple-popover-portal .state-count-row:not(:last-child),
.simple-popover-portal .resource-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

.simple-popover-portal .state-count {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.simple-popover-portal .state-badge-sm {
    padding: 2px 8px;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* State Counts Table Breakdown */
.simple-popover-portal .state-counts-table {
    width: fit-content;
}

.simple-popover-portal .state-breakdown-table {
    width: auto;
    border-collapse: collapse;
    font-size: 0.8rem;
    white-space: nowrap;
}

.simple-popover-portal .state-breakdown-table th,
.simple-popover-portal .state-breakdown-table td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.simple-popover-portal .state-breakdown-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    font-size: 0.75rem;
}

.simple-popover-portal .state-breakdown-table th:first-child,
.simple-popover-portal .state-breakdown-table td:first-child {
    text-align: left;
}

.simple-popover-portal .state-breakdown-table tbody tr:last-child td {
    border-bottom: none;
}

.simple-popover-portal .state-count-cell {
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    color: var(--text-secondary);
}

.simple-popover-portal .state-count-total {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.simple-popover-portal .resource-name {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-popover-portal .resource-hours {
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
}

/* Estimate & Forecast Popovers */
.simple-popover-portal .estimate-popover,
.simple-popover-portal .forecast-popover {
    min-width: 200px;
}

.simple-popover-portal .estimate-row,
.simple-popover-portal .forecast-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    gap: 16px;
}

.simple-popover-portal .estimate-row:not(:last-child),
.simple-popover-portal .forecast-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

.simple-popover-portal .estimate-label,
.simple-popover-portal .forecast-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

.simple-popover-portal .estimate-value,
.simple-popover-portal .forecast-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ========================================
   CAPACITY HEATMAP POPOVER STYLES
   (Matches Delivery Schedule calculation format)
   ======================================== */

.simple-popover-portal .heatmap-popover {
    min-width: 280px;
    max-width: 340px;
}

/* Header */
.simple-popover-portal .heatmap-popover .popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.simple-popover-portal .heatmap-popover .popover-header .resource-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.simple-popover-portal .heatmap-popover .popover-header .month-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Section styles */
.simple-popover-portal .heatmap-popover .popover-section {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.simple-popover-portal .heatmap-popover .section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-color);
}

/* Calculation rows (like Delivery Schedule) */
.simple-popover-portal .heatmap-popover .calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 0.82rem;
}

.simple-popover-portal .heatmap-popover .calc-row .calc-label {
    color: var(--text-secondary);
}

.simple-popover-portal .heatmap-popover .calc-row .calc-value {
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.simple-popover-portal .heatmap-popover .calc-row.deduction .calc-label,
.simple-popover-portal .heatmap-popover .calc-row.deduction .calc-value {
    color: var(--deduction-text);
}

.simple-popover-portal .heatmap-popover .calc-row.subtotal {
    border-top: 1px dashed var(--border-color);
    margin-top: 4px;
    padding-top: 4px;
}

.simple-popover-portal .heatmap-popover .calc-row.subtotal .calc-label,
.simple-popover-portal .heatmap-popover .calc-row .calc-value.highlight {
    color: var(--popover-highlight-text);
    font-weight: 600;
}

.simple-popover-portal .heatmap-popover .calc-row.unused .calc-value.available {
    color: var(--popover-highlight-text);
}

.simple-popover-portal .heatmap-popover .calc-row.applied-total {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 4px;
}

.simple-popover-portal .heatmap-popover .calc-row .calc-value.applied-value {
    color: var(--popover-applied-text);
    font-weight: 600;
}

/* Project rows */
.simple-popover-portal .heatmap-popover .project-row {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.simple-popover-portal .heatmap-popover .project-row:last-of-type {
    margin-bottom: 0;
}

.simple-popover-portal .heatmap-popover .project-row.stabilization {
    border-left: 3px solid var(--stabilization-text);
}

.simple-popover-portal .heatmap-popover .project-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.simple-popover-portal .heatmap-popover .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.simple-popover-portal .heatmap-popover .project-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.simple-popover-portal .heatmap-popover .stabilization-badge {
    font-size: 0.7rem;
    background: var(--stabilization-bg);
    color: var(--stabilization-text);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.simple-popover-portal .heatmap-popover .project-calc {
    padding-left: 18px;
    font-size: 0.8rem;
}

.simple-popover-portal .heatmap-popover .date-range {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Total applied row */
.simple-popover-portal .heatmap-popover .total-applied-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.simple-popover-portal .heatmap-popover .total-label {
    font-weight: 600;
    color: var(--text-primary);
}

.simple-popover-portal .heatmap-popover .total-value {
    font-weight: 700;
    color: var(--popover-applied-text);
}

/* Utilization summary */
.simple-popover-portal .heatmap-popover .utilization-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.simple-popover-portal .heatmap-popover .utilization-summary.under {
    background: var(--utilization-under-bg);
    color: var(--utilization-under-text);
}

.simple-popover-portal .heatmap-popover .utilization-summary.healthy {
    background: var(--utilization-healthy-bg);
    color: var(--utilization-healthy-text);
}

.simple-popover-portal .heatmap-popover .utilization-summary.full {
    background: var(--utilization-full-bg);
    color: var(--utilization-full-text);
}

.simple-popover-portal .heatmap-popover .utilization-summary.over {
    background: var(--utilization-over-bg);
    color: var(--utilization-over-text);
}

/* Status footer */
.simple-popover-portal .heatmap-popover .popover-status {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.simple-popover-portal .heatmap-popover .popover-status.transition {
    background: linear-gradient(135deg, var(--transition-gradient-start) 0%, var(--transition-gradient-end) 100%);
    color: var(--transition-text);
}

.simple-popover-portal .heatmap-popover .popover-status.over-allocated {
    background: var(--utilization-over-bg);
    color: var(--utilization-over-text);
}

/* ========================================
   DARK THEME OVERRIDES
   Note: Most styling is now handled via CSS variables
   defined in app.css. Special overrides are no longer needed
   since all base styles use theme-aware CSS variables.
   ======================================== */

/* Ensure popover content is visible in dark mode */
[data-theme="dark"] .simple-popover-portal {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .simple-popover-portal .popover-header {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
    background: transparent;
}

[data-theme="dark"] .simple-popover-portal .state-breakdown-table th {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

[data-theme="dark"] .simple-popover-portal .state-breakdown-table td {
    color: var(--text-primary);
}

/* Estimate & Forecast Popover Dark Mode */
[data-theme="dark"] .simple-popover-portal .estimate-popover,
[data-theme="dark"] .simple-popover-portal .forecast-popover {
    background: transparent;
}

[data-theme="dark"] .simple-popover-portal .estimate-row,
[data-theme="dark"] .simple-popover-portal .forecast-row {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .simple-popover-portal .estimate-label,
[data-theme="dark"] .simple-popover-portal .forecast-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .simple-popover-portal .estimate-value,
[data-theme="dark"] .simple-popover-portal .forecast-value {
    color: var(--text-primary);
}

/* State Counts Popover Dark Mode */
[data-theme="dark"] .simple-popover-portal .state-counts-popover,
[data-theme="dark"] .simple-popover-portal .state-counts-table {
    background: transparent;
}

[data-theme="dark"] .simple-popover-portal .state-count-row {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .simple-popover-portal .state-count {
    color: var(--text-primary);
}

[data-theme="dark"] .simple-popover-portal .state-badge-sm {
    color: var(--text-on-primary);
}

/* Resource Counts Popover Dark Mode */
[data-theme="dark"] .simple-popover-portal .resource-counts-popover {
    background: transparent;
}

[data-theme="dark"] .simple-popover-portal .resource-row {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .simple-popover-portal .resource-name {
    color: var(--text-primary);
}

[data-theme="dark"] .simple-popover-portal .resource-hours {
    color: var(--primary-color);
}

/* Heatmap Popover Dark Mode */
[data-theme="dark"] .simple-popover-portal .heatmap-popover .popover-section {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .simple-popover-portal .heatmap-popover .project-row {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .simple-popover-portal .heatmap-popover .calc-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .simple-popover-portal .heatmap-popover .calc-value {
    color: var(--text-primary);
}
