/* Dark and Dark Compact parity fixes for controls, overlays, and charts. */

/* Keep toolbar inputs compact while preserving readable form inputs elsewhere. */
html:is(.theme-dark,.theme-dark-compact) :is(
    .filter-toolbar,
    .table-toolbar,
    .feature-toolbar,
    .evidence-filter-row,
    .quick-audit-filter-row,
    .policy-page-actions
) :is(.ant-input,.ant-input-affix-wrapper,.ant-input-search .ant-input-affix-wrapper),
html:is(.theme-dark,.theme-dark-compact) :is(.filter-search-box,.asset-search-field,.report-search-field) :is(.ant-input,.ant-input-affix-wrapper) {
    min-height: 32px !important;
    height: 32px !important;
    padding-block: 2px !important;
    border-radius: 8px !important;
}

html:is(.theme-dark,.theme-dark-compact) :is(.filter-toolbar,.table-toolbar,.feature-toolbar,.evidence-filter-row,.quick-audit-filter-row) .ant-select:not(.ant-select-customize-input) .ant-select-selector {
    min-height: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
}

html:is(.theme-dark,.theme-dark-compact) :is(.filter-toolbar,.table-toolbar,.feature-toolbar,.evidence-filter-row,.quick-audit-filter-row) .ant-select-single .ant-select-selector :is(.ant-select-selection-item,.ant-select-selection-placeholder) {
    line-height: 30px !important;
}

