/* ═══════════════════════════════════════════════════════════════
   IAM — light-first professional theme
   Navy appears only in the compact header bar and modal headers.
   Content surface is light slate with white cards and green accent.
   ═══════════════════════════════════════════════════════════════ */

.iam-body {
  background: linear-gradient(180deg, #eef1f7 0%, #e4e9f2 55%, #dce2ee 100%) !important;
  color: #16233b;
  min-height: 100vh;
}

/* ── Compact brand header (dark as accent, not full theme) ── */

.iam-header {
  background: linear-gradient(180deg, #102862 0%, #0c1a3d 100%);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  box-shadow: 0 8px 24px rgba(12, 26, 61, 0.18);
}

.iam-header-inner {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.iam-header-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.iam-header-brand img {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(280px, 48vw);
  object-fit: contain;
}

.iam-header-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.iam-header-eyebrow {
  margin: 0 0 0.15rem;
  font-family: "Outfit", "Tajawal", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e4c665;
}

.iam-header-copy h1 {
  margin: 0;
  font-family: "Outfit", "Tajawal", sans-serif;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  color: #f6f8fc;
  line-height: 1.3;
}

.iam-header-nav {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.iam-header-nav a {
  color: #e4c665;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.iam-header-nav a:hover {
  text-decoration: underline;
}

/* ── Shell / status ── */

.iam-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.4rem auto 0;
  padding-bottom: 2rem;
}

.iam-status {
  margin: 2rem 0;
  text-align: center;
  color: #64708a;
  font-size: 1rem;
}

/* ── Buttons ── */

.btn {
  cursor: pointer;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
  font-family: inherit;
  line-height: 1.2;
}

.btn-primary {
  background: #17825f;
  color: #ffffff;
  border-color: #17825f;
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-ghost {
  background: #ffffff;
  color: #16233b;
  border-color: #d5dbe8;
}

.btn-ghost:hover {
  background: #f4f6fb;
  border-color: #c5cddd;
}

.btn-danger {
  background: #ffffff;
  color: #b6362f;
  border-color: rgba(182, 54, 47, 0.35);
}

.btn-danger:hover {
  background: rgba(182, 54, 47, 0.08);
}

.iam-login-as {
  display: grid;
  gap: 0.85rem;
}

.iam-login-as-user {
  margin: 0;
  font-size: 0.95rem;
}

.iam-login-as-link-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.iam-login-as-link-label input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d5dbe8;
  border-radius: 10px;
  background: #f7f9fc;
  color: #16233b;
  width: 100%;
}

.iam-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
}

/* ── Cards ── */

.iam-card {
  border: 1px solid #e3e7f0;
  border-radius: 16px;
  background: #ffffff;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 2px 6px rgba(16, 40, 98, 0.05), 0 12px 28px rgba(16, 40, 98, 0.07);
  color: #16233b;
}

.iam-card h2 {
  margin: 0 0 0.25rem;
  font-family: "Outfit", "Tajawal", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #16233b;
}

.iam-card-hint {
  margin: 0;
  color: #64708a;
  font-size: 0.88rem;
  line-height: 1.6;
}

.iam-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.iam-login-card {
  max-width: 420px;
  margin: 2.5rem auto;
}

.iam-login-card .iam-card-hint {
  margin-bottom: 1.1rem;
}

.iam-search {
  min-width: min(280px, 100%);
  background: #f4f6fb;
  border: 1px solid #dde2ee;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  color: #16233b;
  font-family: inherit;
  font-size: 0.92rem;
}

.iam-search:focus {
  outline: none;
  border-color: #17825f;
  box-shadow: 0 0 0 3px rgba(23, 130, 95, 0.14);
}

/* ── Toolbar ── */

.iam-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  padding: 0.9rem 1.15rem;
  background: #ffffff;
  border: 1px solid #e3e7f0;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(16, 40, 98, 0.05);
}

.iam-toolbar-who {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.iam-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.iam-whoami {
  font-weight: 800;
  color: #16233b;
}

.iam-role-badge {
  color: #0b3d2c;
  background: rgba(23, 130, 95, 0.12);
  border-color: rgba(23, 130, 95, 0.3);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid #e3e7f0;
  white-space: nowrap;
}

.badge.enabled {
  color: #0b3d2c;
  background: rgba(23, 130, 95, 0.12);
  border-color: rgba(23, 130, 95, 0.3);
}

.badge.disabled {
  color: #b6362f;
  background: rgba(182, 54, 47, 0.1);
  border-color: rgba(182, 54, 47, 0.28);
}

.badge.flag {
  color: #3c4a63;
  background: #eef1f7;
  border-color: #dde2ee;
}

.badge.flag-warn {
  color: #7a5a06;
  background: rgba(201, 162, 39, 0.14);
  border-color: rgba(201, 162, 39, 0.35);
}

.badge.flag-danger {
  color: #8a2a25;
  background: rgba(182, 54, 47, 0.1);
  border-color: rgba(182, 54, 47, 0.28);
}

/* ── Forms ── */

.iam-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.95rem 1.1rem;
  align-items: end;
}

.iam-form-stack {
  grid-template-columns: 1fr;
}

.iam-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: #3c4a63;
  font-weight: 600;
}

