.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.box > h2, .box-title { font-size: 18px; font-weight: 600; margin: 0; }
.box-sub { font-size: 12px; color: var(--text-muted); margin: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.toolbar-search { display: flex; align-items: center; gap: var(--space-2); flex: 1; min-width: 220px; max-width: 420px; }
.toolbar-search input {
    flex: 1; height: var(--control-height-sm); border-radius: var(--radius-input); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; padding: 0 var(--space-3); outline: none; min-width: 0;
}
.toolbar-search input:focus { border-color: var(--border); box-shadow: none; }

@media (max-width: 720px) {
    .toolbar:has(> .search-box) { flex-wrap: nowrap; }
    .toolbar > .search-box { flex: 1 1 0; min-width: 0; max-width: none; width: auto; }
    .toolbar:has(> .search-box) > :is(.btn-primary, .btn-secondary) { flex: 0 0 auto; }
}

.hint { color: var(--text-muted); font-size: 13px; margin: 0; }
.hint.error, .form-error { color: var(--error); font-size: 12px; margin: 0; }
.hint.error { font-size: 13px; }
.form-notice { color: var(--success); font-size: 12px; background: rgba(22,163,74,0.1); border-radius: var(--radius-input); padding: var(--space-3); margin: 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-card); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: start; font-weight: 500; font-size: 12px; color: var(--text-muted); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-subtle); }
.data-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--text-muted); }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: end; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-badge); font-size: 12px; background: var(--surface-subtle); color: var(--text-secondary); white-space: nowrap; }
.chip.brand { background: var(--brand-tint-10); color: var(--brand-text); }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-badge); font-size: 12px; font-weight: 500; white-space: nowrap; width: fit-content; }
.pill-muted { background: var(--surface-subtle); color: var(--text-muted); }
.pill-info { background: rgba(37,99,235,0.12); color: var(--info); }
.pill-success { background: rgba(22,163,74,0.12); color: var(--success); }
.pill-warning { background: rgba(217,119,6,0.12); color: var(--warning); }
.pill-error { background: rgba(220,38,38,0.12); color: var(--error); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: 12px; color: var(--text-muted); }
.pager-actions { display: flex; gap: var(--space-2); }

.link-btn { color: var(--brand-text); font-size: 13px; font-weight: 500; text-decoration: none; background: none; border: none; font-family: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: none; }
.link-btn:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; border-radius: 6px; }

.stack-form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-actions { display: flex; gap: var(--space-2); justify-content: flex-start; flex-wrap: wrap; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.row-actions { display: flex; align-items: center; gap: var(--space-4); }

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]):not([type="button"]):not([type="submit"]), select, textarea) {
    width: 100%;
    height: var(--control-height);
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background-color: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    transition: border-color var(--motion-micro) var(--ease), box-shadow var(--motion-micro) var(--ease), background-color var(--motion-macro) var(--ease);
}
:where(textarea) { height: auto; min-height: 96px; padding: 8px 12px; line-height: 1.7; resize: vertical; }
:where(input, select, textarea)::placeholder { color: var(--text-muted); }
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus { border-color: var(--brand-strong); box-shadow: 0 0 0 3px var(--brand-focus-ring); }
:where(input, select, textarea)[aria-invalid="true"] { border-color: var(--error); }
:where(input, select, textarea):disabled { opacity: 0.6; cursor: not-allowed; }
:where(input[readonly]) { background-color: var(--surface-subtle); }
:where(input[type="checkbox"], input[type="radio"]) { width: 16px; height: 16px; accent-color: var(--brand-strong); cursor: pointer; flex-shrink: 0; }

:where(select) {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 36px;
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606760' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
select[aria-expanded="true"] { border-color: var(--brand-strong); box-shadow: 0 0 0 3px var(--brand-focus-ring); }
:root[data-theme="dark"] :where(select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A0A6A1' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) :where(select) {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A0A6A1' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    }
}

.maz-select-list {
    position: fixed; z-index: 10000; overflow-y: auto; padding: 4px; box-sizing: border-box;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-input);
    box-shadow: var(--shadow-float); font-family: inherit; font-size: 14px; color: var(--text);
}
.maz-select-item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-height-sm);
    padding: 8px 12px; border-radius: 6px; cursor: pointer; line-height: 1.5;
}
.maz-select-item.active { background: var(--surface-subtle); }
.maz-select-item.selected { color: var(--brand-text); font-weight: 600; }
.maz-select-item.selected.active { background: var(--brand-tint-10); }
.maz-select-item.disabled { opacity: 0.45; cursor: not-allowed; }
.maz-select-item svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.maz-select-search {
    position: sticky; top: 0; z-index: 1;
    display: block; width: 100%; box-sizing: border-box; height: var(--control-height-sm); margin: 0 0 4px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px;
}
.maz-select-search:focus { outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 3px var(--brand-focus-ring); }
.maz-select-none { padding: 12px; text-align: center; font-size: 13px; color: var(--text-muted); }
.maz-select-group { padding: 8px 12px 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }

.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-danger-outline {
    height: var(--control-height);
    border-radius: var(--radius-button);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: background-color var(--motion-micro) var(--ease), color var(--motion-micro) var(--ease),
        border-color var(--motion-micro) var(--ease), transform var(--motion-micro) var(--ease);
}
.btn-primary { border: 1px solid transparent; background: var(--brand); color: var(--brand-on); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); color: #F2F4F2; }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }
.btn-primary:disabled { background: var(--surface-subtle); color: var(--text-muted); cursor: not-allowed; }

