/* =====================================================
   USER PROFILE DIALOG — BizMetry Design System
   ===================================================== */

.user-profile-dialog {
  max-width: 520px;
  width: 90vw;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

/* =====================================================
   TOOLBAR
   ===================================================== */

.user-profile-dialog .upd-toolbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  min-height: 68px !important;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3) !important;
}

.upd-toolbar-tools {
  padding: 0 16px !important;
  min-height: 68px !important;
  display: flex !important;
  align-items: center !important;
}

.upd-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upd-toolbar-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upd-toolbar-icon-wrap md-icon {
  font-size: 20px !important;
  width: 20px !important;
  height: 20px !important;
  color: white !important;
}

.upd-title {
  font-size: 17px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.upd-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  margin: 2px 0 0;
  font-weight: 400;
}

.upd-close-btn {
  color: rgba(255, 255, 255, 0.8) !important;
  transition: all 0.15s ease !important;
}

.upd-close-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
}

.upd-close-btn md-icon { color: inherit !important; }

/* =====================================================
   CONTENT
   ===================================================== */

.user-profile-dialog .upd-content {
  padding: 0 !important;
  background: #f0f2f7 !important;
  max-height: 76vh;
  overflow-y: auto;
}

.user-profile-dialog .upd-content::-webkit-scrollbar { width: 5px; }
.user-profile-dialog .upd-content::-webkit-scrollbar-track { background: #f0f2f7; }
.user-profile-dialog .upd-content::-webkit-scrollbar-thumb { background: #c5c9d6; border-radius: 3px; }
.user-profile-dialog .upd-content::-webkit-scrollbar-thumb:hover { background: #a8adb8; }

.upd-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* =====================================================
   IDENTITY HEADER
   ===================================================== */

.upd-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 28px 24px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.upd-identity::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.upd-identity-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.upd-fullname {
  font-size: 18px;
  font-weight: 700;
  color: #1e2535;
  margin: 0;
  letter-spacing: -0.3px;
}

.upd-email {
  font-size: 13px;
  color: #7c84a0;
  margin: 0;
  font-weight: 400;
}

.upd-identity-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.upd-account-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.upd-account-tag md-icon {
  font-size: 13px !important;
  width: 13px !important;
  height: 13px !important;
  color: white !important;
}

.upd-super-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.upd-super-tag md-icon {
  font-size: 13px !important;
  width: 13px !important;
  height: 13px !important;
  color: white !important;
}

/* =====================================================
   ORG ID
   ===================================================== */

.upd-org-id-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-top: 1px solid #eef0f7;
  padding: 12px 20px;
  transition: background 0.15s ease;
}

.upd-org-id-wrap:hover { background: #fafbff; }

.upd-org-id-icon {
  font-size: 20px !important;
  width: 20px !important;
  height: 20px !important;
  color: #667eea !important;
  flex-shrink: 0;
}

.upd-org-id-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.upd-org-id-label {
  font-size: 10px;
  font-weight: 700;
  color: #9aa0b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upd-org-id-value {
  font-size: 12px;
  font-weight: 600;
  color: #3d4461;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.2px;
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upd-copy-btn {
  margin: 0 !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  flex-shrink: 0 !important;
}

.upd-copy-btn md-icon {
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: #667eea !important;
}

.upd-copy-btn:hover { background: rgba(102, 126, 234, 0.1) !important; }

/* =====================================================
   SECTIONS
   ===================================================== */

.upd-section {
  background: white;
  margin: 12px 14px 0;
  border-radius: 10px;
  border: 1px solid #e8eaf0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.upd-section:last-of-type { margin-bottom: 14px; }

.upd-section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 9px;
  padding: 11px 16px;
  background: #f7f8fc;
  border-bottom: 1px solid #eef0f7;
  text-align: left;
}

.upd-section-header md-icon {
  font-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
  color: #667eea !important;
  flex-shrink: 0;
  margin-right: 0 !important;
}

.upd-section-header span {
  font-size: 11px;
  font-weight: 700;
  color: #5a6080;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex: 1;
}

/* =====================================================
   DETAIL ROWS
   ===================================================== */

.upd-detail-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid #f2f4f9;
}

.upd-detail-row:last-child { border-bottom: none; }

.upd-detail-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  color: #b0b8d0 !important;
  flex-shrink: 0;
}

.upd-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7494;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.upd-detail-value {
  font-size: 13px;
  font-weight: 600;
  color: #1e2535;
  text-align: right;
  word-break: break-word;
  justify-self: end;
}

.upd-mono {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.upd-muted {
  color: #b0b8d0 !important;
  font-style: italic;
  font-weight: 400 !important;
}

.upd-detail-row-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  padding: 12px 16px;
}

.upd-detail-row-top {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
}

.upd-ip-count {
  font-size: 11px;
  font-weight: 700;
  background: rgba(102, 126, 234, 0.12);
  color: #667eea;
  padding: 2px 8px;
  border-radius: 10px;
}

.upd-ip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-left: 28px;
}

.upd-ip-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 8px;
  background: #f0f2f7;
  border: 1px solid #dde1ee;
  font-size: 13px;
  font-weight: 600;
  color: #3d4461;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.2px;
  transition: all 0.15s ease;
}

