/* administration.css — Premium Enterprise UI/UX Styles for Administration Module */

/* ============================================================
   BREADCRUMBS & BREADCRUMB NAVIGATION
   ============================================================ */
.breadcrumb-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.breadcrumb-item {
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-fast);
}

.breadcrumb-item:hover {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
    pointer-events: none;
}

.breadcrumb-separator {
    color: var(--text-disabled);
    font-size: 10px;
    user-select: none;
}

/* ============================================================
   PAGE HEADER & META SUMMARY
   ============================================================ */
.enterprise-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.page-header-info {
    flex: 1;
    min-width: 280px;
}

.page-header-info h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: var(--line-height-tight);
}

.page-header-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Header Stat badging */
.header-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background-color: var(--bg-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-size: var(--font-size-xxs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    margin-left: var(--space-2);
    vertical-align: middle;
}

.header-meta-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--color-success);
}

/* ============================================================
   KPI STATISTICS CARDS
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.kpi-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 110px;
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
    transition: transform var(--duration-base) var(--easing-spring), 
                box-shadow var(--duration-base) var(--easing-out),
                border-color var(--duration-base) var(--easing-out);
}

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

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
}

/* Hover Accent Colors per card class */
.kpi-card.indigo:hover { border-color: rgba(99, 102, 241, 0.4); }
.kpi-card.green:hover { border-color: rgba(16, 185, 129, 0.4); }
.kpi-card.orange:hover { border-color: rgba(249, 115, 22, 0.4); }
.kpi-card.purple:hover { border-color: rgba(139, 92, 246, 0.4); }
.kpi-card.gray:hover { border-color: var(--border-strong); }

.kpi-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.kpi-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* KPI icon background gradients */
.kpi-icon-wrap.indigo { background: rgba(99, 102, 241, 0.08); color: var(--color-primary); }
.kpi-icon-wrap.green { background: rgba(16, 185, 129, 0.08); color: var(--color-success); }
.kpi-icon-wrap.orange { background: rgba(249, 115, 22, 0.08); color: var(--color-warning); }
.kpi-icon-wrap.purple { background: rgba(139, 92, 246, 0.08); color: var(--color-purple); }
.kpi-icon-wrap.gray { background: var(--bg-sunken); color: var(--text-secondary); }

.kpi-trend {
    font-size: var(--font-size-xxs);
    font-weight: var(--font-weight-semibold);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

.kpi-trend.up { background: var(--color-success-bg); color: var(--color-success-text); }
.kpi-trend.neutral { background: var(--bg-sunken); color: var(--text-secondary); }
.kpi-trend.down { background: var(--color-danger-bg); color: var(--color-danger-text); }

.kpi-label {
    font-size: var(--font-size-xxs);
    font-weight: var(--font-weight-bold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: auto;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: var(--line-height-tight);
    letter-spacing: -0.01em;
    margin-top: 2px;
}

.kpi-desc {
    font-size: var(--font-size-xxs);
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* KPI skeleton state */
.kpi-skeleton {
    height: 110px;
    background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--border-subtle) 50%, var(--bg-sunken) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

/* ============================================================
   SEARCH & FILTER BAR TOOLBAR
   ============================================================ */
.filter-toolbar-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: box-shadow var(--duration-base);
}

.filter-toolbar-panel:focus-within {
    box-shadow: var(--shadow-sm);
}

.filter-primary-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    width: 100%;
}

.filter-secondary-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    width: 100%;
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-subtle);
    animation: slideDown 0.2s ease-out;
}

.filter-secondary-row.hidden {
    display: none !important;
}

.search-field-wrapper {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.search-field-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-field-input {
    width: 100%;
    height: 36px;
    padding-left: 36px;
    padding-right: 32px;
    font-size: var(--font-size-sm);
    background-color: var(--bg-page);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color var(--duration-fast), background-color var(--duration-fast);
}

.search-field-input:focus {
    border-color: var(--color-primary);
    background-color: var(--bg-surface);
    outline: none;
}

.search-field-kbd {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-tertiary);
    background: var(--bg-sunken);
    border: 1px solid var(--border-strong);
    padding: 2px 4px;
    border-radius: 4px;
    pointer-events: none;
}

.filter-select {
    height: 36px;
    padding: 0 var(--space-3);
    font-size: var(--font-size-sm);
    background-color: var(--bg-page);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    min-width: 140px;
    cursor: pointer;
    transition: border-color var(--duration-fast);
}

