/* =========================================
   ADMIN USERS PAGE
   Extends the shared Admin Products theme.
========================================= */

.users-summary-grid .summary-card {
    align-items: flex-start;
}

.users-summary-grid .summary-card > div {
    flex: 1;
}

.users-summary-grid .summary-card small {
    margin-top: 6px;
    overflow: hidden;
    color: #8a99ad;
    font-size: 10px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-insight-panel,
.users-panel {
    overflow: hidden;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    box-shadow: var(--admin-shadow);
}

.user-insight-panel {
    margin-bottom: 22px;
}

.user-insight-heading,
.users-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 26px 21px;
}

.user-insight-heading h2,
.users-panel-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
}

.users-panel-heading > div > p:last-child {
    max-width: 720px;
    margin: 7px 0 0;
    color: var(--admin-muted);
    font-size: 13px;
    line-height: 1.55;
}

.overview-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.overview-heading-actions > span {
    color: #8492a6;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.compact-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 11px;
}

.icon-only-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
}

.security-mode-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 11px;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

/* =========================================
   ACCOUNT HEALTH
========================================= */

.user-insight-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--admin-border);
    border-top: 1px solid var(--admin-border);
    border-bottom: 1px solid var(--admin-border);
}

.user-insight-grid article {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: #ffffff;
}

.insight-icon {
    display: grid;
    flex: 0 0 39px;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 11px;
    font-size: 14px;
}

.insight-icon.suspended {
    color: #a16207;
    background: #fef3c7;
}

.insight-icon.blocked {
    color: #b91c1c;
    background: #fee2e2;
}

.insight-icon.verified {
    color: #047857;
    background: #d1fae5;
}

.insight-icon.new-users {
    color: #1d4ed8;
    background: #dbeafe;
}

.user-insight-grid article > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.user-insight-grid small {
    color: #7c8a9e;
    font-size: 10px;
    font-weight: 750;
}

.user-insight-grid strong {
    margin-top: 4px;
    color: #172033;
    font-size: 19px;
}

.vip-distribution {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 26px;
    color: #64748b;
    background: #fbfcfe;
    font-size: 10px;
}