.upd-ip-pill:hover {
  background: rgba(102, 126, 234, 0.08);
  border-color: rgba(102, 126, 234, 0.3);
  color: #667eea;
}

.upd-ip-pill md-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  color: #b0b8d0 !important;
}

.upd-ip-pill:hover md-icon { color: #667eea !important; }

.upd-ip-geo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}

/* =====================================================
   ROLES & PERMISSIONS
   ===================================================== */

.upd-roles-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px 16px;
}

/* ── Base pill ── */
.upd-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.upd-role-pill md-icon {
  font-size: 13px !important;
  width: 13px !important;
  height: 13px !important;
  flex-shrink: 0;
}

/* ── Type badge dentro del pill ── */
.upd-pill-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  opacity: 0.85;
}

/* ── ROLE — purple gradient ── */
.upd-pill--role {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
}

.upd-pill--role md-icon { color: rgba(255, 255, 255, 0.85) !important; }

/* ── PERMISSION — emerald ── */
.upd-pill--permission {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.upd-pill--permission md-icon { color: rgba(255, 255, 255, 0.85) !important; }

/* ── Empty state ── */
.upd-empty-roles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: #b0b8d0;
  font-size: 12px;
  font-weight: 500;
  background: #f7f8fc;
  margin: 10px;
  border-radius: 8px;
  border: 1.5px dashed #dde1ee;
}

.upd-empty-roles md-icon {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
  color: #c8cde0 !important;
}

/* =====================================================
   ACTIONS
   ===================================================== */

.user-profile-dialog .upd-actions {
  background: white !important;
  border-top: 1px solid #e8eaf0 !important;
  padding: 14px 20px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  min-height: 66px !important;
}

.upd-btn-close {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px;
  height: 38px !important;
  padding: 0 18px !important;
  border-radius: 8px !important;
  background: #f0f2f7 !important;
  color: #6b7494 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  margin: 0 !important;
  border: 1px solid #dde1ee !important;
  transition: all 0.15s ease !important;
}

.upd-btn-close:hover { background: #e4e7f2 !important; color: #3d4461 !important; }

.upd-btn-close md-icon {
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: inherit !important;
}

.upd-btn-edit {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px;
  height: 38px !important;
  padding: 0 22px !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-transform: none !important;
  margin: 0 !important;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
  transition: opacity 0.15s ease !important;
}

.upd-btn-edit:hover { opacity: 0.9; }

.upd-btn-edit md-icon {
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: white !important;
}

/* =====================================================
   LOADING
   ===================================================== */

.upd-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 560px) {
  .user-profile-dialog { width: 96vw; }
  .upd-section { margin: 10px 10px 0; border-radius: 8px; }
  .upd-section:last-of-type { margin-bottom: 10px; }
  .upd-identity { padding: 22px 16px 18px; }
  .upd-fullname { font-size: 16px; }
  .upd-detail-row { padding: 10px 14px; }
  .upd-ip-list { padding-left: 0; }
}

@media (max-width: 420px) {
  .upd-subtitle { display: none; }
  .upd-actions { flex-wrap: wrap; gap: 8px !important; }
  .upd-btn-close, .upd-btn-edit { flex: 1 !important; justify-content: center !important; }
  .upd-actions span[flex] { display: none; }
}