/* =============================================================================
   POLICIES PAGES - MODERN STYLES
   Using established theme variables from dashboard-modern.css
   ============================================================================= */

/* =============================================================================
   PAGE CONTAINER
   ============================================================================= */

#policies-page {
    padding: 0 24px 24px 24px;
    min-height: 100vh;
}

/* =============================================================================
   PAGE HEADER - Title & Subtitle (Dashboard Style)
   ============================================================================= */

#policies-page .alerts-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 4px 0 8px 0;
}

#policies-page .alerts-header-title {
    font-size: 24px;
    font-weight: 600;
    color: #e6edf3;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

#policies-page .alerts-header-subtitle {
    font-size: 14px;
    color: #8b949e;
    margin: 0;
    font-weight: 400;
}

/* =============================================================================
   COMPANY SELECTION MESSAGES
   ============================================================================= */



#policies-page .policy-content-disabled {
    opacity: 0.45;
    pointer-events: none;
    filter: blur(6px);
}

/* Light theme adjustments */


/* =============================================================================
   NAVBAR - Tab Navigation
   ============================================================================= */

#policies-page>.page-bar {
    background: var(--theme-bg-glass, rgba(26, 32, 40, 0.82)) !important;
    border: 1px solid var(--theme-border-color, rgba(48, 54, 61, 0.6)) !important;
    border-radius: 14px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
}

/* Light theme page-bar - CRITICAL */
html[data-theme="light"] #policies-page>.page-bar,
[data-theme="light"] #policies-page>.page-bar {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

#policies-page .page-bar .row,
#policies-page .page-bar .row.mybar,
#policies-page .page-bar .mybar {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 !important;
    height: auto !important;
    background: transparent !important;
    width: 100% !important;
}

/* Hide the "You are on" title bar - but keep group selector visible */
#policies-page .page-bar .mytitle .pre-title,
#policies-page .page-bar .row.mytitle .pre-title {
    display: none !important;
}

/* Make sure mytitle row with group selector is still visible */
#policies-page .page-bar .mytitle,
#policies-page .page-bar .row.mytitle {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    background: transparent !important;
    width: 100% !important;
}

/* Pull right container for buttons */
#policies-page .page-bar .pull-right {
    margin-left: auto !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

#policies-page .btn-bar {
    background: transparent !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    color: #8b949e !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1.4 !important;
}

#policies-page .btn-bar:hover {
    background: rgba(88, 166, 255, 0.1) !important;
    border-color: rgba(88, 166, 255, 0.3) !important;
    color: #e6edf3 !important;
}

#policies-page .btn-bar.active {
    background: rgba(88, 166, 255, 0.15) !important;
    border-color: rgba(88, 166, 255, 0.3) !important;
    color: #58a6ff !important;
}

#policies-page .btn-bar i {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#policies-page .btn-bar:hover i,
#policies-page .btn-bar.active i {
    opacity: 1;
}

/* Primary Button - Blue transparent gradient */
#policies-page .btn-primary:not(.btn-pag) {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.25) 0%, rgba(54, 127, 211, 0.15) 100%) !important;
    border: 1px solid rgba(54, 127, 211, 0.4) !important;
    color: #e6edf3 !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1.4 !important;
}

#policies-page .btn-primary:not(.btn-pag):hover {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.35) 0%, rgba(54, 127, 211, 0.25) 100%) !important;
    border-color: #58a6ff !important;
    box-shadow: 0 0 16px rgba(54, 127, 211, 0.25) !important;
}

/* Light theme - primary button (Add New Policy, etc.) */
[data-theme="light"] #policies-page .btn-primary:not(.btn-pag),
html[data-theme="light"] #policies-page .btn-primary:not(.btn-pag) {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue-dark) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] #policies-page .btn-primary:not(.btn-pag):hover,
html[data-theme="light"] #policies-page .btn-primary:not(.btn-pag):hover {
    background: linear-gradient(145deg, var(--theme-accent-blue-dark) 0%, var(--theme-accent-blue-darker) 100%) !important;
    border-color: var(--theme-accent-blue-darker) !important;
    box-shadow: 0 4px 12px var(--theme-accent-blue-glow) !important;
}

/* =============================================================================
   GROUP SELECTOR & INFO BARS (Secondary page-bar sections)
   ============================================================================= */

/* Override all page-bar styling within policies-page */
#policies-page .page-bar {
    background: var(--theme-bg-glass, rgba(26, 32, 40, 0.82)) !important;
    border: 1px solid var(--theme-border-color, rgba(48, 54, 61, 0.6)) !important;
    border-radius: 14px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
}

/* Group selector dropdown styling - override inline styles */
#policies-page .page-bar .dropdown .btn.dropdown-toggle,
#policies-page .page-bar .mytitle .dropdown .btn.dropdown-toggle,
#policies-page .dropdown>.btn.dropdown-toggle {
    background: rgba(0, 0, 0, 0.3) !important;
    background-color: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 6px !important;
    color: #e6edf3 !important;
    padding: 8px 14px !important;
    font-size: 14px !important;
    text-align: left !important;
}

/* Light theme group selector dropdown */
[data-theme="light"] #policies-page .page-bar .dropdown .btn.dropdown-toggle,
[data-theme="light"] #policies-page .page-bar .mytitle .dropdown .btn.dropdown-toggle,
[data-theme="light"] #policies-page .dropdown>.btn.dropdown-toggle,
html[data-theme="light"] #policies-page .page-bar .dropdown .btn.dropdown-toggle,
html[data-theme="light"] #policies-page .page-bar .mytitle .dropdown .btn.dropdown-toggle,
html[data-theme="light"] #policies-page .dropdown>.btn.dropdown-toggle {
    background: var(--theme-bg-secondary) !important;
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

/* Endpoint group selector button should be #f1f5f9 */
[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown>.policy-group-btn.btn.dropdown-toggle,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown>.policy-group-btn.btn.dropdown-toggle {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    border-color: var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown>.policy-group-btn.btn.dropdown-toggle:hover,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown>.policy-group-btn.btn.dropdown-toggle:hover {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] #policies-page .page-bar .dropdown .btn.dropdown-toggle:hover,
[data-theme="light"] #policies-page .dropdown>.btn.dropdown-toggle:hover,
html[data-theme="light"] #policies-page .page-bar .dropdown .btn.dropdown-toggle:hover,
html[data-theme="light"] #policies-page .dropdown>.btn.dropdown-toggle:hover {
    background: var(--theme-bg-tertiary) !important;
    background-color: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-accent-blue) !important;
}

#policies-page .page-bar .dropdown .dropdown-menu,
#policies-page .page-bar .mytitle .dropdown .dropdown-menu,
#policies-page .dropdown>.dropdown-menu {
    background: #1a2028 !important;
    background-color: #1a2028 !important;
    border: 1px solid rgba(48, 54, 61, 0.8) !important;
    border-radius: 8px !important;
    padding: 6px 0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    opacity: 1 !important;
}

#policies-page .page-bar .dropdown .dropdown-menu li a,
#policies-page .page-bar .mytitle .dropdown .dropdown-menu li a,
#policies-page .dropdown>.dropdown-menu li a {
    color: #e6edf3 !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    transition: background 0.15s ease !important;
}

#policies-page .page-bar .dropdown .dropdown-menu li a:hover,
#policies-page .page-bar .mytitle .dropdown .dropdown-menu li a:hover,
#policies-page .dropdown>.dropdown-menu li a:hover {
    background: rgba(88, 166, 255, 0.1) !important;
}

/* Ensure all inner divs in page-bar have transparent background (except dropdowns) */
#policies-page .page-bar>div,
#policies-page .page-bar .row>div:not(.dropdown),
#policies-page .page-bar .mybar>div:not(.dropdown),
#policies-page .page-bar .mytitle>div:not(.dropdown) {
    background: transparent !important;
    background-color: transparent !important;
}

/* Pre-title text styling */
#policies-page .pre-pre-title,
#policies-page .pre-title {
    color: #8b949e !important;
    font-size: 14px !important;
}

/* Info icon styling */
#policies-page .fa-info-circle {
    color: #58a6ff !important;
}

#policies-page .fa-question-circle {
    color: #6e7681 !important;
}

/* =============================================================================
   ROW LAYOUT
   ============================================================================= */

#policies-page .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

#policies-page .col-md-4,
#policies-page .col-md-6,
#policies-page .col-md-8,
#policies-page .col-md-12 {
    padding-left: 0 !important;
    padding-right: 12px !important;
}

/* =============================================================================
   TABLE STYLES
   ============================================================================= */

#policies-page .table-container {
    background: rgba(26, 32, 40, 0.82);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 14px;
    overflow: visible;
}

/* Light theme - table container */
[data-theme="light"] #policies-page .table-container,
html[data-theme="light"] #policies-page .table-container {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

#policies-page #malware-table,
#policies-page #malware-table2,
#policies-page .table {
    width: 100% !important;
    margin-bottom: 0 !important;
    background: transparent !important;
    border-collapse: collapse !important;
    position: relative;
    z-index: 2;
}

#policies-page #malware-table thead th,
#policies-page #malware-table2 thead th,
#policies-page .table thead th {
    background: var(--theme-table-header-bg, #11161d) !important;
    color: var(--theme-text-muted, #8b949e) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 21px 16px !important;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6) !important;
    min-height: 48px !important;
    height: 48px !important;
    vertical-align: middle !important;
}

#policies-page #malware-table thead th.center,
#policies-page #malware-table2 thead th.center,
#policies-page .table thead th.center {
    text-align: center !important;
}

#policies-page #malware-table tbody tr,
#policies-page #malware-table2 tbody tr,
#policies-page .table tbody tr {
    border-bottom: 1px solid var(--theme-border-color, rgba(48, 54, 61, 0.4)) !important;
    transition: background 0.15s ease !important;
    position: relative !important;
    z-index: auto !important;
}

/* When a row has an open dropdown, give it high z-index so menu appears above other rows */
#policies-page #malware-table tbody tr:has(.dropdown.open),
#policies-page #malware-table2 tbody tr:has(.dropdown.open),
#policies-page .table tbody tr:has(.dropdown.open),
#policies-page .exclusions-portlet tbody tr:has(.dropdown.open) {
    z-index: 9999 !important;
    position: relative !important;
}

#policies-page #malware-table tbody tr:hover,
#policies-page #malware-table2 tbody tr:hover,
#policies-page .table tbody tr:hover {
    background: var(--theme-table-row-hover, rgba(88, 166, 255, 0.05)) !important;
}

/* Light theme table rows - CRITICAL */
html[data-theme="light"] #policies-page #malware-table tbody tr,
html[data-theme="light"] #policies-page #malware-table2 tbody tr,
html[data-theme="light"] #policies-page .table tbody tr,
[data-theme="light"] #policies-page #malware-table tbody tr,
[data-theme="light"] #policies-page #malware-table2 tbody tr,
[data-theme="light"] #policies-page .table tbody tr {
    background: var(--theme-bg-secondary) !important;
    border-bottom: 1px solid var(--theme-border-subtle) !important;
}

html[data-theme="light"] #policies-page #malware-table tbody tr:nth-child(even),
html[data-theme="light"] #policies-page #malware-table2 tbody tr:nth-child(even),
html[data-theme="light"] #policies-page .table tbody tr:nth-child(even),
[data-theme="light"] #policies-page #malware-table tbody tr:nth-child(even),
[data-theme="light"] #policies-page #malware-table2 tbody tr:nth-child(even),
[data-theme="light"] #policies-page .table tbody tr:nth-child(even) {
    background: var(--theme-bg-tertiary) !important;
}

html[data-theme="light"] #policies-page #malware-table tbody tr:hover,
html[data-theme="light"] #policies-page #malware-table2 tbody tr:hover,
html[data-theme="light"] #policies-page .table tbody tr:hover,
[data-theme="light"] #policies-page #malware-table tbody tr:hover,
[data-theme="light"] #policies-page #malware-table2 tbody tr:hover,
[data-theme="light"] #policies-page .table tbody tr:hover {
    background: var(--theme-table-row-hover) !important;
}

#policies-page #malware-table tbody tr:last-child,
#policies-page #malware-table2 tbody tr:last-child,
#policies-page .table tbody tr:last-child {
    border-bottom: none !important;
}

#policies-page #malware-table tbody td,
#policies-page #malware-table2 tbody td,
#policies-page .table tbody td {
    padding: 12px 16px !important;
    color: var(--theme-text-primary, #e6edf3) !important;
    font-size: 13px !important;
    vertical-align: middle !important;
    border: none !important;
}

/* Light theme table cell text - CRITICAL */
html[data-theme="light"] #policies-page #malware-table tbody td,
html[data-theme="light"] #policies-page #malware-table2 tbody td,
html[data-theme="light"] #policies-page .table tbody td,
[data-theme="light"] #policies-page #malware-table tbody td,
[data-theme="light"] #policies-page #malware-table2 tbody td,
[data-theme="light"] #policies-page .table tbody td {
    color: var(--theme-text-tertiary) !important;
}

#policies-page #malware-table tbody td.center,
#policies-page #malware-table2 tbody td.center,
#policies-page .table tbody td.center {
    text-align: center !important;
}

/* Disabled Policy Row - Red bar indicator on left */
#policies-page #malware-table tbody tr.disabled-row,
#policies-page #malware-table2 tbody tr.disabled-row,
#policies-page .table tbody tr.disabled-row {
    background: rgba(0, 0, 0, 0.15) !important;
}

#policies-page #malware-table tbody tr.THREAT td:first-child,
#policies-page #malware-table2 tbody tr.THREAT td:first-child,
#policies-page .table tbody tr.THREAT td:first-child,
#policies-page #malware-table tbody tr.disabled-row td:first-child,
#policies-page #malware-table2 tbody tr.disabled-row td:first-child,
#policies-page .table tbody tr.disabled-row td:first-child {
    border-left: 4px solid #f85149 !important;
}

#policies-page #malware-table tbody tr.THREAT:hover,
#policies-page #malware-table2 tbody tr.THREAT:hover,
#policies-page .table tbody tr.THREAT:hover,
#policies-page #malware-table tbody tr.disabled-row:hover,
#policies-page #malware-table2 tbody tr.disabled-row:hover,
#policies-page .table tbody tr.disabled-row:hover {
    background: rgba(0, 0, 0, 0.2) !important;
}

/* Apply opacity to content cells only, not the actions column */
#policies-page #malware-table tbody tr.THREAT td:not(:last-child),
#policies-page #malware-table2 tbody tr.THREAT td:not(:last-child),
#policies-page .table tbody tr.THREAT td:not(:last-child),
#policies-page #malware-table tbody tr.disabled-row td:not(:last-child),
#policies-page #malware-table2 tbody tr.disabled-row td:not(:last-child),
#policies-page .table tbody tr.disabled-row td:not(:last-child) {
    opacity: 0.6 !important;
}

#policies-page #malware-table tbody tr.THREAT:hover td:not(:last-child),
#policies-page #malware-table2 tbody tr.THREAT:hover td:not(:last-child),
#policies-page .table tbody tr.THREAT:hover td:not(:last-child),
#policies-page #malware-table tbody tr.disabled-row:hover td:not(:last-child),
#policies-page #malware-table2 tbody tr.disabled-row:hover td:not(:last-child),
#policies-page .table tbody tr.disabled-row:hover td:not(:last-child) {
    opacity: 0.7 !important;
}

/* Fix for dropdown column in THREAT/disabled rows - ensure it's fully clickable */
#policies-page #malware-table tbody tr.THREAT td:last-child,
#policies-page #malware-table2 tbody tr.THREAT td:last-child,
#policies-page .table tbody tr.THREAT td:last-child,
#policies-page #malware-table tbody tr.disabled-row td:last-child,
#policies-page #malware-table2 tbody tr.disabled-row td:last-child,
#policies-page .table tbody tr.disabled-row td:last-child {
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
    pointer-events: auto !important;
}

/* Ensure dropdown button in THREAT rows is fully interactive */
#policies-page #malware-table tbody tr.THREAT .dropdown,
#policies-page #malware-table2 tbody tr.THREAT .dropdown,
#policies-page .table tbody tr.THREAT .dropdown,
#policies-page #malware-table tbody tr.disabled-row .dropdown,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown,
#policies-page .table tbody tr.disabled-row .dropdown {
    position: relative !important;
    z-index: 101 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Ensure dropdown toggle button is clickable */
#policies-page #malware-table tbody tr.THREAT .dropdown .btn.dropdown-toggle,
#policies-page #malware-table2 tbody tr.THREAT .dropdown .btn.dropdown-toggle,
#policies-page .table tbody tr.THREAT .dropdown .btn.dropdown-toggle,
#policies-page #malware-table tbody tr.disabled-row .dropdown .btn.dropdown-toggle,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown .btn.dropdown-toggle,
#policies-page .table tbody tr.disabled-row .dropdown .btn.dropdown-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Ensure open dropdown has highest z-index */
#policies-page #malware-table tbody tr.THREAT .dropdown.open,
#policies-page #malware-table2 tbody tr.THREAT .dropdown.open,
#policies-page .table tbody tr.THREAT .dropdown.open,
#policies-page #malware-table tbody tr.disabled-row .dropdown.open,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown.open,
#policies-page .table tbody tr.disabled-row .dropdown.open {
    z-index: 10000 !important;
}

/* Ensure dropdown menu in THREAT rows is visible and clickable */
#policies-page #malware-table tbody tr.THREAT .dropdown-menu li,
#policies-page #malware-table2 tbody tr.THREAT .dropdown-menu li,
#policies-page .table tbody tr.THREAT .dropdown-menu li,
#policies-page #malware-table tbody tr.disabled-row .dropdown-menu li,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu li,
#policies-page .table tbody tr.disabled-row .dropdown-menu li {
    opacity: 1 !important;
    pointer-events: auto !important;
}

#policies-page #malware-table tbody tr.THREAT .dropdown-menu li a,
#policies-page #malware-table2 tbody tr.THREAT .dropdown-menu li a,
#policies-page .table tbody tr.THREAT .dropdown-menu li a,
#policies-page #malware-table tbody tr.disabled-row .dropdown-menu li a,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu li a,
#policies-page .table tbody tr.disabled-row .dropdown-menu li a {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Fix for .dropdown-menu.pull-right in THREAT rows - ensure fully visible and clickable */
#policies-page #malware-table tbody tr.THREAT .dropdown-menu.pull-right,
#policies-page #malware-table2 tbody tr.THREAT .dropdown-menu.pull-right,
#policies-page .table tbody tr.THREAT .dropdown-menu.pull-right,
#policies-page #malware-table tbody tr.disabled-row .dropdown-menu.pull-right,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu.pull-right,
#policies-page .table tbody tr.disabled-row .dropdown-menu.pull-right,
#policies-page .exclusions-portlet tbody tr.THREAT .dropdown-menu.pull-right,
#policies-page .exclusions-portlet tbody tr.disabled-row .dropdown-menu.pull-right,
#policies-page .exclusions-portlet tbody tr .dropdown-menu.pull-right {
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 99999 !important;
    background: #1a2028 !important;
    background-color: #1a2028 !important;
    visibility: visible !important;
    border: 1px solid rgba(48, 54, 61, 0.8) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    position: absolute !important;
}

/* Force toggle button to be BELOW dropdown menu when open */
#policies-page .exclusions-portlet .dropdown.open .btn.dropdown-toggle,
#policies-page table .dropdown.open .btn.dropdown-toggle,
#policies-page .table-container .dropdown.open .btn.dropdown-toggle,
#policies-page tbody tr .dropdown.open .btn.dropdown-toggle,
#policies-page .dropdown.pull-right.open .btn.dropdown-toggle,
#policies-page .dropdown.pull-right.open>.btn.dropdown-toggle,
#policies-page .dropdown.open>.btn.dropdown-toggle,
#policies-page .dropdown.open>a.btn.dropdown-toggle {
    position: relative !important;
    z-index: -1 !important;
}