.btn-secondary { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; }
.btn-secondary:hover:not(:disabled) { background: var(--surface-subtle); border-color: var(--text-muted); }
.btn-secondary:disabled { color: var(--text-muted); cursor: not-allowed; }

.btn-ghost { height: var(--control-height-sm); border: 1px solid transparent; background: transparent; color: var(--text-secondary); font-weight: 500; font-size: 13px; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-subtle); color: var(--text); }
.btn-ghost:disabled { color: var(--text-muted); cursor: not-allowed; }

.btn-danger { border: 1px solid transparent; background: var(--error); color: #FFFFFF; font-weight: 600; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-danger:disabled { background: var(--surface-subtle); color: var(--text-muted); cursor: not-allowed; }

.btn-danger-outline { border: 1px solid var(--error); background: var(--surface); color: var(--error); font-weight: 500; }
.btn-danger-outline:hover:not(:disabled) { background: rgba(220, 38, 38, 0.08); }
.btn-danger-outline:disabled { border-color: var(--border); color: var(--text-muted); cursor: not-allowed; }

.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible, .btn-danger-outline:focus-visible {
    outline: 2px solid var(--brand-strong);
    outline-offset: 2px;
}

.btn-sm { height: var(--control-height-sm); font-size: 13px; padding: 0 12px; }
.btn-full { width: 100%; }

.field, .filter-field { display: flex; flex-direction: column; gap: var(--space-2); }
.field > label, .filter-field > label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.field label .required, .filter-field label .required, label .required { color: var(--error); margin-inline-start: 2px; font-weight: 600; }

#blazor-error-ui {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1000;
    box-sizing: border-box;
    padding: var(--space-3) var(--space-5);
    background: var(--surface);
    color: var(--error);
    border-top: 2px solid var(--error);
    box-shadow: var(--shadow-float);
    font-size: 14px;
}

#blazor-error-ui .reload {
    margin-inline: var(--space-2);
    color: var(--brand-text);
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    position: absolute;
    inset-inline-start: var(--space-4);
    top: var(--space-3);
    cursor: pointer;
    color: var(--text-muted);
}

:where(.section-card) {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3);
}
:where(.section-head, .results-head, .section-card-head, .filter-head, .roles-pane-head, .geo-list-head) {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
}
:where(.section-head, .results-head, .section-card-head, .filter-head, .roles-pane-head, .geo-list-head, .permissions-head) > :where(h2) {
    font-size: 18px; font-weight: 600; margin: 0;
}

.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--surface-subtle); }
.seg button {
    border: 1px solid transparent; border-radius: var(--radius-badge); background: transparent; color: var(--text-secondary);
    font-family: inherit; font-size: 13px; font-weight: 500;
    height: calc(var(--control-height-sm) - 6px); padding: 0 var(--space-3); cursor: pointer; white-space: nowrap;
}
.seg-lg button { height: calc(var(--control-height) - 6px); padding: 0 var(--space-4); }
.seg button:hover:not(:disabled):not(.on) { background: var(--surface); color: var(--text); }
.seg button.on { background: var(--brand-tint-14); color: var(--brand-text); font-weight: 600; border-color: var(--brand-strong); }
.seg button:disabled { cursor: progress; opacity: 0.7; }
.seg button:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: -2px; }

.icon-btn, .remove-btn {
    width: 36px; height: 36px; padding: 0; border: none; background: none; color: var(--text-muted);
    border-radius: var(--radius-input); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: background var(--motion-micro) var(--ease), color var(--motion-micro) var(--ease);
}
.icon-btn:hover:not(:disabled), .remove-btn:hover:not(:disabled) { background: var(--surface-subtle); color: var(--text); }
.remove-btn:hover:not(:disabled), .icon-btn.danger:hover:not(:disabled) { color: var(--error); }
.icon-btn:disabled, .remove-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn:focus-visible, .remove-btn:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.icon-btn svg, .remove-btn svg { width: 18px; height: 18px; }

.filter-full-link {
    display: inline-flex; align-items: center; height: var(--control-height-sm); padding: 0 var(--space-4);
    border: 1px solid var(--border); border-radius: var(--radius-button); background: var(--surface);
    color: var(--brand-strong); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.filter-full-link:hover { background: var(--surface-subtle); }

:root { --imp-h: 0px; }
:root:has(.impersonation-bar) { --imp-h: 34px; }
body { padding-bottom: var(--imp-h); }

img.logo-light { display: block; }
img.logo-dark { display: none; }
:root[data-theme="dark"] img.logo-light { display: none; }
:root[data-theme="dark"] img.logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) img.logo-light { display: none; }
    :root:not([data-theme="light"]) img.logo-dark { display: block; }
}

.seg.seg-block { display: flex; width: 100%; }
.seg.seg-block > button { flex: 1 1 0; justify-content: center; }
button.filter-full-link { background: none; border: none; padding: 0; cursor: pointer; font: inherit; }
button.filter-full-link:hover { background: var(--surface); }

.mz-fs { position: fixed !important; inset: 0 !important; z-index: 3000; max-height: none !important; background: #000 !important; border: none !important; border-radius: 0 !important; display: flex; align-items: center; justify-content: center; }

a, a:hover, a:focus, a:active, a:visited { text-decoration: none; }

.pw-advice { margin: 0; font-size: 12px; line-height: 1.8; color: var(--warning); }
