.tenant-tree-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px calc(var(--tenant-level) * 28px + 12px);
    border-bottom: 1px solid var(--mud-palette-divider);
}
.tenant-tree-identity { display: flex; align-items: center; min-width: 0; flex: 1; }
.tenant-tree-identity .mud-typography { overflow-wrap: anywhere; }
.tenant-tree-actions { display: flex; flex-wrap: wrap; flex-shrink: 0; }
.tenant-tree-actions .mud-icon-button { min-width: 40px; min-height: 40px; }
.tenant-invite-form { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) auto auto auto; gap: 12px; align-items: center; }
.tenant-form-row { flex-wrap: wrap; }
.tenant-form-row > * { min-width: 0; }
.tenant-panel .mud-table-cell, .tenant-invitations .mud-table-cell, .tenant-members .mud-table-cell, .tenant-seats .mud-table-cell { overflow-wrap: anywhere; }
.license-details-cell { padding-left: 56px !important; }

@media (max-width: 959.98px) {
    .tenant-tree-row { flex-direction: column; align-items: stretch; gap: 4px; padding-left: calc(var(--tenant-level) * 12px + 8px); }
    .tenant-tree-actions { padding-left: 32px; }
    .tenant-tree-actions .mud-icon-button { min-width: 44px; min-height: 44px; }
    .tenant-invite-form { grid-template-columns: minmax(0, 1fr); }
    .tenant-invite-form > * { min-width: 0; width: 100%; }
    .tenant-invitations, .tenant-members, .tenant-seats { padding: 16px !important; }
    .tenant-panel .tenant-form-row { align-items: stretch !important; flex-direction: column; }
    .tenant-panel .tenant-form-row > * { width: 100%; max-width: 100% !important; }
    .tenant-panel .tenant-form-row .mud-input-control { width: 100%; max-width: 100% !important; }
    .license-details-cell { padding: 12px !important; }
    .tenant-panel .mud-table-cell:before { flex-shrink: 0; }
    .tenant-members .mud-table-cell > .d-flex { flex-wrap: wrap; min-width: 0; }
}

/* License settings use a consistent right-hand control column. */
.license-seat-controls { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 250px); gap:16px; align-items:start; }
.license-seat-controls > [data-testid="license-seat-sharing"] { width:100%; justify-self:end; }
.license-grant-row { display:grid; grid-template-columns:auto minmax(0,1fr) 170px; gap:12px; align-items:center; }
.license-reservation-row { display:grid; grid-template-columns:minmax(0,1fr) 140px; gap:16px; align-items:center; }
.license-expiry-field { justify-self:end; margin-left:auto; width:170px; max-width:100%; }
@media(max-width:599.98px) {
    .license-seat-controls { grid-template-columns:minmax(0,1fr); }
    .license-seat-controls > [data-testid="license-seat-sharing"] { max-width:250px; }
    .license-grant-row { grid-template-columns:auto minmax(0,1fr); }
    .license-grant-row > .license-expiry-field { grid-column:2; width:min(100%,170px); }
}

.license-seat-repair-controls { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,250px); gap:12px; align-items:start; }
.license-seat-repair-controls > [data-testid="license-seat-repair-count"] { grid-column:1; grid-row:1; }
.license-seat-repair-controls > [data-testid="license-seat-repair-unlimited"] { grid-column:1; grid-row:2; }
.license-seat-repair-controls > [data-testid="license-seat-repair-sharing"] { grid-column:2; grid-row:1; }
.license-seat-repair-controls > [data-testid="license-seat-repair-save"] { grid-column:2; grid-row:2; justify-self:end; }
@media(max-width:599.98px) {
    .license-seat-repair-controls { grid-template-columns:minmax(0,1fr); }
    .license-seat-repair-controls > [data-testid] { grid-column:1; grid-row:auto; }
    .license-seat-repair-controls > [data-testid="license-seat-repair-sharing"] { width:min(100%,250px); justify-self:end; }
}

/* Portalled calendars need their own opaque surface above the scrolling editor. */
body:has(.license-panel) .mud-picker-popover { background-color:var(--mud-palette-surface); }
