/* ==========================================
   ADMIN PAGES - User Management Styles
   ========================================== */

.admin-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    font-family: 'Roboto', sans-serif;
}

.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem 0;
    font-size: 0.8125rem;
    color: var(--ps-text-muted);
}

.admin-breadcrumb span:last-child {
    color: var(--ps-text-primary);
}

/* Pill tabs — dead code kept in case any page re-enables .admin-tab markup */
.admin-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 1.5rem;
}

.admin-tab {
    padding: 0.5rem 0.875rem;
    border: 1px solid transparent;
    border-radius: var(--ps-r-sm);
    background: transparent;
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-secondary);
    cursor: pointer;
    font-weight: 400;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.admin-tab:hover {
    color: var(--ps-text-primary);
    background: var(--ps-bg-hover);
}

.admin-tab.active {
    color: var(--ps-accent-text);
    background: var(--ps-accent-subtle);
    font-weight: 500;
}

/* Content */
.admin-content {
    width: 100%;
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ps-text-primary);
    margin: 0 0 1.5rem 0;
}

/* Toolbar */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    flex-wrap: wrap;
}

/* Primary toolbar action — solid accent fill, unambiguous hierarchy vs .btn-toolbar */
.btn-add-user {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--ps-accent);
    border: 1px solid var(--ps-accent);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: 'Roboto', sans-serif;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-weight: 500;
}

.btn-add-user:hover  { background: var(--ps-accent-hover);   border-color: var(--ps-accent-hover); color: #fff; }
.btn-add-user:active { background: var(--ps-accent-pressed); border-color: var(--ps-accent-pressed); }

/* Secondary toolbar actions — transparent with bordered outline */
.btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid var(--ps-border-default);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-primary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    font-weight: 400;
}

.btn-toolbar:hover {
    background: var(--ps-bg-hover);
    border-color: var(--ps-accent);
    color: var(--ps-accent-text);
}

.btn-toolbar.active {
    background: var(--ps-accent-subtle);
    border-color: var(--ps-accent);
    color: var(--ps-accent-text);
}

/* Toolbar groups */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-top: 0.25rem;
}

.toolbar-group-label {
    position: absolute;
    top: -1rem;
    left: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ps-text-secondary);
    white-space: nowrap;
    pointer-events: none;
}

.toolbar-sep {
    width: 1px;
    height: 28px;
    background: var(--ps-border-subtle);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* Users Table */
.users-table-wrap {
    overflow: visible;
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--ps-bg);
}

.users-table thead {
    background: var(--ps-bg-subtle);
}

.users-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    color: var(--ps-text-secondary);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--ps-border-subtle);
    white-space: nowrap;
    user-select: none;
}

.users-table th .sort-icon {
    font-size: 0.75rem;
    opacity: 0.4;
    margin-left: 0.25rem;
    cursor: pointer;
    transition: opacity 0.15s;
}

.users-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ps-border-subtle);
    color: var(--ps-text-primary);
    vertical-align: middle;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover {
    background: var(--ps-bg-hover);
}

.users-table tr.row-blocked {
    opacity: 0.6;
}

.col-check {
    width: 40px;
    text-align: center;
}

.col-status {
    width: 40px;
    text-align: center;
}

.col-user {
    min-width: 200px;
}

.col-role {
    width: 120px;
}

.col-usage {
    width: 140px;
}

.col-count {
    width: 100px;
    text-align: right;
}

.col-date {
    width: 110px;
}

.col-note {
    width: 120px;
    min-width: 80px;
}

.col-actions {
    width: 48px;
    text-align: center;
}

.col-batch {
    width: 90px;
    text-align: center;
}

.batch-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.batch-on {
    background: var(--ps-success-bg);
    color: var(--ps-success);
}

.batch-off {
    background: var(--ps-bg-muted);
    color: var(--ps-text-muted);
}

/* Neutral count variant — plain number, no success/status coloring.
   Use for columns that display *quantity* (e.g. property packages)
   rather than an on/off state. */
.batch-count {
    background: transparent;
    color: var(--ps-text-primary);
    font-weight: 600;
}

/* Note column */
.note-display {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    min-height: 28px;
    transition: background 0.15s;
}

.note-display:hover {
    background: var(--ps-bg-hover);
}