/* Select is portalled to #app-overlay-root; style every internal surface. */
html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .ant-select-dropdown,
html:is(.theme-dark,.theme-dark-compact) .ant-select-dropdown {
    padding: 6px !important;
    overflow: hidden !important;
    border: 1px solid rgba(129,140,248,.34) !important;
    border-radius: 10px !important;
    background: #121a3a !important;
    color: #eef2ff !important;
    box-shadow: 0 22px 50px -14px rgba(0,0,0,.88) !important;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root :is(
    .rc-virtual-list,
    .rc-virtual-list-holder,
    .rc-virtual-list-holder-inner,
    .ant-select-item,
    .ant-select-item-option,
    .ant-select-item-option-content
) {
    background-color: transparent !important;
    color: #eef2ff !important;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .ant-select-item {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 7px;
    line-height: 20px;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .ant-select-item-option-active:not(.ant-select-item-option-disabled) {
    background: rgba(99,102,241,.22) !important;
    color: #fff !important;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
    background: rgba(34,211,238,.16) !important;
    color: #a5f3fc !important;
    font-weight: 650;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .ant-select-item-option-selected .ant-select-item-option-state {
    color: #67e8f9 !important;
}

html:is(.theme-dark,.theme-dark-compact) #app-overlay-root .rc-virtual-list-scrollbar-thumb {
    background: rgba(129,140,248,.45) !important;
}

/* HTML/CSS donut and ring counters across feature dashboards. */
html:is(.theme-dark,.theme-dark-compact) :is(
    .score-ring strong,
    .score-ring span,
    .risk-donut strong,
    .risk-donut span,
    .treatment-donut strong,
    .treatment-donut span,
    .vendor-donut strong,
    .vendor-donut span,
    .access-ring span,
    .donut strong,
    .donut b,
    .donut span,
    .donut small
) {
    color: #fff !important;
    opacity: 1 !important;
    text-shadow: 0 1px 8px rgba(0,0,0,.45);
}

html:is(.theme-dark,.theme-dark-compact) :is(
    .risk-donut::after,
    .treatment-donut::before,
    .vendor-donut::before,
    .access-ring::before,
    .donut::before
) {
    background: #111936 !important;
}

/* SVG-based chart labels use the same dark-theme contrast. */
html:is(.theme-dark,.theme-dark-compact) :is(.chart-host,.quick-audit-chart-host,.copilot-vega-chart) svg text {
    fill: #fff !important;
}




/* Source dark navbar: icon boxes, counters, and navigation spacing. */
html:is(.theme-dark, .theme-dark-compact) .nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 27px;
    padding: 7px 10px 5px;
    color: #7286a3;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .105em;
    line-height: 1;
    text-transform: uppercase;
}

html:is(.theme-dark, .theme-dark-compact) .nav-section-title::after {
    height: 1px;
    flex: 1;
    background: linear-gradient(
        90deg,
        rgba(var(--nav-accent-rgb), .27),
        transparent
    );
    content: "";
}

html:is(.theme-dark, .theme-dark-compact) .sidebar-collapsed .nav-section-title {
    display: none;
}

html:is(.theme-dark, .theme-dark-compact) .nav-section {
    --nav-accent: #818cf8;
    --nav-accent-rgb: 129, 140, 248;
    margin: 0 0 13px;
}

html:is(.theme-dark, .theme-dark-compact) .nav-section.nav-tone-violet { --nav-accent: #a78bfa; --nav-accent-rgb: 167, 139, 250; }
html:is(.theme-dark, .theme-dark-compact) .nav-section.nav-tone-rose { --nav-accent: #fb7185; --nav-accent-rgb: 251, 113, 133; }
html:is(.theme-dark, .theme-dark-compact) .nav-section.nav-tone-amber { --nav-accent: #fbbf24; --nav-accent-rgb: 251, 191, 36; }
html:is(.theme-dark, .theme-dark-compact) .nav-section.nav-tone-indigo { --nav-accent: #818cf8; --nav-accent-rgb: 129, 140, 248; }
html:is(.theme-dark, .theme-dark-compact) .nav-section.nav-tone-emerald { --nav-accent: #34d399; --nav-accent-rgb: 52, 211, 153; }

html:is(.theme-dark, .theme-dark-compact) .nav-entry {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    margin: 3px 0;
    padding: 6px 9px;
    border: 1px solid transparent !important;
    border-radius: 12px;
    color: #a3aecb !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-icon {
    display: grid;
    width: 32px;
    min-width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(var(--nav-accent-rgb), .16) !important;
    border-radius: 9px;
    background: rgba(var(--nav-accent-rgb), .12) !important;
    color: var(--nav-accent) !important;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-icon .anticon {
    display: inline-flex;
    width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    color: inherit !important;
    font-size: 17px;
    line-height: 1;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-icon .anticon svg {
    display: block;
    width: 1em;
    height: 1em;
    fill: currentColor;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry:hover {
    border-color: rgba(var(--nav-accent-rgb), .22) !important;
    background: rgba(var(--nav-accent-rgb), .1) !important;
    color: #f3f5ff !important;
    box-shadow: none !important;
    transform: translateX(2px);
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry:hover .nav-icon {
    border-color: rgba(34, 211, 238, .45) !important;
    background: rgba(34, 211, 238, .14) !important;
    color: #67e8f9 !important;
    transform: scale(1.04);
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry.active {
    border-color: rgba(var(--nav-accent-rgb), .42) !important;
    background: linear-gradient(95deg, rgba(var(--nav-accent-rgb), .34), rgba(var(--nav-accent-rgb), .14) 70%, rgba(var(--nav-accent-rgb), .04)) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 #22d3ee, 0 12px 26px -12px rgba(var(--nav-accent-rgb), .75) !important;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry.active .nav-icon {
    border-color: transparent !important;
    background: linear-gradient(135deg, var(--nav-accent), #22d3ee) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px -4px rgba(var(--nav-accent-rgb), .8) !important;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-badge {
    display: inline-flex;
    margin-left: auto;
    line-height: 1;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .nav-badge .ant-badge-count {
    position: static;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    transform: none;
    border: 1px solid rgba(142, 166, 199, .22);
    border-radius: 999px;
    background: rgba(142, 166, 199, .12);
    color: #c8d5e7;
    box-shadow: none;
    font-size: 12px;
    line-height: 18px;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .site-badge-count-standard .ant-badge-count {
    border-color: rgba(251, 113, 133, .25);
    background: rgba(251, 113, 133, .17);
    color: #fda4af;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .site-badge-count-4 .ant-badge-count {
    border-color: rgba(148, 163, 184, .2);
    background: rgba(148, 163, 184, .13);
    color: #cbd5e1;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry .site-badge-count-109 .ant-badge-count {
    border-color: rgba(52, 211, 153, .24);
    background: rgba(52, 211, 153, .16);
    color: #6ee7b7;
}

html:is(.theme-dark, .theme-dark-compact) .nav-entry.active .nav-badge .ant-badge-count {
    border-color: rgba(34, 211, 238, .45) !important;
    background: rgba(34, 211, 238, .16) !important;
    color: #a5f3fc !important;
}

html:is(.theme-dark, .theme-dark-compact) .sidebar-collapsed .nav-entry {
    position: relative;
    justify-content: center;
}

html:is(.theme-dark, .theme-dark-compact) .sidebar-collapsed .nav-icon {
    width: 36px;
    min-width: 36px;
    height: 36px;
}

html:is(.theme-dark, .theme-dark-compact) .sidebar-collapsed .nav-entry .nav-badge {
    position: absolute;
    top: 3px;
    right: 2px;
    display: inline-flex !important;
    margin: 0;
}

html:is(.theme-dark, .theme-dark-compact) .sidebar-collapsed .nav-entry .nav-badge .ant-badge-count {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 12px;
    line-height: 15px;
}