/* Keep endpoint group selector visible when dropdown is open */
#policies-page .policy-group-dropdown.dropdown.open>.policy-group-btn.btn.dropdown-toggle,
#policies-page .policy-group-dropdown.open>.policy-group-btn.btn.dropdown-toggle {
    position: relative !important;
    z-index: 1002 !important;
    visibility: visible !important;
}

/* Force dropdown menu to be ABOVE toggle button when open */
#policies-page .exclusions-portlet .dropdown.open .dropdown-menu,
#policies-page .exclusions-portlet .dropdown.open .dropdown-menu.pull-right,
#policies-page .dropdown.pull-right.open .dropdown-menu,
#policies-page .dropdown.pull-right.open .dropdown-menu.pull-right,
#policies-page .dropdown.pull-right.open>.dropdown-menu.pull-right,
#policies-page .dropdown.open>ul.dropdown-menu.pull-right,
#policies-page .dropdown.open .dropdown-menu.pull-right {
    z-index: 2147483647 !important;
    position: absolute !important;
}

/* Light theme - disabled/THREAT rows should not use red background */
[data-theme="light"] #policies-page #malware-table tbody tr.THREAT,
[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT,
[data-theme="light"] #policies-page .table tbody tr.THREAT,
[data-theme="light"] #policies-page #malware-table tbody tr.disabled-row,
[data-theme="light"] #policies-page #malware-table2 tbody tr.disabled-row,
[data-theme="light"] #policies-page .table tbody tr.disabled-row,
html[data-theme="light"] #policies-page #malware-table tbody tr.THREAT,
html[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT,
html[data-theme="light"] #policies-page .table tbody tr.THREAT {
    background: transparent !important;
    background-color: transparent !important;
}

[data-theme="light"] #policies-page #malware-table tbody tr.THREAT:hover,
[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT:hover,
[data-theme="light"] #policies-page .table tbody tr.THREAT:hover,
[data-theme="light"] #policies-page #malware-table tbody tr.disabled-row:hover,
[data-theme="light"] #policies-page #malware-table2 tbody tr.disabled-row:hover,
[data-theme="light"] #policies-page .table tbody tr.disabled-row:hover,
html[data-theme="light"] #policies-page #malware-table tbody tr.THREAT:hover,
html[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT:hover,
html[data-theme="light"] #policies-page .table tbody tr.THREAT:hover {
    background: transparent !important;
    background-color: transparent !important;
}

[data-theme="light"] #policies-page #malware-table tbody tr.THREAT td,
[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT td,
[data-theme="light"] #policies-page .table tbody tr.THREAT td,
html[data-theme="light"] #policies-page #malware-table tbody tr.THREAT td,
html[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT td,
html[data-theme="light"] #policies-page .table tbody tr.THREAT td {
    color: inherit !important;
}

/* Fix for dropdowns inside disabled rows - ensure background is solid */
#policies-page #malware-table tbody tr.THREAT .dropdown-menu,
#policies-page #malware-table2 tbody tr.THREAT .dropdown-menu,
#policies-page .table tbody tr.THREAT .dropdown-menu,
#policies-page #malware-table tbody tr.disabled-row .dropdown-menu,
#policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu,
#policies-page .table tbody tr.disabled-row .dropdown-menu {
    background: #1a2028 !important;
    background-color: #1a2028 !important;
    opacity: 1 !important;
    border: 1px solid rgba(48, 54, 61, 0.8) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

/* Light theme - Fix for dropdowns inside disabled rows */
[data-theme="light"] #policies-page #malware-table tbody tr.THREAT .dropdown-menu,
[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT .dropdown-menu,
[data-theme="light"] #policies-page .table tbody tr.THREAT .dropdown-menu,
[data-theme="light"] #policies-page #malware-table tbody tr.disabled-row .dropdown-menu,
[data-theme="light"] #policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu,
[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu,
html[data-theme="light"] #policies-page #malware-table tbody tr.THREAT .dropdown-menu,
html[data-theme="light"] #policies-page #malware-table2 tbody tr.THREAT .dropdown-menu,
html[data-theme="light"] #policies-page .table tbody tr.THREAT .dropdown-menu,
html[data-theme="light"] #policies-page #malware-table tbody tr.disabled-row .dropdown-menu,
html[data-theme="light"] #policies-page #malware-table2 tbody tr.disabled-row .dropdown-menu,
html[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu {
    background: var(--theme-bg-secondary, #ffffff) !important;
    background-color: var(--theme-bg-secondary, #ffffff) !important;
    border: 1px solid var(--theme-border-color, #d0d7de) !important;
    box-shadow: var(--theme-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12)) !important;
    opacity: 1 !important;
    background-clip: padding-box !important;
}

[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li a,
html[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li a {
    color: var(--theme-text-primary, #24292f) !important;
    background: transparent !important;
}

[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li a:hover,
html[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li a:hover {
    background: var(--theme-table-row-hover, #f6f8fa) !important;
    color: var(--theme-accent-blue, #367fd3) !important;
}

[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li.divider,
html[data-theme="light"] #policies-page .table tbody tr.disabled-row .dropdown-menu li.divider {
    background: var(--theme-border-color, #d0d7de) !important;
}

/* =============================================================================
   SHOW DISABLED TOGGLE
   ============================================================================= */

.policy-filter-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.policy-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.policy-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(110, 118, 129, 0.4);
    border-radius: 11px;
    transition: background 0.2s ease;
}

.policy-toggle-switch.active {
    background: rgba(54, 127, 211, 0.6);
}

.policy-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.policy-toggle-switch.active .policy-toggle-slider {
    transform: translateX(18px);
}

.policy-toggle-text {
    font-size: 13px;
    color: #8b949e;
    font-weight: 500;
}

/* Light theme toggle */
[data-theme="light"] .policy-toggle-switch,
html[data-theme="light"] .policy-toggle-switch {
    background: #d0d7de;
}

[data-theme="light"] .policy-toggle-switch.active,
html[data-theme="light"] .policy-toggle-switch.active {
    background: var(--theme-accent-blue, #367fd3);
}

[data-theme="light"] .policy-toggle-text,
html[data-theme="light"] .policy-toggle-text {
    color: var(--theme-text-secondary, #57606a);
}

/* =============================================================================
   POLICY BADGES
   ============================================================================= */

#policies-page .policy-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#policies-page .badge-type {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

#policies-page .badge-allow {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

#policies-page .badge-block {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

#policies-page .badge-applies-to {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

/* =============================================================================
   ACTIONS DROPDOWN (Table row actions)
   ============================================================================= */

#policies-page table .dropdown .btn.dropdown-toggle,
#policies-page .table-container .dropdown .btn.dropdown-toggle {
    background: rgba(54, 127, 211, 0.1) !important;
    border: 1px solid rgba(54, 127, 211, 0.2) !important;
    border-radius: 6px !important;
    color: #58a6ff !important;
    padding: 6px 10px !important;
    transition: all 0.15s ease !important;
}

#policies-page table .dropdown .btn.dropdown-toggle:hover,
#policies-page .table-container .dropdown .btn.dropdown-toggle:hover {
    background: rgba(54, 127, 211, 0.2) !important;
    border-color: rgba(54, 127, 211, 0.4) !important;
}

#policies-page table .dropdown-menu,
#policies-page .table-container .dropdown-menu {
    background: #1a2028 !important;
    background-color: #1a2028 !important;
    border: 1px solid rgba(48, 54, 61, 0.8) !important;
    border-radius: 8px !important;
    padding: 6px 0 !important;
    min-width: 140px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
    opacity: 1 !important;
}

#policies-page table .dropdown.open,
#policies-page .table-container .dropdown.open {
    position: relative !important;
    z-index: 10000 !important;
}

/* Ensure dropdown toggle button has lower z-index than menu when open */
#policies-page table .dropdown.open .btn.dropdown-toggle,
#policies-page .table-container .dropdown.open .btn.dropdown-toggle {
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure dropdown menu is above toggle button */
#policies-page table .dropdown.open .dropdown-menu,
#policies-page .table-container .dropdown.open .dropdown-menu {
    position: absolute !important;
    z-index: 10001 !important;
}

#policies-page table .dropdown-menu li a,
#policies-page .table-container .dropdown-menu li a {
    color: #e6edf3 !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: background 0.15s ease !important;
}

#policies-page table .dropdown-menu li a:hover,
#policies-page .table-container .dropdown-menu li a:hover {
    background: rgba(88, 166, 255, 0.1) !important;
}

/* Light theme - table dropdown menus */
[data-theme="light"] #policies-page table .dropdown-menu,
[data-theme="light"] #policies-page .table-container .dropdown-menu,
html[data-theme="light"] #policies-page table .dropdown-menu,
html[data-theme="light"] #policies-page .table-container .dropdown-menu {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    box-shadow: var(--theme-shadow-md) !important;
}

[data-theme="light"] #policies-page table .dropdown-menu li a,
[data-theme="light"] #policies-page .table-container .dropdown-menu li a,
html[data-theme="light"] #policies-page table .dropdown-menu li a,
html[data-theme="light"] #policies-page .table-container .dropdown-menu li a {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] #policies-page table .dropdown-menu li a:hover,
[data-theme="light"] #policies-page .table-container .dropdown-menu li a:hover,
html[data-theme="light"] #policies-page table .dropdown-menu li a:hover,
html[data-theme="light"] #policies-page .table-container .dropdown-menu li a:hover {
    background: var(--theme-bg-primary) !important;
    color: var(--theme-text-dark) !important;
}

#policies-page table .dropdown-menu li.divider,
#policies-page .table-container .dropdown-menu li.divider {
    background: rgba(48, 54, 61, 0.6) !important;
    margin: 6px 0 !important;
    height: 1px !important;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

#policies-page .fixed-table-pagination {
    background: transparent !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(48, 54, 61, 0.6) !important;
    position: relative !important;
    z-index: 1 !important;
}

#policies-page .fixed-table-pagination .pagination {
    margin: 0 !important;
    display: flex !important;
    gap: 8px !important;
}

#policies-page .fixed-table-pagination .btn-pag {
    background: transparent !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    color: #8b949e !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    transition: all 0.15s ease !important;
}

#policies-page .fixed-table-pagination .btn-pag:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.1) !important;
    border-color: rgba(88, 166, 255, 0.3) !important;
    color: #e6edf3 !important;
}

#policies-page .fixed-table-pagination .btn-pag:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* Light theme - pagination footer */
[data-theme="light"] #policies-page .fixed-table-pagination,
html[data-theme="light"] #policies-page .fixed-table-pagination {
    background: var(--theme-bg-tertiary) !important;
    border-top: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .fixed-table-pagination .btn-pag,
html[data-theme="light"] #policies-page .fixed-table-pagination .btn-pag {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] #policies-page .fixed-table-pagination .btn-pag:hover:not(:disabled),
html[data-theme="light"] #policies-page .fixed-table-pagination .btn-pag:hover:not(:disabled) {
    background: var(--theme-accent-blue) !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

#policies-page .alerts-empty-tbody {
    background: transparent !important;
}

#policies-page .alerts-empty-tbody td {
    padding: 60px 20px 40px 20px !important;
    border-bottom: none !important;
    text-align: center !important;
}

#policies-page .alerts-empty-tbody:hover {
    background: transparent !important;
}

#policies-page .empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8b949e;
}

#policies-page .empty-state-container i {
    font-size: 48px;
    color: #6e7681;
    margin-top: 20px;
    margin-bottom: 16px;
    opacity: 0.6;
}

#policies-page .empty-state-container .empty-state-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #838485;
}

#policies-page .empty-state-container .empty-state-subtitle {
    margin: 0;
    font-size: 13px;
    color: #8b949e;
}

/* =============================================================================
   CARDS (Detection, Agent pages)
   ============================================================================= */

#policies-page .portlet,
#policies-page .portlet.light {
    background: rgba(26, 32, 40, 0.82) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 14px !important;
    margin-bottom: 16px !important;
}

/* Standard portlet title (for non-table sections) */
#policies-page .portlet-title:not(.exclusions-header) {
    background: transparent !important;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4) !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    min-height: auto !important;
}

#policies-page .portlet-title:not(.exclusions-header) .caption,
#policies-page .portlet-title:not(.exclusions-header) .caption-subject {
    color: #58a6ff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    background: transparent !important;
    padding: 0 !important;
}

/* =============================================================================
   EXCLUSIONS SECTION
   ============================================================================= */

#policies-page .exclusions-section {
    width: 100%;
    margin-top: 16px;
}

/* Exclusions header bar - same as navbar */
#policies-page .portlet.exclusions-portlet .portlet-title,
#policies-page .portlet.exclusions-portlet .portlet-title.informations {
    background: var(--theme-bg-glass, rgba(26, 32, 40, 0.82)) !important;
    border: 1px solid var(--theme-border-color, rgba(48, 54, 61, 0.6)) !important;
    border-radius: 14px !important;
    padding: 12px 20px !important;
    margin: 0 0 16px 0 !important;
    min-height: 48px !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

#policies-page .portlet.exclusions-portlet .portlet-title .caption {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: #58a6ff !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

#policies-page .portlet.exclusions-portlet .portlet-title .caption i {
    font-size: 16px !important;
    color: #58a6ff !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
}

#policies-page .portlet.exclusions-portlet .portlet-title .caption-subject {
    color: #58a6ff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    background: transparent !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
}

#policies-page .portlet.exclusions-portlet .portlet-title .pull-right {
    position: static !important;
    top: auto !important;
    float: none !important;
    margin-left: auto !important;
}

/* Exclusions portlet - remove default styling */
#policies-page .portlet.exclusions-portlet {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    margin-bottom: 16px !important;
}

/* Exclusions container - let table-container handle surface styling */
#policies-page .portlet.exclusions-portlet .portlet-body,
#policies-page .portlet.exclusions-portlet .exclusions-body,
#policies-page .portlet.exclusions-portlet #alerts {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* Ensure table inside exclusions matches other tables */
#policies-page .exclusions-portlet #malware-table2,
#policies-page .exclusions-portlet .table-alerts,
#policies-page .exclusions-portlet .table {
    border-radius: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Header - MUST be darker #11161d */
#policies-page .exclusions-portlet #malware-table2 thead,
#policies-page .exclusions-portlet .table-alerts thead,
#policies-page .exclusions-portlet .table thead {
    background: var(--theme-table-header-bg, #11161d) !important;
    background-color: var(--theme-table-header-bg, #11161d) !important;
}

/* Light theme table headers in exclusions */
html[data-theme="light"] #policies-page .exclusions-portlet thead,
html[data-theme="light"] #policies-page .exclusions-portlet .table thead,
[data-theme="light"] #policies-page .exclusions-portlet thead,
[data-theme="light"] #policies-page .exclusions-portlet .table thead {
    background: var(--theme-bg-tertiary) !important;
    background-color: var(--theme-bg-tertiary) !important;
}

html[data-theme="light"] #policies-page .exclusions-portlet thead th,
html[data-theme="light"] #policies-page .table thead th,
[data-theme="light"] #policies-page .exclusions-portlet thead th,
[data-theme="light"] #policies-page .table thead th {
    background: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-dark) !important;
}

#policies-page .exclusions-portlet #malware-table2 thead th,
#policies-page .exclusions-portlet .table-alerts thead th,
#policies-page .exclusions-portlet .table thead th {
    background: #11161d !important;
    background-color: #11161d !important;
    padding: 21px 16px !important;
    min-height: 48px !important;
    height: 48px !important;
}

/* Light theme - exclusions table header cells (match rovers table) */
[data-theme="light"] #policies-page .exclusions-portlet #malware-table2 thead th,
[data-theme="light"] #policies-page .exclusions-portlet .table-alerts thead th,
[data-theme="light"] #policies-page .exclusions-portlet .table thead th,
html[data-theme="light"] #policies-page .exclusions-portlet #malware-table2 thead th,
html[data-theme="light"] #policies-page .exclusions-portlet .table-alerts thead th,
html[data-theme="light"] #policies-page .exclusions-portlet .table thead th {
    background: var(--theme-bg-tertiary) !important;
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-tertiary) !important;
    border-bottom: 1px solid var(--theme-border-solid) !important;
}

/* Body - transparent to show container #181e26 */
#policies-page .exclusions-portlet #malware-table2 tbody,
#policies-page .exclusions-portlet .table-alerts tbody,
#policies-page .exclusions-portlet .table tbody {
    background: transparent !important;
    background-color: transparent !important;
}

#policies-page .exclusions-portlet #malware-table2 tbody tr,
#policies-page .exclusions-portlet .table-alerts tbody tr,
#policies-page .exclusions-portlet .table tbody tr {
    background: transparent !important;
    background-color: transparent !important;
}

#policies-page .exclusions-portlet #malware-table2 tbody tr:nth-of-type(odd),
#policies-page .exclusions-portlet #malware-table2 tbody tr:nth-of-type(even),
#policies-page .exclusions-portlet .table-striped tbody tr:nth-of-type(odd),
#policies-page .exclusions-portlet .table-striped tbody tr:nth-of-type(even) {
    background: transparent !important;
    background-color: transparent !important;
}

#policies-page .exclusions-portlet #malware-table2 tbody tr:hover,
#policies-page .exclusions-portlet .table-alerts tbody tr:hover,
#policies-page .exclusions-portlet .table tbody tr:hover {
    background: rgba(88, 166, 255, 0.05) !important;
    background-color: rgba(88, 166, 255, 0.05) !important;
}

/* Disabled rows - slightly darker background with red bar */
#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT,
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT,
#policies-page .exclusions-portlet .table tbody tr.THREAT {
    background: rgba(0, 0, 0, 0.2) !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
}

/* Apply opacity only to content cells, not the dropdown column */
#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT td:not(:last-child),
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT td:not(:last-child),
#policies-page .exclusions-portlet .table tbody tr.THREAT td:not(:last-child) {
    opacity: 0.7 !important;
}

/* Ensure dropdown column is fully visible and clickable */
#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT td:last-child,
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT td:last-child,
#policies-page .exclusions-portlet .table tbody tr.THREAT td:last-child {
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
    pointer-events: auto !important;
}

#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT td:first-child,
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT td:first-child,
#policies-page .exclusions-portlet .table tbody tr.THREAT td:first-child {
    border-left: 4px solid #f85149 !important;
}

#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT:hover,
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT:hover,
#policies-page .exclusions-portlet .table tbody tr.THREAT:hover {
    background: rgba(0, 0, 0, 0.25) !important;
    background-color: rgba(0, 0, 0, 0.25) !important;
}

/* Hover - opacity on content cells only */
#policies-page .exclusions-portlet #malware-table2 tbody tr.THREAT:hover td:not(:last-child),
#policies-page .exclusions-portlet .table-alerts tbody tr.THREAT:hover td:not(:last-child),
#policies-page .exclusions-portlet .table tbody tr.THREAT:hover td:not(:last-child) {
    opacity: 0.8 !important;
}

#policies-page .exclusions-portlet #malware-table2 thead th:first-child {
    border-top-left-radius: 0 !important;
}

#policies-page .exclusions-portlet #malware-table2 thead th:last-child {
    border-top-right-radius: 0 !important;
}

/* Pagination inside exclusions */
#policies-page .exclusions-portlet .fixed-table-pagination {
    background: transparent !important;
    border-bottom-left-radius: 13px !important;
    border-bottom-right-radius: 13px !important;
}

#policies-page .portlet-body,
#policies-page .portlet.body {
    padding: 20px !important;
    background: transparent !important;
}

/* Detection mode cards styling */
#policies-page .portlet-body>.row>div[ng-click],
#policies-page .col-md-6[ng-click] {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
}

#policies-page .portlet-body>.row>div[ng-click]:hover,
#policies-page .col-md-6[ng-click]:hover {
    border-color: rgba(88, 166, 255, 0.4) !important;
    background: rgba(88, 166, 255, 0.05) !important;
}