.iam-form .iam-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.iam-form input,
.iam-form select,
.iam-form textarea {
  background: #f4f6fb;
  border: 1px solid #dde2ee;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: #16233b;
  font-family: inherit;
  font-size: 0.94rem;
}

.iam-form textarea {
  resize: vertical;
}

.iam-form input:focus,
.iam-form select:focus,
.iam-form textarea:focus {
  outline: none;
  border-color: #17825f;
  box-shadow: 0 0 0 3px rgba(23, 130, 95, 0.14);
}

.iam-form button[type="submit"] {
  grid-column: 1 / -1;
  justify-self: start;
}

.iam-multi-field {
  grid-column: 1 / -1;
  border: 1px solid #e3e7f0;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0;
  background: #fbfcfe;
}

.iam-multi-field legend {
  padding: 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64708a;
}

.iam-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  max-height: 200px;
  overflow-y: auto;
}

.iam-checkbox-group label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  color: #16233b;
  font-size: 0.88rem;
  font-weight: 400;
}

.iam-chip-field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.iam-chip-label {
  font-size: 0.86rem;
  color: #3c4a63;
  font-weight: 600;
}

.iam-chip-input {
  display: flex;
  gap: 0.45rem;
}

.iam-chip-input input {
  flex: 1;
}

.iam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.iam-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef1f7;
  border: 1px solid #dde2ee;
  border-radius: 999px;
  padding: 0.22rem 0.5rem 0.22rem 0.65rem;
  font-size: 0.82rem;
  color: #16233b;
}

.iam-chip button {
  cursor: pointer;
  border: none;
  background: transparent;
  color: #8b96ab;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.iam-chip button:hover {
  color: #b6362f;
}

.iam-chips-static .iam-chip button {
  display: none;
}

.iam-sod-hint {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: #7a5a06;
  font-size: 0.85rem;
}

.iam-form-msg {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.iam-form-msg.ok {
  color: #17825f;
  font-weight: 700;
}

.iam-form-msg.err {
  color: #b6362f;
  font-weight: 700;
}

/* ── Mode switch ── */

.iam-mode-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.28rem;
  margin: 0.9rem 0 1.1rem;
  background: #f4f6fb;
  border: 1px solid #e3e7f0;
  border-radius: 999px;
}

.iam-mode-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  color: #64708a;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition: background 150ms ease, color 150ms ease;
}

.iam-mode-btn.is-active {
  background: #16233b;
  color: #ffffff;
}

.iam-mode-fields[hidden] {
  display: none;
}

.iam-group-preview {
  margin: 0.2rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: rgba(23, 130, 95, 0.07);
  border: 1px solid rgba(23, 130, 95, 0.2);
  grid-column: 1 / -1;
}

.iam-group-preview[hidden] {
  display: none;
}

.iam-group-preview-desc {
  margin: 0 0 0.45rem;
  color: #0b3d2c;
  font-size: 0.85rem;
}

/* ── Users table ── */

.iam-table-wrap {
  overflow-x: auto;
  border: 1px solid #e3e7f0;
  border-radius: 12px;
}

.iam-users-table,
.iam-assignments,
.iam-roles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #ffffff;
}

.iam-users-table th,
.iam-users-table td,
.iam-assignments th,
.iam-assignments td,
.iam-roles-table th,
.iam-roles-table td {
  text-align: right;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid #eef1f7;
  vertical-align: middle;
}