.filter-select:focus {
    border-color: var(--color-primary);
    outline: none;
}

.filter-date-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.filter-date-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.filter-date-sep {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.filter-date-input {
    height: 32px;
    padding: 0 var(--space-2);
    font-size: var(--font-size-xs);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background-color: var(--bg-page);
    color: var(--text-primary);
    width: 130px;
    cursor: pointer;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================
   BULK ACTIONS FLOATING/STICKY PANEL
   ============================================================ */
.table-bulk-bar {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    animation: slideDown 0.2s ease-out;
}

.bulk-count {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    white-space: nowrap;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ============================================================
   ADMIN USERS & ROLES TABLES (STICKY AND RESIZABLE)
   ============================================================ */
.table-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    position: relative;
    width: 100%;
}

.table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    position: relative;
    scroll-behavior: smooth;
}

/* Override and reset conflicting table-wrapper styles from operations.css */
.table-container .table-wrapper {
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
}

/* Modern thin scrollbar matching design system — permanently visible to avoid missing scroll indicators */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: var(--radius-full);
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-tertiary);
}

/* Firefox compatibility */
.table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) var(--bg-sunken);
}

/* ============================================================
   ENTERPRISE DATA GRID - FIXED WIDTHS & STICKY COLUMNS
   ============================================================ */

/* ============================================================
   ENTERPRISE DATA GRID - FIXED WIDTHS & STICKY COLUMNS
   ============================================================ */

/* Enforce table fluid dimensions */
#admin-users-table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
}

/* Column Sizing Overrides — using !important to prevent layout compression */
#admin-users-table .col-chk {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    text-align: center;
}

#admin-users-table .col-avatar {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    text-align: center;
}

#admin-users-table .col-username {
    width: 180px !important;
    min-width: 180px !important;
}

#admin-users-table .col-email {
    width: 320px !important;
    min-width: 320px !important;
}

#admin-users-table .col-role {
    width: 180px !important;
    min-width: 180px !important;
}

#admin-users-table .col-status {
    width: 140px !important;
    min-width: 140px !important;
}

#admin-users-table .col-mfa {
    width: 120px !important;
    min-width: 120px !important;
    text-align: center;
}

#admin-users-table .col-last-login {
    width: 180px !important;
    min-width: 180px !important;
}

#admin-users-table .col-created {
    width: 180px !important;
    min-width: 180px !important;
}

#admin-users-table .col-actions {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    text-align: center;
}

/* Ensure no text wrapping on columns */
#admin-users-table th,
#admin-users-table td {
    white-space: nowrap;
}

/* Text Truncation with Ellipsis when space is tight */
#admin-users-table td.col-username {
    overflow: hidden;
    text-overflow: ellipsis;
}

#admin-users-table td.col-email {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Base Sticky Actions Column definitions */
#admin-users-table th.col-actions,
#admin-users-table td.col-actions {
    position: sticky;
    right: 0;
    z-index: 5;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color) !important;
}

/* Sticky Column Headers stacking context */
#admin-users-table th.col-actions {
    z-index: 12;
    background-color: var(--bg-sunken);
}

/* Hover and Selected row background persistence on sticky cells */
#admin-users-table .clickable-row:hover td.col-actions {
    background-color: var(--bg-sunken) !important;
}

#admin-users-table tr.selected td.col-actions {
    background-color: var(--color-primary-light) !important;
}

#admin-users-table tr.selected:hover td.col-actions {
    background-color: var(--brand-100) !important;
}

:root.dark-mode #admin-users-table tr.selected td.col-actions {
    background-color: rgba(99, 102, 241, 0.12) !important;
}

:root.dark-mode #admin-users-table tr.selected:hover td.col-actions {
    background-color: rgba(99, 102, 241, 0.2) !important;
}


.responsive-table {
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
}

.responsive-table th {
    background-color: var(--bg-sunken);
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.responsive-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
    background-color: var(--bg-surface);
    transition: background-color var(--duration-fast);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background-color: var(--bg-sunken) !important;
}

/* Column sizes — base definitions in tables.css, admin-specific overrides here */
.col-chk { min-width: 50px; width: 50px; text-align: center; }
.col-mfa { min-width: 90px; width: 90px; text-align: center; }