#policies-page .portlet-body>.row>div[ng-click].selected,
#policies-page .col-md-6[ng-click].selected {
    border-color: #58a6ff !important;
    background: rgba(88, 166, 255, 0.1) !important;
}

/* Checkbox and label styling */
#policies-page .mt-checkbox,
#policies-page label:not(.fm-label) {
    color: #e6edf3;
}

#policies-page .font-grey-salsa {
    color: #8b949e !important;
}

/* Input styling */
#policies-page input[type="text"],
#policies-page input[type="number"],
#policies-page input[type="password"],
#policies-page input.dark,
#policies-page textarea.dark {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 6px !important;
    color: #e6edf3 !important;
    padding: 8px 12px !important;
}

#policies-page input[type="text"]:focus,
#policies-page input[type="number"]:focus,
#policies-page input.dark:focus,
#policies-page textarea.dark:focus {
    border-color: rgba(88, 166, 255, 0.5) !important;
    outline: none !important;
}

/* Save button styling */
#policies-page .portlet-body .btn-primary:not(.btn-pag),
#policies-page .portlet.body .btn-primary:not(.btn-pag) {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.25) 0%, rgba(54, 127, 211, 0.15) 100%) !important;
    border: 1px solid rgba(54, 127, 211, 0.4) !important;
    color: #e6edf3 !important;
    border-radius: 6px !important;
    padding: 8px 20px !important;
}

/* Light theme - portlet body primary buttons */
[data-theme="light"] #policies-page .portlet-body .btn-primary:not(.btn-pag),
[data-theme="light"] #policies-page .portlet.body .btn-primary:not(.btn-pag),
html[data-theme="light"] #policies-page .portlet-body .btn-primary:not(.btn-pag),
html[data-theme="light"] #policies-page .portlet.body .btn-primary:not(.btn-pag) {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue-dark) !important;
    color: var(--theme-text-inverse) !important;
}

/* =============================================================================
   GROUPED SECTIONS (Detection & Agent policies - matching Groups wizard style)
   ============================================================================= */

#policies-page .policy-section {
    margin-bottom: 24px;
}

#policies-page .policy-section:last-child {
    margin-bottom: 0;
}

#policies-page .policy-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

#policies-page .detection-right .policy-section-header {
    margin-bottom: 12px;
}

#policies-page .detection-right .policy-section-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

#policies-page .detection-right .policy-section-title {
    font-size: 12px;
}

#policies-page .detection-right .policy-section-subtitle {
    font-size: 11px;
}

#policies-page .policy-section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(88, 166, 255, 0.2) 0%, rgba(88, 166, 255, 0.05) 100%);
    border-radius: 10px;
    color: #58a6ff;
    font-size: 18px;
    flex-shrink: 0;
}

#policies-page .policy-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #e6edf3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#policies-page .policy-section-subtitle {
    font-size: 12px;
    color: #8b949e;
    margin-top: 2px;
}

#policies-page .policy-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(48, 54, 61, 0.6), transparent);
    margin: 20px 0;
}

#policies-page .detection-right .policy-section-divider {
    margin: 16px 0;
}

/* =============================================================================
   ENGINE GRID - Toggle switches with icons (matching Groups wizard)
   ============================================================================= */

#policies-page .engines-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

#policies-page .engines-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Compact engine items for two-column layout */
#policies-page .detection-right .engines-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1400px) {
    #policies-page .detection-right .engines-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

#policies-page .engine-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: all 0.2s ease;
}

#policies-page .engine-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(88, 166, 255, 0.15);
}

#policies-page .engine-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

#policies-page .engine-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    color: #58a6ff !important;
    background: linear-gradient(145deg, rgba(88, 166, 255, 0.2) 0%, rgba(88, 166, 255, 0.05) 100%) !important;
}

#policies-page .engine-icon i,
#policies-page .engine-icon i.fa,
#policies-page .engine-icon .fa {
    font-size: 14px !important;
    line-height: 1 !important;
    color: #58a6ff !important;
    font-family: FontAwesome !important;
}

/* Ensure ng-show/ng-hide works properly */
#policies-page .engine-icon i.ng-hide,
#policies-page .engine-icon .fa.ng-hide {
    display: none !important;
}

/* Response Actions icons - red tint */
#policies-page .engine-icon.response {
    background: linear-gradient(145deg, rgba(248, 81, 73, 0.2) 0%, rgba(248, 81, 73, 0.05) 100%) !important;
}

#policies-page .engine-icon.response i,
#policies-page .engine-icon.response .fa {
    color: #f85149 !important;
}

/* Additional Options icons - amber tint */
#policies-page .engine-icon.option {
    background: linear-gradient(145deg, rgba(210, 153, 34, 0.2) 0%, rgba(210, 153, 34, 0.05) 100%) !important;
}

#policies-page .engine-icon.option i,
#policies-page .engine-icon.option .fa {
    color: #d29922 !important;
}

#policies-page .engine-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--theme-text-primary, #e6edf3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light theme engine name - CRITICAL */
html[data-theme="light"] #policies-page .engine-name,
[data-theme="light"] #policies-page .engine-name {
    color: var(--theme-text-tertiary) !important;
}

#policies-page .engine-help {
    color: #6e7681;
    font-size: 12px;
    cursor: help;
    margin-left: 6px;
    transition: color 0.15s ease;
}

#policies-page .engine-help:hover {
    color: #58a6ff;
}

/* Toggle Switch - Blue with glow */
#policies-page .toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 8px;
}

#policies-page .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

#policies-page .toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(110, 118, 129, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

#policies-page .toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#policies-page .toggle-switch input:checked+.toggle-slider {
    background: rgba(88, 166, 255, 0.9);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.4);
}

#policies-page .toggle-switch input:checked+.toggle-slider::before {
    background: #ffffff;
    transform: translateX(20px);
}

#policies-page .toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.35);
}

#policies-page .toggle-switch input:disabled+.toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   POLICY GRID - For Agent policies (checkbox style)
   ============================================================================= */

#policies-page .policy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

#policies-page .policy-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

#policies-page .policy-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(26, 32, 40, 0.82);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 10px;
    transition: all 0.15s ease;
}

#policies-page .policy-item:hover {
    background: rgba(30, 38, 48, 0.9);
    border-color: rgba(48, 54, 61, 0.8);
}

#policies-page .policy-checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

#policies-page .policy-checkbox input {
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}

#policies-page .policy-content {
    flex: 1;
}

#policies-page .policy-name {
    font-size: 14px;
    font-weight: 500;
    color: #e6edf3;
    margin-bottom: 4px;
    cursor: pointer;
}

#policies-page .policy-desc {
    font-size: 12px;
    color: #8b949e;
    line-height: 1.4;
}

/* Light theme - policy item cards (Agent tab) */
[data-theme="light"] #policies-page .policy-item,
html[data-theme="light"] #policies-page .policy-item {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .policy-item:hover,
html[data-theme="light"] #policies-page .policy-item:hover {
    background: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-border-muted) !important;
}

[data-theme="light"] #policies-page .policy-name,
html[data-theme="light"] #policies-page .policy-name {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .policy-desc,
html[data-theme="light"] #policies-page .policy-desc {
    color: var(--theme-text-medium) !important;
}

#policies-page .policy-inline-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(48, 54, 61, 0.3);
}

#policies-page .policy-inline-input span {
    font-size: 12px;
    color: #8b949e;
}

#policies-page .policy-inline-input input {
    width: 80px !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
}

/* Light theme - policy inline inputs */
[data-theme="light"] #policies-page .policy-inline-input,
html[data-theme="light"] #policies-page .policy-inline-input {
    border-top-color: var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .policy-inline-input span,
html[data-theme="light"] #policies-page .policy-inline-input span {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] #policies-page .policy-inline-input input,
html[data-theme="light"] #policies-page .policy-inline-input input {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-dark) !important;
}

/* =============================================================================
   POLICY SELECTOR BAR (Group + Last Modified)
   ============================================================================= */

#policies-page .policy-selector-bar {
    margin-bottom: 16px !important;
}

#policies-page .policy-selector-bar .row.mybar.policy-selector-row,
#policies-page .policy-selector-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

#policies-page .policy-selector-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0;
}

#policies-page .policy-selector-label {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--theme-text-primary, #e6edf3) !important;
}

/* Light theme policy selector label - CRITICAL */
html[data-theme="light"] #policies-page .policy-selector-label,
[data-theme="light"] #policies-page .policy-selector-label {
    color: var(--theme-text-tertiary) !important;
}

#policies-page .policy-last-modified {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    color: #8b949e !important;
    margin-left: auto !important;
}

#policies-page .policy-last-modified i {
    color: #6e7681 !important;
    font-size: 14px !important;
}

#policies-page .policy-group-dropdown {
    display: inline-block;
}

#policies-page .policy-group-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 220px;
    padding: 8px 14px !important;
    background: var(--theme-bg-card, #161b22) !important;
    border: 1px solid var(--theme-border-color, rgba(48, 54, 61, 0.6)) !important;
    border-radius: 8px !important;
    color: var(--theme-text-primary, #e6edf3) !important;
    font-size: 13px !important;
    text-transform: none !important;
}

#policies-page .policy-group-btn:hover {
    border-color: var(--theme-border-accent, rgba(88, 166, 255, 0.4)) !important;
    background: var(--theme-bg-card-hover, #1c2128) !important;
}

#policies-page .policy-group-btn span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

#policies-page .policy-group-dropdown .dropdown-menu {
    min-width: 220px;
    max-height: 250px;
    overflow-y: auto;
    background: #161b22 !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 8px !important;
    padding: 4px 0 !important;
    margin-top: 4px !important;
}

#policies-page .policy-group-dropdown .dropdown-menu li a {
    padding: 8px 14px !important;
    color: #e6edf3 !important;
    font-size: 13px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#policies-page .policy-group-dropdown .dropdown-menu li a:hover {
    background: rgba(88, 166, 255, 0.1) !important;
    color: #58a6ff !important;
}

/* =============================================================================
   TWO-COLUMN DETECTION LAYOUT
   ============================================================================= */

#policies-page .detection-layout {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

#policies-page .detection-left {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

#policies-page .detection-left .policy-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#policies-page .detection-left .policy-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#policies-page .detection-left .mode-cards-vertical {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

#policies-page .detection-left .policy-actions {
    margin-top: auto;
    padding-top: 20px;
}

#policies-page .detection-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#policies-page .detection-right .policy-container {
    flex: 1;
}

/* Detection Mode Cards - Vertical Stack */
#policies-page .mode-cards-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#policies-page .mode-cards-vertical .mode-card {
    min-height: 140px;
}

/* Detection Mode Cards - Horizontal (for other uses) */
#policies-page .mode-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 500px;
}

#policies-page .mode-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: rgba(0, 0, 0, 0.25);
    border: 1.5px solid rgba(48, 54, 61, 0.6);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 180px;
    overflow: hidden;
}

#policies-page .mode-card:hover {
    border-color: rgba(88, 166, 255, 0.3);
    background: rgba(255, 255, 255, 0.02);
}

#policies-page .mode-card.selected {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.15) 0%, rgba(54, 127, 211, 0.05) 100%);
    border-color: rgba(88, 166, 255, 0.5);
    box-shadow: 0 0 30px rgba(54, 127, 211, 0.15);
}

#policies-page .mode-card-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: transparent;
    transition: all 0.25s ease;
    font-size: 11px;
}

#policies-page .mode-card.selected .mode-card-check {
    background: linear-gradient(145deg, #58a6ff, #367fd3);
    color: white;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
}

#policies-page .mode-card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    color: #8b949e;
    font-size: 26px;
    margin-bottom: 16px;
    transition: all 0.25s ease;
}

#policies-page .mode-card.selected .mode-card-icon {
    background: linear-gradient(145deg, rgba(88, 166, 255, 0.25) 0%, rgba(88, 166, 255, 0.1) 100%);
    color: #58a6ff;
}

#policies-page .mode-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text-primary, #e6edf3);
    margin-bottom: 4px;
    transition: color 0.25s ease;
}

#policies-page .mode-card.selected .mode-card-title {
    color: var(--theme-accent-blue, #58a6ff);
}

#policies-page .mode-card-desc {
    font-size: 12px;
    color: var(--theme-text-muted, #6e7681);
}

/* Light theme mode card text - CRITICAL */
html[data-theme="light"] #policies-page .mode-card-title,
[data-theme="light"] #policies-page .mode-card-title {
    color: var(--theme-text-dark) !important;
}

html[data-theme="light"] #policies-page .mode-card.selected .mode-card-title,
[data-theme="light"] #policies-page .mode-card.selected .mode-card-title {
    color: var(--theme-accent-blue) !important;
}

html[data-theme="light"] #policies-page .mode-card-desc,
[data-theme="light"] #policies-page .mode-card-desc {
    color: var(--theme-text-secondary) !important;
}

/* Policy Container Card (for Detection/Agent) */
#policies-page .policy-container {
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
}

#policies-page .detection-right .policy-container {
    padding: 24px;
}

/* Agent Policy Container - Flex layout with internal scroll */
#policies-page .policy-container--agent {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 450px);
    padding: 0;
    overflow: hidden;
}

#policies-page .policy-container--agent .policy-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

#policies-page .policy-container--agent .policy-actions {
    margin-top: 0;
    padding: 16px 24px;
    background: rgba(22, 27, 34, 0.95);
    border-top: 1px solid rgba(48, 54, 61, 0.6);
    flex-shrink: 0;
    border-radius: 0 0 16px 16px;
}

[data-theme="light"] #policies-page .policy-container--agent .policy-actions,
html[data-theme="light"] #policies-page .policy-container--agent .policy-actions {
    background: var(--theme-bg-secondary, #ffffff);
    border-top: 1px solid var(--theme-border-color, #d0d7de);
}


/* Save Button inside container - styled like the design */
#policies-page .policy-container .btn-primary,
#policies-page .policy-actions .btn-primary {
    margin-top: 0;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.3) 0%, rgba(54, 127, 211, 0.15) 100%);
    border: 1px solid rgba(54, 127, 211, 0.5);
    border-radius: 12px;
    color: #58a6ff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(54, 127, 211, 0.15);
}

#policies-page .policy-container .btn-primary:hover:not(:disabled),
#policies-page .policy-actions .btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.4) 0%, rgba(54, 127, 211, 0.2) 100%);
    border-color: rgba(88, 166, 255, 0.6);
}

/* Light theme - policy container buttons */
[data-theme="light"] #policies-page .policy-container .btn-primary,
[data-theme="light"] #policies-page .policy-actions .btn-primary,
html[data-theme="light"] #policies-page .policy-container .btn-primary,
html[data-theme="light"] #policies-page .policy-actions .btn-primary {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue-dark) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] #policies-page .policy-container .btn-primary:hover:not(:disabled),
[data-theme="light"] #policies-page .policy-actions .btn-primary:hover:not(:disabled),
html[data-theme="light"] #policies-page .policy-container .btn-primary:hover:not(:disabled),
html[data-theme="light"] #policies-page .policy-actions .btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, var(--theme-accent-blue-dark) 0%, var(--theme-accent-blue-darker) 100%) !important;
    border-color: var(--theme-accent-blue-darker) !important;
    box-shadow: 0 4px 12px var(--theme-accent-blue-glow) !important;
    box-shadow: 0 6px 20px var(--theme-accent-blue-glow);
}

#policies-page .policy-container .btn-primary:disabled,
#policies-page .policy-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#policies-page .policy-actions {
    margin-top: 24px;
    text-align: center;
}

#policies-page .detection-left .policy-actions {
    margin-top: 20px;
}

#policies-page .detection-left .policy-actions .btn-primary {
    width: 100%;
}

/* =============================================================================
   PENDING CHANGES SUMMARY
   ============================================================================= */

#policies-page .policy-changes-summary {
    margin-top: 20px;
    padding: 14px 16px;
    background: rgba(30, 37, 48, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

#policies-page .policy-changes-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b949e;
}

#policies-page .policy-changes-header .fa {
    color: #58a6ff;
    font-size: 11px;
}

#policies-page .policy-changes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#policies-page .policy-change-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
}

#policies-page .policy-change-label {
    color: #8b949e;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#policies-page .policy-change-from {
    color: #6e7681;
    text-decoration: line-through;
    flex-shrink: 0;
    font-size: 11px;
}

#policies-page .policy-change-arrow {
    color: #484f58;
    font-size: 10px;
    flex-shrink: 0;
}

#policies-page .policy-change-to {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 12px;
}

#policies-page .policy-change-to--on {
    color: #3fb950;
}

#policies-page .policy-change-to--off {
    color: #f85149;
}

#policies-page .policy-change-to:not(.policy-change-to--on):not(.policy-change-to--off) {
    color: #58a6ff;
}

/* Light theme - Pending changes */
[data-theme="light"] #policies-page .policy-changes-summary,
html[data-theme="light"] #policies-page .policy-changes-summary {
    background: rgba(240, 243, 247, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] #policies-page .policy-changes-header,
html[data-theme="light"] #policies-page .policy-changes-header {
    color: #656d76;
}

[data-theme="light"] #policies-page .policy-changes-header .fa,
html[data-theme="light"] #policies-page .policy-changes-header .fa {
    color: var(--theme-accent-blue, #2563eb);
}

[data-theme="light"] #policies-page .policy-change-label,
html[data-theme="light"] #policies-page .policy-change-label {
    color: #656d76;
}

[data-theme="light"] #policies-page .policy-change-from,
html[data-theme="light"] #policies-page .policy-change-from {
    color: #adb5bd;
}

[data-theme="light"] #policies-page .policy-change-arrow,
html[data-theme="light"] #policies-page .policy-change-arrow {
    color: #adb5bd;
}

[data-theme="light"] #policies-page .policy-change-to--on,
html[data-theme="light"] #policies-page .policy-change-to--on {
    color: #16a34a;
}

[data-theme="light"] #policies-page .policy-change-to--off,
html[data-theme="light"] #policies-page .policy-change-to--off {
    color: #dc2626;
}

[data-theme="light"] #policies-page .policy-change-to:not(.policy-change-to--on):not(.policy-change-to--off),
html[data-theme="light"] #policies-page .policy-change-to:not(.policy-change-to--on):not(.policy-change-to--off) {
    color: var(--theme-accent-blue, #2563eb);
}

/* =============================================================================
   APPLY TO ALL GROUPS
   ============================================================================= */

#policies-page .apply-all-groups {
    margin-top: 20px;
    padding: 14px 16px;
    background: rgba(30, 37, 48, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

#policies-page .apply-all-groups-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    font-weight: 400;
    user-select: none;
}

#policies-page .apply-all-groups-label input[type="checkbox"] {
    display: none;
}

#policies-page .apply-all-groups-check {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-size: 11px;
    color: transparent;
}

#policies-page .apply-all-groups-label input[type="checkbox"]:checked~.apply-all-groups-check {
    background: rgba(54, 127, 211, 0.3);
    border-color: rgba(88, 166, 255, 0.6);
    color: #58a6ff;
}

#policies-page .apply-all-groups-text {
    font-size: 13px;
    color: #e6edf3;
}

#policies-page .apply-all-groups-warning {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(210, 153, 34, 0.08);
    border: 1px solid rgba(210, 153, 34, 0.25);
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #d29922;
    line-height: 1.4;
}

#policies-page .apply-all-groups-warning .fa {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 13px;
}

/* Light theme */
[data-theme="light"] #policies-page .apply-all-groups,
html[data-theme="light"] #policies-page .apply-all-groups {
    background: rgba(240, 243, 247, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] #policies-page .apply-all-groups-check,
html[data-theme="light"] #policies-page .apply-all-groups-check {
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] #policies-page .apply-all-groups-label input[type="checkbox"]:checked~.apply-all-groups-check,
html[data-theme="light"] #policies-page .apply-all-groups-label input[type="checkbox"]:checked~.apply-all-groups-check {
    background: rgba(54, 127, 211, 0.15);
    border-color: var(--theme-accent-blue);
    color: var(--theme-accent-blue);
}

