.settings-section { margin-bottom: 24px; }
.settings-section-title {
  font-size: 16px; font-weight: 700; color: var(--pl-text, #1e293b);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.settings-section-title i { color: #059669; }

/* ===== Users table ===== */
.users-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 14px 18px;
  border-bottom: 1px solid var(--pl-border, #e5e7eb);
}
.users-count { font-size: 13px; color: var(--pl-text-muted, #64748b); font-weight: 600; }
.users-count strong { color: var(--pl-text, #1e293b); font-weight: 800; }

.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  padding: 11px 16px; text-align: left; font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #94a3b8; background: #f8fafc; border-bottom: 1px solid var(--pl-border, #e5e7eb);
}
.users-table td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-avatar.blue { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.user-avatar.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.user-avatar.red { background: linear-gradient(135deg, #ef4444, #f87171); }
.user-avatar.gray { background: linear-gradient(135deg, #64748b, #94a3b8); }
.user-name { font-weight: 700; color: var(--pl-text, #1e293b); font-size: 13px; line-height: 1.3; }
.user-name .me-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: #dcfce7; color: #15803d; border-radius: 20px;
  font-size: 10px; font-weight: 700; vertical-align: middle;
}
.user-email { font-size: 11.5px; color: #94a3b8; }

.role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.role-badge.admin { background: #ede9fe; color: #6d28d9; }
.role-badge.finance { background: #dcfce7; color: #15803d; }
.role-badge.employee { background: #dbeafe; color: #1e40af; }

.rights-pills { display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.right-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600;
  background: #f1f5f9; color: #475569;
}
.right-pill.on { background: #ecfdf5; color: #15803d; }
.right-pill.admin { background: #fef3c7; color: #a16207; }

.cross-scope-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  background: #ede9fe; color: #6d28d9;
  border: 1px dashed #a78bfa;
  text-transform: none; letter-spacing: 0;
}

.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-badge.active { background: #dcfce7; color: #15803d; }
.status-badge.invited { background: #fef3c7; color: #a16207; }
.status-badge.disabled { background: #fee2e2; color: #b91c1c; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-btn {
  background: #fff; border: 1px solid var(--pl-border, #e5e7eb);
  border-radius: 6px; padding: 5px 10px; font-size: 11px; font-weight: 600;
  color: #64748b; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.15s;
}
.row-btn:hover { background: #f8fafc; border-color: #059669; color: #059669; }
.row-btn.danger:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }

/* ===== Invite modal ===== */
.invite-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px);
  z-index: 1050; align-items: center; justify-content: center; padding: 20px;
}
.invite-modal.open { display: flex; }
.invite-dialog {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.18);
}
.invite-dialog-header {
  padding: 20px 24px 16px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.invite-dialog-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: #1e293b; margin: 0;
}
.invite-dialog-title i { color: #059669; }
.invite-dialog-close {
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  color: #94a3b8; font-size: 20px; line-height: 1;
}
.invite-dialog-body { padding: 20px 24px; }
.invite-dialog-footer {
  padding: 14px 24px; border-top: 1px solid #f1f5f9;
  display: flex; justify-content: flex-end; gap: 8px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  color: #475569; text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.field input[type="email"],
.field input[type="text"],
.field textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 13px; color: #1e293b; outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { border-color: #059669; }
.field textarea { resize: vertical; min-height: 70px; }

.role-picker { display: flex; gap: 8px; }
.role-option {
  flex: 1; padding: 12px 10px; border: 1.5px solid #e2e8f0;
  border-radius: 10px; cursor: pointer; text-align: center;
  transition: all 0.15s; position: relative;
}
.role-option:hover { border-color: #cbd5e1; background: #f8fafc; }
.role-option.selected { border-color: #059669; background: #ecfdf5; }
.role-option .role-icon { font-size: 18px; color: #64748b; margin-bottom: 4px; }
.role-option.selected .role-icon { color: #059669; }
.role-option .role-name { font-size: 12.5px; font-weight: 700; color: #1e293b; }
.role-option .role-desc { font-size: 10.5px; color: #94a3b8; margin-top: 2px; line-height: 1.35; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }

.rights-list {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px;
}
.right-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; cursor: pointer;
}
.right-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #059669; flex-shrink: 0; }
.right-row .right-label { flex: 1; font-size: 13px; font-weight: 600; color: #1e293b; }
.right-row .right-hint { font-size: 11px; color: #94a3b8; display: block; margin-top: 1px; font-weight: 400; }

/* ===== Email preview card ===== */
.email-preview-card {
  background: #fff; border: 1px solid var(--pl-border, #e5e7eb); border-radius: 12px;
  overflow: hidden;
}
.email-preview-header {
  padding: 12px 18px; border-bottom: 1px solid var(--pl-border, #e5e7eb);
  background: #f8fafc; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: #64748b; font-weight: 600;
}
.email-preview-header i { color: #059669; }
.email-envelope {
  padding: 20px 24px; background: #f8fafc;
  border-bottom: 1px dashed #cbd5e1; font-size: 12px; color: #475569;
  font-family: SFMono-Regular, Consolas, Liberation Mono, monospace;
}
.email-envelope div { margin-bottom: 4px; }
.email-envelope strong { color: #1e293b; font-weight: 700; }
.email-body {
  padding: 28px 32px; font-family: -apple-system, "Segoe UI", Helvetica, sans-serif;
  color: #1e293b; background: #fff;
}
.email-body h2 { font-size: 20px; font-weight: 800; margin-bottom: 16px; color: #1e293b; }
.email-body p { font-size: 14px; line-height: 1.6; margin-bottom: 14px; color: #334155; }
.email-body .email-cta {
  display: inline-block; padding: 12px 28px;
  background: #059669; color: #fff;
  border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px;
  margin: 10px 0 18px;
}
.email-body .email-details {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 14px 16px; font-size: 13px; margin: 8px 0 16px;
}
.email-body .email-details .email-details-row {
  display: flex; justify-content: space-between; padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}
.email-body .email-details .email-details-row:last-child { border-bottom: none; }
.email-body .email-details strong { color: #1e293b; }
.email-body .email-footer { font-size: 12px; color: #94a3b8; border-top: 1px solid #f1f5f9; padding-top: 14px; margin-top: 16px; }

@media (max-width: 768px) {
  .users-table thead { display: none; }
  .users-table tr { display: block; padding: 14px; border-bottom: 1px solid #f1f5f9; }
  .users-table td { display: block; border: none; padding: 4px 0; }
  .row-actions { justify-content: flex-start; margin-top: 8px; }
  .rights-pills { max-width: 100%; }
}

/* Mobile: show "desktop only" message, hide page content */
.mobile-desktop-only-msg { display: none; }

@media (max-width: 768px) {
  .mobile-desktop-only-msg {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 60px 24px; min-height: 60vh;
  }
  .mobile-desktop-only-msg .desktop-only-icon {
    width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex; align-items: center; justify-content: center; font-size: 36px; color: #2563eb; margin-bottom: 20px;
    border: 2px solid #93c5fd;
  }
  .mobile-desktop-only-msg h2 { font-size: 20px; font-weight: 800; color: #1e293b; margin: 0 0 8px; }
  .mobile-desktop-only-msg p { font-size: 14px; color: #64748b; margin: 0 0 6px; max-width: 320px; }
  .mobile-desktop-only-msg .desktop-only-sub { font-size: 13px; color: #94a3b8; margin-bottom: 24px; }
  .mobile-desktop-only-msg .desktop-only-hint {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px;
    background: #f0f9ff; border: 1.5px solid #bae6fd; border-radius: 12px;
    font-size: 13px; color: #0369a1; font-weight: 600;
  }
  .mobile-desktop-only-msg .desktop-only-hint i { font-size: 18px; }
  .portal-content > *:not(.mobile-desktop-only-msg) { display: none !important; }
}