/* Utility classes for admin table inline style replacements */
.admin-select-all-chk {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.admin-row-chk {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.admin-pagesize-select {
    padding: 2px 8px;
    width: 70px;
}

.mfa-badge-on {
    font-size: 10px;
}

.mfa-badge-off {
    font-size: 10px;
    background-color: var(--bg-sunken);
    color: var(--text-tertiary);
}

.badge-role-item {
    margin-right: 2px;
}

.btn-margin-top {
    margin-top: var(--space-4);
}

.sort-indicator-active {
    color: var(--color-primary);
    font-weight: bold;
}

.badge-font-size-11 {
    font-size: 11px;
}

.badge-font-size-10 {
    font-size: 10px;
}

.admin-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) var(--space-6);
    text-align: center;
    color: var(--text-secondary);
}

.admin-error-icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
    opacity: 0.7;
}

.admin-error-title {
    font-size: var(--font-size-md);
    color: var(--color-danger);
    margin-bottom: var(--space-2);
}

.admin-error-desc {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: var(--space-4);
}

.btn-icon-mr {
    margin-right: var(--space-1);
}


.admin-pagesize-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Sticky Actions Column */
.responsive-table th.col-actions,
.responsive-table td.col-actions {
    position: sticky;
    right: 0;
    z-index: 5;
}

.responsive-table th.col-actions {
    background-color: var(--bg-sunken);
    z-index: 12;
}

.responsive-table td.col-actions {
    background-color: var(--bg-surface);
}

/* Left boundary border for sticky actions column */
.responsive-table th.col-actions::before,
.responsive-table td.col-actions::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--border-subtle);
}

.clickable-row:hover td.col-actions {
    background-color: var(--bg-sunken);
}

/* Table Empty/Skeleton Loading States */
.empty-state {
    padding: var(--space-10) var(--space-6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-icon {
    font-size: 28px;
    margin-bottom: var(--space-3);
    opacity: 0.8;
}

.empty-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.empty-desc {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    max-width: 320px;
    line-height: 1.4;
}

.skeleton-row td {
    padding: var(--space-4);
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--border-subtle) 50%, var(--bg-sunken) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--radius-xs);
    width: 100%;
}

.skeleton-line.avatar { width: 32px; height: 32px; border-radius: var(--radius-full); }
.skeleton-line.name { width: 140px; }
.skeleton-line.email { width: 180px; }
.skeleton-line.role { width: 90px; }
.skeleton-line.status { width: 70px; }

/* Table pagination footer */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background-color: var(--bg-sunken);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.table-pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* ============================================================
   AVATARS & BADGES (ENTERPRISE GRADE STYLE)
   ============================================================ */
.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: var(--text-inverse);
    text-transform: uppercase;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
    border: 2px solid var(--bg-surface);
}

/* Standard badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.status-badge.green, .status-badge.success { background-color: var(--color-success-bg); color: var(--color-success-text); border: 1px solid rgba(16, 185, 129, 0.15); }
.status-badge.red, .status-badge.suspended { background-color: var(--color-danger-bg); color: var(--color-danger-text); border: 1px solid rgba(239, 68, 68, 0.15); }
.status-badge.gray, .status-badge.inactive { background-color: var(--bg-sunken); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.status-badge.orange, .status-badge.locked { background-color: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid rgba(245, 158, 11, 0.15); }

/* Role specific badges */
.badge-role {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
    display: inline-block;
}

.badge-role.super_admin {
    background-color: rgba(139, 92, 246, 0.08);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.18);
}

.badge-role.admin {
    background-color: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.18);
}

.badge-role.manager {
    background-color: rgba(16, 185, 129, 0.08);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.badge-role.support {
    background-color: rgba(14, 165, 233, 0.08);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.18);
}

.badge-role.finance {
    background-color: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.18);
}

/* ============================================================
   COLUMN VISIBILITY CONTROLS (DROPDOWNS)
   ============================================================ */
.column-visibility-dropdown {
    position: relative;
    display: inline-block;
}

.column-toggle-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    min-width: 210px;
    box-shadow: var(--shadow-lg);
    margin-top: var(--space-1);
    animation: slideDown 0.15s ease-out;
}

.column-toggle-menu.open {
    display: block;
}

.column-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-2);
}

.col-toggle-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}

.col-toggle-select-all-label input {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.col-toggle-reset-btn {
    font-size: var(--font-size-xs);
    color: var(--color-primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-fast);
}

.col-toggle-reset-btn:hover {
    color: var(--color-primary-hover);
}

.column-toggle-body {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    gap: 2px;
}

.column-toggle-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.column-toggle-item:hover {
    background-color: var(--bg-sunken);
    color: var(--text-primary);
}

.column-toggle-item input {
    cursor: pointer;
    width: 15px;
    height: 15px;
}

/* ============================================================
   MODALS WITH TABS (ADD/EDIT ADMINS)
   ============================================================ */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-4);
    gap: var(--space-2);
}