[data-theme="light"] #policies-page .apply-all-groups-text,
html[data-theme="light"] #policies-page .apply-all-groups-text {
    color: #1f2328;
}

[data-theme="light"] #policies-page .apply-all-groups-warning,
html[data-theme="light"] #policies-page .apply-all-groups-warning {
    background: rgba(210, 153, 34, 0.06);
    border-color: rgba(210, 153, 34, 0.3);
    color: #9a6700;
}

/* =============================================================================
   SCROLLBAR
   ============================================================================= */

#policies-page ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#policies-page ::-webkit-scrollbar-track {
    background: transparent;
}

#policies-page ::-webkit-scrollbar-thumb {
    background: rgba(99, 110, 123, 0.4);
    border-radius: 4px;
}

#policies-page ::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 110, 123, 0.6);
}

/* =============================================================================
   BACKGROUND OVERRIDES
   ============================================================================= */

#policies-page .bg-1,
#policies-page .bg-2,
#policies-page .bg-5 {
    background: transparent !important;
}

/* Remove table striping */
#policies-page .table-striped>tbody>tr:nth-of-type(odd) {
    background: transparent !important;
}

#policies-page .table-striped>tbody>tr:nth-of-type(even) {
    background: transparent !important;
}

/* Override myborder */
#policies-page .myborder {
    border: none !important;
}

/* Inner content div */
#policies-page .inner-content-div,
#policies-page #alerts {
    background: transparent !important;
}

/* =============================================================================
   EXCLUSION POLICY SLIDE PANEL
   Modern slide-in panel for adding/editing exclusion policies
   ============================================================================= */

/* Panel Overlay */
.policy-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1050;
}

.policy-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Slide Panel */
.policy-slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 960px;
    max-width: 100%;
    height: 100vh;
    background: #11161d;
    border-left: 1px solid rgba(48, 54, 61, 0.6);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1051;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

.policy-slide-panel.active,
.policy-slide-panel.open {
    transform: translateX(0);
}

/* Two-column layout for panel content */
.policy-panel-columns {
    display: flex;
    gap: 24px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.policy-panel-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

/* Policy Details - natural height */
.policy-panel-left .policy-form-section:first-child {
    flex: 0 0 auto;
}

/* Exclusion/Connection Filters - fill remaining height */
.policy-panel-left .policy-form-section:last-child {
    flex: 1;
}

/* Path-input with reasonable min-height */
.policy-panel-left .policy-form-section:last-child path-input .path-input {
    min-height: 180px;
    resize: vertical;
}

.policy-panel-right {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.policy-form-section-sticky {
    position: sticky;
    top: 0;
}

.policy-targeting-hint {
    margin: 0 0 16px 0;
    padding: 10px 14px;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 8px;
    color: #8b949e;
    font-size: 12px;
}

.policy-targeting-hint i {
    color: #58a6ff;
    margin-right: 6px;
}

/* Panel Header */
.policy-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(180deg, rgba(26, 32, 40, 0.95) 0%, rgba(26, 32, 40, 0.8) 100%);
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    backdrop-filter: blur(12px);
}

/* Loading overlay for panel */
.policy-panel-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #8b949e;
    font-size: 14px;
}

.policy-panel-loading i {
    font-size: 32px;
    color: #58a6ff;
}

.policy-panel-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.policy-panel-header-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 10px;
    color: #58a6ff;
    font-size: 18px;
}

.policy-panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #e6edf3;
    margin: 0;
}

.policy-panel-header p {
    font-size: 13px;
    color: #8b949e;
    margin: 2px 0 0 0;
}

.policy-btn-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.15s ease;
}

.policy-btn-close:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.3);
    color: #f85149;
}

/* Panel Content */
.policy-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px 0px 20px;
    /* Increased bottom padding for footer spacing */
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 16px;
    /* Add gap between children */
}

/* Warning message inside the exclusion panel */
#policies-page .policy-panel-warning {
    margin: 0;
}

/* Ensure policy-panel-columns has bottom margin */
.policy-panel-content>.policy-panel-columns {
    margin-bottom: 20px !important;
}

.policy-panel-content::-webkit-scrollbar {
    width: 6px;
}

.policy-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.policy-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.policy-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Form Sections */
.policy-form-section {
    background: rgba(26, 32, 40, 0.6);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.policy-form-section:last-child {
    margin-bottom: 0;
}

.policy-form-section .policy-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

/* Filters section - tighter spacing */
.policy-form-section--filters .policy-section-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.policy-form-section .policy-section-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 166, 255, 0.1);
    border-radius: 6px;
    color: #58a6ff;
    font-size: 12px;
}

.policy-form-section .policy-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #e6edf3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Groups */
.policy-form-group {
    margin-bottom: 12px;
}

.policy-form-group:last-child {
    margin-bottom: 0;
}

.policy-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #8b949e;
    margin-bottom: 8px;
}

.policy-form-label.required::after {
    content: ' *';
    color: #f85149;
}

.policy-form-label.invalid {
    color: #f85149;
}

.policy-form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    transition: all 0.15s ease;
}

.policy-form-input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.policy-form-input.invalid {
    border-color: rgba(248, 81, 73, 0.5);
}

.policy-form-input::placeholder {
    color: #6e7681;
}

.policy-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.policy-form-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #6e7681;
}

.policy-form-hint i {
    color: #58a6ff;
    margin-right: 4px;
}

/* Dropdown */
.policy-dropdown {
    position: relative;
}

.policy-dropdown-btn {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

.policy-dropdown-btn:hover {
    border-color: rgba(88, 166, 255, 0.4);
}

.policy-dropdown-btn i {
    color: #8b949e;
}

/* Light theme - policy dropdown button */
[data-theme="light"] .policy-dropdown-btn,
html[data-theme="light"] .policy-dropdown-btn {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-dropdown-btn:hover,
html[data-theme="light"] .policy-dropdown-btn:hover {
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-dropdown-btn i,
html[data-theme="light"] .policy-dropdown-btn i {
    color: var(--theme-text-medium) !important;
}

.policy-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: rgba(26, 32, 40, 0.98);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
}

.policy-dropdown-item {
    padding: 12px 16px;
    color: #e6edf3;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.policy-dropdown-item:hover {
    background: rgba(88, 166, 255, 0.1);
}

/* Panel Footer */
.policy-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(26, 32, 40, 0.82);
    border-top: 1px solid rgba(48, 54, 61, 0.6);
    gap: 0;
    flex-shrink: 0;
}

.policy-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    color: #8b949e;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.policy-btn-secondary:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.3);
    color: #f85149;
}

/* Light theme - secondary button (Cancel) */
[data-theme="light"] .policy-btn-secondary,
html[data-theme="light"] .policy-btn-secondary {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-btn-secondary:hover,
html[data-theme="light"] .policy-btn-secondary:hover {
    background: var(--theme-danger-bg) !important;
    border-color: var(--theme-danger-light) !important;
    color: var(--theme-danger-dark) !important;
}

.policy-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.3) 0%, rgba(54, 127, 211, 0.2) 100%);
    border: 1px solid rgba(54, 127, 211, 0.4);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.policy-btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.4) 0%, rgba(54, 127, 211, 0.3) 100%);
    border-color: #58a6ff;
    box-shadow: 0 0 16px rgba(54, 127, 211, 0.25);
}

.policy-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Light theme - policy primary button (Add Policy, Save Changes) */
[data-theme="light"] .policy-btn-primary,
html[data-theme="light"] .policy-btn-primary {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue-dark) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] .policy-btn-primary:hover:not(:disabled),
html[data-theme="light"] .policy-btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, var(--theme-accent-blue-dark) 0%, var(--theme-accent-blue-darker) 100%) !important;
    border-color: var(--theme-accent-blue-darker) !important;
    box-shadow: 0 4px 12px var(--theme-accent-blue-glow) !important;
}

/* =============================================================================
   PATH-INPUT DIRECTIVE STYLING
   ============================================================================= */

.policy-form-section path-input {
    display: block;
}

.policy-form-section path-input .main-container {
    margin: 0;
    padding: 0;
}

.policy-form-section path-input .card {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.policy-form-section path-input .form-group {
    margin: 0;
}

.policy-form-section path-input .path-input-wrapper {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.15s ease;
}

.policy-form-section path-input .path-input-wrapper:hover {
    border-color: rgba(88, 166, 255, 0.4);
}

.policy-form-section path-input .path-input-wrapper.focused {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.policy-form-section path-input .path-input-wrapper.ng-invalid {
    border-color: rgba(248, 81, 73, 0.5);
}

.policy-form-section path-input .path-textarea-container {
    position: relative;
}

.policy-form-section path-input .path-input {
    width: 100%;
    min-height: 120px;
    padding: 6px 16px 12px 44px;
    background: transparent !important;
    border: none !important;
    color: #e6edf3 !important;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 24px;
    resize: vertical;
}

.policy-form-section path-input .path-input:focus {
    outline: none;
    box-shadow: none;
}

.policy-form-section path-input .path-input::placeholder {
    color: #6e7681;
}

/* Light theme - path input textarea */
[data-theme="light"] .policy-form-section path-input .path-input-wrapper,
html[data-theme="light"] .policy-form-section path-input .path-input-wrapper {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
}

[data-theme="light"] .policy-form-section path-input .path-input-wrapper:hover,
html[data-theme="light"] .policy-form-section path-input .path-input-wrapper:hover {
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-form-section path-input .path-input-wrapper.focused,
html[data-theme="light"] .policy-form-section path-input .path-input-wrapper.focused {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .policy-form-section path-input .path-input,
html[data-theme="light"] .policy-form-section path-input .path-input {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-form-section path-input .path-input::placeholder,
html[data-theme="light"] .policy-form-section path-input .path-input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

.policy-form-section path-input .line-icons {
    position: absolute;
    left: 12px;
    top: 6px;
    pointer-events: none;
}

.policy-form-section path-input .line-icon {
    height: 24px;
    line-height: 24px;
    font-size: 14px;
}

.policy-form-section path-input .current-line-indicator {
    position: absolute;
    left: 0;
    width: 3px;
    height: 24px;
    background: #58a6ff;
    border-radius: 0 2px 2px 0;
    transition: top 0.1s ease, opacity 0.15s ease;
}

/* Path hint uses standard hint styling - no specific overrides needed */

/* =============================================================================
   ENDPOINT-FILTER DIRECTIVE STYLING
   ============================================================================= */

.policy-form-section endpoint-filter {
    display: block;
}

.policy-form-section endpoint-filter .endpoint-filter-container {
    background: transparent;
}

/* Selected items display */
.policy-form-section endpoint-filter .selected-items-display {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}

.policy-form-section endpoint-filter .selected-items-scroll {
    max-height: 120px;
    overflow-y: auto;
}

.policy-form-section endpoint-filter .selected-items-scroll::-webkit-scrollbar {
    width: 4px;
}

.policy-form-section endpoint-filter .selected-items-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.policy-form-section endpoint-filter .selected-items-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.policy-form-section endpoint-filter .selected-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 4px;
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 6px;
    color: #58a6ff;
    font-size: 12px;
}

.policy-form-section endpoint-filter .selected-item .fa-times {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.policy-form-section endpoint-filter .selected-item .fa-times:hover {
    opacity: 1;
    color: #f85149;
}

.policy-form-section endpoint-filter .selected-item .item-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Add button */
.policy-form-section endpoint-filter .add-items-control {
    margin-top: 8px;
}

.policy-form-section endpoint-filter .add-items-control .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(88, 166, 255, 0.1) !important;
    border: 1px dashed rgba(88, 166, 255, 0.4) !important;
    border-radius: 8px !important;
    color: #58a6ff !important;
    font-size: 13px;
    transition: all 0.15s ease;
}

.policy-form-section endpoint-filter .add-items-control .btn:hover {
    background: rgba(88, 166, 255, 0.2) !important;
    border-color: #58a6ff !important;
}

/* Modal styling (override Bootstrap) */
.policy-form-section endpoint-filter .modal-content {
    background: #11161d;
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.policy-form-section endpoint-filter .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
}

.policy-form-section endpoint-filter .modal-header h4 {
    color: #e6edf3;
    font-weight: 600;
    margin: 0;
}

.policy-form-section endpoint-filter .modal-body {
    padding: 0;
}

.policy-form-section endpoint-filter .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(48, 54, 61, 0.6);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.policy-form-section endpoint-filter .modal-footer .btn-primary {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.3) 0%, rgba(54, 127, 211, 0.2) 100%) !important;
    border: 1px solid rgba(54, 127, 211, 0.4) !important;
    color: #e6edf3 !important;
}

.policy-form-section endpoint-filter .modal-footer .btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, rgba(54, 127, 211, 0.4) 0%, rgba(54, 127, 211, 0.3) 100%) !important;
}

.policy-form-section endpoint-filter .modal-footer .btn-primary:disabled {
    opacity: 0.5;
}

.policy-form-section endpoint-filter .modal-footer .btn-default {
    background: transparent !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    color: #8b949e !important;
}

.policy-form-section endpoint-filter .modal-footer .btn-default:hover {
    background: rgba(248, 81, 73, 0.1) !important;
    border-color: rgba(248, 81, 73, 0.3) !important;
    color: #f85149 !important;
}

/* Table inside modal */
.policy-form-section endpoint-filter .table {
    margin: 0;
    background: transparent;
}

.policy-form-section endpoint-filter .table thead {
    background: rgba(26, 32, 40, 0.82);
}

.policy-form-section endpoint-filter .table thead th {
    padding: 14px 12px;
    background: #11161d !important;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    color: #8b949e;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.policy-form-section endpoint-filter .table tbody tr {
    background: transparent;
    transition: background 0.15s ease;
}

.policy-form-section endpoint-filter .table tbody tr:hover {
    background: rgba(88, 166, 255, 0.05);
}

.policy-form-section endpoint-filter .table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4);
    color: #e6edf3;
    font-size: 13px;
}

.policy-form-section endpoint-filter .table tbody td a {
    color: #58a6ff;
}

.policy-form-section endpoint-filter .table tbody td a:hover {
    text-decoration: underline;
}

.policy-form-section endpoint-filter .table tbody td .label {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.policy-form-section endpoint-filter .table tbody td .label-success {
    background: rgba(63, 185, 80, 0.2);
    color: #3fb950;
}

.policy-form-section endpoint-filter .table tbody td .label-warning {
    background: rgba(210, 153, 34, 0.2);
    color: #d29922;
}

.policy-form-section endpoint-filter .table tbody td .label-danger {
    background: rgba(248, 81, 73, 0.2);
    color: #f85149;
}

/* Search input in table */
.policy-form-section endpoint-filter .search-container input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 6px !important;
    color: #e6edf3 !important;
    font-size: 13px;
}

.policy-form-section endpoint-filter .search-container input:focus {
    border-color: #58a6ff !important;
    outline: none;
}

.policy-form-section endpoint-filter .search-container input::placeholder {
    color: #6e7681;
}

/* Dropdown in table header */
.policy-form-section endpoint-filter thead .dropdown .btn {
    background: rgba(54, 127, 211, 0.2) !important;
    border: 1px solid rgba(54, 127, 211, 0.4) !important;
    color: #e6edf3 !important;
    font-size: 12px;
    padding: 6px 12px;
}

.policy-form-section endpoint-filter thead .dropdown-menu {
    background: rgba(26, 32, 40, 0.98);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.policy-form-section endpoint-filter thead .dropdown-menu li a {
    padding: 10px 16px;
    color: #e6edf3;
}

.policy-form-section endpoint-filter thead .dropdown-menu li a:hover {
    background: rgba(88, 166, 255, 0.1);
}

.policy-form-section endpoint-filter thead .dropdown-menu li.active a {
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
}

/* Checkbox styling */
.policy-form-section endpoint-filter input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #58a6ff;
    cursor: pointer;
}

/* Table container scroll */
.policy-form-section endpoint-filter .endpoints-table-container,
.policy-form-section endpoint-filter .groups-table-container {
    max-height: 350px;
    overflow-y: auto;
    background: rgba(26, 32, 40, 0.4);
}

.policy-form-section endpoint-filter .endpoints-table-container::-webkit-scrollbar,
.policy-form-section endpoint-filter .groups-table-container::-webkit-scrollbar {
    width: 6px;
}

.policy-form-section endpoint-filter .endpoints-table-container::-webkit-scrollbar-track,
.policy-form-section endpoint-filter .groups-table-container::-webkit-scrollbar-track {
    background: transparent;
}

.policy-form-section endpoint-filter .endpoints-table-container::-webkit-scrollbar-thumb,
.policy-form-section endpoint-filter .groups-table-container::-webkit-scrollbar-thumb {
    background: rgba(99, 110, 123, 0.4);
    border-radius: 3px;
}

/* Refresh icon */
.policy-form-section endpoint-filter .fa-refresh {
    color: #8b949e;
    cursor: pointer;
    transition: color 0.15s ease;
}

.policy-form-section endpoint-filter .fa-refresh:hover {
    color: #58a6ff;
}

/* Loading state */
.policy-form-section endpoint-filter .blur-view {
    opacity: 0.5;
    pointer-events: none;
}

/* =============================================================================
   INLINE ENDPOINT/GROUP SELECTORS
   ============================================================================= */

.policy-form-section .policy-section-hint {
    font-size: 11px;
    color: #6e7681;
    font-weight: 400;
    margin-left: auto;
}