.iam-users-table thead th,
.iam-assignments thead th,
.iam-roles-table thead th {
  background: #f4f6fb;
  color: #64708a;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}

.iam-users-table tbody tr:last-child td,
.iam-assignments tbody tr:last-child td,
.iam-roles-table tbody tr:last-child td {
  border-bottom: none;
}

.iam-users-table tbody tr:hover,
.iam-roles-table tbody tr:hover {
  background: #fbfcfe;
}

.iam-user-name {
  font-weight: 800;
  color: #16233b;
}

.iam-user-email {
  margin-top: 0.15rem;
  color: #8b96ab;
  font-size: 0.82rem;
}

.iam-role-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef1f7;
  color: #16233b;
  font-weight: 800;
  font-size: 0.82rem;
}

.iam-role-count.is-zero {
  color: #8b96ab;
  background: #f4f6fb;
}

.iam-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-start;
}

.iam-assignments tr.is-inactive {
  opacity: 0.5;
}

.iam-role-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #3c4a63;
  direction: ltr;
  unicode-bidi: embed;
}

.iam-role-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.iam-workspaces {
  color: #3c4a63;
  font-size: 0.82rem;
}

/* ── Modal ── */

.iam-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem;
  background: rgba(12, 22, 45, 0.48);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.iam-modal-overlay[hidden] {
  display: none;
}

.iam-modal {
  width: min(860px, 100%);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 28px 64px rgba(7, 15, 33, 0.32);
  overflow: hidden;
  animation: iam-modal-in 160ms ease;
}

.iam-modal.is-wide {
  width: min(980px, 100%);
}

.iam-modal.is-xwide {
  width: min(1180px, 100%);
}

.iam-acl-editor {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
}

.iam-acl-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(16, 40, 98, 0.06), rgba(16, 40, 98, 0.02)),
    #f8fafc;
  border: 1px solid #e2e8f0;
}

.iam-acl-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  text-transform: uppercase;
}

.iam-acl-title {
  margin: 0 0 0.35rem;
  font-family: "Outfit", "Tajawal", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f1c3a;
}

.iam-acl-subtitle {
  margin: 0;
  color: #64708a;
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 46rem;
}

.iam-acl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  max-width: 22rem;
}

.iam-acl-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.6rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.iam-acl-stat strong {
  font-size: 1rem;
  font-weight: 800;
  color: #102862;
  line-height: 1.1;
}

.iam-acl-stat span {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
}

.iam-acl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  font-size: 0.78rem;
  color: #475569;
}

.iam-acl-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.iam-acl-legend-exception {
  margin-inline-start: 0.4rem;
  padding-inline-start: 0.75rem;
  border-inline-start: 1px solid #e2e8f0;
  gap: 0.55rem;
}

.iam-acl-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
}

