/* Compact role permission dialog: one quiet block per area, small checkboxes in two columns. */
#tenantRoleDialog { width: min(640px, calc(100vw - 32px)); max-width: none; }
#tenantRoleDialog .dialog-card { width: 100%; }
#tenantRoleDialog .tenant-role-head { display: flex; align-items: end; gap: 12px; }
#tenantRoleDialog .tenant-role-head label:first-child { flex: 1; }
#tenantRoleDialog .tenant-role-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 400; cursor: pointer; white-space: nowrap; }
#tenantRoleDialog .tenant-role-check input { width: 16px; height: 16px; min-height: 0; margin: 0; flex: none; }
#tenantRoleDialog .tenant-role-areas { display: grid; gap: 8px; margin-top: 12px; max-height: min(60vh, 520px); overflow: auto; }
#tenantRoleDialog .tenant-role-area { border: 1px solid var(--color-border, #dfe5ee); border-radius: 8px; padding: 8px 12px; }
#tenantRoleDialog .tenant-role-area-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#tenantRoleDialog .tenant-role-area-head strong { font-size: 14px; }
#tenantRoleDialog .tenant-role-area-head select { width: auto; min-width: 11rem; padding-block: 4px; font-size: 13px; }
#tenantRoleDialog .tenant-role-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin-top: 8px; }
#tenantRoleDialog .tenant-role-actions .muted { font-size: 12px; }
@media (max-width: 560px) { #tenantRoleDialog .tenant-role-actions { grid-template-columns: 1fr; } }

/* Role overview: the permission summary takes the free width, the other columns fit their content. */
.tenant-roles-table { width: 100%; min-width: 0 !important; }
.tenant-roles-table th:nth-child(1) { width: 18%; }
.tenant-roles-table th:nth-child(n+3), .tenant-roles-table td:nth-child(n+3) { width: 1%; white-space: nowrap; }
/* Each area is a line of its own that wraps inside the cell, so the table never outgrows its card. */
.tenant-roles-table td:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.tenant-roles-table .tenant-role-summary { display: block; white-space: normal; font-size: 13px; line-height: 1.4; }

/* Phone: every role is a block (name, permissions, then count, state and action) instead of a table to scroll sideways. */
@media (max-width: 640px) {
  .tenant-roles-table, .tenant-roles-table tbody { display: block; width: 100%; min-width: 0 !important; }
  .tenant-roles-table thead { display: none; }
  .tenant-roles-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border, #dfe5ee); background: none; }
  .tenant-roles-table td { display: block; width: max-content !important; max-width: 100%; padding: 0 !important; border: 0; background: none !important; box-sizing: border-box; flex: 0 0 auto; }
  .tenant-roles-table td:nth-child(1), .tenant-roles-table td:nth-child(2) { flex: 0 0 100%; width: 100% !important; }
  .tenant-roles-table td:nth-child(3)::before { content: "Uživatelé: "; color: var(--color-text-muted, #5a6b82); }
  .tenant-roles-table td:last-child { margin-left: auto; }
}