.note-text {
    font-size: 0.8125rem;
    color: var(--ps-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.note-placeholder {
    color: var(--ps-text-muted);
    font-size: 0.8125rem;
}

.note-edit-icon {
    flex-shrink: 0;
    color: var(--ps-text-muted);
    opacity: 0;
    transition: opacity 0.15s;
}

.note-display:hover .note-edit-icon {
    opacity: 1;
}

.note-edit-wrap {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.note-input {
    width: 100%;
    min-width: 80px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--ps-accent);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-family: var(--prism-font, 'Roboto', sans-serif);
    color: var(--ps-text-primary);
    outline: none;
    background: var(--ps-bg);
}

.note-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.note-btn-save {
    background: var(--ps-accent);
    color: #fff;
}

.note-btn-save:hover {
    background: var(--ps-accent-hover);
}

.note-btn-cancel {
    background: var(--ps-bg-muted);
    color: var(--ps-text-muted);
}

.note-btn-cancel:hover {
    background: var(--ps-border-subtle);
    color: var(--ps-text-primary);
}

.user-name {
    font-weight: 500;
    color: var(--ps-text-primary);
    line-height: 1.3;
}

.user-email {
    font-size: 0.75rem;
    color: var(--ps-text-muted);
    margin-top: 2px;
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-superadmin {
    background: var(--ps-accent-subtle);
    color: var(--ps-accent-hover);
}

.role-admin {
    background: var(--ps-success-bg);
    color: var(--ps-success);
}

.role-user {
    background: var(--ps-bg-muted);
    color: var(--ps-text-secondary);
}

/* Usage bar */
/* Track uses bg-active for visible contrast on both themes
   (borders skipped to keep the 6px height stable). */
.usage-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--ps-bg-active);
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar {
    height: 100%;
    background: var(--ps-accent);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.15s;
    min-width: 2px;
}

/* Over-quota states — keyed by inline style on the bar or helper classes */
.usage-bar.over-warn { background: var(--ps-warning); }
.usage-bar.over-error { background: var(--ps-error); }

/* Status indicators */
.status-active, .status-blocked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Actions dropdown */
.actions-dropdown-wrap {
    display: inline-flex;
}

.btn-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    color: var(--ps-text-muted);
    transition: all 0.15s;
}

.btn-actions:hover {
    background: var(--ps-bg-hover);
    color: var(--ps-text-primary);
}

.actions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

.actions-dropdown {
    position: fixed;
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 220px;
    z-index: 1000;
    padding: 0.375rem 0;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.actions-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    width: 100%;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-primary);
    cursor: pointer;
    white-space: nowrap;
    text-align: left;
}

.actions-item:hover {
    background: var(--ps-bg-hover);
    color: var(--ps-accent);
}

.actions-item:hover svg {
    stroke: var(--ps-accent);
}

.actions-item svg {
    flex-shrink: 0;
    color: var(--ps-text-muted);
}

.actions-item-danger:hover {
    color: var(--ps-error);
}

.actions-item-danger:hover svg {
    stroke: var(--ps-error);
}

.actions-divider {
    height: 1px;
    background: var(--ps-border-subtle);
    margin: 0.25rem 0;
}

.actions-section-label {
    padding: 0.375rem 1rem 0.125rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ps-text-muted);
    font-weight: 500;
    text-align: left;
}

/* Bulk actions bar */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--ps-text-primary);
    color: #fff;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.btn-bulk {
    padding: 0.375rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: none;
    color: #fff;
    font-size: 0.8125rem;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-bulk:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

.btn-bulk-limit {
    background: var(--ps-accent);
    border-color: var(--ps-accent);
}

.btn-bulk-limit:hover {
    background: var(--ps-accent-hover);
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--ps-text-muted);
}

.spinner-border {
    width: 32px;
    height: 32px;
    border: 3px solid var(--ps-border-subtle);
    border-top-color: var(--ps-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-bottom: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   MODAL STYLES
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(36, 43, 58, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--ps-bg);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-content.modal-sm {
    max-width: 420px;
}

.modal-content h3 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--ps-text-primary);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.modal-text {
    text-align: center;
    color: var(--ps-text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0 0 1.25rem 0;
}

.modal-link {
    display: block;
    text-align: center;
    color: var(--ps-accent);
    font-size: 0.875rem;
    text-decoration: none;
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.modal-link:hover {
    text-decoration: underline;
}

.modal-form {
    margin-bottom: 1.5rem;
}

.modal-form .form-group {
    margin-bottom: 1rem;
}

.modal-form .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ps-text-primary);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--ps-border-default);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-primary);
    background: var(--ps-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.form-input::placeholder {
    color: var(--ps-text-muted);
}

.form-input:focus {
    border-color: var(--ps-accent);
    box-shadow: 0 0 0 3px rgba(62, 56, 240, 0.08);
}

.input-with-prefix {
    display: flex;
    align-items: center;
    border: 1px solid var(--ps-border-default);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-with-prefix:focus-within {
    border-color: var(--ps-accent);
    box-shadow: 0 0 0 3px rgba(62, 56, 240, 0.08);
}

.input-prefix {
    padding: 0.625rem 0 0.625rem 0.875rem;
    color: var(--ps-text-muted);
    font-size: 0.9375rem;
}

.form-input.with-prefix {
    border: none;
    box-shadow: none;
    padding-left: 0.25rem;
}

.form-input.with-prefix:focus {
    border: none;
    box-shadow: none;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--ps-text-muted);
    margin-top: 0.375rem;
    line-height: 1.4;
}

/* Limit control */
.limit-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    overflow: hidden;
    background: var(--ps-bg);
}

