/* System users professional modal + permissions */
.users-pro-page {
  max-width: 1680px;
  width: min(1680px, 98vw);
}

.users-hero-pro {
  overflow: hidden;
}

.users-command-panel {
  padding: 26px;
  border-radius: 30px;
}

.users-command-head {
  align-items: flex-end;
}

.users-table-wrap {
  border-radius: 22px;
}

.users-pro-table {
  min-width: 1260px;
}

.permission-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 220px;
}

.permission-preview small {
  display: block;
  width: 100%;
  color: #64748b;
  font-weight: 800;
  margin-top: 2px;
}

.mini-permission-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eefdf4;
  color: #0f7f55;
  font-size: .72rem;
  font-weight: 900;
  text-transform: capitalize;
}

.user-modal-card {
  width: min(1180px, 96vw);
  padding: 26px;
}

.user-modal-form {
  display: grid;
  gap: 18px;
}

.user-modal-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.user-profile-rail {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0%, rgba(28,124,84,.12), transparent 34%),
    #fbfdff;
}

.user-photo-trigger {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.permission-summary-box {
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.08);
  text-align: center;
}

.permission-summary-box span {
  display: block;
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.permission-summary-box strong {
  display: block;
  margin-top: 4px;
  color: #1c7c54;
  font-size: 2rem;
  line-height: 1;
}

.user-form-body {
  display: grid;
  gap: 16px;
}

.form-section-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(15,23,42,.08);
  background: #fff;
  box-shadow: 0 12px 34px rgba(16,24,40,.04);
}

.mini-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.mini-section-head strong {
  display: block;
  font-size: 1.08rem;
  color: #0f172a;
}

.mini-section-head span {
  color: #64748b;
  font-weight: 700;
  font-size: .9rem;
}

.password-field-pro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px auto;
  gap: 8px;
  align-items: center;
}

.password-field-pro input {
  min-width: 0;
}

.password-eye-btn {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  border-radius: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #334155;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.password-eye-btn:hover {
  background: #f8fafc;
  border-color: rgba(28,124,84,.35);
  color: #1c7c54;
  transform: translateY(-1px);
}

.password-eye-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.password-eye-btn .eye-closed {
  display: none;
}

.password-eye-btn.is-visible .eye-open {
  display: none;
}

.password-eye-btn.is-visible .eye-closed {
  display: block;
}

.password-generate-btn {
  height: 48px;
  white-space: nowrap;
}

.permission-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.permissions-grid-pro {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.permission-group-card {
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 22px;
  background: #fbfdff;
  overflow: hidden;
}

.permission-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  background: linear-gradient(135deg, #f1fbf6, #fff);
  border-bottom: 1px solid rgba(15,23,42,.07);
}

.permission-group-head strong {
  color: #0f172a;
}

.permission-group-head span {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.08);
  font-size: .75rem;
  font-weight: 900;
  color: #1c7c54;
}

.permission-check-list {
  display: grid;
  gap: 0;
}

.permission-check-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(15,23,42,.055);
  transition: background .15s ease;
}

.permission-check-row:last-child {
  border-bottom: 0;
}

.permission-check-row:hover {
  background: #f8fafc;
}

.permission-check-row.is-selected {
  background: #effdf5;
}

.permission-check-row input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: #1c7c54;
}

.permission-check-row strong {
  display: block;
  color: #0f172a;
  font-size: .92rem;
}

.permission-check-row small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-weight: 800;
  font-size: .76rem;
}

.user-modal-actions {
  align-items: center;
  border-top: 1px solid rgba(15,23,42,.08);
  padding-top: 16px;
}

.user-modal-actions .notice {
  margin-right: auto;
  min-height: 0;
}

@media (max-width: 1050px) {
  .user-modal-layout {
    grid-template-columns: 1fr;
  }
  .user-profile-rail {
    position: static;
  }
  .permissions-grid-pro {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .users-command-head {
    align-items: stretch;
  }
  .users-command-head,
  .search-controls {
    flex-direction: column;
  }
  .password-field-pro {
    grid-template-columns: minmax(0, 1fr) 48px;
  }
  .password-generate-btn {
    grid-column: 1 / -1;
  }
}

/* Section-level permission controls */
.permission-group-head {
  align-items: flex-start;
}
.permission-group-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.permission-group-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.permission-mini-btn {
  border: 1px solid rgba(28,124,84,.18);
  background: #fff;
  color: #0f7f55;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .74rem;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.permission-mini-btn:hover {
  background: #ecfdf3;
  border-color: rgba(28,124,84,.38);
  transform: translateY(-1px);
}
.permission-mini-btn.muted {
  color: #475569;
  border-color: rgba(15,23,42,.12);
}
.permission-mini-btn.muted:hover {
  background: #f8fafc;
}
@media (max-width: 560px) {
  .permission-group-head {
    flex-direction: column;
    align-items: stretch;
  }
  .permission-group-head > div:first-child,
  .permission-group-actions {
    justify-content: space-between;
  }
  .permission-mini-btn {
    flex: 1;
  }
}


/* System users: professional country selector and profile modal */
.phone-label-pro {
  min-width: 0;
}

.phone-field-pro {
  display: grid;
  grid-template-columns: minmax(190px, .65fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.country-select-pro {
  position: relative;
  min-width: 0;
}

.country-select-btn {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(28,124,84,.06), transparent),
    #fff;
  color: #0f172a;
  font-weight: 900;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.country-select-btn span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.country-select-btn:hover,
.country-select-btn[aria-expanded="true"] {
  border-color: rgba(28,124,84,.35);
  box-shadow: 0 10px 28px rgba(28,124,84,.10);
}

.country-dropdown-pro {
  position: absolute;
  z-index: 5000;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, 88vw);
  padding: 10px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15,23,42,.20);
}

.country-search-pro {
  width: 100%;
  margin-bottom: 8px;
  height: 42px;
  border-radius: 13px;
}

.country-options-pro {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.country-option-pro {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 13px;
  background: #fff;
  padding: 10px 11px;
  cursor: pointer;
  text-align: left;
  color: #0f172a;
}

.country-option-pro:hover,
.country-option-pro.is-selected {
  background: #ecfdf3;
}

.country-option-pro span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-option-pro strong {
  color: #0f7f55;
}

.country-empty {
  margin: 8px;
}

.user-profile-modal-card {
  width: min(1180px, 96vw);
  padding: 26px;
}

.user-profile-hero-pro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0%, rgba(28,124,84,.10), transparent 34%),
    #fbfdff;
}

.user-profile-hero-pro h3 {
  margin: 0 0 5px;
  font-size: 1.4rem;
}

.profile-full-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.profile-info-card-pro,
.profile-panel {
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(28,124,84,.07), transparent 34%),
    #fff;
  border: 1px solid rgba(15,23,42,.08);
}

.profile-info-card-pro h4 {
  margin: 0 0 14px;
  font-size: 1.02rem;
}

.profile-field-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,.07);
}

.profile-field-row:first-of-type {
  border-top: 0;
}

.profile-field-row span {
  color: #64748b;
  font-size: .82rem;
  font-weight: 900;
}

.profile-field-row strong {
  color: #0f172a;
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.profile-permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#userModal {
  z-index: 2100;
}

#userProfileModal {
  z-index: 2000;
}

@media (max-width: 980px) {
  .phone-field-pro,
  .user-profile-hero-pro,
  .profile-full-info-grid {
    grid-template-columns: 1fr;
  }
  .profile-field-row {
    grid-template-columns: 120px minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .profile-field-row {
    grid-template-columns: 1fr;
  }
}