.modal-tab-btn {
    background: none;
    border: none;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--duration-fast), border-color var(--duration-fast);
}

.modal-tab-btn:hover {
    color: var(--text-primary);
}

.modal-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.modal-tab-content {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.modal-tab-content.active {
    display: block;
}

.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 640px) {
    .modal-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Password strength elements */
.pwd-strength-container {
    margin-top: 6px;
}

.pwd-strength-meter {
    height: 4px;
    background-color: var(--border-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 4px;
}

.pwd-strength-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.pwd-strength-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
}

/* ============================================================
   ENTERPRISE PERMISSION MATRIX GRID
   ============================================================ */
.permissions-matrix-container {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    margin-top: var(--space-3);
    overflow: hidden;
}

.permission-group-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: box-shadow var(--duration-fast);
}

.permission-group-card:hover {
    box-shadow: var(--shadow-sm);
}

.permission-group-header {
    padding: var(--space-3) var(--space-4);
    background-color: var(--bg-sunken);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    user-select: none;
}

.permission-group-header h4 {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.permission-group-body {
    padding: var(--space-4);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
    background-color: var(--bg-surface);
}

.permission-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--font-size-sm);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background-color var(--duration-fast);
}

.permission-checkbox-wrap:hover {
    background-color: var(--bg-sunken);
}

.permission-checkbox-wrap input {
    margin-top: 3px;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.permission-checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.permission-name-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.permission-desc {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    line-height: 1.35;
}

/* Live Computed Permission Badge */
.effective-perm-badge {
    display: inline-block;
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid rgba(99, 102, 241, 0.15);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 3px;
}

/* Drag and drop columns */
.drag-drop-column {
    background-color: var(--bg-sunken);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
}

.drag-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    transition: transform var(--duration-fast), box-shadow var(--duration-fast);
    user-select: none;
}

.drag-item:hover {
    box-shadow: var(--shadow-xs);
    transform: translateY(-1px);
}

.drag-item:active {
    cursor: grabbing;
}

.drag-item-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.drag-item-actions button:hover {
    background-color: var(--bg-sunken);
    color: var(--text-primary);
}

/* ============================================================
   ANIMATIONS & KEYFRAMES
   ============================================================ */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dropdown alignment corrections */
.dropdown-menu {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    background-color: var(--bg-elevated);
}

.dropdown-item {
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-3);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .enterprise-page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header-actions {
        margin-top: var(--space-2);
    }
    .filter-actions {
        width: 100%;
        margin-top: var(--space-2);
    }
    .filter-primary-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-select {
        width: 100%;
    }
    .search-field-wrapper {
        min-width: 100%;
    }
}

/* Fixed-position Row Actions Dropdown — uses fixed to avoid scroll container clipping */
.row-actions-dropdown {
    position: fixed;
    display: none;
    flex-direction: column;
    min-width: 190px;
    z-index: 1050; /* Above sticky headers/actions columns but below modals */
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-1) 0;
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 150ms var(--easing-out);
}

.row-actions-dropdown.open {
    display: flex;
    opacity: 1;
}

.row-actions-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color var(--duration-fast);
}

.row-actions-dropdown .dropdown-item:hover {
    background-color: var(--bg-sunken);
}

.row-actions-dropdown .dropdown-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: transparent !important;
    color: var(--text-disabled);
}

.row-actions-dropdown .dropdown-item:disabled svg {
    color: var(--text-disabled) !important;
}

.row-actions-dropdown .dropdown-item.danger {
    color: var(--color-danger);
}

.row-actions-dropdown .dropdown-item.danger:hover {
    background-color: rgba(239, 68, 68, 0.08);
}

.row-actions-dropdown .dropdown-item svg {
    color: var(--text-secondary);
    transition: color var(--duration-fast);
    flex-shrink: 0;
}

.row-actions-dropdown .dropdown-item:hover svg {
    color: var(--text-primary);
}

.row-actions-dropdown .dropdown-item.danger svg {
    color: var(--color-danger);
}

.row-actions-dropdown .dropdown-divider {
    height: 1px;
    background-color: var(--border-subtle);
    margin: var(--space-1) 0;
}

