auth

Main authentication module for my projects
git clone git://git.finwo.net/app/auth
Log | Files | Refs

admin-realms.html (49697B)


      1 <!doctype html>
      2 <html lang="en">
      3   <head>
      4     <meta charset="utf-8" />
      5     <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
      6     <title>Admin realms mockup</title>
      7     <link rel="stylesheet" href="../../app/shared/style/global.css" />
      8     <link rel="stylesheet" href="../../app/shared/component/user-menu.css" />
      9     <link rel="stylesheet" href="./mockups.css" />
     10   </head>
     11   <body>
     12     <header class="topbar">
     13       <a class="brand" href="./admin-dashboard.html">
     14         <svg class="brand-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     15           <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
     16         </svg>
     17         <span class="brand-name">Auth</span>
     18       </a>
     19       <div class="topbar-actions">
     20         <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation">
     21           <span class="mobile-nav-toggle-bars" aria-hidden="true"></span>
     22         </button>
     23         <details class="menu user-menu">
     24           <summary class="menu-trigger" aria-label="Account menu">
     25             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     26               <circle cx="12" cy="12" r="10" />
     27               <circle cx="12" cy="10" r="3" />
     28               <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" />
     29             </svg>
     30           </summary>
     31           <div class="menu-panel">
     32             <div class="menu-heading">
     33               <span class="menu-heading-title">System Admin</span>
     34               <span class="menu-heading-meta">admin@system.test</span>
     35             </div>
     36             <div class="menu-list">
     37               <a class="menu-item" href="#">
     38                 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     39                   <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
     40                   <circle cx="12" cy="12" r="3" />
     41                 </svg>
     42                 <span>Account settings</span>
     43               </a>
     44               <button class="menu-item" type="button" data-user-theme>
     45                 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     46                   <circle cx="12" cy="12" r="4" />
     47                   <path d="M12 2v2" />
     48                   <path d="M12 20v2" />
     49                   <path d="m4.93 4.93 1.41 1.41" />
     50                   <path d="m17.66 17.66 1.41 1.41" />
     51                   <path d="M2 12h2" />
     52                   <path d="M20 12h2" />
     53                   <path d="m6.34 17.66-1.41 1.41" />
     54                   <path d="m19.07 4.93-1.41 1.41" />
     55                 </svg>
     56                 <span>Theme</span>
     57                 <span class="menu-value" data-user-theme-value>Auto</span>
     58               </button>
     59               <a class="menu-item" href="#">
     60                 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     61                   <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
     62                   <path d="m16 17 5-5-5-5" />
     63                   <path d="M21 12H9" />
     64                 </svg>
     65                 <span>Sign out</span>
     66               </a>
     67             </div>
     68           </div>
     69         </details>
     70       </div>
     71     </header>
     72 
     73     <div class="mobile-nav" id="mobile-navigation" aria-hidden="true">
     74       <nav class="nav" aria-label="Administration">
     75         <p class="nav-label">Administration</p>
     76         <a class="nav-item" href="./admin-dashboard.html">
     77           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     78             <rect x="3" y="3" width="7" height="7" />
     79             <rect x="14" y="3" width="7" height="7" />
     80             <rect x="3" y="14" width="7" height="7" />
     81             <rect x="14" y="14" width="7" height="7" />
     82           </svg>
     83           <span>Overview</span>
     84         </a>
     85         <a class="nav-item is-active" data-realm-nav href="./admin-realms.html" aria-current="page">
     86           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     87             <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
     88             <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
     89             <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
     90             <path d="M10 6h4" />
     91             <path d="M10 10h4" />
     92             <path d="M10 14h4" />
     93             <path d="M10 18h4" />
     94           </svg>
     95           <span data-realm-nav-label>Realms</span>
     96         </a>
     97         <a class="nav-item" href="./admin-clients.html">
     98           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
     99             <rect x="2" y="4" width="20" height="16" rx="2" />
    100             <path d="M10 4v4" />
    101             <path d="M2 8h20" />
    102             <path d="M6 4v4" />
    103           </svg>
    104           <span>Clients</span>
    105         </a>
    106         <a class="nav-item" href="#">
    107           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    108             <path d="M22 12h-4l-3 8-6-16-3 8H2" />
    109           </svg>
    110           <span>Sessions</span>
    111         </a>
    112         <a class="nav-item" href="./admin-users.html">
    113           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    114             <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" />
    115             <circle cx="12" cy="7" r="4" />
    116           </svg>
    117           <span>Users</span>
    118         </a>
    119         <a class="nav-item" data-settings-nav href="./admin-system-settings.html">
    120           <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    121             <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
    122             <circle cx="12" cy="12" r="3" />
    123           </svg>
    124           <span>Settings</span>
    125         </a>
    126       </nav>
    127       <div class="mobile-nav-divider" aria-hidden="true"></div>
    128       <section class="mobile-nav-account" aria-label="Account">
    129         <div class="menu-heading">
    130           <span class="menu-heading-title">System Admin</span>
    131           <span class="menu-heading-meta">admin@system.test</span>
    132         </div>
    133         <div class="menu-list">
    134           <a class="menu-item" href="#">
    135             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    136               <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
    137               <circle cx="12" cy="12" r="3" />
    138             </svg>
    139             <span>Account settings</span>
    140           </a>
    141           <button class="menu-item" type="button" data-user-theme>
    142             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    143               <circle cx="12" cy="12" r="4" />
    144               <path d="M12 2v2" />
    145               <path d="M12 20v2" />
    146               <path d="m4.93 4.93 1.41 1.41" />
    147               <path d="m17.66 17.66 1.41 1.41" />
    148               <path d="M2 12h2" />
    149               <path d="M20 12h2" />
    150               <path d="m6.34 17.66-1.41 1.41" />
    151               <path d="m19.07 4.93-1.41 1.41" />
    152             </svg>
    153             <span>Theme</span>
    154             <span class="menu-value" data-user-theme-value>Auto</span>
    155           </button>
    156           <a class="menu-item" href="#">
    157             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    158               <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
    159               <path d="m16 17 5-5-5-5" />
    160               <path d="M21 12H9" />
    161             </svg>
    162             <span>Sign out</span>
    163           </a>
    164         </div>
    165       </section>
    166     </div>
    167 
    168     <div class="app">
    169       <aside class="sidebar">
    170         <nav class="nav" aria-label="Administration">
    171           <p class="nav-label">Administration</p>
    172           <a class="nav-item" href="./admin-dashboard.html">
    173             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    174               <rect x="3" y="3" width="7" height="7" />
    175               <rect x="14" y="3" width="7" height="7" />
    176               <rect x="3" y="14" width="7" height="7" />
    177               <rect x="14" y="14" width="7" height="7" />
    178             </svg>
    179             <span>Overview</span>
    180           </a>
    181           <a class="nav-item is-active" data-realm-nav href="./admin-realms.html" aria-current="page">
    182             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    183               <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
    184               <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
    185               <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
    186               <path d="M10 6h4" />
    187               <path d="M10 10h4" />
    188               <path d="M10 14h4" />
    189               <path d="M10 18h4" />
    190             </svg>
    191             <span data-realm-nav-label>Realms</span>
    192           </a>
    193           <a class="nav-item" href="./admin-clients.html">
    194             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    195               <rect x="2" y="4" width="20" height="16" rx="2" />
    196               <path d="M10 4v4" />
    197               <path d="M2 8h20" />
    198               <path d="M6 4v4" />
    199             </svg>
    200             <span>Clients</span>
    201           </a>
    202           <a class="nav-item" href="#">
    203             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    204               <path d="M22 12h-4l-3 8-6-16-3 8H2" />
    205             </svg>
    206             <span>Sessions</span>
    207           </a>
    208           <a class="nav-item" href="./admin-users.html">
    209             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    210               <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" />
    211               <circle cx="12" cy="7" r="4" />
    212             </svg>
    213             <span>Users</span>
    214           </a>
    215           <a class="nav-item" data-settings-nav href="./admin-system-settings.html">
    216             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    217               <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
    218               <circle cx="12" cy="12" r="3" />
    219             </svg>
    220             <span>Settings</span>
    221           </a>
    222         </nav>
    223       </aside>
    224 
    225       <div class="main">
    226         <main class="content">
    227           <div class="page-header">
    228             <div class="breadcrumb">
    229               <span id="realm-breadcrumb-root" aria-current="page">Realms</span>
    230             </div>
    231             <h1 id="realm-page-title">Realms</h1>
    232             <p>Realm registry and administrative access.</p>
    233           </div>
    234 
    235           <div id="realm-notice" class="notice" role="status" hidden></div>
    236 
    237           <section class="card" aria-labelledby="realm-table-title">
    238             <h2 id="realm-table-title" class="sr-only">Realm registry</h2>
    239             <div class="toolbar toolbar-panel">
    240               <div class="toolbar-search">
    241                 <input id="realm-search" type="search" aria-label="Search realms" placeholder="Search realms" />
    242               </div>
    243               <div class="toolbar-actions">
    244                 <button id="realm-register-button" class="button button-primary" type="button">Register realm</button>
    245               </div>
    246             </div>
    247 
    248             <table class="table table-linkable">
    249               <thead>
    250                 <tr>
    251                   <th scope="col"><span class="sr-only">Realm</span></th>
    252                   <th scope="col">Realm</th>
    253                   <th scope="col">Owner</th>
    254                   <th scope="col">Actions</th>
    255                 </tr>
    256               </thead>
    257               <tbody id="realm-rows">
    258                   <tr
    259                     class="realm-row"
    260                     tabindex="0"
    261                     data-row-href="./admin-settings.html"
    262                     data-roles="system owner"
    263                     data-delete-roles="system owner"
    264                     data-owners='{"system":{"name":"Acme IT","meta":"it@acme.test"},"owner":{"name":"Realm Owner","meta":"owner@acme.test"},"admin":{"name":"Acme IT","meta":"it@acme.test"}}'
    265                   >
    266                     <td>
    267                       <span class="table-icon" aria-hidden="true">
    268                         <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    269                           <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
    270                           <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
    271                           <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
    272                           <path d="M10 6h4" />
    273                           <path d="M10 10h4" />
    274                           <path d="M10 14h4" />
    275                           <path d="M10 18h4" />
    276                         </svg>
    277                       </span>
    278                     </td>
    279                     <td>
    280                       <span class="table-title"><a class="link realm-display" href="./admin-settings.html">Acme</a></span>
    281                       <span class="realm-meta">
    282                         <span class="realm-slug table-mono">acme</span>
    283                         <span class="realm-count">6 members</span>
    284                         <a class="realm-count realm-count-link" data-count-kind="hosts" href="./admin-realm-hosts.html?realm=acme">2 hosts</a>
    285                         <a class="realm-count realm-count-link" data-count-kind="domains" href="./admin-realm-email-domains.html?realm=acme">3 domains</a>
    286                         <span class="realm-count">4 clients</span>
    287                       </span>
    288                     </td>
    289                     <td data-label="Owner">
    290                       <span class="realm-owner-name table-title">Acme IT</span>
    291                       <span class="realm-owner-meta table-sub">it@acme.test</span>
    292                     </td>
    293                     <td data-label="Actions">
    294                       <button class="button-inline button-danger" type="button" data-delete-realm>Delete realm</button>
    295                     </td>
    296                   </tr>
    297                   <tr
    298                     class="realm-row"
    299                     tabindex="0"
    300                     data-row-href="./admin-settings.html"
    301                     data-roles="system admin"
    302                     data-delete-roles="system"
    303                     data-owners='{"system":{"name":"Globex IT","meta":"it@globex.test"},"admin":{"name":"Globex IT","meta":"it@globex.test"}}'
    304                   >
    305                     <td>
    306                       <span class="table-icon" aria-hidden="true">
    307                         <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    308                           <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
    309                           <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
    310                           <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
    311                           <path d="M10 6h4" />
    312                           <path d="M10 10h4" />
    313                           <path d="M10 14h4" />
    314                           <path d="M10 18h4" />
    315                         </svg>
    316                       </span>
    317                     </td>
    318                     <td>
    319                       <span class="table-title"><a class="link realm-display" href="./admin-settings.html">Globex</a></span>
    320                       <span class="realm-meta">
    321                         <span class="realm-slug table-mono">globex</span>
    322                         <span class="realm-count">5 members</span>
    323                         <a class="realm-count realm-count-link" data-count-kind="hosts" href="./admin-realm-hosts.html?realm=globex">1 host</a>
    324                         <a class="realm-count realm-count-link" data-count-kind="domains" href="./admin-realm-email-domains.html?realm=globex">1 domain</a>
    325                         <span class="realm-count">2 clients</span>
    326                       </span>
    327                     </td>
    328                     <td data-label="Owner">
    329                       <span class="realm-owner-name table-title">Globex IT</span>
    330                       <span class="realm-owner-meta table-sub">it@globex.test</span>
    331                     </td>
    332                     <td data-label="Actions">
    333                       <button class="button-inline button-danger" type="button" data-delete-realm>Delete realm</button>
    334                     </td>
    335                   </tr>
    336                   <tr
    337                     class="realm-row"
    338                     tabindex="0"
    339                     data-row-href="./admin-settings.html"
    340                     data-roles="system"
    341                     data-delete-roles="system"
    342                     data-owners='{"system":{"name":"Unassigned","meta":"No owner assigned"}}'
    343                   >
    344                     <td>
    345                       <span class="table-icon" aria-hidden="true">
    346                         <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    347                           <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
    348                           <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
    349                           <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
    350                           <path d="M10 6h4" />
    351                           <path d="M10 10h4" />
    352                           <path d="M10 14h4" />
    353                           <path d="M10 18h4" />
    354                         </svg>
    355                       </span>
    356                     </td>
    357                     <td>
    358                       <span class="table-title"><a class="link realm-display" href="./admin-settings.html">Northwind</a></span>
    359                       <span class="realm-meta">
    360                         <span class="realm-slug table-mono">northwind</span>
    361                         <span class="realm-count">0 members</span>
    362                         <a class="realm-count realm-count-link" data-count-kind="hosts" href="./admin-realm-hosts.html?realm=northwind">0 hosts</a>
    363                         <a class="realm-count realm-count-link" data-count-kind="domains" href="./admin-realm-email-domains.html?realm=northwind">0 domains</a>
    364                         <span class="realm-count">0 clients</span>
    365                       </span>
    366                     </td>
    367                     <td data-label="Owner">
    368                       <span class="realm-owner-name table-title">Unassigned</span>
    369                       <span class="realm-owner-meta table-sub">No owner assigned</span>
    370                     </td>
    371                     <td data-label="Actions">
    372                       <button class="button-inline button-danger" type="button" data-delete-realm>Delete realm</button>
    373                     </td>
    374                   </tr>
    375                 </tbody>
    376               </table>
    377               <div id="realm-search-empty" class="empty" hidden>
    378                 <p>No realms match this search.</p>
    379               </div>
    380               <div id="realm-empty" class="empty" hidden>
    381                 <p>No realms are available for this account.</p>
    382               </div>
    383             </div>
    384           </section>
    385 
    386           <section class="state-preview">
    387             <h2>Loading state</h2>
    388             <div class="panel" aria-busy="true">
    389               <div class="skeleton skeleton-title"></div>
    390               <div class="skeleton"></div>
    391               <div class="skeleton skeleton-short"></div>
    392               <div class="skeleton"></div>
    393               <div class="skeleton skeleton-short"></div>
    394             </div>
    395           </section>
    396 
    397           <section class="state-preview">
    398             <h2>Empty state</h2>
    399             <div class="card">
    400               <div class="toolbar toolbar-panel">
    401                 <div class="toolbar-search">
    402                   <input type="search" aria-label="Search realms" placeholder="Search realms" disabled />
    403                 </div>
    404                 <div class="toolbar-actions">
    405                   <button class="button button-primary" type="button">Register realm</button>
    406                 </div>
    407               </div>
    408               <p class="empty">No realms are available for this account.</p>
    409             </div>
    410           </section>
    411         </main>
    412       </div>
    413     </div>
    414 
    415     <div id="realm-create-dialog" class="overlay" hidden>
    416       <form id="realm-create-form" class="modal" role="dialog" aria-modal="true" aria-labelledby="realm-create-title" novalidate>
    417         <div class="modal-header">
    418           <h2 id="realm-create-title">Register a realm</h2>
    419           <button class="modal-close" type="button" aria-label="Close dialog" data-dialog-close>
    420             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    421               <path d="M18 6 6 18" />
    422               <path d="m6 6 12 12" />
    423             </svg>
    424           </button>
    425         </div>
    426         <div class="modal-body">
    427           <div id="realm-create-alert" class="alert" role="alert" hidden></div>
    428 
    429           <label class="field" for="realm-display-name">
    430             <span class="field-label">Display name</span>
    431             <input id="realm-display-name" class="field-control" type="text" maxlength="100" placeholder="Acme Inc" />
    432           </label>
    433 
    434           <label class="field" for="realm-slug-input">
    435             <span class="field-label">Realm ID</span>
    436             <input id="realm-slug-input" class="field-control" type="text" maxlength="63" placeholder="acme" spellcheck="false" />
    437           </label>
    438           <p class="modal-note">Lowercase letters, numbers and hyphens. admin, account and global are reserved.</p>
    439 
    440           <div class="grid">
    441             <label class="field" for="realm-logo-url">
    442               <span class="field-label">Logo URL</span>
    443               <input id="realm-logo-url" class="field-control" type="text" placeholder="https://app.example.test/logo.svg" maxlength="2048" />
    444             </label>
    445 
    446             <label class="field" for="realm-primary-color">
    447               <span class="field-label">Primary color</span>
    448               <input id="realm-primary-color" class="field-control" type="text" placeholder="#25a" maxlength="7" spellcheck="false" />
    449             </label>
    450           </div>
    451 
    452           <div class="branding-preview" aria-hidden="true">
    453             <span class="branding-logo-preview is-empty" id="realm-logo-preview"></span>
    454             <span class="branding-color-preview is-empty" id="realm-color-preview"></span>
    455           </div>
    456 
    457           <div class="modal-actions">
    458             <button class="button button-secondary" type="button" data-dialog-close>Cancel</button>
    459             <button class="button button-primary" type="submit">Create realm</button>
    460           </div>
    461         </div>
    462       </form>
    463     </div>
    464 
    465     <div id="realm-delete-dialog" class="overlay" hidden>
    466       <div class="modal" role="dialog" aria-modal="true" aria-labelledby="realm-delete-title">
    467         <div class="modal-header">
    468           <h2 id="realm-delete-title">Delete realm</h2>
    469           <button class="modal-close" type="button" aria-label="Close dialog" data-dialog-close>
    470             <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
    471               <path d="M18 6 6 18" />
    472               <path d="m6 6 12 12" />
    473             </svg>
    474           </button>
    475         </div>
    476         <div class="modal-body">
    477           <p id="realm-delete-message" class="modal-note"></p>
    478           <label class="field" for="realm-delete-confirm">
    479             <span class="field-label">Confirm realm ID</span>
    480             <input id="realm-delete-confirm" class="field-control" type="text" maxlength="63" autocomplete="off" spellcheck="false" />
    481           </label>
    482           <p class="modal-note">Type the realm ID exactly to confirm.</p>
    483           <div class="modal-actions">
    484             <button class="button button-secondary" type="button" data-dialog-close>Cancel</button>
    485             <button id="realm-delete-confirm-button" class="button button-danger" type="button" disabled>Delete realm</button>
    486           </div>
    487         </div>
    488       </div>
    489     </div>
    490 
    491     <div class="mockup-controls" aria-label="Mockup controls">
    492       <span class="mockup-label">Mockup</span>
    493       <button class="mockup-button is-active" type="button" data-theme-target="auto">Auto</button>
    494       <button class="mockup-button" type="button" data-theme-target="light">Light</button>
    495       <button class="mockup-button" type="button" data-theme-target="dark">Dark</button>
    496       <span class="mockup-separator" aria-hidden="true"></span>
    497       <span class="mockup-label">View as</span>
    498       <button class="mockup-button is-active" type="button" data-role-target="system" aria-pressed="true">System admin</button>
    499       <button class="mockup-button" type="button" data-role-target="owner" aria-pressed="false">Realm owner</button>
    500       <button class="mockup-button" type="button" data-role-target="admin" aria-pressed="false">Realm admin</button>
    501     </div>
    502 
    503     <script>
    504       const root = document.documentElement;
    505       const themeButtons = document.querySelectorAll('[data-theme-target]');
    506       const userThemeButtons = document.querySelectorAll('[data-user-theme]');
    507       const userThemeValues = document.querySelectorAll('[data-user-theme-value]');
    508       let currentTheme = 'auto';
    509 
    510       function setTheme(value) {
    511         currentTheme = value;
    512         if (value === 'auto') {
    513           root.removeAttribute('data-theme');
    514         } else {
    515           root.setAttribute('data-theme', value);
    516         }
    517 
    518         themeButtons.forEach((button) => {
    519           button.classList.toggle('is-active', button.dataset.themeTarget === value);
    520         });
    521         userThemeValues.forEach((element) => {
    522           element.textContent = value.charAt(0).toUpperCase() + value.slice(1);
    523         });
    524 
    525         if (typeof refreshRealmLinks === 'function') refreshRealmLinks();
    526       }
    527 
    528       themeButtons.forEach((button) => {
    529         button.addEventListener('click', () => setTheme(button.dataset.themeTarget));
    530       });
    531 
    532       userThemeButtons.forEach((button) => {
    533         button.addEventListener('click', () => {
    534           const themes = ['auto', 'light', 'dark'];
    535           setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]);
    536         });
    537       });
    538 
    539       const userMenu = document.querySelector('.user-menu');
    540       document.addEventListener('click', (event) => {
    541         if (userMenu && userMenu.open && !userMenu.contains(event.target)) {
    542           userMenu.open = false;
    543         }
    544       });
    545 
    546       document.querySelectorAll('[data-dialog-close]').forEach((button) => {
    547         button.addEventListener('click', () => {
    548           button.closest('.overlay').hidden = true;
    549         });
    550       });
    551 
    552       document.querySelectorAll('.overlay').forEach((overlay) => {
    553         overlay.addEventListener('mousedown', (event) => {
    554           if (event.target === overlay) overlay.hidden = true;
    555         });
    556       });
    557 
    558       document.addEventListener('keydown', (event) => {
    559         if (event.key === 'Escape') {
    560           document.querySelectorAll('.overlay:not([hidden])').forEach((dialog) => {
    561             dialog.hidden = true;
    562           });
    563         }
    564       });
    565 
    566       const identities = {
    567         system: {
    568           name: 'System Admin',
    569           email: 'admin@system.test',
    570         },
    571         owner: {
    572           name: 'Realm Owner',
    573           email: 'owner@acme.test',
    574         },
    575         admin: {
    576           name: 'Realm Admin',
    577           email: 'realm-admin@managed.test',
    578         },
    579       };
    580 
    581       const currentRole = { value: 'system' };
    582       const roleButtons = document.querySelectorAll('[data-role-target]');
    583       const registerButton = document.getElementById('realm-register-button');
    584       const searchInput = document.getElementById('realm-search');
    585       const searchEmpty = document.getElementById('realm-search-empty');
    586       const realmEmpty = document.getElementById('realm-empty');
    587       const realmRows = document.getElementById('realm-rows');
    588       const notice = document.getElementById('realm-notice');
    589 
    590       function realmRowList() {
    591         return [...realmRows.querySelectorAll('.realm-row')];
    592       }
    593 
    594       function searchableRealmText(row) {
    595         return [...row.querySelectorAll('.realm-display,.realm-slug,.realm-count,.realm-owner-name,.realm-owner-meta')]
    596           .map((element) => element.textContent)
    597           .join(' ')
    598           .toLowerCase();
    599       }
    600 
    601       const realmNavLinks = document.querySelectorAll('[data-realm-nav]');
    602       const realmNavLabels = document.querySelectorAll('[data-realm-nav-label]');
    603       const settingsNavLinks = document.querySelectorAll('[data-settings-nav]');
    604       const realmBreadcrumbRoot = document.getElementById('realm-breadcrumb-root');
    605       const realmPageTitle = document.getElementById('realm-page-title');
    606 
    607       function accessibleRealmCount() {
    608         return realmRowList().filter((row) => (row.dataset.roles || '').split(' ').includes(currentRole.value)).length;
    609       }
    610 
    611       function applySearch() {
    612         const term = searchInput.value.trim().toLowerCase();
    613         let roleCount = 0;
    614         let visibleCount = 0;
    615 
    616         realmRowList().forEach((row) => {
    617           const roleVisible = (row.dataset.roles || '').split(' ').includes(currentRole.value);
    618           if (roleVisible) roleCount += 1;
    619 
    620           const termVisible = !term || searchableRealmText(row).includes(term);
    621           row.hidden = !(roleVisible && termVisible);
    622           if (!row.hidden) visibleCount += 1;
    623         });
    624 
    625         searchEmpty.hidden = roleCount === 0 || visibleCount !== 0;
    626         realmEmpty.hidden = roleCount !== 0;
    627       }
    628 
    629       function updateRealmNavigation() {
    630         const count = accessibleRealmCount();
    631         const label = count === 1 ? 'Realm' : 'Realms';
    632         const href = count === 1 ? './admin-settings.html' : './admin-realms.html';
    633 
    634         realmNavLinks.forEach((link) => {
    635           link.href = href;
    636           link.classList.toggle('is-active', count !== 1);
    637           if (count === 1) {
    638             link.removeAttribute('aria-current');
    639           } else {
    640             link.setAttribute('aria-current', 'page');
    641           }
    642         });
    643         realmNavLabels.forEach((labelElement) => {
    644           labelElement.textContent = label;
    645         });
    646         if (realmBreadcrumbRoot) realmBreadcrumbRoot.textContent = label;
    647         if (realmPageTitle) realmPageTitle.textContent = label;
    648         settingsNavLinks.forEach((link) => {
    649           link.hidden = currentRole.value !== 'system';
    650         });
    651         refreshRealmLinks();
    652       }
    653 
    654       const countLinkTargets = {
    655         hosts: './admin-realm-hosts.html',
    656         domains: './admin-realm-email-domains.html',
    657       };
    658 
    659       function refreshRealmLinks() {
    660         realmRowList().forEach((row) => {
    661           const slugEl = row.querySelector('.realm-slug');
    662           if (!slugEl) return;
    663           const slug = slugEl.textContent.trim();
    664           row.querySelectorAll('[data-count-kind]').forEach((link) => {
    665             const target = countLinkTargets[link.dataset.countKind];
    666             if (!target) return;
    667             const params = new URLSearchParams();
    668             params.set('realm', slug);
    669             params.set('role', currentRole.value);
    670             if (currentTheme !== 'auto') params.set('theme', currentTheme);
    671             link.setAttribute('href', `${target}?${params.toString()}`);
    672           });
    673         });
    674       }
    675 
    676       function setRole(role) {
    677         currentRole.value = role;
    678         const identity = identities[role];
    679 
    680         document.querySelectorAll('.menu-heading-title').forEach((element) => {
    681           element.textContent = identity.name;
    682         });
    683         document.querySelectorAll('.menu-heading-meta').forEach((element) => {
    684           element.textContent = identity.email;
    685         });
    686 
    687         roleButtons.forEach((button) => {
    688           const active = button.dataset.roleTarget === role;
    689           button.classList.toggle('is-active', active);
    690           button.setAttribute('aria-pressed', String(active));
    691         });
    692 
    693         registerButton.hidden = role !== 'system';
    694 
    695         realmRowList().forEach((row) => {
    696           let owners = {};
    697           try {
    698             owners = JSON.parse(row.dataset.owners || '{}');
    699           } catch {
    700             owners = {};
    701           }
    702 
    703           const owner = owners[role];
    704           if (owner) {
    705             row.querySelector('.realm-owner-name').textContent = owner.name;
    706             row.querySelector('.realm-owner-meta').textContent = owner.meta;
    707           }
    708 
    709           const canDelete = (row.dataset.deleteRoles || '').split(' ').includes(role);
    710           row.querySelectorAll('[data-delete-realm]').forEach((button) => {
    711             button.hidden = !canDelete;
    712           });
    713         });
    714 
    715         applySearch();
    716         updateRealmNavigation();
    717       }
    718 
    719       roleButtons.forEach((button) => {
    720         button.addEventListener('click', () => setRole(button.dataset.roleTarget));
    721       });
    722 
    723       const createDialog = document.getElementById('realm-create-dialog');
    724       const createForm = document.getElementById('realm-create-form');
    725       const createAlert = document.getElementById('realm-create-alert');
    726       const displayNameInput = document.getElementById('realm-display-name');
    727       const slugInput = document.getElementById('realm-slug-input');
    728       const logoUrlInput = document.getElementById('realm-logo-url');
    729       const primaryColorInput = document.getElementById('realm-primary-color');
    730       const logoPreview = document.getElementById('realm-logo-preview');
    731       const colorPreview = document.getElementById('realm-color-preview');
    732 
    733       const existingSlugs = new Set(
    734         realmRowList().map((row) => row.querySelector('.realm-slug').textContent.trim())
    735       );
    736       const reservedSlugs = new Set(['admin', 'account', 'global']);
    737       const slugPattern = /^[a-z0-9][a-z0-9-]*$/;
    738       const colorPattern = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
    739       let slugTouched = false;
    740 
    741       function slugify(value) {
    742         return value
    743           .trim()
    744           .toLowerCase()
    745           .replace(/[^a-z0-9]+/g, '-')
    746           .replace(/^-+|-+$/g, '')
    747           .slice(0, 63);
    748       }
    749 
    750       function isLoopbackHostname(hostname) {
    751         const host = hostname.startsWith('[') && hostname.endsWith(']')
    752           ? hostname.slice(1, -1)
    753           : hostname;
    754         return host === 'localhost' || host.endsWith('.localhost') || host === '127.0.0.1' || host === '::1';
    755       }
    756 
    757       function logoUrlError(value) {
    758         const url = value.trim();
    759         if (!url) return null;
    760         if (url.length > 2048) return 'Logo URL must be 2048 characters or fewer.';
    761         if (url.includes('*')) return 'Logo URL cannot contain wildcards.';
    762 
    763         let parsed;
    764         try {
    765           parsed = new URL(url);
    766         } catch {
    767           return 'Logo URL must be absolute.';
    768         }
    769 
    770         const allowedProtocol =
    771           parsed.protocol === 'https:' ||
    772           (parsed.protocol === 'http:' && isLoopbackHostname(parsed.hostname));
    773         if (!allowedProtocol) return 'Logo URL must use https, or http for a loopback host.';
    774         if (parsed.username || parsed.password) return 'Logo URL cannot contain credentials.';
    775         if (parsed.hash) return 'Logo URL cannot contain a fragment.';
    776         return null;
    777       }
    778 
    779       function normalizedColor(value) {
    780         const color = value.trim().toLowerCase();
    781         if (!colorPattern.test(color)) return '';
    782         if (color.length === 4) {
    783           return `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}`;
    784         }
    785         return color;
    786       }
    787 
    788       function updateCreatePreview() {
    789         const color = normalizedColor(primaryColorInput.value);
    790         colorPreview.classList.toggle('is-empty', !color);
    791         if (color) {
    792           colorPreview.style.background = color;
    793         } else {
    794           colorPreview.style.background = '';
    795         }
    796 
    797         const logo = logoUrlInput.value.trim();
    798         const logoValid = Boolean(logo) && !logoUrlError(logo);
    799         logoPreview.classList.toggle('is-empty', !logoValid);
    800         logoPreview.replaceChildren();
    801         if (logoValid) {
    802           const image = document.createElement('img');
    803           image.alt = '';
    804           image.src = logo;
    805           image.addEventListener('error', () => {
    806             image.style.visibility = 'hidden';
    807           });
    808           logoPreview.appendChild(image);
    809         }
    810       }
    811 
    812       function clearCreateErrors() {
    813         createAlert.hidden = true;
    814         createAlert.textContent = '';
    815         [displayNameInput, slugInput, logoUrlInput, primaryColorInput].forEach((field) => {
    816           field.removeAttribute('aria-invalid');
    817         });
    818       }
    819 
    820       function showCreateError(message, field) {
    821         createAlert.hidden = false;
    822         createAlert.textContent = message;
    823         [displayNameInput, slugInput, logoUrlInput, primaryColorInput].forEach((candidate) => {
    824           candidate.removeAttribute('aria-invalid');
    825         });
    826         if (field) field.setAttribute('aria-invalid', 'true');
    827       }
    828 
    829       function validateCreate() {
    830         const displayName = displayNameInput.value.trim();
    831         const slug = slugInput.value.trim().toLowerCase();
    832         const logo = logoUrlInput.value.trim();
    833         const color = primaryColorInput.value.trim();
    834 
    835         if (!displayName) {
    836           return { ok: false, message: 'Display name is required.', field: displayNameInput };
    837         }
    838         if (/[\r\n]/.test(displayNameInput.value)) {
    839           return { ok: false, message: 'Display name must be a single line.', field: displayNameInput };
    840         }
    841         if (displayName.length > 100) {
    842           return { ok: false, message: 'Display name must be 100 characters or fewer.', field: displayNameInput };
    843         }
    844         if (!slug) {
    845           return { ok: false, message: 'Realm ID is required.', field: slugInput };
    846         }
    847         if (!slugPattern.test(slug)) {
    848           return {
    849             ok: false,
    850             message: 'Realm ID must use lowercase letters, numbers and hyphens.',
    851             field: slugInput,
    852           };
    853         }
    854         if (slug.length > 63) {
    855           return { ok: false, message: 'Realm ID must be 63 characters or fewer.', field: slugInput };
    856         }
    857         if (reservedSlugs.has(slug)) {
    858           return { ok: false, message: `Realm ID ${slug} is reserved.`, field: slugInput };
    859         }
    860         if (existingSlugs.has(slug)) {
    861           return { ok: false, message: 'Realm ID already exists.', field: slugInput };
    862         }
    863 
    864         const logoError = logoUrlError(logo);
    865         if (logoError) {
    866           return { ok: false, message: logoError, field: logoUrlInput };
    867         }
    868         if (color && !normalizedColor(color)) {
    869           return { ok: false, message: 'Primary color must be a #rgb or #rrggbb hex color.', field: primaryColorInput };
    870         }
    871 
    872         return { ok: true, realm: { displayName, slug } };
    873       }
    874 
    875       function escapeHtml(value) {
    876         return String(value).replace(/[&<>"']/g, (character) => {
    877           const entities = {
    878             '&': '&amp;',
    879             '<': '&lt;',
    880             '>': '&gt;',
    881             '"': '&quot;',
    882             "'": '&#39;',
    883           };
    884           return entities[character];
    885         });
    886       }
    887 
    888       function addRealmRow({ displayName, slug }) {
    889         const identity = identities[currentRole.value];
    890         const row = document.createElement('tr');
    891         row.className = 'realm-row';
    892         row.tabIndex = 0;
    893         row.setAttribute('data-row-href', './admin-settings.html');
    894         row.setAttribute('data-roles', currentRole.value);
    895         row.setAttribute('data-delete-roles', currentRole.value);
    896         row.dataset.owners = JSON.stringify({
    897           [currentRole.value]: { name: identity.name, meta: identity.email },
    898         });
    899         row.innerHTML = `
    900           <td>
    901             <span class="table-icon" aria-hidden="true">
    902               <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    903                 <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
    904                 <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
    905                 <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
    906                 <path d="M10 6h4" />
    907                 <path d="M10 10h4" />
    908                 <path d="M10 14h4" />
    909                 <path d="M10 18h4" />
    910               </svg>
    911             </span>
    912           </td>
    913           <td>
    914             <span class="table-title"><a class="link realm-display" href="./admin-settings.html">${escapeHtml(displayName)}</a></span>
    915             <span class="realm-meta">
    916               <span class="realm-slug table-mono">${escapeHtml(slug)}</span>
    917               <span class="realm-count">0 members</span>
    918               <a class="realm-count realm-count-link" data-count-kind="hosts" href="./admin-realm-hosts.html?realm=${escapeHtml(slug)}">0 hosts</a>
    919               <a class="realm-count realm-count-link" data-count-kind="domains" href="./admin-realm-email-domains.html?realm=${escapeHtml(slug)}">0 domains</a>
    920               <span class="realm-count">0 clients</span>
    921             </span>
    922           </td>
    923           <td data-label="Owner">
    924             <span class="realm-owner-name table-title">${escapeHtml(identity.name)}</span>
    925             <span class="realm-owner-meta table-sub">${escapeHtml(identity.email)}</span>
    926           </td>
    927           <td data-label="Actions">
    928             <button class="button-inline button-danger" type="button" data-delete-realm>Delete realm</button>
    929           </td>`;
    930         realmRows.prepend(row);
    931       }
    932 
    933       function showNotice(message) {
    934         notice.textContent = message;
    935         notice.hidden = false;
    936       }
    937 
    938       function resetCreateForm() {
    939         createForm.reset();
    940         slugInput.value = '';
    941         slugTouched = false;
    942         clearCreateErrors();
    943         updateCreatePreview();
    944       }
    945 
    946       registerButton.addEventListener('click', () => {
    947         resetCreateForm();
    948         createDialog.hidden = false;
    949         requestAnimationFrame(() => displayNameInput.focus());
    950       });
    951 
    952       displayNameInput.addEventListener('input', () => {
    953         clearCreateErrors();
    954         if (!slugTouched) {
    955           slugInput.value = slugify(displayNameInput.value);
    956         }
    957         updateCreatePreview();
    958       });
    959 
    960       slugInput.addEventListener('input', () => {
    961         slugTouched = true;
    962         clearCreateErrors();
    963         updateCreatePreview();
    964       });
    965 
    966       logoUrlInput.addEventListener('input', () => {
    967         clearCreateErrors();
    968         updateCreatePreview();
    969       });
    970 
    971       primaryColorInput.addEventListener('input', () => {
    972         clearCreateErrors();
    973         updateCreatePreview();
    974       });
    975 
    976       createForm.addEventListener('submit', (event) => {
    977         event.preventDefault();
    978         const result = validateCreate();
    979         if (!result.ok) {
    980           showCreateError(result.message, result.field);
    981           return;
    982         }
    983 
    984         addRealmRow(result.realm);
    985         existingSlugs.add(result.realm.slug);
    986         createDialog.hidden = true;
    987         showNotice(`Realm ${result.realm.displayName} created.`);
    988         setRole(currentRole.value);
    989       });
    990 
    991       const deleteDialog = document.getElementById('realm-delete-dialog');
    992       const deleteMessage = document.getElementById('realm-delete-message');
    993       const deleteInput = document.getElementById('realm-delete-confirm');
    994       const confirmDeleteButton = document.getElementById('realm-delete-confirm-button');
    995       let pendingDeleteRow = null;
    996       let pendingDeleteSlug = '';
    997 
    998       function openDeleteDialog(row) {
    999         pendingDeleteRow = row;
   1000         pendingDeleteSlug = row.querySelector('.realm-slug').textContent.trim();
   1001         const displayName = row.querySelector('.realm-display').textContent.trim();
   1002 
   1003         deleteMessage.textContent = `Delete ${displayName} (${pendingDeleteSlug})? Realm settings, clients, hosts, email domains, sessions, consents, refresh tokens and memberships will be permanently removed. Users remain global accounts; home-realm users return to no home realm.`;
   1004         deleteInput.value = '';
   1005         deleteInput.placeholder = pendingDeleteSlug;
   1006         confirmDeleteButton.disabled = true;
   1007         deleteDialog.hidden = false;
   1008         requestAnimationFrame(() => deleteInput.focus());
   1009       }
   1010 
   1011       deleteInput.addEventListener('input', () => {
   1012         confirmDeleteButton.disabled = deleteInput.value.trim() !== pendingDeleteSlug;
   1013       });
   1014 
   1015       confirmDeleteButton.addEventListener('click', () => {
   1016         if (!pendingDeleteRow || confirmDeleteButton.disabled) return;
   1017 
   1018         const displayName = pendingDeleteRow.querySelector('.realm-display').textContent.trim();
   1019         existingSlugs.delete(pendingDeleteSlug);
   1020         pendingDeleteRow.remove();
   1021         pendingDeleteRow = null;
   1022         deleteDialog.hidden = true;
   1023         showNotice(`Realm ${displayName} deleted.`);
   1024         setRole(currentRole.value);
   1025       });
   1026 
   1027       realmRows.addEventListener('click', (event) => {
   1028         const deleteButton = event.target.closest('[data-delete-realm]');
   1029         if (deleteButton) {
   1030           event.stopPropagation();
   1031           openDeleteDialog(deleteButton.closest('.realm-row'));
   1032           return;
   1033         }
   1034 
   1035         const row = event.target.closest('[data-row-href]');
   1036         if (row && !event.target.closest('a')) {
   1037           window.location.href = row.dataset.rowHref;
   1038         }
   1039       });
   1040 
   1041       realmRows.addEventListener('keydown', (event) => {
   1042         const row = event.target.closest('[data-row-href]');
   1043         if (!row || event.target !== row) return;
   1044         if (event.key !== 'Enter' && event.key !== ' ') return;
   1045         event.preventDefault();
   1046         window.location.href = row.dataset.rowHref;
   1047       });
   1048 
   1049       searchInput.addEventListener('input', applySearch);
   1050       resetCreateForm();
   1051 
   1052       const initialParams = new URLSearchParams(window.location.search);
   1053       const initialTheme = initialParams.get('theme');
   1054       if (initialTheme === 'light' || initialTheme === 'dark') setTheme(initialTheme);
   1055       const initialRole = initialParams.get('role');
   1056       setRole(identities[initialRole] ? initialRole : 'system');
   1057     </script>
   1058     <script src="./shell.js"></script>
   1059   </body>
   1060 </html>