.tenant-admin-section { margin-bottom: 20px; overflow: hidden; }
.tenant-admin-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.tenant-admin-section-heading h3 { margin: 0; color: var(--ink); font-size: 18px; }
.tenant-admin-section-heading .muted { margin-top: 6px; max-width: 650px; font-size: 12px; line-height: 1.6; }
.tenant-admin-section-heading > .button { flex-shrink: 0; }
.tenant-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.tenant-admin-row:last-child { border-bottom: 0; }
.tenant-admin-row-copy { min-width: 0; }
.tenant-admin-row-copy > strong { color: var(--ink); font-size: 14px; }
.tenant-admin-row-copy > p { margin-top: 6px; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.tenant-admin-row-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.tenant-admin-managed { color: var(--muted); font-size: 11px; }
.tenant-admin-field { display: grid; align-content: start; gap: 7px; margin: 0; min-width: 0; font-size: 12px; color: var(--ink-secondary, #334155); font-weight: 650; }
.tenant-admin-field > span { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.tenant-admin-field input, .tenant-admin-field select, .tenant-admin-field textarea { width: 100%; min-width: 0; min-height: 38px; padding: 9px 11px; border: 1px solid var(--line-strong, #cbd5e1); border-radius: 8px; background: var(--surface, white); font: inherit; font-weight: 400; color: var(--ink); }
.tenant-admin-field textarea { resize: vertical; }
.tenant-admin-field input:focus, .tenant-admin-field select:focus, .tenant-admin-field textarea:focus { outline: 2px solid var(--brand-border, #c4b5fd); outline-offset: 1px; border-color: var(--brand); }
.tenant-admin-field input[readonly], .tenant-admin-field input:disabled, .tenant-admin-field select:disabled { background: var(--surface-subtle, #f5f6f8); color: var(--muted); }
.tenant-admin-form { margin: 18px 20px; padding: 22px; border: 1px solid var(--brand-border, #ddd6fe); border-radius: 12px; background: var(--brand-soft, #fcfaff); }
.tenant-admin-form h4 { margin: 0 0 20px; font-size: 16px; color: var(--brand-strong, var(--brand-dark)); }
.tenant-admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; min-width: 0; padding: 0; border: 0; margin: 0; }
.tenant-admin-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; color: var(--ink); font-size: 12px; line-height: 1.5; }
.tenant-admin-check input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); }
.tenant-admin-check strong { font-weight: 650; }
.tenant-admin-check small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.tenant-admin-site-choices, .tenant-admin-permissions { grid-column: 1 / -1; display: grid; gap: 14px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; margin: 0; background: var(--surface, white); }
.tenant-admin-site-choices legend, .tenant-admin-permissions legend { padding: 0 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.tenant-admin-site-choices > .muted { font-size: 11px; line-height: 1.5; }
.tenant-admin-help { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.tenant-admin-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.tenant-admin-message { margin: 0; padding: 16px 20px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.tenant-admin-message:empty { display: none; }
.tenant-admin-message.error { color: var(--red); }
.tenant-admin-form > .tenant-admin-message { padding: 14px 0 0; }
.tenant-admin-device-form { padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; }
.tenant-admin-device-form > .tenant-admin-message { grid-column: 1 / -1; padding: 0; }
@media (max-width: 650px) {
  .tenant-admin-section-heading { flex-wrap: wrap; }
  .tenant-admin-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .tenant-admin-row-actions { justify-content: flex-start; }
  .tenant-admin-form { padding: 16px; margin: 16px; }
  .tenant-admin-fields, .tenant-admin-device-form { grid-template-columns: minmax(0, 1fr); }
  .tenant-admin-device-form > .button { justify-self: start; }
}

.tenant-admin-grid-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tenant-admin-user-search { flex: 1 1 230px; max-width: 420px; }
.tenant-admin-tenant-filter { flex: 0 1 200px; }
.tenant-admin-status-filter { flex: 0 1 150px; }
.tenant-admin-grid-toolbar .tenant-admin-field input, .tenant-admin-grid-toolbar .tenant-admin-field select { height: 36px; min-height: 36px; padding: 7px 10px; }
.tenant-admin-grid-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tenant-admin-grid-actions .button { min-height: 36px; height: 36px; padding: 7px 14px; box-shadow: none; white-space: nowrap; }
.tenant-admin-grid-actions .tenant-admin-refresh { width: 36px; height: 36px; min-height: 36px; }
.tenant-admin-table-wrap { overflow-x: auto; }
.tenant-admin-table { width: 100%; min-width: 760px; }
.tenant-admin-table td { vertical-align: middle; }
.tenant-admin-table td > strong, .tenant-admin-table td > small, .tenant-admin-table td:first-child > span { display: block; }
.tenant-admin-table td > small, .tenant-admin-table td:first-child > span { margin-top: 5px; font-size: 12px; }
.tenant-admin-table .tenant-admin-sites-cell { max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.tenant-admin-table .status-pill, .tenant-admin-table td:last-child { white-space: nowrap; }
.tenant-admin-grid-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.tenant-admin-grid-footer > :first-child { margin-right: auto; font-size: 12px; }
.tenant-admin-grid-footer .tenant-admin-field { display: flex; align-items: center; }
.tenant-admin-grid-footer select { width: 74px; }
@media (max-width: 650px) {
  .tenant-admin-grid-toolbar { padding: 12px; }
  .tenant-admin-user-search { flex-basis: 100%; max-width: none; }
  .tenant-admin-tenant-filter { flex: 1 1 150px; }
  .tenant-admin-status-filter { flex: 1 1 130px; }
  .tenant-admin-grid-footer { padding: 12px; gap: 10px; }
}

body.tenant-user-open { overflow: hidden; }
dialog.tenant-user-drawer { position: fixed; inset: 0 0 0 auto; width: min(640px, 100vw); max-width: 100vw; height: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; color: var(--ink); }
.tenant-user-drawer:not([open]) { display: none; }
.tenant-user-drawer::backdrop { background: rgba(15,23,42,.5); animation: creation-fade-in .16s ease-out; }
.tenant-user-drawer .creation-header { grid-template-columns: minmax(0, 1fr) auto; flex-shrink: 0; }
.tenant-user-drawer .creation-header .icon-button { font-size: 24px; }
.tenant-user-drawer .creation-footer { flex-shrink: 0; }
.tenant-user-body > .tenant-admin-message { padding: 14px 0 0; }
@media (prefers-reduced-motion: reduce) {
  .tenant-user-drawer, .tenant-user-drawer::backdrop { animation: none; }
}