.vip-distribution > span {
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.vip-distribution > strong {
    overflow: hidden;
    color: #334155;
    font-size: 11px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================
   FILTERS AND USER TABLE
========================================= */

.user-toolbar {
    display: grid;
    grid-template-columns:
        minmax(250px, 1.45fr)
        repeat(4, minmax(138px, 0.7fr))
        auto;
    gap: 10px;
    padding: 17px 26px;
    background: var(--admin-surface-soft);
    border-top: 1px solid #e7edf5;
    border-bottom: 1px solid #e7edf5;
}

.user-toolbar .filter-control {
    height: 42px;
}

.user-search-control input {
    height: 42px;
}

.user-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.user-table-wrap {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th,
.user-table td {
    padding: 15px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e8edf4;
}

.user-table th:first-child,
.user-table td:first-child {
    padding-left: 26px;
}

.user-table th:last-child,
.user-table td:last-child {
    padding-right: 26px;
}

.user-table th {
    color: #64748b;
    background: #fbfcfe;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    white-space: nowrap;
}

.user-table tbody tr {
    transition: background 140ms ease;
}

.user-table tbody tr:hover {
    background: #f9fbff;
}

.user-table tbody tr:last-child td {
    border-bottom: 0;
}

.user-identity {
    display: flex;
    min-width: 210px;
    align-items: center;
    gap: 11px;
}

.user-avatar {
    display: grid;
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    place-items: center;
    color: #1d4ed8;
    background: linear-gradient(145deg, #eff6ff, #dbeafe);
    border: 1px solid #c7dcff;
    border-radius: 13px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.user-identity-copy,
.user-cell-stack {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.user-identity-copy strong {
    overflow: hidden;
    color: #172033;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-identity-copy span,
.user-identity-copy small,
.user-cell-stack small {
    margin-top: 3px;
    color: #7c8a9e;
    font-size: 10px;
    white-space: nowrap;
}

.user-identity-copy code {
    margin-top: 3px;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 9px;
}

.badge-stack {
    display: flex;
    min-width: 120px;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
}

.role-pill,
.vip-pill,
.verification-pill,
.login-pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 850;
    white-space: nowrap;
}

.role-pill.admin {
    color: #6d28d9;
    background: #ede9fe;
}

.role-pill.user {
    color: #334155;
    background: #e2e8f0;
}

.vip-pill {
    color: #a16207;
    background: #fef3c7;
}

.verification-pill.verified {
    color: #047857;
    background: #d1fae5;
}

.verification-pill.unverified {
    color: #64748b;
    background: #f1f5f9;
}

.login-pill.locked {
    color: #b91c1c;
    background: #fee2e2;
}

.login-pill.clear {
    color: #047857;
    background: #ecfdf5;
}

.status-pill.suspended {
    color: #a16207;
    background: #fef3c7;
}

.status-pill.blocked {
    color: #b91c1c;
    background: #fee2e2;
}

.network-stack {
    display: grid;
    min-width: 126px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
}

.network-stack span {
    display: flex;
    flex-direction: column;
    padding: 7px 8px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e6ebf2;
    border-radius: 8px;
    font-size: 8px;
    font-weight: 750;
    text-transform: uppercase;
}

.network-stack strong {
    margin-top: 3px;
    color: #334155;
    font-size: 11px;
}

.date-stack {
    display: flex;
    min-width: 108px;
    flex-direction: column;
    color: #334155;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.date-stack small {
    margin-top: 4px;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 650;
}

.user-pagination {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 26px;
    color: #64748b;
    background: #fbfcfe;
    border-top: 1px solid #e8edf4;
    font-size: 11px;
}

/* =========================================
   USER DETAIL MODAL
========================================= */

.user-modal {
    width: min(1180px, 100%);
}

.user-modal-body {
    max-height: min(76vh, 820px);
}

.detail-state {
    display: flex;
    min-height: 250px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 32px;
    color: #64748b;
    text-align: center;
}

.detail-state > i {
    margin-bottom: 14px;
    color: var(--admin-primary);
    font-size: 28px;
}

.detail-state strong {
    color: #1e293b;
    font-size: 16px;
}

.detail-state span {
    margin-top: 7px;
    font-size: 12px;
}

.detail-state.error > i {
    color: var(--admin-danger);
}

.user-detail-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    overflow: hidden;
    padding: 22px;
    color: #e2e8f0;
    background:
        radial-gradient(circle at 90% 10%, rgba(96, 165, 250, 0.32), transparent 18rem),
        linear-gradient(135deg, #14213d, #1e3a5f);
    border-radius: 17px;
}

.user-detail-hero::after {
    position: absolute;
    right: -44px;
    bottom: -85px;
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.detail-user-identity {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 15px;
}

.detail-user-avatar {
    display: grid;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 17px;
    box-shadow: 0 13px 26px rgba(2, 6, 23, 0.25);
    font-size: 16px;
    font-weight: 900;
}

.detail-user-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.detail-user-copy small {
    color: #93c5fd;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-user-copy strong {
    margin-top: 3px;
    color: #ffffff;
    font-size: 22px;
}

.detail-user-copy span {
    margin-top: 4px;
    color: #cbd5e1;
    font-size: 11px;
}

.detail-user-badges {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 10px;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    backdrop-filter: blur(7px);
}

.user-detail-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
    margin-top: 13px;
}

.user-detail-metrics article {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 13px;
    background: #fbfcfe;
    border: 1px solid #e1e8f1;
    border-radius: 12px;
}

.user-detail-metrics i {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #1d4ed8;
    background: #e8f0ff;
    border-radius: 10px;
    font-size: 12px;
}

.user-detail-metrics div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.user-detail-metrics span {
    color: #7c8a9e;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-detail-metrics strong {
    margin-top: 3px;
    overflow: hidden;
    color: #1e293b;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
    margin-top: 13px;
}

.user-detail-card {
    min-width: 0;
    padding: 17px;
    background: #ffffff;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
}

.user-detail-card > header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
}

.user-detail-card > header > span {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 10px;
    font-size: 12px;
}

.user-detail-card h3 {
    margin: 0;
    color: #1e293b;
    font-size: 14px;
}

.detail-list {
    display: grid;
    gap: 9px;
    margin: 0;
}

.detail-list > div {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 9px;
    border-bottom: 1px solid #eef2f6;
}

.detail-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.detail-list dt {
    color: #7c8a9e;
    font-size: 10px;
    font-weight: 750;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #334155;
    font-size: 11px;
    font-weight: 750;
    text-align: right;
}

.wallet-summary-grid,
.activity-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.wallet-summary-grid article,
.activity-summary-grid article {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 11px;
    background: #f8fafc;
    border: 1px solid #e5ebf2;
    border-radius: 10px;
}

.wallet-summary-grid span,
.activity-summary-grid span {
    color: #7c8a9e;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.wallet-summary-grid strong,
.activity-summary-grid strong {
    margin-top: 5px;
    overflow: hidden;
    color: #1e293b;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-summary-grid small {
    margin-top: 4px;
    color: #94a3b8;
    font-size: 9px;
}

/* =========================================
   SENSITIVE CONTROLS
========================================= */

.user-control-section,
.user-audit-section {
    margin-top: 15px;
    padding: 19px;
    background: #fbfcfe;
    border: 1px solid #dfe7f1;
    border-radius: 15px;
}

.user-control-section > header,
.user-audit-section > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 15px;
}

.user-control-section h3,
.user-audit-section h3 {
    margin: 0;
    color: #172033;
    font-size: 17px;
}

.user-control-section header p:last-child {
    max-width: 670px;
    margin: 6px 0 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.5;
}

.user-control-section > header > span,
.user-audit-section > header > span {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.user-control-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.user-control-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #dfe7f1;
    border-radius: 13px;
}

.control-card-icon {
    display: grid;
    width: 36px;
    height: 36px;
    margin-bottom: 11px;
    place-items: center;
    color: #b45309;
    background: #fef3c7;
    border-radius: 10px;
    font-size: 13px;
}

.role-control-card .control-card-icon {
    color: #6d28d9;
    background: #ede9fe;
}

.vip-control-card .control-card-icon {
    color: #a16207;
    background: #fef9c3;
}

.user-control-card h4 {
    margin: 0;
    color: #1e293b;
    font-size: 14px;
}

.user-control-card > p {
    min-height: 32px;
    margin: 5px 0 12px;
    color: #7c8a9e;
    font-size: 10px;
    line-height: 1.45;
}

.user-control-card .form-field + .form-field {
    margin-top: 10px;
}

.user-control-card .form-field textarea {
    min-height: 72px;
}

.control-submit-button {
    display: inline-flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
    color: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.control-submit-button.status {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.control-submit-button.role {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.control-submit-button.vip {
    color: #422006;
    background: linear-gradient(135deg, #facc15, #eab308);
}

.control-submit-button:hover {
    box-shadow: 0 9px 18px rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
}

.control-submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.control-safety-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 13px 0 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.5;
}

.control-safety-note i {
    margin-top: 2px;
    color: #2563eb;
}

/* =========================================
   AUDIT HISTORY
========================================= */

.user-audit-section > header > span {
    color: #475569;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.audit-list {
    display: grid;
    gap: 9px;
}

.audit-entry {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: flex-start;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
}

.audit-entry-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 10px;
    font-size: 12px;
}

.audit-entry-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.audit-entry-copy strong {
    color: #1e293b;
    font-size: 11px;
}

.audit-entry-copy span {
    margin-top: 3px;
    color: #475569;
    font-size: 10px;
    font-weight: 750;
}

.audit-entry-copy small {
    margin-top: 5px;
    color: #7c8a9e;
    font-size: 9px;
    line-height: 1.45;
}

.audit-entry-time {
    color: #94a3b8;
    font-size: 9px;
    white-space: nowrap;
}

.audit-empty-state {
    display: flex;
    min-height: 100px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: #94a3b8;
    font-size: 11px;
}

.audit-empty-state i {
    font-size: 22px;
}

.audit-load-more {
    margin: 12px auto 0;
}

.user-detail-footer {
    align-items: center;
}

.user-safety-copy {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #64748b;
    font-size: 10px;
}

.user-safety-copy i {
    color: #059669;
}

/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 1320px) {
    .user-toolbar {
        grid-template-columns:
            minmax(260px, 1.4fr)
            repeat(2, minmax(150px, 0.8fr))
            auto;
    }

    .user-toolbar .filter-control:nth-of-type(4),
    .user-toolbar .filter-control:nth-of-type(5) {
        grid-row: 2;
    }

    .user-toolbar-actions {
        grid-column: -2 / -1;
    }
}

@media (max-width: 1100px) {
    .user-insight-grid,
    .user-detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-control-grid {
        grid-template-columns: 1fr;
    }

    .user-control-card > p {
        min-height: 0;
    }
}

@media (max-width: 900px) {
    .user-insight-heading,
    .users-panel-heading {
        flex-direction: column;
    }

    .overview-heading-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-search-control {
        grid-column: 1 / -1;
    }

    .user-toolbar .filter-control:nth-of-type(4),
    .user-toolbar .filter-control:nth-of-type(5) {
        grid-row: auto;
    }

    .user-toolbar-actions {
        grid-column: 1 / -1;
    }

    .user-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .user-insight-heading,
    .users-panel-heading,
    .user-toolbar,
    .vip-distribution,
    .user-pagination {
        padding-right: 18px;
        padding-left: 18px;
    }

    .user-insight-grid,
    .user-detail-metrics {
        grid-template-columns: 1fr;
    }

    .user-detail-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-user-badges {
        justify-content: flex-start;
    }

    .user-control-section > header,
    .user-audit-section > header {
        flex-direction: column;
    }

    .audit-entry {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .audit-entry-time {
        grid-column: 2;
    }

    .user-detail-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .user-detail-footer button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .user-toolbar {
        grid-template-columns: 1fr;
    }

    .user-search-control,
    .user-toolbar-actions {
        grid-column: auto;
    }

    .user-toolbar-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .user-toolbar-actions .primary-button,
    .user-toolbar-actions .secondary-button:not(.icon-only-button) {
        flex: 1;
    }

    .overview-heading-actions,
    .vip-distribution,
    .user-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .vip-distribution > strong {
        text-align: left;
        white-space: normal;
    }

    .wallet-summary-grid,
    .activity-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .control-submit-button,
    .user-table tbody tr {
        transition: none;
    }
}
