/* =====================================================================
   USERS module — list + form
   ===================================================================== */

/* ---------- TABLE CELLS ---------- */
.users-table { font-size: 13px; }
.users-table th, .users-table td { padding: 12px 10px; vertical-align: middle; }

.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    background: #e5e7eb;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--c-border);
}
.u-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.u-info { min-width: 0; }
.u-name { font-weight: 800; color: var(--c-text); display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.u-gender {
    background: #fde2e8; color: #db2777;
    font-size: 10.5px; font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
}
.u-handle { font-size: 11.5px; color: var(--c-text-muted); margin-top: 1px; }

.u-email { font-size: 13px; color: var(--c-text); direction: ltr; }
.u-when { font-size: 12.5px; color: var(--c-text-muted); direction: ltr; }

/* Role pills */
.role-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

/* Status pills */
.u-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}
.u-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.u-status.on { background: var(--c-green-soft); color: var(--c-green); }
.u-status.on .dot { background: var(--c-green); }
.u-status.off { background: #f3f4f6; color: var(--c-text-muted); }
.u-status.off .dot { background: #9ca3af; }
.u-status.susp { background: var(--c-red-soft); color: var(--c-red); }
.u-status.susp .dot { background: var(--c-red); }

/* Row actions */
.u-actions { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.btn-icon {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: 8px;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: .15s;
    text-decoration: none;
}
.btn-icon:hover { color: var(--c-primary); border-color: var(--c-primary); }
.btn-icon .material-symbols-rounded { font-size: 16px; }

/* Row dropdown menu */
.u-menu {
    position: absolute;
    top: calc(100% + 4px); inset-inline-end: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0,0,0,.12);
    z-index: 30;
    min-width: 200px;
    overflow: hidden;
}
.u-menu .u-mi {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: transparent; border: 0;
    text-align: start;
    font-family: inherit; font-size: 13px; font-weight: 600;
    color: var(--c-text); cursor: pointer;
}
.u-menu .u-mi:hover { background: rgba(108,92,231,.06); }
.u-menu .u-mi .material-symbols-rounded { font-size: 16px; color: var(--c-text-muted); }
.u-menu .u-mi.danger { color: var(--c-red); }
.u-menu .u-mi.danger .material-symbols-rounded { color: var(--c-red); }

/* ---------- BOTTOM 3-CARD ROW ---------- */
.users-bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}
.u-bottom-card { padding: 18px; }
.u-bottom-title {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 14px;
    font-size: 14.5px; font-weight: 800; color: var(--c-text);
    text-align: end;
}
.u-empty { color: var(--c-text-muted); padding: 16px 0; text-align: center; font-size: 13px; }

/* Recent logins */
.recent-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--c-border);
}
.recent-row:last-child { border-bottom: 0; }
.rec-when { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--c-text-muted); direction: ltr; }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-green); }
.rec-user { display: flex; align-items: center; gap: 10px; }
.rec-meta { text-align: end; }
.rec-name { font-weight: 700; font-size: 13.5px; color: var(--c-text); }
.rec-role { font-size: 11.5px; color: var(--c-text-muted); margin-top: 2px; }
.rec-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden;
    background: #e5e7eb;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--c-border);
}
.rec-avatar img { width: 100%; height: 100%; object-fit: cover; }

.u-show-all {
    display: flex; align-items: center; gap: 6px;
    color: var(--c-primary);
    font-weight: 700; font-size: 13px;
    padding-top: 10px;
    text-decoration: none;
    margin-top: 6px;
    border-top: 1px solid var(--c-border);
}
.u-show-all .material-symbols-rounded { font-size: 16px; }
body.ltr .u-show-all .material-symbols-rounded { transform: rotate(180deg); }

/* Quick actions */
.quick-action {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--c-text);
    transition: .15s;
    border: 1px solid transparent;
}
.quick-action + .quick-action { margin-top: 6px; }
.quick-action:hover { background: rgba(108,92,231,.06); border-color: rgba(108,92,231,.2); }
.qa-ico {
    width: 44px; height: 44px; border-radius: 12px;
    background: rgba(108,92,231,.1);
    color: var(--c-primary);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.qa-ico .material-symbols-rounded { font-size: 22px; }
.qa-text b { display: block; font-size: 13.5px; font-weight: 800; }
.qa-text span { font-size: 11.5px; color: var(--c-text-muted); display: block; margin-top: 2px; }

/* Role distribution donut */
.role-donut-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    padding: 6px 0;
}
.role-donut {
    width: 150px; height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--gradient));
    position: relative;
    display: grid; place-items: center;
}
.role-donut::before {
    content: ""; position: absolute; inset: 12px;
    background: var(--c-surface); border-radius: 50%;
}
.role-donut-inner { position: relative; z-index: 1; text-align: center; }
.role-donut-inner .rdi-val { font-size: 22px; font-weight: 800; color: var(--c-text); }
.role-donut-inner .rdi-lbl { font-size: 11px; color: var(--c-text-muted); margin-top: 2px; }

.role-legend { width: 100%; }
.rl-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0;
    font-size: 13px;
}
.rl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rl-name { flex: 1; color: var(--c-text); font-weight: 600; }
.rl-amt { color: var(--c-text-muted); font-weight: 700; font-size: 12.5px; }

/* ---------- FORM ---------- */
.user-form-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}
.user-avatar-col {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding-top: 8px;
}
.big-avatar {
    width: 160px; height: 160px; border-radius: 50%;
    overflow: hidden; background: #e5e7eb;
    border: 4px solid #fff;
    box-shadow: 0 8px 18px rgba(0,0,0,.10), 0 0 0 1px var(--c-border);
    margin-bottom: 6px;
}
.big-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar-col .lbl-tight { font-size: 12.5px; font-weight: 700; color: var(--c-text-muted); align-self: flex-start; }
.user-avatar-col .input { width: 100%; }

.role-preview {
    margin-top: 14px;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 800; font-size: 13px;
    text-align: center;
}

.user-form-section {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c-border);
    font-size: 15px; font-weight: 800;
    color: var(--c-text);
    text-align: end;
}
.user-form-section + .form-grid { margin-bottom: 24px; }

.pwd-hint { font-size: 11.5px; color: var(--c-text-muted); margin-top: -8px; }

/* ---------- Toasts (auto-dismiss via simple display) ---------- */
.toast-success, .toast-error {
    position: fixed; bottom: 20px; inset-inline-start: 20px;
    z-index: 200;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700; font-size: 13.5px;
    box-shadow: 0 12px 28px rgba(0,0,0,.20);
    animation: slideUp .3s ease;
}
.toast-success { background: var(--c-green); color: #fff; }
.toast-error   { background: var(--c-red);   color: #fff; }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* responsive */
@media (max-width: 1100px) {
    .users-bottom-grid { grid-template-columns: 1fr; }
    .user-form-grid { grid-template-columns: 1fr; }
    .user-avatar-col { padding-top: 0; }
}