.limit-control-lg {
    transform: scale(1.1);
    margin: 0 0.5rem;
}

.limit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 1.125rem;
    color: var(--ps-accent);
    cursor: pointer;
    transition: background 0.15s;
}

.limit-btn:hover {
    background: var(--ps-accent-subtle);
}

.limit-input {
    width: 48px;
    text-align: center;
    border: none;
    background: none;
    font-size: 0.9375rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-primary);
    font-weight: 500;
    outline: none;
    -moz-appearance: textfield;
}

.limit-input::-webkit-outer-spin-button,
.limit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.limit-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.limit-inline label {
    margin-bottom: 0 !important;
}

.limit-suffix {
    font-size: 0.875rem;
    color: var(--ps-text-primary);
}

.limit-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
    font-size: 0.9375rem;
    color: var(--ps-text-primary);
}

/* Modal actions */
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 0.5rem;
}

.modal-error {
    padding: 0.75rem 1rem;
    background: var(--ps-warning-bg);
    border: 1px solid var(--ps-warning);
    border-radius: 8px;
    color: var(--ps-warning);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    text-align: center;
}

.btn-cancel {
    padding: 0.625rem 1.5rem;
    border: none;
    background: none;
    font-size: 0.9375rem;
    font-family: 'Roboto', sans-serif;
    color: var(--ps-text-secondary);
    cursor: pointer;
    transition: color 0.15s;
    font-weight: 500;
}

.btn-cancel:hover {
    color: var(--ps-text-primary);
}

