/* IAM embedded panel + hash view */
.app.view-iam {
  grid-template-columns: 220px 1fr;
  grid-template-areas:
    "sidebar top"
    "sidebar iam";
}
.app.view-iam .inbox-panel,
.app.view-iam .chat-panel,
.app.view-iam .profile-panel {
  display: none !important;
}
.iam-panel {
  grid-area: iam;
  background: var(--bg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  min-height: 0;
}
.app.view-iam .iam-panel {
  display: flex;
}
.iam-body {
  padding: 16px 20px 28px;
  overflow-y: auto;
  flex: 1;
}
.iam-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.iam-card h3 { margin: 0 0 12px; font-size: 16px; }
.iam-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.iam-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; margin-bottom: 8px; }
.iam-field label { font-size: 12px; color: var(--muted); }
.iam-field input {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px;
}
.roles-box { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 8px 0; }
.roles-box label { font-size: 13px; display: flex; align-items: center; gap: 6px; color: #334155; }
.iam-table { width: 100%; border-collapse: collapse; background: #fff; }
.iam-table th, .iam-table td {
  border: 1px solid var(--border); padding: 8px 10px; font-size: 13px; text-align: left; vertical-align: middle;
}
.iam-table th { background: #f8fafc; }
.iam-table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.iam-table .actions button { padding: 5px 8px; font-size: 12px; }
.err { color: #be123c; min-height: 18px; margin: 0 0 10px; font-size: 13px; }
.ok { color: #047857; min-height: 18px; margin: 0 0 10px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #e2e8f0; color: #334155;
}
.status-badge.active { background: #d1fae5; color: #065f46; }
.status-badge.disabled, .status-badge.locked { background: #fee2e2; color: #9f1239; }
.btn.danger { background: #be123c; color: #fff; border: 0; }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.logout-link:hover { color: var(--text); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 460px; background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.modal h3 { margin: 0 0 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.iam-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.iam-card-head h3 { margin: 0; font-size: 16px; }
.iam-matrix-wrap { overflow: auto; max-height: 480px; border: 1px solid var(--border); border-radius: 8px; }
.iam-matrix th, .iam-matrix td { white-space: nowrap; }
.iam-matrix th.sticky-col, .iam-matrix td.sticky-col {
  position: sticky; left: 0; background: #fff; z-index: 1; min-width: 220px;
}
.iam-matrix thead th.sticky-col { background: #f8fafc; z-index: 2; }
.iam-matrix input[type="checkbox"] { width: 16px; height: 16px; }
.iam-custom-roles { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.iam-custom-roles .role-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; background: #f8fafc;
}
.composer[data-disabled="1"], .header-actions[data-disabled="1"] { opacity: 0.45; pointer-events: none; }

@media (max-width: 1100px) {
  .app.view-iam {
    grid-template-columns: 200px 1fr;
  }
}