.policy-target-group {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.policy-target-group:last-child {
    margin-bottom: 0;
}

/* When neither is expanded, both stay compact */
.policy-target-group:not(.expanded) {
    flex: 0 0 auto;
}

.policy-target-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.policy-target-header:hover {
    background: rgba(88, 166, 255, 0.05);
}

/* Light theme - policy target headers (Endpoints, Groups accordion) */
[data-theme="light"] .policy-target-header,
html[data-theme="light"] .policy-target-header {
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] .policy-target-header:hover,
html[data-theme="light"] .policy-target-header:hover {
    background: var(--theme-bg-primary) !important;
}

.policy-target-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.policy-target-info>i {
    color: #58a6ff;
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.policy-target-info>span {
    color: #e6edf3;
    font-size: 14px;
}

/* Light theme - target info text */
[data-theme="light"] .policy-target-info>span,
html[data-theme="light"] .policy-target-info>span {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-target-header>i,
html[data-theme="light"] .policy-target-header>i {
    color: var(--theme-text-medium) !important;
}

.policy-target-count {
    padding: 3px 10px;
    background: rgba(88, 166, 255, 0.15);
    border-radius: 12px;
    color: #58a6ff !important;
    font-size: 11px;
    font-weight: 500;
}

.policy-target-header>i {
    color: #6e7681;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.policy-target-body {
    border-top: 1px solid rgba(48, 54, 61, 0.4);
    padding: 12px;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Light theme - target body (expanded Endpoints/Groups) */
[data-theme="light"] .policy-target-body,
html[data-theme="light"] .policy-target-body {
    border-top: 1px solid var(--theme-border-solid) !important;
    background: var(--theme-bg-secondary) !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Make target groups expand when open */
.policy-target-group.expanded {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Right column fills height - see main .policy-panel-right rule */

/* Right column section should be flex container */
.policy-panel-right .policy-form-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Targeting hint and header don't grow */
.policy-panel-right .policy-section-header,
.policy-panel-right .policy-targeting-hint {
    flex-shrink: 0;
}

/* Selected items - limited height with scroll */
.policy-selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4);
    max-height: 120px;
    /* ~3-4 rows of tags */
    overflow-y: auto;
    flex-shrink: 0;
}

.policy-selected-items::-webkit-scrollbar {
    width: 4px;
}

.policy-selected-items::-webkit-scrollbar-track {
    background: transparent;
}

.policy-selected-items::-webkit-scrollbar-thumb {
    background: rgba(99, 110, 123, 0.4);
    border-radius: 2px;
}

.policy-selected-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(88, 166, 255, 0.15);
}

/* Light theme - selected items */
[data-theme="light"] .policy-selected-item,
html[data-theme="light"] .policy-selected-item {
    background: var(--theme-accent-blue-bg) !important;
    color: var(--theme-accent-blue-darker) !important;
}

[data-theme="light"] .policy-selected-item i,
html[data-theme="light"] .policy-selected-item i {
    color: var(--theme-accent-blue) !important;
    border: 1px solid var(--theme-border-accent);
    border-radius: 6px;
    color: var(--theme-accent-blue);
    font-size: 12px;
}

.policy-item-id {
    color: #6e7681;
    font-size: 11px;
}

.policy-selected-item i {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.policy-selected-item i:hover {
    opacity: 1;
    color: #f85149;
}

/* Search box */
.policy-search-box {
    position: relative;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.policy-search-box>i.fa-search {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6e7681;
    font-size: 11px;
    pointer-events: none;
    z-index: 2;
}

/* Override global input padding for search boxes - must be very specific */
#policies-page .policy-slide-panel .policy-search-box input,
#policies-page .policy-slide-panel .policy-search-box input[type="text"],
.policy-slide-panel .policy-search-box input,
.policy-slide-panel .policy-search-box input[type="text"] {
    width: 100% !important;
    padding-top: 8px !important;
    padding-right: 12px !important;
    padding-bottom: 8px !important;
    padding-left: 30px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(48, 54, 61, 0.6) !important;
    border-radius: 6px !important;
    color: #e6edf3 !important;
    font-size: 12px !important;
    box-sizing: border-box !important;
}

#policies-page .policy-slide-panel .policy-search-box input:focus,
.policy-slide-panel .policy-search-box input:focus {
    outline: none !important;
    border-color: #58a6ff !important;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15) !important;
}

#policies-page .policy-slide-panel .policy-search-box input::placeholder,
.policy-slide-panel .policy-search-box input::placeholder {
    color: #6e7681 !important;
    font-size: 12px !important;
    opacity: 1 !important;
}

/* Items list */
.policy-items-list {
    min-height: 0;
    max-height: 370px;
    /* ~5 items visible */
    overflow-y: auto;
    border: 1px solid rgba(48, 54, 61, 0.4);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    flex: 1;
}

.policy-items-list::-webkit-scrollbar {
    width: 6px;
}

.policy-items-list::-webkit-scrollbar-track {
    background: transparent;
}

.policy-items-list::-webkit-scrollbar-thumb {
    background: rgba(99, 110, 123, 0.4);
    border-radius: 3px;
}

.policy-items-list.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Light theme - items list (search results) */
[data-theme="light"] .policy-items-list,
html[data-theme="light"] .policy-items-list {
    border: 1px solid var(--theme-border-solid) !important;
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] .policy-search-box input,
[data-theme="light"] #policies-page .policy-slide-panel .policy-search-box input,
html[data-theme="light"] .policy-search-box input,
html[data-theme="light"] #policies-page .policy-slide-panel .policy-search-box input {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-search-box input::placeholder,
[data-theme="light"] #policies-page .policy-slide-panel .policy-search-box input::placeholder,
html[data-theme="light"] .policy-search-box input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

[data-theme="light"] .policy-search-box>i.fa-search,
html[data-theme="light"] .policy-search-box>i.fa-search {
    color: var(--theme-text-medium) !important;
}

.policy-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(48, 54, 61, 0.3);
}

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

.policy-item:hover {
    background: rgba(88, 166, 255, 0.08);
}

.policy-item:hover .policy-item-add-icon {
    color: #58a6ff;
}

.policy-item-add-icon {
    color: #6e7681;
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.policy-item.selected {
    background: rgba(88, 166, 255, 0.12);
}

.policy-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #58a6ff;
    cursor: pointer;
    flex-shrink: 0;
}

.policy-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.policy-item-name {
    color: #e6edf3;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.policy-item-meta {
    color: #6e7681;
    font-size: 11px;
}

.policy-items-empty,
.policy-items-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: #6e7681;
    font-size: 13px;
}

.policy-items-empty i,
.policy-items-loading i {
    font-size: 24px;
    opacity: 0.5;
}

/* Light theme - policy items in list (endpoints/groups to select) */
[data-theme="light"] .policy-item-name,
html[data-theme="light"] .policy-item-name {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-item-meta,
html[data-theme="light"] .policy-item-meta {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-item-add-icon,
html[data-theme="light"] .policy-item-add-icon {
    color: var(--theme-text-muted-decorative) !important;
}

[data-theme="light"] .policy-item:hover .policy-item-add-icon,
html[data-theme="light"] .policy-item:hover .policy-item-add-icon {
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-items-empty,
[data-theme="light"] .policy-items-loading,
html[data-theme="light"] .policy-items-empty,
html[data-theme="light"] .policy-items-loading {
    color: var(--theme-text-medium) !important;
}

/* =============================================================================
   CREATIVE TOGGLE BUTTONS FOR POLICY PANELS
   ============================================================================= */

/* Action Toggle (Block/Allow) - Large prominent toggle */
.policy-action-toggle {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(48, 54, 61, 0.6);
    background: rgba(0, 0, 0, 0.2);
}

/* Compact version for section headers */
.policy-action-toggle--compact {
    border-radius: 8px;
}

.policy-action-toggle--compact .policy-action-btn {
    padding: 8px 14px;
    font-size: 13px;
    gap: 6px;
}

.policy-action-toggle--compact .policy-action-btn i {
    font-size: 13px;
}

/* Section header with action */
.policy-section-header--with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.policy-section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.policy-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: #6e7681;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.policy-action-btn i {
    font-size: 16px;
}

.policy-action-btn.block-btn.active {
    background: linear-gradient(145deg, rgba(248, 81, 73, 0.3) 0%, rgba(248, 81, 73, 0.15) 100%);
    color: #f85149;
    box-shadow: inset 0 0 20px rgba(248, 81, 73, 0.1);
}

.policy-action-btn.allow-btn.active {
    background: linear-gradient(145deg, rgba(63, 185, 80, 0.3) 0%, rgba(63, 185, 80, 0.15) 100%);
    color: #3fb950;
    box-shadow: inset 0 0 20px rgba(63, 185, 80, 0.1);
}

.policy-action-btn:hover:not(.active):not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: #8b949e;
}

.policy-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Light theme - action toggle buttons */
[data-theme="light"] .policy-action-toggle,
html[data-theme="light"] .policy-action-toggle {
    border: 1px solid var(--theme-border-solid) !important;
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] .policy-action-btn,
html[data-theme="light"] .policy-action-btn {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-action-btn.block-btn.active,
html[data-theme="light"] .policy-action-btn.block-btn.active {
    background: linear-gradient(145deg, var(--theme-danger) 0%, var(--theme-danger-dark) 100%) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] .policy-action-btn.allow-btn.active,
html[data-theme="light"] .policy-action-btn.allow-btn.active {
    background: linear-gradient(145deg, var(--theme-success) 0%, var(--theme-success-dark) 100%) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] .policy-action-btn:hover:not(.active):not(:disabled),
html[data-theme="light"] .policy-action-btn:hover:not(.active):not(:disabled) {
    background: var(--theme-border-solid) !important;
    color: var(--theme-text-tertiary) !important;
}

/* Action feedback message */
/* Policy Action Feedback - Footer Message */
.policy-action-feedback {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 16px;
    text-align: center;
}

.policy-action-feedback.block-mode {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #f85149;
}

.policy-action-feedback.allow-mode {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: #3fb950;
}

.policy-action-feedback i {
    font-size: 16px;
}

.policy-action-feedback strong {
    font-weight: 600;
}

/* Filter Type Toggle Buttons (Pill style) */
.policy-filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Compact version for section headers - joined buttons */
.policy-filter-toggles--compact {
    flex-wrap: nowrap;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(48, 54, 61, 0.5);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    /* Prevent shrinking at high DPI */
    min-height: 32px;
    /* Ensure visibility */
    display: inline-flex;
    /* Ensure it sizes to content properly */
}

.policy-filter-toggles--compact .policy-filter-btn {
    border: none;
    border-radius: 0;
    padding: 6px 12px;
    font-size: 12px;
    gap: 5px;
    border-right: 1px solid rgba(48, 54, 61, 0.4);
}

.policy-filter-toggles--compact .policy-filter-btn:last-child {
    border-right: none;
}

.policy-filter-toggles--compact .policy-filter-btn i {
    font-size: 11px;
}

.policy-filter-toggles--compact .policy-filter-btn.active {
    background: rgba(88, 166, 255, 0.2);
    border-color: transparent;
}

/* Section with filters - natural height */
.policy-form-section--filters {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}

.policy-form-section--filters .policy-section-header {
    display: flex;
}

.policy-form-section--filters .policy-filter-content {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
}

.policy-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 8px;
    color: #8b949e;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.policy-filter-btn i {
    font-size: 14px;
    opacity: 0.7;
}

.policy-filter-btn:hover:not(.active) {
    background: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.3);
    color: #e6edf3;
}

.policy-filter-btn.active {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.4);
    color: #58a6ff;
}

.policy-filter-btn.active i {
    opacity: 1;
}

/* Light theme - filter type buttons (Hash, Path, Signer, Chain) */
[data-theme="light"] .policy-filter-toggles--compact,
html[data-theme="light"] .policy-filter-toggles--compact {
    border: 1px solid var(--theme-border-solid) !important;
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] .policy-filter-btn,
html[data-theme="light"] .policy-filter-btn {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn,
html[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn {
    background: transparent !important;
    border: none !important;
    border-right: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn:last-child,
html[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn:last-child {
    border-right: none !important;
}

[data-theme="light"] .policy-filter-btn:hover:not(.active),
html[data-theme="light"] .policy-filter-btn:hover:not(.active) {
    background: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-muted) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-filter-btn.active,
[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn.active,
html[data-theme="light"] .policy-filter-btn.active,
html[data-theme="light"] .policy-filter-toggles--compact .policy-filter-btn.active {
    background: var(--theme-accent-blue) !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
}

/* Direction Toggle (Icon buttons) */
.policy-direction-toggles {
    display: flex;
    gap: 8px;
}

.policy-direction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 10px;
    color: #6e7681;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 80px;
}

.policy-direction-btn i {
    font-size: 20px;
}

.policy-direction-btn:hover:not(.active) {
    background: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.3);
    color: #8b949e;
}

.policy-direction-btn.active {
    background: rgba(88, 166, 255, 0.15);
    border-color: #58a6ff;
    color: #58a6ff;
}

/* Connection Type Toggle */
.policy-connection-toggles {
    display: flex;
    gap: 8px;
}

.policy-connection-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 8px;
    color: #8b949e;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.policy-connection-btn i {
    font-size: 14px;
}

.policy-connection-btn:hover:not(.active) {
    background: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.3);
}

.policy-connection-btn.active {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.4);
    color: #58a6ff;
}

/* Dynamic filter content area */
.policy-filter-content {
    margin-top: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Directive wrappers - fill available space */
.policy-filter-content hash-input,
.policy-filter-content signer-input,
.policy-filter-content path-input,
.policy-filter-content execution-chain,
.policy-filter-content cidr-input,
.policy-filter-content port-input,
.policy-filter-content country-selector,
.policy-filter-content domain-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.policy-filter-content hash-input .main-container,
.policy-filter-content hash-input .card,
.policy-filter-content hash-input .form-group,
.policy-filter-content hash-input .hash-input-wrapper,
.policy-filter-content hash-input .hash-textarea-container,
.policy-filter-content signer-input .main-container,
.policy-filter-content signer-input .card,
.policy-filter-content signer-input .form-group,
.policy-filter-content signer-input .signer-input-wrapper,
.policy-filter-content signer-input .signer-textarea-container,
.policy-filter-content path-input .main-container,
.policy-filter-content path-input .card,
.policy-filter-content path-input .form-group,
.policy-filter-content path-input .path-input-wrapper,
.policy-filter-content path-input .path-textarea-container,
.policy-filter-content execution-chain .main-container,
.policy-filter-content execution-chain .card,
.policy-filter-content execution-chain .form-group,
.policy-filter-content execution-chain .chain-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* All directive text areas - fill remaining space with reduced top padding */
.policy-filter-content textarea,
.policy-filter-content hash-input textarea,
.policy-filter-content signer-input textarea,
.policy-filter-content path-input textarea,
.policy-filter-content cidr-input textarea,
.policy-filter-content port-input textarea,
.policy-filter-content domain-input textarea,
.policy-filter-content hash-input .hash-input-area,
.policy-filter-content signer-input .signer-input-area,
.policy-filter-content path-input .path-input,
.policy-filter-content execution-chain .chain-textarea-container textarea {
    flex: 1;
    min-height: 100px;
    height: auto !important;
    resize: none !important;
    overflow-y: auto !important;
}

/* Reduced top padding for all directive textareas */
.policy-form-section--filters .policy-filter-content textarea,
.policy-form-section--filters hash-input textarea,
.policy-form-section--filters hash-input .hash-textarea-container textarea,
.policy-form-section--filters signer-input textarea,
.policy-form-section--filters signer-input .signer-textarea-container textarea,
.policy-form-section--filters path-input .path-input,
.policy-form-section--filters path-input .path-textarea-container textarea,
.policy-form-section--filters execution-chain textarea,
.policy-form-section--filters execution-chain .chain-textarea-container textarea,
.ip-filter-cidr cidr-input textarea,
.ip-filter-port port-input textarea,
.policy-filter-content domain-input textarea {
    padding-top: 6px !important;
}

/* Light theme - all input wrappers (hash, signer, path, chain) */
[data-theme="light"] .policy-filter-content hash-input .hash-input-wrapper,
[data-theme="light"] .policy-filter-content signer-input .signer-input-wrapper,
[data-theme="light"] .policy-filter-content path-input .path-input-wrapper,
[data-theme="light"] .policy-filter-content execution-chain .chain-input-wrapper,
[data-theme="light"] .policy-form-section hash-input .hash-input-wrapper,
[data-theme="light"] .policy-form-section signer-input .signer-input-wrapper,
[data-theme="light"] .policy-form-section execution-chain .chain-input-wrapper,
html[data-theme="light"] .policy-filter-content hash-input .hash-input-wrapper,
html[data-theme="light"] .policy-filter-content signer-input .signer-input-wrapper,
html[data-theme="light"] .policy-filter-content path-input .path-input-wrapper,
html[data-theme="light"] .policy-filter-content execution-chain .chain-input-wrapper {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
}

[data-theme="light"] .policy-filter-content hash-input .hash-input-wrapper:hover,
[data-theme="light"] .policy-filter-content signer-input .signer-input-wrapper:hover,
[data-theme="light"] .policy-filter-content path-input .path-input-wrapper:hover,
[data-theme="light"] .policy-filter-content execution-chain .chain-input-wrapper:hover,
html[data-theme="light"] .policy-filter-content hash-input .hash-input-wrapper:hover,
html[data-theme="light"] .policy-filter-content signer-input .signer-input-wrapper:hover,
html[data-theme="light"] .policy-filter-content path-input .path-input-wrapper:hover,
html[data-theme="light"] .policy-filter-content execution-chain .chain-input-wrapper:hover {
    border-color: var(--theme-accent-blue) !important;
}

/* Light theme - all directive textareas */
[data-theme="light"] .policy-filter-content textarea,
[data-theme="light"] .policy-filter-content hash-input textarea,
[data-theme="light"] .policy-filter-content signer-input textarea,
[data-theme="light"] .policy-filter-content path-input textarea,
[data-theme="light"] .policy-filter-content execution-chain textarea,
[data-theme="light"] .policy-form-section hash-input textarea,
[data-theme="light"] .policy-form-section signer-input textarea,
[data-theme="light"] .policy-form-section path-input textarea,
[data-theme="light"] .policy-form-section execution-chain textarea,
html[data-theme="light"] .policy-filter-content textarea,
html[data-theme="light"] .policy-filter-content hash-input textarea,
html[data-theme="light"] .policy-filter-content signer-input textarea,
html[data-theme="light"] .policy-filter-content path-input textarea,
html[data-theme="light"] .policy-filter-content execution-chain textarea {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-filter-content textarea::placeholder,
[data-theme="light"] .policy-filter-content hash-input textarea::placeholder,
[data-theme="light"] .policy-filter-content signer-input textarea::placeholder,
[data-theme="light"] .policy-filter-content path-input textarea::placeholder,
[data-theme="light"] .policy-filter-content execution-chain textarea::placeholder,
html[data-theme="light"] .policy-filter-content textarea::placeholder,
html[data-theme="light"] .policy-filter-content hash-input textarea::placeholder,
html[data-theme="light"] .policy-filter-content signer-input textarea::placeholder,
html[data-theme="light"] .policy-filter-content path-input textarea::placeholder,
html[data-theme="light"] .policy-filter-content execution-chain textarea::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - execution chain line labels sidebar */
[data-theme="light"] .line-labels,
[data-theme="light"] execution-chain .line-labels,
[data-theme="light"] .policy-filter-content execution-chain .line-labels,
html[data-theme="light"] .line-labels,
html[data-theme="light"] execution-chain .line-labels,
html[data-theme="light"] .policy-filter-content execution-chain .line-labels {
    background-color: var(--theme-bg-primary) !important;
    box-shadow: var(--theme-shadow-sm) !important;
}

[data-theme="light"] .line-label,
[data-theme="light"] execution-chain .line-label,
html[data-theme="light"] .line-label,
html[data-theme="light"] execution-chain .line-label {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .line-label.chain-hover,
html[data-theme="light"] .line-label.chain-hover {
    background-color: var(--theme-danger-bg) !important;
}

[data-theme="light"] .label-bullet,
html[data-theme="light"] .label-bullet {
    color: var(--theme-accent-blue) !important;
}

/* Light theme - chain input scrollbar */
[data-theme="light"] .chain-input::-webkit-scrollbar-track,
html[data-theme="light"] .chain-input::-webkit-scrollbar-track {
    background: var(--theme-bg-primary) !important;
}

[data-theme="light"] .chain-input::-webkit-scrollbar-thumb,
html[data-theme="light"] .chain-input::-webkit-scrollbar-thumb {
    background: var(--theme-border-muted) !important;
}

[data-theme="light"] .chain-input::-webkit-scrollbar-corner,
html[data-theme="light"] .chain-input::-webkit-scrollbar-corner {
    background: var(--theme-bg-primary) !important;
}

/* Light theme - line labels fade gradient */
[data-theme="light"] .line-labels::after,
html[data-theme="light"] .line-labels::after {
    background: linear-gradient(to right, var(--theme-bg-primary), transparent) !important;
}

/* Light theme - all input wrappers in policy.style.css */
[data-theme="light"] .path-input-wrapper,
[data-theme="light"] .hash-input-wrapper,
[data-theme="light"] .signer-input-wrapper,
[data-theme="light"] .chain-input-wrapper,
[data-theme="light"] .app-name-input-wrapper,
html[data-theme="light"] .path-input-wrapper,
html[data-theme="light"] .hash-input-wrapper,
html[data-theme="light"] .signer-input-wrapper,
html[data-theme="light"] .chain-input-wrapper,
html[data-theme="light"] .app-name-input-wrapper {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
}

[data-theme="light"] .path-input-wrapper:hover,
[data-theme="light"] .hash-input-wrapper:hover,
[data-theme="light"] .signer-input-wrapper:hover,
[data-theme="light"] .chain-input-wrapper:hover,
[data-theme="light"] .app-name-input-wrapper:hover,
html[data-theme="light"] .path-input-wrapper:hover,
html[data-theme="light"] .hash-input-wrapper:hover,
html[data-theme="light"] .signer-input-wrapper:hover,
html[data-theme="light"] .chain-input-wrapper:hover,
html[data-theme="light"] .app-name-input-wrapper:hover {
    border-color: var(--theme-accent-blue) !important;
}

/* Light theme - chain input textarea and content */
[data-theme="light"] .chain-input,
[data-theme="light"] .chain-textarea-container,
html[data-theme="light"] .chain-input,
html[data-theme="light"] .chain-textarea-container {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .chain-input::placeholder,
html[data-theme="light"] .chain-input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - chain delete button */
[data-theme="light"] .chain-delete-btn,
html[data-theme="light"] .chain-delete-btn {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-medium) !important;
    border: 1px solid var(--theme-border-muted) !important;
    box-shadow: var(--theme-shadow-sm) !important;
}

[data-theme="light"] .chain-delete-btn:hover,
html[data-theme="light"] .chain-delete-btn:hover {
    background-color: var(--theme-danger-bg) !important;
    border-color: var(--theme-danger-light) !important;
    color: var(--theme-danger-dark) !important;
}

[data-theme="light"] .chain-delete-btn:active,
html[data-theme="light"] .chain-delete-btn:active {
    background-color: var(--theme-danger-bg) !important;
    border-color: var(--theme-danger-light) !important;
}

/* Light theme - chain-textarea-container and its fade gradient (right side) */
[data-theme="light"] .chain-textarea-container::after,
html[data-theme="light"] .chain-textarea-container::after {
    background: linear-gradient(to right, transparent, var(--theme-bg-secondary)) !important;
}

/* Light theme - chain-textarea-container background */
[data-theme="light"] .chain-textarea-container,
html[data-theme="light"] .chain-textarea-container {
    background: var(--theme-bg-secondary) !important;
}

/* Light theme - all the various scrollbar tracks in policy.style.css */
[data-theme="light"] .selected-items-scroll::-webkit-scrollbar-track,
[data-theme="light"] .execution-chain-container::-webkit-scrollbar-track,
[data-theme="light"] .endpoints-table-container::-webkit-scrollbar-track,
[data-theme="light"] .groups-table-container::-webkit-scrollbar-track,
[data-theme="light"] .country-list-container::-webkit-scrollbar-track,
[data-theme="light"] .selected-countries-list::-webkit-scrollbar-track,
html[data-theme="light"] .selected-items-scroll::-webkit-scrollbar-track,
html[data-theme="light"] .execution-chain-container::-webkit-scrollbar-track,
html[data-theme="light"] .endpoints-table-container::-webkit-scrollbar-track,
html[data-theme="light"] .groups-table-container::-webkit-scrollbar-track,
html[data-theme="light"] .country-list-container::-webkit-scrollbar-track,
html[data-theme="light"] .selected-countries-list::-webkit-scrollbar-track {
    background: var(--theme-bg-primary) !important;
}

[data-theme="light"] .selected-items-scroll::-webkit-scrollbar-thumb,
[data-theme="light"] .execution-chain-container::-webkit-scrollbar-thumb,
[data-theme="light"] .endpoints-table-container::-webkit-scrollbar-thumb,
[data-theme="light"] .groups-table-container::-webkit-scrollbar-thumb,
[data-theme="light"] .country-list-container::-webkit-scrollbar-thumb,
[data-theme="light"] .selected-countries-list::-webkit-scrollbar-thumb,
html[data-theme="light"] .selected-items-scroll::-webkit-scrollbar-thumb,
html[data-theme="light"] .execution-chain-container::-webkit-scrollbar-thumb,
html[data-theme="light"] .endpoints-table-container::-webkit-scrollbar-thumb,
html[data-theme="light"] .groups-table-container::-webkit-scrollbar-thumb,
html[data-theme="light"] .country-list-container::-webkit-scrollbar-thumb,
html[data-theme="light"] .selected-countries-list::-webkit-scrollbar-thumb {
    background: var(--theme-border-muted) !important;
}

/* Light theme - form labels and inputs */
[data-theme="light"] .policy-form-label,
[data-theme="light"] .policy-slide-panel .policy-form-label,
[data-theme="light"] .policy-form-group .policy-form-label,
[data-theme="light"] #policies-page .policy-form-label,
[data-theme="light"] label.policy-form-label,
html[data-theme="light"] .policy-form-label,
html[data-theme="light"] .policy-slide-panel .policy-form-label,
html[data-theme="light"] .policy-form-group .policy-form-label {
    color: var(--theme-text-dark) !important;
    /* Dark text for visibility */
}

/* Light theme - required asterisk on form labels */
[data-theme="light"] .policy-form-label.required::after,
html[data-theme="light"] .policy-form-label.required::after {
    color: var(--theme-danger-dark) !important;
    /* Red asterisk */
}

[data-theme="light"] .policy-form-input,
[data-theme="light"] .policy-textarea,
html[data-theme="light"] .policy-form-input,
html[data-theme="light"] .policy-textarea {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-form-input:focus,
[data-theme="light"] .policy-textarea:focus,
html[data-theme="light"] .policy-form-input:focus,
html[data-theme="light"] .policy-textarea:focus {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .policy-form-input::placeholder,
[data-theme="light"] .policy-textarea::placeholder,
html[data-theme="light"] .policy-form-input::placeholder,
html[data-theme="light"] .policy-textarea::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - Country selector wrapper (main container) */
[data-theme="light"] .country-selector-wrapper,
[data-theme="light"] country-selector .country-selector-wrapper,
html[data-theme="light"] .country-selector-wrapper,
html[data-theme="light"] country-selector .country-selector-wrapper {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

/* Light theme - Country selector card and main-container */
[data-theme="light"] country-selector .main-container,
[data-theme="light"] country-selector .card,
[data-theme="light"] country-selector .form-group,
html[data-theme="light"] country-selector .main-container,
html[data-theme="light"] country-selector .card,
html[data-theme="light"] country-selector .form-group {
    background-color: transparent !important;
}

/* Light theme - Country list for network policies */
[data-theme="light"] .country-list-container,
html[data-theme="light"] .country-list-container {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .country-item,
html[data-theme="light"] .country-item {
    border-bottom: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .country-item:hover,
html[data-theme="light"] .country-item:hover {
    background-color: var(--theme-bg-primary) !important;
}

[data-theme="light"] .country-item.selected,
html[data-theme="light"] .country-item.selected {
    background-color: var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] .country-name,
html[data-theme="light"] .country-name {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .country-code,
html[data-theme="light"] .country-code {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .country-item.selected .country-name,
[data-theme="light"] .country-item.selected .country-code,
html[data-theme="light"] .country-item.selected .country-name,
html[data-theme="light"] .country-item.selected .country-code {
    color: var(--theme-text-inverse) !important;
}

[data-theme="light"] .selected-country-item,
html[data-theme="light"] .selected-country-item {
    background-color: var(--theme-accent-blue-bg) !important;
    border: 1px solid var(--theme-accent-blue-light) !important;
    color: var(--theme-accent-blue-darker) !important;
}

[data-theme="light"] .selected-country-item .country-name,
html[data-theme="light"] .selected-country-item .country-name {
    color: var(--theme-accent-blue-darker) !important;
}

[data-theme="light"] .selected-country-item .remove-country,
html[data-theme="light"] .selected-country-item .remove-country {
    color: var(--theme-accent-blue-darker) !important;
}

[data-theme="light"] .selected-country-item .remove-country:hover,
html[data-theme="light"] .selected-country-item .remove-country:hover {
    color: var(--theme-danger-dark) !important;
}

[data-theme="light"] .country-search-container,
[data-theme="light"] country-selector .country-search-container,
html[data-theme="light"] .country-search-container,
html[data-theme="light"] country-selector .country-search-container {
    background-color: var(--theme-bg-secondary) !important;
    border-bottom: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .country-search-input,
[data-theme="light"] country-selector .country-search-input,
[data-theme="light"] input.country-search-input,
[data-theme="light"] #policies-page .country-search-input,
[data-theme="light"] #policies-page country-selector .country-search-input,
[data-theme="light"] .policy-slide-panel .country-search-input,
html[data-theme="light"] .country-search-input,
html[data-theme="light"] country-selector .country-search-input,
html[data-theme="light"] input.country-search-input,
html[data-theme="light"] #policies-page .country-search-input {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

/* Force override for country search input with attribute selector */
[data-theme="light"] input[class*="country-search"],
html[data-theme="light"] input[class*="country-search"] {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .country-search-input:focus,
html[data-theme="light"] .country-search-input:focus {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .country-search-input::placeholder,
html[data-theme="light"] .country-search-input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - Domain input wrapper (Network policies) */
[data-theme="light"] .domain-input-wrapper,
html[data-theme="light"] .domain-input-wrapper {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
}

[data-theme="light"] .domain-input-wrapper:hover,
[data-theme="light"] .domain-input-wrapper.focused,
html[data-theme="light"] .domain-input-wrapper:hover,
html[data-theme="light"] .domain-input-wrapper.focused {
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .domain-input,
[data-theme="light"] .domain-textarea-container,
html[data-theme="light"] .domain-input,
html[data-theme="light"] .domain-textarea-container {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .domain-input::placeholder,
html[data-theme="light"] .domain-input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - Domain input line icons */
[data-theme="light"] .domain-input-wrapper .line-icons,
html[data-theme="light"] .domain-input-wrapper .line-icons {
    background-color: var(--theme-bg-primary) !important;
}

[data-theme="light"] .domain-input-wrapper .line-icon,
html[data-theme="light"] .domain-input-wrapper .line-icon {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .country-list-container .no-results,
html[data-theme="light"] .country-list-container .no-results {
    color: var(--theme-text-medium) !important;
}

/* Light theme - CIDR and Port input wrappers (Network policies) */
[data-theme="light"] .cidr-input-wrapper,
[data-theme="light"] .port-input-wrapper,
html[data-theme="light"] .cidr-input-wrapper,
html[data-theme="light"] .port-input-wrapper {
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
}

[data-theme="light"] .cidr-input-wrapper:hover,
[data-theme="light"] .port-input-wrapper:hover,
[data-theme="light"] .cidr-input-wrapper.focused,
[data-theme="light"] .port-input-wrapper.focused,
html[data-theme="light"] .cidr-input-wrapper:hover,
html[data-theme="light"] .port-input-wrapper:hover,
html[data-theme="light"] .cidr-input-wrapper.focused,
html[data-theme="light"] .port-input-wrapper.focused {
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .cidr-input,
[data-theme="light"] .port-input,
[data-theme="light"] .cidr-textarea-container,
[data-theme="light"] .port-textarea-container,
html[data-theme="light"] .cidr-input,
html[data-theme="light"] .port-input,
html[data-theme="light"] .cidr-textarea-container,
html[data-theme="light"] .port-textarea-container {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .cidr-input::placeholder,
[data-theme="light"] .port-input::placeholder,
html[data-theme="light"] .cidr-input::placeholder,
html[data-theme="light"] .port-input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

/* Light theme - hint bars for all input types */
[data-theme="light"] .path-hint,
[data-theme="light"] .hash-hint,
[data-theme="light"] .signer-hint,
[data-theme="light"] .chain-hint,
[data-theme="light"] .cidr-hint,
[data-theme="light"] .port-hint,
[data-theme="light"] .domain-hint,
[data-theme="light"] .app-name-hint,
html[data-theme="light"] .path-hint,
html[data-theme="light"] .hash-hint,
html[data-theme="light"] .signer-hint,
html[data-theme="light"] .chain-hint,
html[data-theme="light"] .cidr-hint,
html[data-theme="light"] .port-hint,
html[data-theme="light"] .domain-hint,
html[data-theme="light"] .app-name-hint {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .hint-default,
html[data-theme="light"] .hint-default {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .hint-valid,
html[data-theme="light"] .hint-valid {
    background-color: var(--theme-success-bg) !important;
    color: var(--theme-success-dark) !important;
}

[data-theme="light"] .hint-invalid,
html[data-theme="light"] .hint-invalid {
    background-color: var(--theme-danger-bg) !important;
    color: var(--theme-danger-dark) !important;
}

/* Light theme - line types/icons for CIDR and Port inputs */
[data-theme="light"] .cidr-input-wrapper .line-types,
[data-theme="light"] .port-input-wrapper .line-types,
html[data-theme="light"] .cidr-input-wrapper .line-types,
html[data-theme="light"] .port-input-wrapper .line-types {
    background-color: var(--theme-bg-primary) !important;
}

[data-theme="light"] .cidr-input-wrapper .line-type,
[data-theme="light"] .port-input-wrapper .line-type,
html[data-theme="light"] .cidr-input-wrapper .line-type,
html[data-theme="light"] .port-input-wrapper .line-type {
    color: var(--theme-text-medium) !important;
}

/* Also adjust line indicators/icons position */
.policy-form-section--filters hash-input .line-types,
.policy-form-section--filters signer-input .line-types,
.policy-form-section--filters path-input .line-icons,
.policy-form-section--filters app-name-input .line-icons,
.policy-form-section--filters execution-chain .line-labels,
.ip-filter-cidr cidr-input .line-types,
.ip-filter-port port-input .line-types,
.policy-filter-content domain-input .line-icons {
    top: 6px !important;
}

.policy-form-section--filters hash-input .current-line-indicator,
.policy-form-section--filters signer-input .current-line-indicator,
.policy-form-section--filters path-input .current-line-indicator,
.policy-form-section--filters app-name-input .current-line-indicator,
.policy-form-section--filters execution-chain .current-line-indicator,
.ip-filter-cidr cidr-input .current-line-indicator,
.ip-filter-port port-input .current-line-indicator,
.policy-filter-content domain-input .current-line-indicator {
    top: 6px !important;
}

/* Status/hint bars stay at bottom */
.policy-filter-content .status-bar,
.policy-filter-content .hash-status,
.policy-filter-content .validation-status,
.policy-filter-content .input-hint {
    flex-shrink: 0;
}


/* Execution chain - fill container */
.policy-filter-content execution-chain .chain-textarea-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.policy-filter-content execution-chain .main-container .card {
    margin: 0 !important;
    padding: 0 !important;
}

/* Hint styles - use standard base styling from policy.style.css */

/* IP Filter - Side by side layout (CIDR 2/3, Ports 1/3) */

.policy-form-section--filters .policy-filter-content.policy-filter-content--ip-row {
    display: flex;
    flex-direction: row;
    gap: 15px;
}

.ip-filter-cidr {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ip-filter-port {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ip-filter-cidr cidr-input,
.ip-filter-port port-input {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ip-filter-cidr cidr-input .main-container,
.ip-filter-cidr cidr-input .card,
.ip-filter-cidr cidr-input .form-group,
.ip-filter-port port-input .main-container,
.ip-filter-port port-input .card,
.ip-filter-port port-input .form-group,
.policy-filter-content domain-input .main-container,
.policy-filter-content domain-input .card,
.policy-filter-content domain-input .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Auto-fit container height */
.ip-filter-cidr cidr-input textarea,
.ip-filter-port port-input textarea,
.policy-filter-content domain-input textarea {
    flex: 1;
    min-height: 150px !important;
    height: 100%;
}

.policy-filter-content .hint-icon {
    font-size: 14px;
    margin-right: 6px;
}

.policy-filter-content .hint-summary {
    font-size: 10px;
    gap: 10px;
}

.policy-filter-content .hint-content-wrapper strong {
    font-size: 13px;
}

.policy-filter-content .hint-content-wrapper .text-xs {
    font-size: 12px;
}

.policy-filter-content-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #8b949e;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.policy-filter-content-header i {
    color: #58a6ff;
}

/* ==========================================================================
   STORAGE POLICY - Permission Cards
   ========================================================================== */

/* Fix for Access Permissions section to contain all permission cards */
/* Override the flex: 1 from :last-child rule for storage policies */
.policy-permissions-section,
.policy-panel-left .policy-form-section.policy-permissions-section,
.policy-panel-left .policy-form-section.policy-permissions-section:last-child,
.policy-panel-left .policy-form-section:has(.policy-permissions-grid),
.policy-panel-left .policy-form-section:has(.policy-permissions-grid):last-child {
    flex: 0 0 auto !important;
    overflow: visible !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    margin-bottom: 16px !important;
}

/* Ensure last section in panel has bottom margin for footer spacing */
.policy-panel-columns .policy-form-section:last-child,
.policy-panel-left .policy-form-section:last-child,
.policy-panel-right .policy-form-section:last-child {
    /* margin-bottom: 16px !important; */
}

/* Storage policy - ensure proper two-column layout */
.policy-panel-columns {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

/* Storage policy - add breathing room above the footer */
.policy-slide-panel--storage .policy-panel-left,
.policy-slide-panel--storage .policy-panel-right {
    padding-bottom: 20px;
    box-sizing: border-box;
}

/* Storage policy - separate content border from footer */
.policy-slide-panel--storage .policy-panel-footer {
    margin-top: 16px;
}

/* Storage policy - keep space between panel content and footer */
.policy-slide-panel--storage .policy-panel-content {
    padding-bottom: 48px;
}

/* Ensure permissions section padding at bottom */
.policy-permissions-section {
    padding-bottom: 20px !important;
}

/* Add spacing between Device Filters and section bottom */
.policy-device-filters {
    margin-bottom: 8px !important;
}

/* Fallback for browsers without :has() support */
.policy-permissions-grid {
    overflow: visible !important;
}

.policy-permissions-grid+.policy-form-group {
    margin-top: 24px;
}

.policy-permissions-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.policy-permission-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(48, 54, 61, 0.5);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.policy-permission-item:hover {
    background: rgba(88, 166, 255, 0.05);
    border-color: rgba(88, 166, 255, 0.3);
}

.policy-permission-item.active {
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.4);
}

.policy-permission-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(48, 54, 61, 0.5);
    border-radius: 8px;
    color: #8b949e;
    font-size: 18px;
    transition: all 0.2s ease;
}

.policy-permission-item.active .policy-permission-icon {
    background: rgba(63, 185, 80, 0.2);
    color: #3fb950;
}

.policy-permission-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.policy-permission-title {
    font-size: 14px;
    font-weight: 600;
    color: #e6edf3;
}

.policy-permission-desc {
    font-size: 12px;
    color: #8b949e;
}

.policy-permission-item.active .policy-permission-desc {
    color: #a3d9a5;
}

.policy-permission-toggle {
    font-size: 28px;
    color: #484f58;
    transition: all 0.2s ease;
}

.policy-permission-item.active .policy-permission-toggle {
    color: #3fb950;
}

/* Device Filters */
.policy-device-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.policy-device-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.policy-device-filter-row label {
    min-width: 100px;
    font-size: 13px;
    color: #8b949e;
}

.policy-device-filter-row .policy-form-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 13px;
}

/* Light theme - Permission cards */
[data-theme="light"] .policy-permission-item,
html[data-theme="light"] .policy-permission-item {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-permission-item:hover,
html[data-theme="light"] .policy-permission-item:hover {
    background: var(--theme-bg-primary) !important;
    border-color: var(--theme-accent-blue-light) !important;
}

[data-theme="light"] .policy-permission-item.active,
html[data-theme="light"] .policy-permission-item.active {
    background: var(--theme-success-bg) !important;
    border-color: var(--theme-success-light) !important;
}

[data-theme="light"] .policy-permission-icon,
html[data-theme="light"] .policy-permission-icon {
    background: var(--theme-border-solid) !important;
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-permission-item.active .policy-permission-icon,
html[data-theme="light"] .policy-permission-item.active .policy-permission-icon {
    background: var(--theme-success-bg) !important;
    color: var(--theme-success-dark) !important;
}

[data-theme="light"] .policy-permission-title,
html[data-theme="light"] .policy-permission-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-permission-desc,
html[data-theme="light"] .policy-permission-desc {
    color: var(--theme-text-medium) !important;
}

[data-theme="light"] .policy-permission-item.active .policy-permission-desc,
html[data-theme="light"] .policy-permission-item.active .policy-permission-desc {
    color: var(--theme-success-dark) !important;
}

[data-theme="light"] .policy-permission-toggle,
html[data-theme="light"] .policy-permission-toggle {
    color: var(--theme-text-muted-decorative) !important;
}

[data-theme="light"] .policy-permission-item.active .policy-permission-toggle,
html[data-theme="light"] .policy-permission-item.active .policy-permission-toggle {
    color: var(--theme-success-dark) !important;
}

/* Light theme - Device Filters */
[data-theme="light"] .policy-device-filter-row label,
[data-theme="light"] .policy-device-filters label,
[data-theme="light"] #policies-page .policy-device-filter-row label,
[data-theme="light"] .policy-slide-panel .policy-device-filter-row label,
html[data-theme="light"] .policy-device-filter-row label,
html[data-theme="light"] .policy-device-filters label {
    color: var(--theme-text-dark) !important;
    font-weight: 500 !important;
}

[data-theme="light"] .policy-device-filter-row .policy-form-input,
[data-theme="light"] .policy-device-filter-row input,
[data-theme="light"] .policy-device-filters .policy-form-input,
[data-theme="light"] .policy-device-filters input,
[data-theme="light"] #policies-page .policy-device-filter-row .policy-form-input,
[data-theme="light"] #policies-page .policy-device-filter-row input,
[data-theme="light"] .policy-slide-panel .policy-device-filter-row input,
html[data-theme="light"] .policy-device-filter-row .policy-form-input,
html[data-theme="light"] .policy-device-filter-row input,
html[data-theme="light"] .policy-device-filters input {
    background: var(--theme-bg-secondary) !important;
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-device-filter-row .policy-form-input::placeholder,
[data-theme="light"] .policy-device-filter-row input::placeholder,
[data-theme="light"] .policy-device-filters input::placeholder,
html[data-theme="light"] .policy-device-filter-row .policy-form-input::placeholder,
html[data-theme="light"] .policy-device-filter-row input::placeholder,
html[data-theme="light"] .policy-device-filters input::placeholder {
    color: var(--theme-text-muted-decorative) !important;
}

[data-theme="light"] .policy-device-filter-row input:focus,
[data-theme="light"] .policy-device-filters input:focus,
html[data-theme="light"] .policy-device-filter-row input:focus {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

/* Storage Feedback - Info style instead of block/allow */
.policy-storage-feedback {
    background: rgba(88, 166, 255, 0.1) !important;
    border: 1px solid rgba(88, 166, 255, 0.3) !important;
    color: #58a6ff !important;
}

.policy-storage-feedback.all-blocked {
    background: rgba(248, 81, 73, 0.1) !important;
    border-color: rgba(248, 81, 73, 0.3) !important;
    color: #f85149 !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .policy-slide-panel {
        width: 100%;
    }

    .policy-panel-columns {
        flex-direction: column;
        height: auto;
    }

    .policy-panel-left {
        height: auto;
    }

    .policy-panel-left .policy-form-section:last-child {
        flex: 0 0 auto;
    }

    .policy-panel-left .policy-form-section:last-child path-input {
        min-height: 150px;
    }

    .policy-panel-left .policy-form-section:last-child path-input .path-input {
        min-height: 120px;
    }

    .policy-panel-right {
        width: 100%;
    }

    .policy-form-section-sticky {
        position: static;
    }
}

/* =============================================================================
   LIGHT THEME OVERRIDES
   ============================================================================= */

/* Page Container */
[data-theme="light"] #policies-page,
html[data-theme="light"] #policies-page {
    background: var(--theme-bg-primary) !important;
}

/* Page Header */
[data-theme="light"] #policies-page .alerts-header-title,
html[data-theme="light"] #policies-page .alerts-header-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .alerts-header-subtitle,
html[data-theme="light"] #policies-page .alerts-header-subtitle {
    color: var(--theme-text-secondary) !important;
}

/* Tab Navigation Bar */
[data-theme="light"] #policies-page>.page-bar,
html[data-theme="light"] #policies-page>.page-bar {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    box-shadow: var(--theme-shadow-sm) !important;
}

/* Tab Buttons */
[data-theme="light"] #policies-page .btn-bar,
html[data-theme="light"] #policies-page .btn-bar {
    background: transparent !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-secondary) !important;
}

[data-theme="light"] #policies-page .btn-bar:hover,
html[data-theme="light"] #policies-page .btn-bar:hover {
    background: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] #policies-page .btn-bar.active,
html[data-theme="light"] #policies-page .btn-bar.active {
    background: var(--theme-accent-blue-bg) !important;
    border: 1px solid var(--theme-accent-blue) !important;
    color: var(--theme-accent-blue) !important;
}

/* Endpoint Group Selector Bar */
[data-theme="light"] .policy-selector-bar,
[data-theme="light"] #policies-page .policy-selector-bar,
[data-theme="light"] #policies-page>.page-bar.policy-selector-bar,
html[data-theme="light"] .policy-selector-bar,
html[data-theme="light"] #policies-page .policy-selector-bar,
html[data-theme="light"] #policies-page>.page-bar.policy-selector-bar {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-selector-label,
[data-theme="light"] #policies-page .policy-selector-label,
html[data-theme="light"] .policy-selector-label,
html[data-theme="light"] #policies-page .policy-selector-label {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-group-btn,
[data-theme="light"] #policies-page .policy-group-btn,
html[data-theme="light"] .policy-group-btn,
html[data-theme="light"] #policies-page .policy-group-btn {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
    position: relative;
    z-index: 1002;
}

[data-theme="light"] .policy-group-btn:hover,
[data-theme="light"] #policies-page .policy-group-btn:hover,
html[data-theme="light"] .policy-group-btn:hover,
html[data-theme="light"] #policies-page .policy-group-btn:hover {
    background: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-group-btn:hover,
html[data-theme="light"] .policy-group-btn:hover {
    background: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-group-dropdown .dropdown-menu,
html[data-theme="light"] .policy-group-dropdown .dropdown-menu {
    background: var(--theme-bg-secondary) !important;
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    box-shadow: var(--theme-shadow-md) !important;
    z-index: 1;
}

[data-theme="light"] .policy-group-dropdown .dropdown-menu li a,
html[data-theme="light"] .policy-group-dropdown .dropdown-menu li a {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-group-dropdown .dropdown-menu li a:hover,
html[data-theme="light"] .policy-group-dropdown .dropdown-menu li a:hover {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-accent-blue-dark) !important;
}

[data-theme="light"] #policies-page .policy-group-dropdown.open .policy-group-btn,
html[data-theme="light"] #policies-page .policy-group-dropdown.open .policy-group-btn,
[data-theme="light"] #policies-page .policy-group-btn:focus,
html[data-theme="light"] #policies-page .policy-group-btn:focus {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-text-dark) !important;
    z-index: 1002 !important;
}

[data-theme="light"] #policies-page .policy-group-dropdown.open>.policy-group-btn,
html[data-theme="light"] #policies-page .policy-group-dropdown.open>.policy-group-btn {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-text-dark) !important;
    z-index: 1002 !important;
}

/* Override generic dropdown rules so the endpoint group selector stays visible */
#policies-page .policy-group-dropdown.open>.policy-group-btn,
#policies-page .policy-group-dropdown.open .policy-group-btn {
    position: relative !important;
    z-index: 1002 !important;
    visibility: visible !important;
}

/* Light theme: enforce #f1f5f9 on the selector button with higher specificity */
[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .policy-group-btn,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .policy-group-btn {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .policy-group-btn:hover,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .policy-group-btn:hover,
[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown.open>.policy-group-btn,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown.open>.policy-group-btn {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
}

/* Light theme: dropdown menu should be white, not dark */
[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .dropdown-menu,
html[data-theme="light"] #policies-page .policy-selector-bar .policy-group-dropdown .dropdown-menu {
    background: var(--theme-bg-secondary) !important;
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    z-index: 1001;
}

[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu,
html[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu {
    background: var(--theme-bg-secondary) !important;
    background-color: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    z-index: 1001;
}

[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu li a,
html[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu li a {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu li a:hover,
html[data-theme="light"] #policies-page .policy-group-dropdown .dropdown-menu li a:hover {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-accent-blue-dark) !important;
}

[data-theme="light"] .policy-last-modified,
html[data-theme="light"] .policy-last-modified {
    color: var(--theme-text-secondary) !important;
}

/* Main Content Panel */
[data-theme="light"] .policy-main-container,
html[data-theme="light"] .policy-main-container {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

/* Detection Mode Cards - white cards on page background */
[data-theme="light"] .mode-card,
[data-theme="light"] #policies-page .mode-card,
html[data-theme="light"] .mode-card,
html[data-theme="light"] #policies-page .mode-card {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .mode-card:hover,
[data-theme="light"] #policies-page .mode-card:hover,
html[data-theme="light"] .mode-card:hover,
html[data-theme="light"] #policies-page .mode-card:hover {
    border-color: var(--theme-accent-blue) !important;
    background: var(--theme-bg-secondary) !important;
    box-shadow: 0 2px 8px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .mode-card.selected,
[data-theme="light"] #policies-page .mode-card.selected,
html[data-theme="light"] .mode-card.selected,
html[data-theme="light"] #policies-page .mode-card.selected {
    background: var(--theme-bg-secondary) !important;
    border: 2px solid var(--theme-accent-blue) !important;
    box-shadow: 0 2px 12px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .mode-card-title,
html[data-theme="light"] .mode-card-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .mode-card-desc,
html[data-theme="light"] .mode-card-desc {
    color: var(--theme-text-secondary) !important;
}

[data-theme="light"] .mode-card-icon,
html[data-theme="light"] .mode-card-icon {
    background: var(--theme-accent-blue-bg) !important;
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .mode-card-check,
html[data-theme="light"] .mode-card-check {
    background: var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
}

/* Detection Layout - should match page background, NOT white */
[data-theme="light"] .detection-layout,
[data-theme="light"] #policies-page .detection-layout,
html[data-theme="light"] .detection-layout,
html[data-theme="light"] #policies-page .detection-layout {
    background: transparent !important;
}

[data-theme="light"] .detection-left,
[data-theme="light"] .detection-right,
[data-theme="light"] #policies-page .detection-left,
[data-theme="light"] #policies-page .detection-right,
html[data-theme="light"] .detection-left,
html[data-theme="light"] .detection-right,
html[data-theme="light"] #policies-page .detection-left,
html[data-theme="light"] #policies-page .detection-right {
    background: transparent !important;
}

[data-theme="light"] .policy-container,
[data-theme="light"] #policies-page .policy-container,
html[data-theme="light"] .policy-container,
html[data-theme="light"] #policies-page .policy-container {
    background: transparent !important;
}

/* Agent policies: white container, #f1f5f9 inner items */
[data-theme="light"] #policies-page .policy-container--agent,
html[data-theme="light"] #policies-page .policy-container--agent {
    background: var(--theme-bg-secondary) !important;
    border: none !important;
    box-shadow: none !important;
}

[data-theme="light"] #policies-page .policy-container--agent .policy-section,
html[data-theme="light"] #policies-page .policy-container--agent .policy-section {
    background: var(--theme-bg-secondary) !important;
    border: none !important;
    box-shadow: none !important;
}

[data-theme="light"] #policies-page .policy-container--agent .policy-item,
html[data-theme="light"] #policies-page .policy-container--agent .policy-item {
    background: #f1f5f9 !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .policy-container--agent .policy-item:hover,
html[data-theme="light"] #policies-page .policy-container--agent .policy-item:hover {
    background: #f1f5f9 !important;
    border-color: var(--theme-accent-blue) !important;
}

/* Detection mode + engines containers should be white (no border) */
[data-theme="light"] #policies-page .detection-left .policy-container,
[data-theme="light"] #policies-page .detection-right .policy-container,
html[data-theme="light"] #policies-page .detection-left .policy-container,
html[data-theme="light"] #policies-page .detection-right .policy-container {
    background: var(--theme-bg-secondary) !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

/* Inner cards should match the page background */
[data-theme="light"] #policies-page .detection-left .mode-card,
html[data-theme="light"] #policies-page .detection-left .mode-card {
    background: var(--theme-bg-primary) !important;
}

[data-theme="light"] #policies-page .detection-right .policy-section,
html[data-theme="light"] #policies-page .detection-right .policy-section {
    background: var(--theme-bg-secondary) !important;
    border: none !important;
    box-shadow: none !important;
}

[data-theme="light"] #policies-page .detection-right .engine-item,
html[data-theme="light"] #policies-page .detection-right .engine-item {
    background: var(--theme-bg-primary) !important;
}

[data-theme="light"] #policies-page .detection-right .toggle-item,
html[data-theme="light"] #policies-page .detection-right .toggle-item {
    background: var(--theme-bg-primary) !important;
}

/* Section Panels (Detection Engines, Response Actions, etc.) */
[data-theme="light"] .policy-section,
html[data-theme="light"] .policy-section {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-section-header,
html[data-theme="light"] .policy-section-header {
    color: var(--theme-text-dark) !important;
    border-bottom-color: var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-section-title,
html[data-theme="light"] .policy-section-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-section-subtitle,
html[data-theme="light"] .policy-section-subtitle {
    color: var(--theme-text-secondary) !important;
}

/* Toggle Items */
[data-theme="light"] .toggle-item,
html[data-theme="light"] .toggle-item {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .toggle-item:hover,
html[data-theme="light"] .toggle-item:hover {
    background: var(--theme-bg-secondary) !important;
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .toggle-item-label,
[data-theme="light"] .toggle-label,
html[data-theme="light"] .toggle-item-label,
html[data-theme="light"] .toggle-label {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .toggle-item-icon,
[data-theme="light"] .toggle-icon,
html[data-theme="light"] .toggle-item-icon,
html[data-theme="light"] .toggle-icon {
    color: var(--theme-accent-blue) !important;
}

/* Engines Grid */
[data-theme="light"] .engines-grid,
html[data-theme="light"] .engines-grid {
    background: transparent !important;
}

[data-theme="light"] .engine-item,
html[data-theme="light"] .engine-item {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .engine-item:hover,
html[data-theme="light"] .engine-item:hover {
    background: var(--theme-bg-secondary) !important;
    border-color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .engine-label,
[data-theme="light"] .engine-name,
html[data-theme="light"] .engine-label,
html[data-theme="light"] .engine-name {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .engine-info,
html[data-theme="light"] .engine-info {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] #policies-page .engine-name,
html[data-theme="light"] #policies-page .engine-name {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .engine-icon,
html[data-theme="light"] .engine-icon {
    color: var(--theme-accent-blue) !important;
}

/* Footer / Save Changes Bar */
[data-theme="light"] .policy-footer,
html[data-theme="light"] .policy-footer {
    background: var(--theme-bg-secondary) !important;
    border-top: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-save-btn,
html[data-theme="light"] .policy-save-btn {
    background: linear-gradient(135deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    color: var(--theme-text-inverse) !important;
}

/* Policy Grid Layout */
[data-theme="light"] .policy-grid,
html[data-theme="light"] .policy-grid {
    background: transparent !important;
}

/* Policy Cards in Grid */
[data-theme="light"] .policy-card,
html[data-theme="light"] .policy-card {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-card-header,
html[data-theme="light"] .policy-card-header {
    background: var(--theme-bg-tertiary) !important;
    border-bottom: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-card-title,
html[data-theme="light"] .policy-card-title {
    color: var(--theme-text-dark) !important;
}

/* Form Elements */
[data-theme="light"] .policy-form-input,
html[data-theme="light"] .policy-form-input {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-form-input:focus,
html[data-theme="light"] .policy-form-input:focus {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .policy-form-label,
html[data-theme="light"] .policy-form-label {
    color: var(--theme-text-tertiary) !important;
}

/* Dropdowns */
[data-theme="light"] .policy-dropdown,
html[data-theme="light"] .policy-dropdown {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-dropdown-menu,
html[data-theme="light"] .policy-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid var(--theme-border-solid) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .policy-dropdown-item,
html[data-theme="light"] .policy-dropdown-item {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-dropdown-item:hover,
html[data-theme="light"] .policy-dropdown-item:hover {
    background: var(--theme-table-row-hover) !important;
    color: var(--theme-accent-blue) !important;
}

/* Panel Columns */
[data-theme="light"] .policy-panel-columns,
html[data-theme="light"] .policy-panel-columns {
    background: transparent !important;
}

[data-theme="light"] .policy-panel-left,
[data-theme="light"] .policy-panel-right,
html[data-theme="light"] .policy-panel-left,
html[data-theme="light"] .policy-panel-right {
    background: var(--theme-bg-secondary) !important;
}

/* Form Sections */
[data-theme="light"] .policy-slide-panel .policy-form-section,
html[data-theme="light"] .policy-slide-panel .policy-form-section {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-form-section-header,
html[data-theme="light"] .policy-form-section-header {
    color: var(--theme-text-dark) !important;
    border-bottom-color: var(--theme-border-solid) !important;
}

/* =============================================================================
   LIGHT THEME - Exclusions Table
   ============================================================================= */

/* Exclusions Section */
[data-theme="light"] .exclusions-section,
html[data-theme="light"] .exclusions-section {
    background: transparent !important;
}

/* Exclusions Portlet */
[data-theme="light"] .portlet.exclusions-portlet,
html[data-theme="light"] .portlet.exclusions-portlet {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .portlet.exclusions-portlet .portlet-title,
[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title,
[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title.informations,
html[data-theme="light"] .portlet.exclusions-portlet .portlet-title,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title.informations {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption,
[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption-subject,
html[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption,
html[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption-subject {
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption i,
html[data-theme="light"] .portlet.exclusions-portlet .portlet-title .caption i {
    color: var(--theme-accent-blue) !important;
}

/* Exclusions Table */
[data-theme="light"] #policies-page .table,
[data-theme="light"] .exclusions-table,
html[data-theme="light"] #policies-page .table,
html[data-theme="light"] .exclusions-table {
    background: var(--theme-bg-secondary) !important;
}

[data-theme="light"] #policies-page .table thead th,
html[data-theme="light"] #policies-page .table thead th {
    background: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-dark) !important;
    border-bottom: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .table tbody tr,
html[data-theme="light"] #policies-page .table tbody tr {
    background: var(--theme-bg-secondary) !important;
    border-bottom: 1px solid var(--theme-border-subtle) !important;
}

[data-theme="light"] #policies-page .table tbody tr:nth-child(even),
html[data-theme="light"] #policies-page .table tbody tr:nth-child(even) {
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] #policies-page .table tbody tr:hover,
html[data-theme="light"] #policies-page .table tbody tr:hover {
    background: var(--theme-table-row-hover) !important;
}

[data-theme="light"] #policies-page .table tbody td,
html[data-theme="light"] #policies-page .table tbody td {
    color: var(--theme-text-tertiary) !important;
    border-bottom: 1px solid var(--theme-border-subtle) !important;
}

/* Exclusion Row Text */
[data-theme="light"] .exclusion-name,
[data-theme="light"] .exclusion-path,
[data-theme="light"] .exclusion-date,
[data-theme="light"] .exclusion-user,
html[data-theme="light"] .exclusion-name,
html[data-theme="light"] .exclusion-path,
html[data-theme="light"] .exclusion-date,
html[data-theme="light"] .exclusion-user {
    color: var(--theme-text-tertiary) !important;
}

/* Path code elements in exclusions table */
[data-theme="light"] #policies-page .table .code,
[data-theme="light"] #policies-page .exclusions-portlet .code,
[data-theme="light"] #policies-page td .code,
[data-theme="light"] #policies-page p.code,
[data-theme="light"] .exclusions-body .code,
html[data-theme="light"] #policies-page .table .code,
html[data-theme="light"] #policies-page .exclusions-portlet .code,
html[data-theme="light"] #policies-page td .code,
html[data-theme="light"] #policies-page p.code,
html[data-theme="light"] .exclusions-body .code {
    background: var(--theme-border-solid) !important;
    background-color: var(--theme-border-solid) !important;
    color: var(--theme-text-tertiary) !important;
    border: 1px solid var(--theme-border-muted) !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
}

/* Badge Styling */
[data-theme="light"] .exclusion-badge,
[data-theme="light"] .badge-windows,
html[data-theme="light"] .exclusion-badge,
html[data-theme="light"] .badge-windows {
    background: var(--theme-accent-blue-bg) !important;
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .exclusion-scope-badge,
html[data-theme="light"] .exclusion-scope-badge {
    background: var(--theme-warning-bg) !important;
    color: var(--theme-warning-dark) !important;
}

/* Pagination Footer */
[data-theme="light"] #policies-page .pagination-footer,
[data-theme="light"] .exclusions-pagination,
html[data-theme="light"] #policies-page .pagination-footer,
html[data-theme="light"] .exclusions-pagination {
    background: var(--theme-bg-tertiary) !important;
    border-top: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .pagination-btn,
html[data-theme="light"] #policies-page .pagination-btn {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] #policies-page .pagination-btn:hover:not(:disabled),
html[data-theme="light"] #policies-page .pagination-btn:hover:not(:disabled) {
    background: var(--theme-table-row-hover) !important;
    border-color: var(--theme-accent-blue) !important;
    color: var(--theme-accent-blue) !important;
}

/* Row Actions */
[data-theme="light"] .exclusion-actions .dropdown-menu,
html[data-theme="light"] .exclusion-actions .dropdown-menu {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    box-shadow: var(--theme-shadow-md) !important;
}

[data-theme="light"] .exclusion-actions .dropdown-menu li a,
html[data-theme="light"] .exclusion-actions .dropdown-menu li a {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .exclusion-actions .dropdown-menu li a:hover,
html[data-theme="light"] .exclusion-actions .dropdown-menu li a:hover {
    background: var(--theme-table-row-hover) !important;
    color: var(--theme-accent-blue) !important;
}

/* =============================================================================
   LIGHT THEME - Additional Text Fixes
   ============================================================================= */

/* Engine items should have subtle background on page background */
[data-theme="light"] #policies-page .engine-item,
html[data-theme="light"] #policies-page .engine-item {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] #policies-page .engine-item:hover,
html[data-theme="light"] #policies-page .engine-item:hover {
    background: var(--theme-bg-secondary) !important;
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 2px 8px var(--theme-accent-blue-bg) !important;
}

/* Policy section should match page background (NOT white box) */
[data-theme="light"] #policies-page .policy-section,
html[data-theme="light"] #policies-page .policy-section {
    background: transparent !important;
    border: none !important;
}

/* Section header text */
[data-theme="light"] #policies-page .policy-section-title,
html[data-theme="light"] #policies-page .policy-section-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] #policies-page .policy-section-subtitle,
html[data-theme="light"] #policies-page .policy-section-subtitle {
    color: var(--theme-text-secondary) !important;
}

/* Section icon */
[data-theme="light"] #policies-page .policy-section-icon,
html[data-theme="light"] #policies-page .policy-section-icon {
    background: var(--theme-accent-blue-bg) !important;
    color: var(--theme-accent-blue) !important;
}

/* Endpoint Group label */
[data-theme="light"] .policy-selector-label,
html[data-theme="light"] .policy-selector-label {
    color: var(--theme-text-tertiary) !important;
}

/* Page bar for exclusions/settings */
[data-theme="light"] #policies-page .page-bar,
html[data-theme="light"] #policies-page .page-bar {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
}

/* Policy Badges */
[data-theme="light"] .policy-badge,
html[data-theme="light"] .policy-badge {
    border: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-badge.badge-type,
html[data-theme="light"] .policy-badge.badge-type {
    background: var(--theme-accent-blue-bg) !important;
    color: var(--theme-accent-blue) !important;
}

[data-theme="light"] .policy-badge.badge-applies-to,
html[data-theme="light"] .policy-badge.badge-applies-to {
    background: var(--theme-warning-bg) !important;
    color: var(--theme-warning-dark) !important;
}

/* Exclusions Body */
[data-theme="light"] .exclusions-body,
[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-body,
[data-theme="light"] #policies-page .portlet.exclusions-portlet .exclusions-body,
[data-theme="light"] #policies-page .portlet.exclusions-portlet #alerts,
html[data-theme="light"] .exclusions-body,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-body,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet .exclusions-body,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet #alerts {
    background: transparent !important;
    border: none !important;
}

/* Exclusions table rows in light theme */
[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr,
html[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr {
    background: var(--theme-bg-secondary) !important;
}

[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr:nth-child(even),
html[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr:nth-child(even) {
    background: var(--theme-bg-tertiary) !important;
}

[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr:hover,
html[data-theme="light"] #policies-page .exclusions-portlet .table tbody tr:hover {
    background: var(--theme-table-row-hover) !important;
}

[data-theme="light"] #policies-page .exclusions-portlet .table tbody td,
html[data-theme="light"] #policies-page .exclusions-portlet .table tbody td {
    color: var(--theme-text-tertiary) !important;
}

/* Exclusions Table Rows - using table in exclusions */
[data-theme="light"] .exclusions-body .table tbody tr td,
html[data-theme="light"] .exclusions-body .table tbody tr td {
    color: var(--theme-text-tertiary) !important;
    background: transparent !important;
}

/* Slide Panel for Add/Edit Exclusion */
[data-theme="light"] .policy-slide-panel,
html[data-theme="light"] .policy-slide-panel {
    background: var(--theme-bg-secondary) !important;
    border-left: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-panel-header,
html[data-theme="light"] .policy-panel-header {
    background: var(--theme-bg-tertiary) !important;
    border-bottom: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-panel-title,
html[data-theme="light"] .policy-panel-title {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-panel-body,
html[data-theme="light"] .policy-panel-body {
    background: var(--theme-bg-secondary) !important;
}

[data-theme="light"] .policy-panel-footer,
html[data-theme="light"] .policy-panel-footer {
    background: var(--theme-bg-tertiary) !important;
    border-top: 1px solid var(--theme-border-solid) !important;
}

[data-theme="light"] .policy-form-label,
html[data-theme="light"] .policy-form-label {
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-form-input,
[data-theme="light"] .policy-form-select,
[data-theme="light"] .policy-form-textarea,
html[data-theme="light"] .policy-form-input,
html[data-theme="light"] .policy-form-select,
html[data-theme="light"] .policy-form-textarea {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-form-input:focus,
[data-theme="light"] .policy-form-select:focus,
[data-theme="light"] .policy-form-textarea:focus,
html[data-theme="light"] .policy-form-input:focus,
html[data-theme="light"] .policy-form-select:focus,
html[data-theme="light"] .policy-form-textarea:focus {
    border-color: var(--theme-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-blue-bg) !important;
}

[data-theme="light"] .policy-selected-item,
html[data-theme="light"] .policy-selected-item {
    background: var(--theme-bg-primary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-btn-close,
html[data-theme="light"] .policy-btn-close {
    color: var(--theme-text-secondary) !important;
}

[data-theme="light"] .policy-btn-close:hover,
html[data-theme="light"] .policy-btn-close:hover {
    color: var(--theme-text-dark) !important;
}

[data-theme="light"] .policy-btn-secondary,
html[data-theme="light"] .policy-btn-secondary {
    background: var(--theme-bg-tertiary) !important;
    border: 1px solid var(--theme-border-solid) !important;
    color: var(--theme-text-tertiary) !important;
}

[data-theme="light"] .policy-btn-secondary:hover,
html[data-theme="light"] .policy-btn-secondary:hover {
    background: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-muted) !important;
}

/* Panel Overlay */
[data-theme="light"] .policy-panel-overlay.active,
html[data-theme="light"] .policy-panel-overlay.active {
    background: var(--theme-bg-overlay) !important;
}

/* Save Button (primary) */
[data-theme="light"] #policies-page .policy-container .btn-primary,
[data-theme="light"] #policies-page .policy-actions .btn-primary,
html[data-theme="light"] #policies-page .policy-container .btn-primary,
html[data-theme="light"] #policies-page .policy-actions .btn-primary {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
    box-shadow: 0 4px 12px var(--theme-accent-blue-glow) !important;
}

[data-theme="light"] #policies-page .policy-container .btn-primary:hover:not(:disabled),
[data-theme="light"] #policies-page .policy-actions .btn-primary:hover:not(:disabled),
html[data-theme="light"] #policies-page .policy-container .btn-primary:hover:not(:disabled),
html[data-theme="light"] #policies-page .policy-actions .btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, var(--theme-accent-blue-dark) 0%, var(--theme-accent-blue-darker) 100%) !important;
    box-shadow: 0 6px 16px var(--theme-accent-blue-glow) !important;
}

/* Add New Policy Button */
[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title .btn-primary,
html[data-theme="light"] #policies-page .portlet.exclusions-portlet .portlet-title .btn-primary {
    background: linear-gradient(145deg, var(--theme-accent-blue) 0%, var(--theme-accent-blue-dark) 100%) !important;
    border: 1px solid var(--theme-accent-blue) !important;
    color: var(--theme-text-inverse) !important;
}

/* =============================================================================
   POLICY TABLE ACTION DROPDOWN - Dark Theme
   ============================================================================= */

/* Action dropdown button in policy tables - match rovers button size */
#policies-page .table tbody td .dropdown .btn.dropdown-toggle,
#policies-page .table tbody td .dropdown>.btn {
    background: rgba(54, 127, 211, 0.15) !important;
    border: 1px solid rgba(54, 127, 211, 0.3) !important;
    color: #58a6ff !important;
    font-size: 13px !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    transition: all 0.15s ease !important;
    line-height: 1.4 !important;
}

#policies-page .table tbody td .dropdown .btn.dropdown-toggle:hover,
#policies-page .table tbody td .dropdown>.btn:hover {
    background: rgba(54, 127, 211, 0.25) !important;
    border-color: #58a6ff !important;
}

/* Action dropdown menu in policy tables */
#policies-page .table tbody td .dropdown .dropdown-menu {
    background: var(--theme-bg-secondary, #1e2228) !important;
    background-color: var(--theme-bg-secondary, #1e2228) !important;
    border: 1px solid rgba(88, 166, 255, 0.2) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    padding: 8px 0 !important;
    min-width: 160px !important;
    opacity: 1 !important;
    background-clip: padding-box !important;
}

#policies-page .table tbody td .dropdown .dropdown-menu li {
    background: transparent !important;
}

#policies-page .table tbody td .dropdown .dropdown-menu li a {
    display: block !important;
    color: #c9d1d9 !important;
    background: transparent !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    transition: all 0.15s !important;
}

#policies-page .table tbody td .dropdown .dropdown-menu li a:hover {
    background: rgba(88, 166, 255, 0.15) !important;
    color: #58a6ff !important;
}

#policies-page .table tbody td .dropdown .dropdown-menu li a i.fa {
    width: 20px;
    text-align: center;
    margin-right: 8px;
    color: #58a6ff;
    opacity: 0.8;
}

#policies-page .table tbody td .dropdown .dropdown-menu li a:hover i.fa {
    opacity: 1;
}

/* Divider styling */
#policies-page .table tbody td .dropdown .dropdown-menu li.divider,
#policies-page .table tbody td .dropdown .dropdown-menu li[role="separator"] {
    background: rgba(88, 166, 255, 0.15) !important;
    border: none !important;
    margin: 8px 12px !important;
    padding: 0 !important;
    height: 1px !important;
}

/* =============================================================================
   POLICY TABLE ACTION DROPDOWN - Light Theme
   ============================================================================= */

[data-theme="light"] #policies-page .table tbody td .dropdown .btn.dropdown-toggle,
[data-theme="light"] #policies-page .table tbody td .dropdown>.btn,
html[data-theme="light"] #policies-page .table tbody td .dropdown .btn.dropdown-toggle,
html[data-theme="light"] #policies-page .table tbody td .dropdown>.btn {
    background: var(--theme-accent-blue-bg, rgba(54, 127, 211, 0.1)) !important;
    border: 1px solid var(--theme-accent-blue, #367fd3) !important;
    color: var(--theme-accent-blue, #367fd3) !important;
}

[data-theme="light"] #policies-page .table tbody td .dropdown .btn.dropdown-toggle:hover,
[data-theme="light"] #policies-page .table tbody td .dropdown>.btn:hover,
html[data-theme="light"] #policies-page .table tbody td .dropdown .btn.dropdown-toggle:hover,
html[data-theme="light"] #policies-page .table tbody td .dropdown>.btn:hover {
    background: var(--theme-accent-blue-bg-subtle, rgba(54, 127, 211, 0.15)) !important;
    border-color: var(--theme-accent-blue-dark, #2563eb) !important;
}

[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu,
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu {
    background: var(--theme-bg-secondary, #ffffff) !important;
    background-color: var(--theme-bg-secondary, #ffffff) !important;
    border: 1px solid var(--theme-border-color, #d0d7de) !important;
    box-shadow: var(--theme-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12)) !important;
    opacity: 1 !important;
    background-clip: padding-box !important;
}

[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a,
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a {
    color: var(--theme-text-primary, #24292f) !important;
}

[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a:hover,
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a:hover {
    background: var(--theme-table-row-hover, #f6f8fa) !important;
    color: var(--theme-accent-blue, #367fd3) !important;
}

[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a i.fa,
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li a i.fa {
    color: var(--theme-accent-blue, #367fd3);
}

[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li.divider,
[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li[role="separator"],
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li.divider,
html[data-theme="light"] #policies-page .table tbody td .dropdown .dropdown-menu li[role="separator"] {
    background: var(--theme-border-color, #d0d7de) !important;
}

/* ==================================================================
   Wizard-specific layout (inside .policy-slide-panel)
   ================================================================== */
.wizard-shell {
    display: flex;
    height: 100%;
    min-height: 0;
}

.wizard-side {
    flex: 0 0 220px;
    background: rgba(255, 255, 255, .02);
    border-right: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

[data-theme="light"] .wizard-side {
    background: #f5f7fb;
    border-right-color: rgba(0, 0, 0, .08);
}

.wizard-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s;
    position: relative;
}

.wizard-step:hover {
    background: rgba(255, 255, 255, .03);
}

[data-theme="light"] .wizard-step:hover {
    background: rgba(0, 0, 0, .03);
}

.wizard-step.active {
    background: rgba(77, 171, 247, .08);
    border-left-color: #4dabf7;
}

[data-theme="light"] .wizard-step.active {
    background: rgba(77, 171, 247, .12);
}

.wizard-step .wz-num {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    color: #8892a6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
}

[data-theme="light"] .wizard-step .wz-num {
    background: #e8eef8;
    color: #566074;
    border-color: #d0d7e3;
}

.wizard-step.active .wz-num {
    background: #4dabf7;
    color: #0b1322;
    border-color: #4dabf7;
}

.wizard-step.complete .wz-num {
    background: rgba(46, 204, 113, .18);
    color: #2ecc71;
    border-color: rgba(46, 204, 113, .35);
}

.wizard-step.complete .wz-num::before {
    content: "\f00c";
    font-family: FontAwesome;
}

.wizard-step.complete .wz-num>.wz-digit {
    display: none;
}

.wizard-step .wz-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wizard-step .wz-title {
    font-size: 13px;
    font-weight: 600;
    color: #d4dce8;
}

[data-theme="light"] .wizard-step .wz-title {
    color: #1f2d3d;
}

.wizard-step .wz-sub {
    font-size: 11px;
    color: #6b7890;
    line-height: 1.3;
    margin-top: 2px;
}

.wizard-step.active .wz-title {
    color: #fff;
}

[data-theme="light"] .wizard-step.active .wz-title {
    color: #0b1322;
}

.wizard-step .wz-state {
    position: absolute;
    right: 10px;
    top: 14px;
    font-size: 10px;
    color: #6b7890;
}

.wizard-step.invalid .wz-num {
    background: rgba(231, 76, 60, .18);
    color: #e74c3c;
    border-color: rgba(231, 76, 60, .4);
}

.wizard-step.invalid .wz-num::before {
    content: "!";
    font-weight: 900;
}

.wizard-step.invalid .wz-num>.wz-digit {
    display: none;
}

.wizard-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wizard-pane {
    display: none;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
}

.wizard-pane.active,
[ng-show="wizardStep === 1"],
[ng-show="wizardStep === 2"],
[ng-show="wizardStep === 3"] {
    display: block !important;
}

.wizard-pane .policy-form-section {
    margin-bottom: 12px;
}

/* Step 1 OS multi-select */
.os-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.os-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    color: #d4dce8;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    transition: background .15s, border-color .15s;
}

[data-theme="light"] .os-toggle {
    background: #f5f7fb;
    border-color: #d0d7e3;
    color: #1f2d3d;
}

.os-toggle:hover {
    border-color: rgba(77, 171, 247, .5);
}

.os-toggle.active {
    background: rgba(77, 171, 247, .15);
    border-color: #4dabf7;
    color: #4dabf7;
}

.os-toggle i {
    font-size: 13px;
}

/* Step 3 targeting layout: two columns (picker | live summary) */
.wizard-targeting {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.wizard-targeting-picker {
    flex: 1 1 60%;
    min-width: 0;
}

.wizard-targeting-summary {
    flex: 1 1 40%;
    min-width: 280px;
    position: sticky;
    top: 0;
}

/* Live summary card */
.policy-summary-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 6px;
    padding: 14px 16px;
}

[data-theme="light"] .policy-summary-card {
    background: #f5f7fb;
    border-color: #d0d7e3;
}

.policy-summary-card .summary-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #d4dce8;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

[data-theme="light"] .policy-summary-card .summary-heading {
    color: #1f2d3d;
    border-bottom-color: #e0e5ee;
}

.policy-summary-card .summary-heading i {
    color: #4dabf7;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
    font-size: 12px;
}

.summary-row .summary-label {
    color: #8892a6;
    flex: 0 0 90px;
}

.summary-row .summary-value {
    color: #d4dce8;
    text-align: right;
    flex: 1 1 auto;
    word-break: break-word;
}

[data-theme="light"] .summary-row .summary-value {
    color: #1f2d3d;
}

.summary-value .mini-chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 2px 2px 0;
    background: rgba(77, 171, 247, .12);
    color: #4dabf7;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.summary-value .mini-chip.mini-chip--block {
    background: rgba(231, 76, 60, .15);
    color: #ff6b6b;
}

.summary-value .mini-chip.mini-chip--allow {
    background: rgba(46, 204, 113, .15);
    color: #2ecc71;
}

.summary-value .mini-chip.mini-chip--muted {
    background: rgba(255, 255, 255, .06);
    color: #8892a6;
}

.summary-empty {
    color: #6b7890;
    font-style: italic;
    font-size: 11px;
}

.summary-counts {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, .06);
}

[data-theme="light"] .summary-counts {
    border-top-color: #e0e5ee;
}

.summary-count {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: #8892a6;
}

.summary-count strong {
    color: #4dabf7;
    font-size: 16px;
    line-height: 1;
}

/* Footer progress indicator */
.wizard-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #8892a6;
}

.wizard-progress .wz-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.wizard-progress .wz-dot.active {
    background: #4dabf7;
}

.wizard-progress .wz-dot.complete {
    background: #2ecc71;
}

.wizard-progress .wz-label {
    margin-right: 6px;
}

/* Tighten the panel content when in wizard mode, and remove the
   built-in 2-column split (we use our own). */
.policy-slide-panel--network .policy-panel-content.wizard-mode {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.policy-slide-panel--network .policy-panel-content.wizard-mode .policy-panel-columns {
    display: none;
}

/* Make the panel a bit narrower than the existing slim 2-col layout --
   we gain horizontal breathing room from the vertical stepper. */
.policy-slide-panel.wizard-variant {
    max-width: 1150px;
    width: 92vw;
}

/* Filter toggle group on step 2 should wrap on narrow widths */
.policy-filter-toggles--wrap {
    flex-wrap: wrap;
}

/* Fix white edges/borders on filter buttons when focused in dark theme */
.policy-filter-btn:focus,
.policy-filter-btn:active:focus,
.policy-action-btn:focus,
.policy-action-btn:active:focus {
    outline: none !important;
    box-shadow: none !important;
}