.btn-primary {
    padding: 0.625rem 1.5rem;
    border: none;
    background: var(--ps-accent);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--ps-accent-hover);
    box-shadow: 0 4px 12px rgba(62, 56, 240, 0.25);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-danger {
    padding: 0.625rem 1.5rem;
    border: none;
    background: var(--ps-error);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-danger:hover {
    background: var(--ps-error);
    box-shadow: 0 4px 12px rgba(233, 28, 64, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        flex-wrap: wrap;
    }

    .toolbar-group-label {
        position: static;
        display: block;
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .toolbar-sep {
        width: 100%;
        height: 1px;
    }

    .users-table {
        font-size: 0.8125rem;
    }

    .col-usage, .col-role, .col-note, .col-batch {
        display: none;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .bulk-actions-bar {
        flex-wrap: wrap;
    }
}

/* ==========================================
   TABLE LAYOUT with FILTER PANEL
   ========================================== */

.admin-table-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.admin-table-layout .users-table-wrap {
    flex: 1;
    min-width: 0;
}

/* ==========================================
   FILTER SIDE PANEL
   ========================================== */

.filter-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--ps-text-primary);
}

.filter-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--ps-text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.filter-close:hover {
    color: var(--ps-text-primary);
}

.filter-search {
    margin-bottom: 1rem;
}

.filter-search .form-input {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

.filter-section {
    margin-bottom: 1.25rem;
}

.filter-section-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ps-text-secondary);
    margin-bottom: 0.625rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--ps-text-primary);
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--ps-accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.filter-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-date {
    flex: 1;
    font-size: 0.75rem !important;
    padding: 0.375rem 0.5rem !important;
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-range .limit-control {
    flex: 1;
    justify-content: space-between;
}

.filter-range .limit-input {
    width: 36px;
    font-size: 0.8125rem;
    flex: 1;
}

.filter-range .limit-btn {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.filter-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.filter-actions .btn-primary {
    font-size: 0.8125rem;
    padding: 0.5rem 1.25rem;
}

.filter-actions .btn-cancel {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

/* ==========================================
   PENDING STATUS & SORT
   ========================================== */

.status-pending {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-pending-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: var(--ps-warning-bg);
    color: var(--ps-warning);
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
}

.sort-icon {
    font-size: 0.75rem;
    opacity: 0.4;
    margin-left: 0.25rem;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sort-icon.sort-active {
    opacity: 1;
    color: var(--ps-accent);
}

.users-table th {
    cursor: pointer;
}

.users-table th:hover .sort-icon {
    opacity: 0.7;
}

/* Limit pool info bar */
.limit-pool-info {
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.limit-pool-bar {
    width: 100%;
    height: 8px;
    background: var(--ps-border-subtle);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.limit-pool-used {
    height: 100%;
    background: var(--ps-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.limit-pool-text {
    font-size: 13px;
    color: var(--ps-text-secondary);
}

.limit-pool-text strong {
    color: var(--ps-text-primary);
}

.limit-available-hint {
    font-size: 12px;
    color: var(--ps-text-secondary);
    margin-top: 4px;
}

/* Users count column */
.col-users-count {
    text-align: center;
    width: 90px;
}

/* Neutral count — plain number, no pill. Zero rendered muted. */
.users-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    color: var(--ps-text-primary);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.users-count-badge-zero {
    color: var(--ps-text-muted);
    font-weight: 500;
}

.users-count-na {
    color: var(--ps-text-muted);
}

/* Count used/limit */
.count-used {
    font-weight: 600;
    color: var(--ps-text-primary);
}

.count-separator {
    color: var(--ps-text-secondary);
    margin: 0 2px;
}

.count-limit {
    color: var(--ps-text-secondary);
}

/* Stats modal */
.modal-stats {
    max-width: 800px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-header h3 {
    margin: 0;
}

/* Summary cards grid */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stats-card {
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
}

.stats-card-label {
    font-size: 12px;
    color: var(--ps-text-secondary);
    margin-bottom: 4px;
}

.stats-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--ps-text-primary);
}

/* Period stats grid */
.stats-period-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stats-period-card {
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
}

.stats-period-label {
    font-size: 13px;
    color: var(--ps-text-secondary);
    margin-bottom: 6px;
}

.stats-period-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--ps-text-primary);
    margin-bottom: 8px;
}

.stats-period-limit {
    font-size: 14px;
    font-weight: 400;
    color: var(--ps-text-secondary);
}

.stats-period-bar {
    width: 100%;
    height: 6px;
    background: var(--ps-border-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.stats-period-fill {
    height: 100%;
    background: var(--ps-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Chart */
.stats-chart-section {
    margin-bottom: 24px;
}

.stats-chart-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--ps-text-primary);
}

.stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    padding: 0 4px;
    border-bottom: 1px solid var(--ps-border-subtle);
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    min-width: 0;
}

.chart-bar {
    width: 100%;
    min-height: 2px;
    background: var(--ps-accent);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

.chart-label {
    font-size: 9px;
    color: var(--ps-text-secondary);
    margin-top: 4px;
    line-height: 1;
}

/* Breakdown table */
.stats-breakdown-section {
    margin-bottom: 16px;
}

.stats-breakdown-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--ps-text-primary);
}

.stats-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-breakdown-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--ps-bg-subtle);
    border-bottom: 1px solid var(--ps-border-subtle);
    font-weight: 600;
    color: var(--ps-text-secondary);
    font-size: 12px;
}

.stats-breakdown-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--ps-border-subtle);
}

.stats-breakdown-table .row-admin {
    background: var(--ps-accent-subtle);
}

.badge-admin-self {
    display: inline-block;
    font-size: 10px;
    background: var(--ps-accent);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ==========================================
   HIERARCHICAL USER ROWS
   ========================================== */

.row-admin-parent {
    background: var(--ps-bg-subtle);
}

.row-admin-parent:hover {
    background: var(--ps-bg-muted) !important;
}

.row-child-user {
    background: var(--ps-bg);
}

.row-child-user .col-user {
    padding-left: 0.5rem;
}

.child-user-indent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.child-user-connector {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-left: 2px solid var(--ps-border-subtle);
    border-bottom: 2px solid var(--ps-border-subtle);
    border-radius: 0 0 0 4px;
    flex-shrink: 0;
    margin-left: 4px;
}

/* Expand/collapse button */
.btn-expand-users {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-expand-users:hover {
    background: var(--ps-accent-subtle);
}

.expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: var(--ps-border-subtle);
    color: var(--ps-text-secondary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.2s, background 0.15s;
}

.expand-icon.expanded {
    background: var(--ps-accent);
    color: #fff;
    transform: rotate(45deg);
}

/* Delete warning */
.delete-warning {
    color: var(--ps-error);
    font-weight: 500;
}

/* Export dropdown */
.export-dropdown-wrap {
    position: relative;
    display: inline-flex;
}

.export-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--ps-bg);
    border: 1px solid var(--ps-border-subtle);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    padding: 0.375rem 0;
}

/* ===========================================
   Dark Theme Overrides for Admin
   =========================================== */
[data-theme="dark"] .admin-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .admin-modal {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .status-active { color: var(--ps-success); }
[data-theme="dark"] .status-inactive { color: var(--ps-text-secondary); }

[data-theme="dark"] .role-superadmin {
    background: var(--ps-success-bg);
    color: var(--ps-success);
}

[data-theme="dark"] .btn-primary-modal {
    color: #fff;
}

[data-theme="dark"] .btn-danger {
    color: #fff;
}

[data-theme="dark"] .btn-danger-confirm {
    color: #fff;
}

[data-theme="dark"] .export-dropdown {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