.iam-acl-dot--workspace { background: #2563eb; }
.iam-acl-dot--menu { background: #6366f1; }
.iam-acl-dot--screen { background: #16a34a; }
.iam-acl-dot--component { background: #0d9488; }
.iam-acl-dot--button { background: #ea580c; }
.iam-acl-dot--field { background: #db2777; }
.iam-acl-dot--grant { background: #059669; }
.iam-acl-dot--deny { background: #dc2626; }

.iam-acl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.iam-acl-search {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.iam-acl-search input {
  width: 100%;
  border: 1px solid #d0d7e6;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  background: #fff;
}

.iam-acl-search input:focus {
  outline: 2px solid rgba(16, 40, 98, 0.25);
  border-color: #102862;
}

.iam-acl-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.iam-acl-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 0;
}

@media (max-width: 820px) {
  .iam-acl-layout {
    grid-template-columns: 1fr;
  }
}

.iam-acl-side {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.45rem;
  max-height: min(56vh, 560px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.iam-acl-side-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: start;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  color: #1e293b;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
}

.iam-acl-side-btn:hover {
  background: rgba(16, 40, 98, 0.06);
}

.iam-acl-side-btn.is-active {
  background: #102862;
  color: #fff;
}

.iam-acl-side-btn.is-active .iam-acl-side-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.iam-acl-side-count {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.4rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}

.iam-acl-side-btn.is-partial .iam-acl-side-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.iam-acl-main {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.iam-acl-main-head {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid #eef2f7;
  background: #fbfcfe;
}

.iam-acl-main-head h5 {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}

.iam-acl-main-head p {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}

.iam-acl-tree {
  max-height: min(48vh, 480px);
  overflow: auto;
  padding: 0.45rem 0.4rem 0.7rem;
  background: #fff;
}

.iam-acl-node {
  --depth: 0;
}

.iam-acl-row {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.55rem 0.38rem calc(0.45rem + var(--depth) * 1.05rem);
  border-radius: 9px;
  border: 1px solid transparent;
}

.iam-acl-row:hover {
  background: #f8fafc;
  border-color: #eef2f7;
}

.iam-acl-row.is-granted {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.18);
}

.iam-acl-row.is-denied {
  background: rgba(220, 38, 38, 0.07);
  border-color: rgba(220, 38, 38, 0.16);
}

.iam-acl-row.is-workspace {
  background: #f1f5f9;
  border-color: #e2e8f0;
  margin-bottom: 0.25rem;
}

.iam-acl-toggle {
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  font-size: 0.75rem;
}

.iam-acl-toggle:disabled {
  visibility: hidden;
  cursor: default;
}

.iam-acl-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.iam-acl-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  accent-color: #102862;
}

.iam-acl-type {
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}

.iam-acl-type--workspace { background: #dbeafe; color: #1e3a8a; }
.iam-acl-type--menu { background: #e0e7ff; color: #3730a3; }
.iam-acl-type--screen { background: #dcfce7; color: #166534; }
.iam-acl-type--component { background: #ccfbf1; color: #0f766e; }
.iam-acl-type--button { background: #ffedd5; color: #9a3412; }
.iam-acl-type--field { background: #fce7f3; color: #9d174d; }

.iam-acl-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.05rem;
}

.iam-acl-name {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iam-acl-meta {
  color: #94a3b8;
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iam-acl-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: end;
}

.iam-acl-field-mode,
.iam-acl-exception-mode {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.22rem 0.4rem;
  font-size: 0.78rem;
  background: #fff;
  color: #0f172a;
}

.iam-acl-exception-mode {
  min-width: 5.8rem;
}

.iam-acl-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  padding-top: 0.25rem;
  border-top: 1px solid #eef2f7;
}

.iam-form-msg.is-ok {
  color: #166534;
}

.iam-form-msg.is-err {
  color: #b91c1c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.iam-acl-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

@keyframes iam-modal-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.iam-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.3rem;
  background: linear-gradient(180deg, #102862 0%, #0c1a3d 100%);
  color: #ffffff;
}

.iam-modal-head h3 {
  margin: 0;
  font-family: "Outfit", "Tajawal", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
}

.iam-modal-close {
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iam-modal-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.iam-modal-body {
  padding: 1.2rem 1.3rem 1.4rem;
  max-height: 74vh;
  overflow-y: auto;
  color: #16233b;
}

.iam-modal-sub {
  margin: 0 0 0.9rem;
  color: #64708a;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ── Groups management ── */

.iam-groups-manage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.iam-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.iam-group-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid #e3e7f0;
  border-radius: 12px;
  background: #fbfcfe;
}

.iam-group-row.is-inactive {
  opacity: 0.55;
}

.iam-group-row-main h4 {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
  font-weight: 800;
  color: #16233b;
}

.iam-group-row-main p {
  margin: 0 0 0.5rem;
  color: #64708a;
  font-size: 0.84rem;
  line-height: 1.55;
}

.iam-group-row-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.iam-group-role-pill {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #eef1f7;
  color: #3c4a63;
  font-size: 0.76rem;
  font-weight: 600;
}

.iam-group-row-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.iam-group-form-wrap[hidden] {
  display: none;
}

.iam-group-form-wrap {
  margin-bottom: 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(23, 130, 95, 0.28);
  border-radius: 12px;
  background: rgba(23, 130, 95, 0.05);
}

.iam-group-form-desc {
  grid-column: 1 / -1;
}

.iam-group-role-picker .iam-checkbox-group {
  max-height: 240px;
}

.iam-group-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.55rem;
}

/* ── Denied / empty ── */

.iam-denied {
  max-width: 520px;
  margin: 2.5rem auto;
  text-align: center;
}

.iam-denied .iam-card-hint {
  margin: 0.6rem 0 1.2rem;
}

.iam-empty-cell {
  color: #8b96ab;
  text-align: center !important;
  padding: 1.4rem 0.9rem !important;
}

@media (max-width: 760px) {
  .iam-header-brand img {
    height: 34px;
  }

  .iam-toolbar-actions {
    width: 100%;
  }

  .iam-users-table thead {
    display: none;
  }

  .iam-users-table tbody tr {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid #eef1f7;
  }

  .iam-users-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    padding: 0.3rem 0.9rem;
  }

  .iam-group-row {
    flex-direction: column;
  }

  .iam-group-row-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
